gli 2.19.1 → 2.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +28 -0
  3. data/.gitignore +1 -3
  4. data/CONTRIBUTING.md +1 -3
  5. data/Gemfile +0 -6
  6. data/README.rdoc +7 -17
  7. data/Rakefile +22 -38
  8. data/bin/ci +29 -0
  9. data/bin/gli +25 -64
  10. data/bin/rake +29 -0
  11. data/bin/setup +5 -0
  12. data/exe/gli +68 -0
  13. data/gli.gemspec +19 -21
  14. data/gli.rdoc +2 -2
  15. data/lib/gli/app_support.rb +3 -1
  16. data/lib/gli/command_support.rb +2 -6
  17. data/lib/gli/commands/help_modules/command_help_format.rb +1 -1
  18. data/lib/gli/commands/help_modules/global_help_format.rb +1 -1
  19. data/lib/gli/commands/scaffold.rb +9 -93
  20. data/lib/gli/dsl.rb +5 -0
  21. data/lib/gli/gli_option_parser.rb +19 -4
  22. data/lib/gli/options.rb +2 -2
  23. data/lib/gli/version.rb +1 -1
  24. data/object-model.dot +29 -0
  25. data/object-model.png +0 -0
  26. data/test/apps/todo/Gemfile +1 -1
  27. data/test/apps/todo/bin/todo +1 -1
  28. data/test/integration/gli_cli_test.rb +69 -0
  29. data/test/integration/gli_powered_app_test.rb +52 -0
  30. data/test/integration/scaffold_test.rb +30 -0
  31. data/test/integration/test_helper.rb +52 -0
  32. data/test/{tc_command_finder.rb → unit/command_finder_test.rb} +6 -6
  33. data/test/{tc_command.rb → unit/command_test.rb} +4 -4
  34. data/test/unit/compound_command_test.rb +17 -0
  35. data/test/{tc_doc.rb → unit/doc_test.rb} +38 -51
  36. data/test/{tc_flag.rb → unit/flag_test.rb} +19 -25
  37. data/test/{tc_gli.rb → unit/gli_test.rb} +58 -47
  38. data/test/{tc_help.rb → unit/help_test.rb} +48 -107
  39. data/test/{init_simplecov.rb → unit/init_simplecov.rb} +0 -0
  40. data/test/{tc_options.rb → unit/options_test.rb} +4 -4
  41. data/test/unit/subcommand_parsing_test.rb +263 -0
  42. data/test/unit/subcommands_test.rb +245 -0
  43. data/test/{fake_std_out.rb → unit/support/fake_std_out.rb} +0 -0
  44. data/test/{config.yaml → unit/support/gli_test_config.yml} +0 -0
  45. data/test/unit/switch_test.rb +49 -0
  46. data/test/{tc_terminal.rb → unit/terminal_test.rb} +4 -3
  47. data/test/unit/test_helper.rb +13 -0
  48. data/test/unit/verbatim_wrapper_test.rb +24 -0
  49. metadata +73 -140
  50. data/.ruby-gemset +0 -1
  51. data/.ruby-version +0 -1
  52. data/.travis.yml +0 -11
  53. data/ObjectModel.graffle +0 -1191
  54. data/bin/report_on_rake_results +0 -10
  55. data/bin/test_all_rubies.sh +0 -6
  56. data/features/gli_executable.feature +0 -90
  57. data/features/gli_init.feature +0 -236
  58. data/features/step_definitions/gli_executable_steps.rb +0 -18
  59. data/features/step_definitions/gli_init_steps.rb +0 -11
  60. data/features/step_definitions/todo_steps.rb +0 -100
  61. data/features/support/env.rb +0 -54
  62. data/features/support/hooks.rb +0 -5
  63. data/features/todo.feature +0 -579
  64. data/features/todo_legacy.feature +0 -130
  65. data/test/option_test_helper.rb +0 -13
  66. data/test/tc_compound_command.rb +0 -22
  67. data/test/tc_subcommand_parsing.rb +0 -280
  68. data/test/tc_subcommands.rb +0 -259
  69. data/test/tc_switch.rb +0 -55
  70. data/test/tc_verbatim_wrapper.rb +0 -36
  71. data/test/test_helper.rb +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 635c14c43560039c5a46a367a501201b6d255dfb850d1280a8300e0c5b7f9ab8
