From fcec2bb04146fba55a12ff72fd8221e8c85f3fa9 Mon Sep 17 00:00:00 2001 From: "Tj (bougyman) Vanderpoel" Date: Wed, 24 Jan 2024 12:25:12 -0600 Subject: [PATCH] Initial Commit --- .github/workflows/main.yml | 27 ++++++++ .gitignore | 11 ++++ .rspec | 3 + .rubocop.yml | 15 +++++ CHANGELOG.md | 5 ++ Gemfile | 15 +++++ Gemfile.lock | 121 ++++++++++++++++++++++++++++++++++++ LICENSE.txt | 21 +++++++ README.md | 31 +++++++++ Rakefile | 12 ++++ bin/console | 11 ++++ bin/setup | 8 +++ cucumber.yml | 1 + exe/lc | 4 ++ features/completion.feature | 11 ++++ features/support/setup.rb | 3 + lib/linear/cli.rb | 10 +++ lib/linear/cli/version.rb | 7 +++ linear-cli.gemspec | 43 +++++++++++++ sig/linear/cli.rbs | 6 ++ spec/linear/cli_spec.rb | 11 ++++ spec/spec_helper.rb | 15 +++++ 22 files changed, 391 insertions(+) create mode 100644 .github/workflows/main.yml create mode 100644 .gitignore create mode 100644 .rspec create mode 100644 .rubocop.yml create mode 100644 CHANGELOG.md create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 LICENSE.txt create mode 100644 README.md create mode 100644 Rakefile create mode 100755 bin/console create mode 100755 bin/setup create mode 100644 cucumber.yml create mode 100755 exe/lc create mode 100644 features/completion.feature create mode 100644 features/support/setup.rb create mode 100644 lib/linear/cli.rb create mode 100644 lib/linear/cli/version.rb create mode 100644 linear-cli.gemspec create mode 100644 sig/linear/cli.rbs create mode 100644 spec/linear/cli_spec.rb create mode 100644 spec/spec_helper.rb diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..37a9318 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,27 @@ +name: Ruby + +on: + push: + branches: + - main + + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + name: Ruby ${{ matrix.ruby }} + strategy: + matrix: + ruby: + - '3.3.0' + + steps: + - uses: actions/checkout@v4 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Run the default task + run: bundle exec rake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b04a8c8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +/.bundle/ +/.yardoc +/_yardoc/ +/coverage/ +/doc/ +/pkg/ +/spec/reports/ +/tmp/ + +# rspec failure tracking +.rspec_status diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..34c5164 --- /dev/null +++ b/.rspec @@ -0,0 +1,3 @@ +--format documentation +--color +--require spec_helper diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..fba6804 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,15 @@ +--- +AllCops: + TargetRubyVersion: 2.6 + NewCops: enable + +Style/StringLiterals: + Enabled: true + EnforcedStyle: double_quotes + +Style/StringLiteralsInInterpolation: + Enabled: true + EnforcedStyle: double_quotes + +Layout/LineLength: + Max: 120 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..208197b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +## [Unreleased] + +## [0.1.0] - 2024-01-24 + +- Initial release diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..b4bd089 --- /dev/null +++ b/Gemfile @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +# Specify your gem's dependencies in linear-cli.gemspec +gemspec + +group :development, :test do + gem "aruba", "~> 2.2" + gem "cucumber", "~> 9.1" + gem "gem-release", "~> 2.2" + gem "rake", "~> 13.0" + gem "rspec", "~> 3.0" + gem "rubocop", "~> 1.21" +end diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..8d9184e --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,121 @@ +PATH + remote: . + specs: + linear-cli (0.1.0) + dry-cli (~> 1.0) + dry-cli-completion (~> 1.0) + httpx (~> 1.2) + +GEM + remote: https://rubygems.org/ + specs: + aruba (2.2.0) + bundler (>= 1.17, < 3.0) + contracts (>= 0.16.0, < 0.18.0) + cucumber (>= 8.0, < 10.0) + rspec-expectations (~> 3.4) + thor (~> 1.0) + ast (2.4.2) + builder (3.2.4) + colsole (1.0.0) + completely (0.6.2) + colsole (>= 0.8.1, < 2) + mister_bin (~> 0.7) + contracts (0.17) + cucumber (9.1.2) + builder (~> 3.2, >= 3.2.4) + cucumber-ci-environment (~> 9.2, >= 9.2.0) + cucumber-core (~> 12.0) + cucumber-cucumber-expressions (~> 17.0) + cucumber-gherkin (> 24, < 27) + cucumber-html-formatter (> 20.3, < 22) + cucumber-messages (> 19, < 25) + diff-lcs (~> 1.5) + mini_mime (~> 1.1, >= 1.1.5) + multi_test (~> 1.1, >= 1.1.0) + sys-uname (~> 1.2, >= 1.2.3) + cucumber-ci-environment (9.2.0) + cucumber-core (12.0.0) + cucumber-gherkin (>= 25, < 27) + cucumber-messages (>= 20, < 23) + cucumber-tag-expressions (~> 5.0, >= 5.0.4) + cucumber-cucumber-expressions (17.0.1) + cucumber-gherkin (26.2.0) + cucumber-messages (>= 19.1.4, < 22.1) + cucumber-html-formatter (21.2.0) + cucumber-messages (> 19, < 25) + cucumber-messages (22.0.0) + cucumber-tag-expressions (5.0.6) + diff-lcs (1.5.0) + docopt_ng (0.7.1) + dry-cli (1.0.0) + dry-cli-completion (1.0.0) + completely (~> 0.5) + ffi (1.16.3) + gem-release (2.2.2) + http-2-next (1.0.3) + httpx (1.2.1) + http-2-next (>= 1.0.3) + json (2.7.1) + language_server-protocol (3.17.0.3) + mini_mime (1.1.5) + mister_bin (0.7.6) + colsole (>= 0.8.1, < 2) + docopt_ng (~> 0.7, >= 0.7.1) + multi_test (1.1.0) + parallel (1.24.0) + parser (3.3.0.5) + ast (~> 2.4.1) + racc + racc (1.7.3) + rainbow (3.1.1) + rake (13.1.0) + regexp_parser (2.9.0) + rexml (3.2.6) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.6) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-support (3.12.1) + rubocop (1.60.2) + json (~> 2.3) + language_server-protocol (>= 3.17.0) + parallel (~> 1.10) + parser (>= 3.3.0.2) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.30.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.30.0) + parser (>= 3.2.1.0) + ruby-progressbar (1.13.0) + sys-uname (1.2.3) + ffi (~> 1.1) + thor (1.3.0) + unicode-display_width (2.5.0) + +PLATFORMS + ruby + x86_64-linux + +DEPENDENCIES + aruba (~> 2.2) + cucumber (~> 9.1) + gem-release (~> 2.2) + linear-cli! + rake (~> 13.0) + rspec (~> 3.0) + rubocop (~> 1.21) + +BUNDLED WITH + 2.5.3 diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..293bdba --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2024 Tj (bougyman) Vanderpoel + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..b1edfb2 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# Linear::Cli + +TODO: Delete this and the text below, and describe your gem + +Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/linear/cli`. To experiment with that code, run `bin/console` for an interactive prompt. + +## Installation + +TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org. + +Install the gem and add to the application's Gemfile by executing: + + $ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG + +If bundler is not being used to manage dependencies, install the gem by executing: + + $ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG + +## Usage + +TODO: Write usage instructions here + +## Development + +After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. + +To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). + +## Contributing + +Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/linear-cli. diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..cca7175 --- /dev/null +++ b/Rakefile @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require "bundler/gem_tasks" +require "rspec/core/rake_task" + +RSpec::Core::RakeTask.new(:spec) + +require "rubocop/rake_task" + +RuboCop::RakeTask.new + +task default: %i[spec rubocop] diff --git a/bin/console b/bin/console new file mode 100755 index 0000000..76b34ab --- /dev/null +++ b/bin/console @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require "bundler/setup" +require "linear/cli" + +# You can add fixtures and/or initialization code here to make experimenting +# with your gem easier. You can also use a different console, if you like. + +require "irb" +IRB.start(__FILE__) diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000..dce67d8 --- /dev/null +++ b/bin/setup @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' +set -vx + +bundle install + +# Do any other automated setup that you need to do here diff --git a/cucumber.yml b/cucumber.yml new file mode 100644 index 0000000..fea5edc --- /dev/null +++ b/cucumber.yml @@ -0,0 +1 @@ +default: --publish-quiet diff --git a/exe/lc b/exe/lc new file mode 100755 index 0000000..5542c58 --- /dev/null +++ b/exe/lc @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require "linear/cli" diff --git a/features/completion.feature b/features/completion.feature new file mode 100644 index 0000000..e1ce622 --- /dev/null +++ b/features/completion.feature @@ -0,0 +1,11 @@ +Feature: Completion + Shell completion for commands are an important feature of any cli + As a CLI user + I want to be able to complete commands and options + + Scenario: Showing help when no shell argument is given + When I run `lc completion` + Then the output should contain: + """ + Something + """ diff --git a/features/support/setup.rb b/features/support/setup.rb new file mode 100644 index 0000000..25a3b5d --- /dev/null +++ b/features/support/setup.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +require "aruba/cucumber" diff --git a/lib/linear/cli.rb b/lib/linear/cli.rb new file mode 100644 index 0000000..b6cee22 --- /dev/null +++ b/lib/linear/cli.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +require_relative "cli/version" + +module Linear + module Cli + class Error < StandardError; end + # Your code goes here... + end +end diff --git a/lib/linear/cli/version.rb b/lib/linear/cli/version.rb new file mode 100644 index 0000000..59cec7d --- /dev/null +++ b/lib/linear/cli/version.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +module Linear + module Cli + VERSION = "0.1.0" + end +end diff --git a/linear-cli.gemspec b/linear-cli.gemspec new file mode 100644 index 0000000..6b241db --- /dev/null +++ b/linear-cli.gemspec @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +require_relative "lib/linear/cli/version" + +Gem::Specification.new do |spec| + spec.name = "linear-cli" + spec.version = Linear::Cli::VERSION + spec.authors = ["Tj (bougyman) Vanderpoel"] + spec.email = ["tj@rubyists.com"] + + spec.summary = "CLI for interacting with Linear.app." + spec.description = "A CLI for interacting with Linear.app. Loosely based on the GitHub CLI" + spec.homepage = "https://github.com/rubyists/linear-cli" + spec.required_ruby_version = ">= 2.6.0" + + spec.license = "MIT" + spec.metadata["allowed_push_host"] = "https://rubygems.org" + + spec.metadata["homepage_uri"] = spec.homepage + spec.metadata["source_code_uri"] = spec.homepage + spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md" + + # Specify which files should be added to the gem when it is released. + # The `git ls-files -z` loads the files in the RubyGem that have been added into git. + spec.files = Dir.chdir(__dir__) do + `git ls-files -z`.split("\x0").reject do |f| + (File.expand_path(f) == __FILE__) || + f.start_with?(*%w[pkg/ bin/ test/ spec/ features/ .git .github appveyor .rspec .rubocop cucumber.yml Gemfile]) + end + end + spec.bindir = "exe" + spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } + spec.require_paths = ["lib"] + + # Uncomment to register a new dependency of your gem + spec.add_dependency "dry-cli", "~> 1.0" + spec.add_dependency "dry-cli-completion", "~> 1.0" + spec.add_dependency "httpx", "~> 1.2" + + # For more information and examples about making a new gem, check out our + # guide at: https://bundler.io/guides/creating_gem.html + spec.metadata["rubygems_mfa_required"] = "true" +end diff --git a/sig/linear/cli.rbs b/sig/linear/cli.rbs new file mode 100644 index 0000000..8667515 --- /dev/null +++ b/sig/linear/cli.rbs @@ -0,0 +1,6 @@ +module Linear + module Cli + VERSION: String + # See the writing guide of rbs: https://github.com/ruby/rbs#guides + end +end diff --git a/spec/linear/cli_spec.rb b/spec/linear/cli_spec.rb new file mode 100644 index 0000000..121be87 --- /dev/null +++ b/spec/linear/cli_spec.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +RSpec.describe Linear::Cli do + it "has a version number" do + expect(Linear::Cli::VERSION).not_to be nil + end + + it "does something useful" do + expect(false).to eq(true) + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..b4f1952 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require "linear/cli" + +RSpec.configure do |config| + # Enable flags like --only-failures and --next-failure + config.example_status_persistence_file_path = ".rspec_status" + + # Disable RSpec exposing methods globally on `Module` and `main` + config.disable_monkey_patching! + + config.expect_with :rspec do |c| + c.syntax = :expect + end +end