-
Notifications
You must be signed in to change notification settings - Fork 1
Create RubyGem project psdk-cli using Thor structure #2 #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: Ruby | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| pull_request: | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| name: Ruby ${{ matrix.ruby }} | ||
| strategy: | ||
| matrix: | ||
| ruby: | ||
| - '3.4.5' | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
| - 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| /.bundle/ | ||
| /.yardoc | ||
| /_yardoc/ | ||
| /coverage/ | ||
| /doc/ | ||
| /pkg/ | ||
| /spec/reports/ | ||
| /tmp/ | ||
|
|
||
| # rspec failure tracking | ||
| .rspec_status |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| --format documentation | ||
| --color | ||
| --require spec_helper |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| AllCops: | ||
| TargetRubyVersion: 3.2 | ||
| NewCops: enable | ||
|
|
||
| Style/StringLiterals: | ||
| EnforcedStyle: single_quotes | ||
|
|
||
| Style/StringLiteralsInInterpolation: | ||
| EnforcedStyle: single_quotes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| --- | ||
| include: | ||
| - Rakefile | ||
| - Gemfile | ||
| - "*.gemspec" | ||
| - "**/*.rb" | ||
| exclude: | ||
| - spec/**/* | ||
| - test/**/* | ||
| - vendor/**/* | ||
| - ".bundle/**/*" | ||
| require: [] | ||
| domains: [] | ||
| reporters: | ||
| - rubocop | ||
| - require_not_found | ||
| formatter: | ||
| rubocop: | ||
| cops: safe | ||
| except: [] | ||
| only: [] | ||
| extra_args: [] | ||
| require_paths: [] | ||
| plugins: [] | ||
| max_files: 5000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| ## [Unreleased] | ||
|
|
||
| ## [0.1.0] - 2025-11-12 | ||
|
|
||
| - Initial release |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| source 'https://rubygems.org' | ||
|
|
||
| # Specify your gem's dependencies in psdk-cli.gemspec | ||
| gemspec | ||
|
|
||
| gem 'irb' | ||
| gem 'rake', '~> 13.0' | ||
|
|
||
| gem 'rspec', '~> 3.0' | ||
|
|
||
| gem 'rubocop', '~> 1.21' | ||
|
|
||
| gem 'thor', '~> 1.4.0' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| PATH | ||
| remote: . | ||
| specs: | ||
| psdk-cli (0.1.0) | ||
|
|
||
| GEM | ||
| remote: https://rubygems.org/ | ||
| specs: | ||
| ast (2.4.3) | ||
| date (3.5.0) | ||
| diff-lcs (1.6.2) | ||
| erb (5.1.3) | ||
| io-console (0.8.1) | ||
| irb (1.15.3) | ||
| pp (>= 0.6.0) | ||
| rdoc (>= 4.0.0) | ||
| reline (>= 0.4.2) | ||
| json (2.16.0) | ||
| language_server-protocol (3.17.0.5) | ||
| lint_roller (1.1.0) | ||
| parallel (1.27.0) | ||
| parser (3.3.10.0) | ||
| ast (~> 2.4.1) | ||
| racc | ||
| pp (0.6.3) | ||
| prettyprint | ||
| prettyprint (0.2.0) | ||
| prism (1.6.0) | ||
| psych (5.2.6) | ||
| date | ||
| stringio | ||
| racc (1.8.1) | ||
| rainbow (3.1.1) | ||
| rake (13.3.1) | ||
| rdoc (6.15.1) | ||
| erb | ||
| psych (>= 4.0.0) | ||
| tsort | ||
| regexp_parser (2.11.3) | ||
| reline (0.6.3) | ||
| io-console (~> 0.5) | ||
| rspec (3.13.2) | ||
| rspec-core (~> 3.13.0) | ||
| rspec-expectations (~> 3.13.0) | ||
| rspec-mocks (~> 3.13.0) | ||
| rspec-core (3.13.6) | ||
| rspec-support (~> 3.13.0) | ||
| rspec-expectations (3.13.5) | ||
| diff-lcs (>= 1.2.0, < 2.0) | ||
| rspec-support (~> 3.13.0) | ||
| rspec-mocks (3.13.7) | ||
| diff-lcs (>= 1.2.0, < 2.0) | ||
| rspec-support (~> 3.13.0) | ||
| rspec-support (3.13.6) | ||
| rubocop (1.81.7) | ||
| json (~> 2.3) | ||
| language_server-protocol (~> 3.17.0.2) | ||
| lint_roller (~> 1.1.0) | ||
| parallel (~> 1.10) | ||
| parser (>= 3.3.0.2) | ||
| rainbow (>= 2.2.2, < 4.0) | ||
| regexp_parser (>= 2.9.3, < 3.0) | ||
| rubocop-ast (>= 1.47.1, < 2.0) | ||
| ruby-progressbar (~> 1.7) | ||
| unicode-display_width (>= 2.4.0, < 4.0) | ||
| rubocop-ast (1.48.0) | ||
| parser (>= 3.3.7.2) | ||
| prism (~> 1.4) | ||
| ruby-progressbar (1.13.0) | ||
| stringio (3.1.8) | ||
| thor (1.4.0) | ||
| tsort (0.2.0) | ||
| unicode-display_width (3.2.0) | ||
| unicode-emoji (~> 4.1) | ||
| unicode-emoji (4.1.0) | ||
|
|
||
| PLATFORMS | ||
| arm64-darwin-24 | ||
| ruby | ||
|
|
||
| DEPENDENCIES | ||
| irb | ||
| psdk-cli! | ||
| rake (~> 13.0) | ||
| rspec (~> 3.0) | ||
| rubocop (~> 1.21) | ||
| thor (~> 1.4.0) | ||
|
|
||
| BUNDLED WITH | ||
| 2.7.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,27 @@ | ||
| # psdk-cli | ||
|
|
||
| A CLI that helps people perform actions with PSDK | ||
|
|
||
| ## Installation | ||
|
|
||
| To be able to use the psdk-cli you must install Ruby and Git and then run the following command: | ||
|
|
||
| ```bash | ||
| gem install psdk-cli | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| In a terminal you can run `psdk-cli` it will list all the available commands. | ||
|
|
||
| Please note that sub command (such as `psdk-cli plugin`) can be executed using the shortcut `psdk-<sub>` (eg. `psdk-plugin` for `psdk-cli plugin`). | ||
|
|
||
| ## 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/PokemonWorkshop/psdk-cli. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #!/usr/bin/env ruby | ||
| # frozen_string_literal: true | ||
|
|
||
| require 'bundler/setup' | ||
| require 'psdk/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__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| #!/usr/bin/env ruby | ||
| # frozen_string_literal: true | ||
|
|
||
| require 'bundler/setup' | ||
| require 'psdk/cli' | ||
|
|
||
| Psdk::Cli::Main.start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| #!/usr/bin/env ruby | ||
| # frozen_string_literal: true | ||
|
|
||
| require 'bundler/setup' | ||
| require 'psdk/cli/plugin' | ||
|
|
||
| Psdk::Cli::Plugin.start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require 'thor' | ||
| require_relative 'cli/version' | ||
| require_relative 'cli/plugin' | ||
|
|
||
| module Psdk | ||
| module Cli | ||
| # Main PSDK CLI class | ||
| # | ||
| # Must be used for the general psdk-cli command | ||
| class Main < Thor | ||
| package_name 'psdk-cli' | ||
|
|
||
| desc 'version', 'show the psdk-cli version' | ||
| def version | ||
| puts "psdk-cli v#{VERSION}" | ||
| end | ||
|
|
||
| desc 'plugin', 'manage PSDK plugins' | ||
| subcommand 'plugin', Plugin | ||
| end | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require 'thor' | ||
|
|
||
| module Psdk | ||
| module Cli | ||
| # Class responsible of handling the psdk-plugin cli commands | ||
| class Plugin < Thor | ||
| package_name 'psdk-plugin' | ||
|
|
||
| # TODO: remove this and actually implement the plugin cli | ||
| desc 'fake ARG1', 'run a fake command with ARG1 as first argument' | ||
| def fake(arg1) | ||
| puts "Fake called with ARG1=#{arg1}" | ||
| end | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Psdk | ||
| module Cli | ||
| VERSION = '0.1.0' | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require_relative 'lib/psdk/cli/version' | ||
|
|
||
| Gem::Specification.new do |spec| | ||
| spec.name = 'psdk-cli' | ||
| spec.version = Psdk::Cli::VERSION | ||
| spec.authors = ['Pokémon Workshop'] | ||
| spec.email = ['hostmaster@pokemonworkshop.com'] | ||
|
|
||
| spec.summary = 'Utility cli that would help people perform several actions related to PSDK.' | ||
| spec.homepage = 'https://github.com/PokemonWorkshop/psdk-cli' | ||
| spec.required_ruby_version = '>= 3.2.0' | ||
|
|
||
| # spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'" | ||
| spec.metadata['homepage_uri'] = spec.homepage | ||
| spec.metadata['source_code_uri'] = 'https://github.com/PokemonWorkshop/psdk-cli' | ||
| spec.metadata['changelog_uri'] = 'https://github.com/PokemonWorkshop/psdk-cli/blob/main/CHANGELOG.md' | ||
| spec.metadata['rubygems_mfa_required'] = 'true' | ||
|
|
||
| # 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. | ||
| gemspec = File.basename(__FILE__) | ||
| spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls| | ||
| ls.readlines("\x0", chomp: true).reject do |f| | ||
| (f == gemspec) || | ||
| f.start_with?(*%w[bin/ Gemfile .gitignore .rspec spec/ .github/ .rubocop.yml]) | ||
NuriYuri marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| end | ||
| end | ||
| spec.bindir = 'exe' | ||
NuriYuri marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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 "example-gem", "~> 1.0" | ||
|
|
||
| # For more information and examples about making a new gem, check out our | ||
| # guide at: https://bundler.io/guides/creating_gem.html | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| module Psdk | ||
| module Cli | ||
| VERSION: String | ||
| # See the writing guide of rbs: https://github.com/ruby/rbs#guides | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| RSpec.describe Psdk::Cli do | ||
| it 'has a version number' do | ||
| expect(Psdk::Cli::VERSION).not_to be nil | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require 'psdk/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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.