4
- data.tar.gz: 0d82f1d19eb5f41a91cdee92f3acf1732b84f93ff9e6353a4e18ad438a5f259a
3
+ metadata.gz: 0017e490227889383633bf3d4fc2f85783aa50cd86587fd35b704f4fa036d1c3
4
+ data.tar.gz: 96667382f9092e22abc794e6967d969cecea12339675e46d8a2990df0067810c
5
5
  SHA512:
6
- metadata.gz: ae6e5aa99a45658686fdbd6cb0e7835c66f0761f8cb0a7e7822265e963d08830441ba6024b747bd0a077152110b55b7c7726bdb55178b1b188bfe2e9804b3968
7
- data.tar.gz: '0396dc0ac0290db90f9715bf4b3f3352394003403b81fe0b0c1c6b57af5f981983ac7e691bf17d1e68e9dee80358b9e87991407137a4824464270c4574d468b8'
6
+ metadata.gz: 7b76b5845f5beb5907d7c11355c5e02ba22521f124c0486f5d1d08ae75969338bc23434ac680da72306cd761cdaac986fb01c966e8eb14a664eb84db95164e82
7
+ data.tar.gz: 55f76b94f22cf271a93bc0e0916c1a500175fbaa5a45a01c74372042baba384da6660f5860946bf803c7db14c23712f51249ee03c6a1a2d9d52c3da05638eaeb
@@ -0,0 +1,28 @@
1
+ version: 2.1
2
+ orbs:
3
+ # See https://circleci.com/developer/orbs/orb/circleci/ruby
4
+ ruby: circleci/ruby@1.4.0
5
+ jobs: # keyword
6
+ test: # my name for the job
7
+ parameters: # keyword
8
+ ruby-version: # my parameter name
9
+ type: string # type is a keyword
10
+ docker: # keyword
11
+ - image: cimg/base:stable
12
+ steps: # keyword
13
+ - checkout # magic name
14
+ - ruby/install: # ruby/ is from the orb name, install is a command in that orb
15
+ version: << parameters.ruby-version >> # magic nonsense for param subst (version param to the command)
16
+ - run:
17
+ command: "bin/setup"
18
+ - run:
19
+ command: "bin/ci none"
20
+ workflows: # keyword
21
+ all-rubies: # my name for the workflow
22
+ jobs: # keyword
23
+ - test: # my name for the job
24
+ matrix: # keyword
25
+ parameters: # keyword
26
+ # All rubies being maintained per this page:
27
+ # https://www.ruby-lang.org/en/downloads/branches/
28
+ ruby-version: [ "2.5", "2.6", "2.7", "3.0" ]
data/.gitignore CHANGED
@@ -5,11 +5,9 @@ pkg
5
5
  coverage
6
6
  .bundle
7
7
  tmp
8
- cruddo.rdoc
9
- gli.wiki
10
8
  Gemfile.lock
11
9
  *.gem
12
10
  results.html
13
- .rbx
14
11
  .DS_Store
15
12
  Session.vim
13
+ scaffold_test
data/CONTRIBUTING.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Contributions are welcome as long as they are part of my vision for GLI (or can be treated as optional to the user). I am obsessive about backwards-compatibility, so you may need to default things to disable your features. Sorry, not ready to bump a major version any time soon.
2
2
 
3
3
  1. Fork my Repository
4
- 2. Create a branch off of gli-2 (**master is no longer the canonical branch**)
4
+ 2. Create a branch off of main
5
5
  3. Make your changes:
6
6
  * Please include tests and watch out for reek and roodi; i.e. keep your code clean
7
7
  * If you make changes to the gli executable or the scaffolding, please update the cucumber features
@@ -19,5 +19,3 @@ Contributions are welcome as long as they are part of my vision for GLI (or can
19
19
  * Use <code># :nodoc:</code> for methods that a _user_ of GLI should not call (but still please do document all methods)
20
20
  4. Make sure your branch will merge with my gli-2 branch (or just rebase your branch from my gli-2 branch)
21
21
  5. Create a pull request explaining your change
22
-
23
-
data/Gemfile CHANGED
@@ -2,11 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem "rcov", ">= 0.9.8", :platforms => :mri_18
6
5
  gem "simplecov", "~> 0.6.4", :platforms => :mri_19
7
6
  gem "psych", :platforms => :mri_19
8
-
9
- major,minor = RUBY_VERSION.split(/\./)
10
- if major.to_i >=2 && minor.to_i >= 2
11
- gem "test-unit"
12
- end
data/README.rdoc CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  GLI allows you to create command-line app in Ruby that behaves like <tt>git</tt> in that it takes subcommands to perform a series of complex action, e.g. <tt>git remote add</tt>.
4
4
 
5
- * {Overview}[http://davetron5000.github.com/gli]
5
+ * {Overview}[http://davetron5000.github.io/gli]
6
6
  * {Source on Github}[http://github.com/davetron5000/gli]
7
- * RDoc[http://davetron5000.github.com/gli/rdoc/index.html]
7
+ * RDoc[http://davetron5000.github.io/gli/rdoc/index.html]
8
8
 
9
9
  {<img src="https://secure.travis-ci.org/davetron5000/gli.svg?branch=gli-2" alt="Build Status" />}[https://travis-ci.org/davetron5000/gli]
10
10
 
@@ -46,7 +46,6 @@ This will create a basic scaffold project in <tt>./todo</tt> with:
46
46
 
47
47
  * executable in <tt>./todo/bin/todo</tt>. This file demonstrates most of what you need to describe your command line interface.
48
48
  * an empty test in <tt>./todo/test/default_test.rb</tt> that can bootstrap your tests
49
- * an empty feature in <tt>./todo/features/todo.feature</tt> that can bootstrap testing your CLI via Aruba.
50
49
  * a gemspec shell
51
50
  * a README shell
52
51
  * Rakefile that can generate RDoc, package your Gem and run tests
@@ -89,28 +88,19 @@ Now, you are ready to go:
89
88
 
90
89
  All you need to do is fill in the documentation and your code; the help system, command-line parsing and many other awesome features are all handled for you.
91
90
 
92
- Get a more detailed walkthrough on the {main site}[http://davetron5000.github.com/gli]
91
+ Get a more detailed walkthrough on the {main site}[http://davetron5000.github.io/gli]
93
92
 
94
93
  == Supported Platforms
95
94
 
96
- Tests should be passing supported MRI Rubies (see +.travis.yml+ for specifics).
97
-
98
- Due to the vagaries of Travis, I can't keep the test suite running on unsupported Rubies, but we currently support:
99
-
100
- * 2.1
101
- * 2.2
102
- * 2.3
103
- * 2.4
104
- * JRuby
105
-
106
- GLI likely works on older rubies, but the cost of keeping tests passing on those versions (which are now totally unsupported by Ruby core) is too high.
95
+ See `.circleci/config.yml` for the supported rubies, but general we're running tests on the all MRI rubies receiving support, which tends to be the most recent four versions.
107
96
 
97
+ GLI should work on older Rubies and JRuby, but it's too much work to keep tests passing for those.
108
98
 
109
99
  == Documentation
110
100
 
111
101
  Extensive documentation is {available at the wiki}[https://github.com/davetron5000/gli/wiki].
112
102
 
113
- API Documentation is available {here}[http://davetron5000.github.com/gli/rdoc/index.html]. Recommend starting with GLI::DSL or GLI::App.
103
+ API Documentation is available {here}[http://davetron5000.github.io/gli/rdoc/index.html]. Recommend starting with GLI::DSL or GLI::App.
114
104
 
115
105
  == Credits
116
106
 
@@ -120,7 +110,7 @@ License:: Distributes under the Apache License, see LICENSE.txt in the source di
120
110
 
121
111
  == Links
122
112
 
123
- * [http://davetron5000.github.com/gli] - RubyDoc
113
+ * [http://davetron5000.github.io/gli] - RubyDoc
124
114
  * [http://www.github.com/davetron5000/gli] - Source on GitHub
125
115
  * [http://www.github.com/davetron5000/gli/wiki] - Documentation Wiki
126
116
  * [http://www.github.com/davetron5000/gli/wiki/Changelog] - Changelog
data/Rakefile CHANGED
@@ -3,8 +3,6 @@ require 'bundler'
3
3
  require 'rake/clean'
4
4
  require 'rake/testtask'
5
5
  require 'rdoc/task'
6
- require 'cucumber'
7
- require 'cucumber/rake/task'
8
6
 
9
7
  include Rake::DSL
10
8
 
@@ -75,52 +73,38 @@ end
75
73
 
76
74
  Bundler::GemHelper.install_tasks
77
75
 
78
- desc 'run unit tests'
79
- Rake::TestTask.new do |t|
76
+ desc "run unit tests"
77
+ Rake::TestTask.new("test:unit") do |t|
80
78
  t.libs << "test"
81
- t.test_files = FileList['test/init_simplecov.rb','test/tc_*.rb']
82
- end
83
-
84
- CUKE_RESULTS = 'results.html'
85
- CLEAN << CUKE_RESULTS
86
- Cucumber::Rake::Task.new(:features) do |t|
87
- opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
88
- opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
89
- t.cucumber_opts = opts
90
- t.fork = false
91
- end
92
- Cucumber::Rake::Task.new('features:wip') do |t|
93
- tag_opts = ' --tags ~@pending'
94
- tag_opts = ' --tags @wip'
95
- t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
96
- t.fork = false
79
+ t.libs << "lib"
80
+ ENV["RUBYOPT"].split(/\s/).each do |opt|
81
+ t.ruby_opts << opt
82
+ end
83
+ t.test_files = FileList["test/unit/**/*_test.rb"]
97
84
  end
98
85
 
99
- begin
100
- require 'rcov/rcovtask'
101
- task :clobber_coverage do
102
- rm_rf "coverage"
86
+ desc "run integration tests"
87
+ Rake::TestTask.new("test:integration") do |t|
88
+ t.libs << "test"
89
+ ENV["RUBYOPT"].split(/\s/).each do |opt|
90
+ t.ruby_opts << opt
103
91
  end
104
-
105
- desc 'Measures test coverage'
106
- task :coverage => :rcov do
107
- puts "coverage/index.html contains what you need"
92
+ explicitly_named_files = ARGV[1..-1]
93
+ if Array(explicitly_named_files).size == 0
94
+ t.test_files = FileList["test/integration/**/*_test.rb"]
95
+ else
96
+ t.test_files = explicitly_named_files
108
97
  end
98
+ end
109
99
 
110
- Rcov::RcovTask.new do |t|
111
- t.libs << 'lib'
112
- t.test_files = FileList['test/tc_*.rb']
113
- end
100
+
101
+ begin
102
+ require 'simplecov'
114
103
  rescue LoadError
115
- begin
116
- require 'simplecov'
117
- rescue LoadError
118
- $stderr.puts "neither rcov nor simplecov are installed; you won't be able to check code coverage"
119
- end
120
104
  end
121
105
 
122
106
  desc 'Publish rdoc on github pages and push to github'
123
107
  task :publish_rdoc => [:rdoc,:publish]
124
108
 
125
- task :default => [:test,:features]
109
+ task :default => ["test:unit", "test:integraton"]
126
110
 
data/bin/ci ADDED
@@ -0,0 +1,29 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+ if [ -z $1 ]; then
5
+ echo "[bin/ci] Running with default warnings"
6
+ export RUBYOPT=
7
+ else
8
+ if [ $1 == 'warnings' ]; then
9
+ echo "[bin/ci] Running with all warnings on"
10
+ export RUBYOPT=-w
11
+ else
12
+ if [ $1 == 'none' ]; then
13
+ echo "[bin/ci] Running with all warnings off"
14
+ export RUBYOPT='-W0'
15
+ else
16
+ echo "[bin/ci] '$1' is not a supported option"
17
+ echo "[bin/ci] usage: $0 # run with default warnings"
18
+ echo "[bin/ci] usage: $0 warnings # run with all warnings"
19
+ echo "[bin/ci] usage: $0 none # run with warnings disabled"
20
+ exit 1
21
+ fi
22
+ fi
23
+ fi
24
+
25
+ echo "[bin/ci] Running unit tests"
26
+ bin/rake test:unit
27
+
28
+ echo "[bin/ci] Running integration tests"
29
+ bin/rake test:integration
data/bin/gli CHANGED
@@ -1,68 +1,29 @@
1
1
  #!/usr/bin/env ruby
2
-
3
- require 'gli'
4
- require 'gli/commands/scaffold'
5
-
6
- class App
7
- extend GLI::App
8
-
9
- program_desc 'create scaffolding for a GLI-powered application'
10
-
11
- version GLI::VERSION
12
-
13
- # Can't use these without changing the current behavior of gli
14
- # arguments :strict
15
- # subcommand_option_handling :normal
16
-
17
- switch :v, :desc => 'Be verbose'
18
-
19
- switch :n, :desc => 'Dry run; don''t change the disk'
20
-
21
- desc 'Root dir of project'
22
- long_desc <<EOS
23
- This is the directory where the project''s directory will be made, so if you
24
- specify a project name ''foo'' and the root dir of ''.'', the directory
25
- ''./foo'' will be created'
26
- EOS
27
-
28
- flag :r,:root, :default_value => '.'
29
-
30
- desc 'Create a new GLI-based project'
31
- long_desc <<EOS
32
- This will create a scaffold command line project that uses GLI
33
- for command line processing. Specifically, this will create
34
- an executable ready to go, as well as a lib and test directory, all
35
- inside the directory named for your project
36
- EOS
37
- arg :project_name
38
- arg :command_name, [:optional, :multiple]
39
- arg_name "project_name [command_name]..."
40
- command [:init,:scaffold] do |c|
41
-
42
- c.switch :e,:ext, :desc => 'Create an ext dir'
43
-
44
- c.switch :notest, :desc => 'Do not create a test or features dir', :negatable => false
45
-
46
- c.switch :force, :desc => 'Overwrite/ignore existing files and directories'
47
-
48
- c.switch :rvmrc, :desc => 'Create an .rvmrc based on your current RVM setup'
49
-
50
- c.action do |g,o,args|
51
- if args.length < 1
52
- raise 'You must specify the name of your project'
53
- end
54
- GLI::Commands::Scaffold.create_scaffold(g[:r],!o[:notest],o[:e],args[0],args[1..-1],o[:force],g[:n],o[:rvmrc])
55
- end
56
- end
57
-
58
- pre do |global,command,options,args|
59
- puts "Executing #{command.name}" if global[:v]
60
- true
61
- end
62
-
63
- post do |global,command,options,args|
64
- puts "Executed #{command.name}" if global[:v]
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'gli' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
65
23
  end
66
24
  end
67
25
 
68
- exit App.run(ARGV)
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("gli", "gli")
data/bin/rake ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rake' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rake", "rake")
data/bin/setup ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ bundle check || bundle install
data/exe/gli ADDED
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'gli'
4
+ require 'gli/commands/scaffold'
5
+
6
+ class App
7
+ extend GLI::App
8
+
9
+ program_desc 'create scaffolding for a GLI-powered application'
10
+
11
+ version GLI::VERSION
12
+
13
+ # Can't use these without changing the current behavior of gli
14
+ # arguments :strict
15
+ # subcommand_option_handling :normal
16
+
17
+ switch :v, :desc => 'Be verbose'
18
+
19
+ switch :n, :desc => 'Dry run; don''t change the disk'
20
+
21
+ desc 'Root dir of project'
22
+ long_desc <<EOS
23
+ This is the directory where the project''s directory will be made, so if you
24
+ specify a project name ''foo'' and the root dir of ''.'', the directory
25
+ ''./foo'' will be created'
26
+ EOS
27
+
28
+ flag :r,:root, :default_value => '.'
29
+
30
+ desc 'Create a new GLI-based project'
31
+ long_desc <<EOS
32
+ This will create a scaffold command line project that uses GLI
33
+ for command line processing. Specifically, this will create
34
+ an executable ready to go, as well as a lib and test directory, all
35
+ inside the directory named for your project
36
+ EOS
37
+ arg :project_name
38
+ arg :command_name, [:optional, :multiple]
39
+ arg_name "project_name [command_name]..."
40
+ command [:init,:scaffold] do |c|
41
+
42
+ c.switch :e,:ext, :desc => 'Create an ext dir'
43
+
44
+ c.switch :notest, :desc => 'Do not create a test or features dir', :negatable => false
45
+
46
+ c.switch :force, :desc => 'Overwrite/ignore existing files and directories'
47
+
48
+ c.switch :rvmrc, :desc => 'Create an .rvmrc based on your current RVM setup'
49
+
50
+ c.action do |g,o,args|
51
+ if args.length < 1
52
+ raise 'You must specify the name of your project'
53
+ end
54
+ GLI::Commands::Scaffold.create_scaffold(g[:r],!o[:notest],o[:e],args[0],args[1..-1],o[:force],g[:n],o[:rvmrc])
55
+ end
56
+ end
57
+
58
+ pre do |global,command,options,args|
59
+ puts "Executing #{command.name}" if global[:v]
60
+ true
61
+ end
62
+
63
+ post do |global,command,options,args|
64
+ puts "Executed #{command.name}" if global[:v]
65
+ end
66
+ end
67
+
68
+ exit App.run(ARGV)
data/gli.gemspec CHANGED
@@ -1,32 +1,30 @@
1
1
  # Make sure we get the gli that's local
2
- require File.join([File.dirname(__FILE__),'lib','gli','version.rb'])
2
+ require File.join([File.dirname(__FILE__),"lib","gli","version.rb"])
3
3
 
4
4
  spec = Gem::Specification.new do |s|
5
- s.name = 'gli'
5
+ s.name = "gli"
6
6
  s.version = GLI::VERSION
7
- s.licenses = ['Apache-2.0']
8
- s.author = 'David Copeland'
9
- s.email = 'davidcopeland@naildrivin5.com'
10
- s.homepage = 'http://davetron5000.github.com/gli'
7
+ s.licenses = ["Apache-2.0"]
8
+ s.author = "David Copeland"
9
+ s.email = "davidcopeland@naildrivin5.com"
10
+ s.homepage = "http://davetron5000.github.io/gli"
11
11
  s.platform = Gem::Platform::RUBY
12
- s.summary = 'Build command-suite CLI apps that are awesome.'
13
- s.description = 'Build command-suite CLI apps that are awesome. Bootstrap your app, add commands, options and documentation while maintaining a well-tested idiomatic command-line app'
12
+ s.summary = "Build command-suite CLI apps that are awesome."
13
+ s.description = "Build command-suite CLI apps that are awesome. Bootstrap your app, add commands, options and documentation while maintaining a well-tested idiomatic command-line app"
14
14
 
15
15
  s.files = `git ls-files`.split("\n")
16
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
- s.executables = 'gli'
18
17
  s.require_paths = ["lib"]
19
18
 
20
- s.extra_rdoc_files = ['README.rdoc', 'gli.rdoc']
21
- s.rdoc_options << '--title' << 'Git Like Interface' << '--main' << 'README.rdoc'
22
- s.bindir = 'bin'
23
- s.add_development_dependency('rake', '~> 0.9.2.2')
24
- s.add_development_dependency('rdoc', '~> 4.2')
25
- s.add_development_dependency('rainbow', '~> 1.1', '~> 1.1.1')
26
- s.add_development_dependency('clean_test', '~> 1.0')
27
- s.add_development_dependency('cucumber', '~> 3.1.2')
28
- s.add_development_dependency('gherkin', '~> 5.1.0')
29
- s.add_development_dependency('aruba', '~> 0.7.4')
30
- s.add_development_dependency('sdoc', '~> 0.4')
31
- s.add_development_dependency('faker','~> 1.9.1')
19
+ s.extra_rdoc_files = ["README.rdoc", "gli.rdoc"]
20
+ s.rdoc_options << "--title" << "Git Like Interface" << "--main" << "README.rdoc"
21
+
22
+ s.bindir = "exe"
23
+ s.executables = "gli"
24
+
25
+ s.add_development_dependency("rake")
26
+ s.add_development_dependency("rdoc")
27
+ s.add_development_dependency("rainbow", "~> 1.1", "~> 1.1.1")
28
+ s.add_development_dependency("sdoc")
29
+ s.add_development_dependency("minitest")
32
30
  end
data/gli.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  == gli - create scaffolding for a GLI-powered application
2
2
 
3
- v2.17.1
3
+ v2.19.2
4
4
 
5
5
  === Global Options
6
6
  === -r|--root arg
@@ -43,7 +43,7 @@ List commands one per line, to assist with shell completion
43
43
 
44
44
 
45
45
 
46
- ==== Command: <tt>init|scaffold project_name [command_name][, [command_name]]*</tt>
46
+ ==== Command: <tt>init|scaffold project_name [command_name]...</tt>
47
47
  Create a new GLI-based project
48
48
 
49
49
  This will create a scaffold command line project that uses GLI
@@ -15,6 +15,7 @@ module GLI
15
15
  switches.clear
16
16
  flags.clear
17
17
  @commands = nil
18
+ @command_missing_block = nil
18
19
  @commands_declaration_order = []
19
20
  @flags_declaration_order = []
20
21
  @switches_declaration_order = []
@@ -72,7 +73,8 @@ module GLI
72
73
  :default_command => @default_command,
73
74
  :autocomplete => autocomplete,
74
75
  :subcommand_option_handling_strategy => subcommand_option_handling_strategy,
75
- :argument_handling_strategy => argument_handling_strategy)
76
+ :argument_handling_strategy => argument_handling_strategy,
77
+ :command_missing_block => @command_missing_block)
76
78
 
77
79
  parsing_result = gli_option_parser.parse_options(args)
78
80
  parsing_result.convert_to_openstruct! if @use_openstruct
@@ -166,12 +166,8 @@ module GLI
166
166
 
167
167
  def generate_error_action(arguments)
168
168
  lambda { |global_options,options,arguments|
169
- if am_subcommand?
170
- if arguments.size > 0
171
- raise UnknownCommand,"Unknown command '#{arguments[0]}'"
172
- else
173
- raise BadCommandLine,"Command '#{name}' requires a subcommand"
174
- end
169
+ if am_subcommand? && arguments.size > 0
170
+ raise UnknownCommand,"Unknown command '#{arguments[0]}'"
175
171
  elsif have_subcommands?
176
172
  raise BadCommandLine,"Command '#{name}' requires a subcommand #{self.commands.keys.join(',')}"
177
173
  else
@@ -53,7 +53,7 @@ COMMANDS
53
53
 
54
54
 
55
55
  <%= command_examples %>
56
- <% end %>),nil,'<>')
56
+ <% end %>))
57
57
 
58
58
 
59
59
  def flags_and_switches(command,app)
@@ -51,7 +51,7 @@ GLOBAL OPTIONS
51
51
 
52
52
  <% end %>
53
53
  COMMANDS
54
- <%= commands %>),nil,'<>')
54
+ <%= commands %>))
55
55
 
56
56
  def global_flags_and_switches
57
57
  @app.flags_declaration_order + @app.switches_declaration_order