quickl 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/CHANGELOG.md +82 -0
  2. data/Gemfile.lock +14 -14
  3. data/bin/quickl +2 -2
  4. data/lib/quickl.rb +162 -2
  5. data/lib/quickl/command.rb +22 -32
  6. data/lib/quickl/command/builder.rb +3 -3
  7. data/lib/quickl/command/delegator.rb +22 -12
  8. data/lib/quickl/command/options.rb +29 -4
  9. data/lib/quickl/command/robustness.rb +5 -12
  10. data/lib/quickl/command/single.rb +4 -6
  11. data/lib/quickl/errors.rb +2 -2
  12. data/lib/quickl/version.rb +2 -2
  13. data/quickl.gemspec +4 -4
  14. data/quickl.noespec +13 -37
  15. data/spec/command/delegator/test_split_argv.rb +41 -0
  16. data/spec/command/{command_building_spec.rb → test_command_building.rb} +4 -4
  17. data/spec/command/{command_name_spec.rb → test_command_name.rb} +1 -6
  18. data/spec/command/{documentation_spec.rb → test_documentation.rb} +1 -1
  19. data/spec/command/{overview_spec.rb → test_overview.rb} +1 -5
  20. data/spec/command/test_parse_options.rb +112 -0
  21. data/spec/command/{requester_spec.rb → test_requester.rb} +1 -1
  22. data/spec/command/test_run.rb +40 -0
  23. data/spec/command/{subcommand_by_name_spec.rb → test_subcommand_by_name.rb} +3 -3
  24. data/spec/command/{subcommands_spec.rb → test_subcommands.rb} +8 -7
  25. data/spec/command/test_usage.rb +11 -0
  26. data/spec/mini_client.rb +36 -6
  27. data/spec/naming/test_command2module.rb +17 -0
  28. data/spec/naming/test_module2command.rb +21 -0
  29. data/spec/quickl/test_command_name.rb +16 -0
  30. data/spec/quickl/test_documentation.rb +32 -0
  31. data/spec/quickl/test_overview.rb +16 -0
  32. data/spec/quickl/test_parse_commandline_args.rb +52 -0
  33. data/spec/quickl/test_split_commandline_args.rb +39 -0
  34. data/spec/quickl/test_sub_command.rb +48 -0
  35. data/spec/quickl/test_super_command.rb +21 -0
  36. data/spec/quickl/test_usage.rb +16 -0
  37. data/spec/{command/robustness/valid_read_file_spec.rb → quickl/test_valid_read_file.rb} +4 -4
  38. data/spec/ruby_tools/fixtures.rb +1 -1
  39. data/spec/ruby_tools/{class_unqualified_name_spec.rb → test_class_unqualified_name.rb} +0 -0
  40. data/spec/ruby_tools/{extract_file_rdoc_spec.rb → test_extract_file_rdoc.rb} +0 -0
  41. data/spec/ruby_tools/{optional_args_block_call_spec.rb → test_optional_args_block.rb} +0 -0
  42. data/spec/ruby_tools/{parent_module_spec.rb → test_parent_module.rb} +0 -0
  43. data/spec/spec_helper.rb +1 -0
  44. data/spec/{quickl_spec.rb → test_quickl.rb} +1 -1
  45. data/tasks/debug_mail.rake +1 -1
  46. data/tasks/spec_test.rake +2 -2
  47. data/tasks/unit_test.rake +2 -2
  48. data/templates/single.erb +1 -1
  49. metadata +96 -76
  50. data/spec/command/run_spec.rb +0 -22
  51. data/spec/command/usage_spec.rb +0 -16
  52. data/spec/naming/command2module_spec.rb +0 -17
  53. data/spec/naming/module2command_spec.rb +0 -21
@@ -1,8 +1,8 @@
1
- require File.expand_path('../../../spec_helper', __FILE__)
1
+ require 'spec_helper'
2
2
  module Quickl
3
- describe "Command::Robustness#valid_read_file!" do
3
+ describe "Quickl.valid_read_file!" do
4
4
 
5
- let(:r){ Object.new.extend(Command::Robustness) }
5
+ let(:r){ Quickl }
6
6
 
7
7
  describe "with default options" do
8
8
 
@@ -59,4 +59,4 @@ module Quickl
59
59
  end
60
60
 
61
61
  end
62
- end # module Quickl
62
+ end # module Quickl
@@ -1,4 +1,4 @@
1
- require File.expand_path('../../spec_helper', __FILE__)
1
+ require 'spec_helper'
2
2
  module Quickl
3
3
  module Fixtures
4
4
 
@@ -1,4 +1,5 @@
1
1
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
2
  $LOAD_PATH.unshift File.expand_path('../../spec', __FILE__)
3
+ $VERBOSE = true
3
4
  require 'quickl'
4
5
  require 'mini_client'
@@ -1,4 +1,4 @@
1
- require File.expand_path('../spec_helper', __FILE__)
1
+ require 'spec_helper'
2
2
  describe Quickl do
3
3
 
4
4
  it "should have a version number" do
@@ -56,7 +56,7 @@ begin
56
56
  # Load interesting changesets
57
57
  changes, end_found = [], 0
58
58
  File.readlines(logs.first).select{|line|
59
- if line =~ /^#/
59
+ if line =~ /^# /
60
60
  break if end_found >= 1
61
61
  end_found += 1
62
62
  end
@@ -30,7 +30,7 @@ begin
30
30
  desc "Run RSpec code examples"
31
31
  RSpec::Core::RakeTask.new(:spec_test) do |t|
32
32
  # Glob pattern to match files.
33
- t.pattern = "spec/**/*_spec.rb"
33
+ t.pattern = "spec/**/test_*.rb"
34
34
 
35
35
  # By default, if there is a Gemfile, the generated command will include
36
36
  # 'bundle exec'. Set this to true to ignore the presence of a Gemfile,
@@ -61,7 +61,7 @@ begin
61
61
  t.rcov_opts = []
62
62
 
63
63
  # Command line options to pass to ruby. See 'ruby --help' about this
64
- t.ruby_opts = []
64
+ t.ruby_opts = ["-w"]
65
65
 
66
66
  # Path to rspec
67
67
  t.rspec_path = "rspec"
@@ -45,7 +45,7 @@ begin
45
45
  t.warning = false
46
46
 
47
47
  # Glob pattern to match test files. (default is 'test/test*.rb')
48
- t.pattern = "examples/**/*_test.rb"
48
+ t.pattern = "examples/**/test_*.rb"
49
49
 
50
50
  # Style of test loader to use. Options are:
51
51
  #
@@ -57,7 +57,7 @@ begin
57
57
 
58
58
  # Array of commandline options to pass to ruby when running test
59
59
  # loader.
60
- t.ruby_opts = []
60
+ t.ruby_opts = ["-w"]
61
61
 
62
62
  # Explicitly define the list of test files to be included in a
63
63
  # test. +list+ is expected to be an array of file names (a
@@ -31,7 +31,7 @@ class <%= cmd_class_name %> < Quickl::Command(__FILE__, __LINE__)
31
31
  # Run the command
32
32
  def execute(args)
33
33
  # FIX: do something here
34
- puts "Hello #{args.join(' and ')} from #{program_name}"
34
+ puts "Hello #{args.join(' and ')} from #{Quickl.program_name}"
35
35
  end
36
36
 
37
37
  end # class <%= cmd_class_name %>
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 2
9
- - 2
10
- version: 0.2.2
8
+ - 3
9
+ - 0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bernard Lambeau
@@ -15,10 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-12 00:00:00 Z
18
+ date: 2011-07-29 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
21
+ type: :development
22
+ requirement: &id001 !ruby/object:Gem::Requirement
22
23
  none: false
23
24
  requirements:
24
25
  - - ~>
@@ -29,12 +30,12 @@ dependencies:
29
30
  - 9
30
31
  - 2
31
32
  version: 0.9.2
32
- type: :development
33
- requirement: *id001
34
- prerelease: false
33
+ version_requirements: *id001
35
34
  name: rake
35
+ prerelease: false
36
36
  - !ruby/object:Gem::Dependency
37
- version_requirements: &id002 !ruby/object:Gem::Requirement
37
+ type: :development
38
+ requirement: &id002 !ruby/object:Gem::Requirement
38
39
  none: false
39
40
  requirements:
40
41
  - - ~>
@@ -44,74 +45,73 @@ dependencies:
44
45
  - 1
45
46
  - 0
46
47
  version: "1.0"
47
- type: :development
48
- requirement: *id002
49
- prerelease: false
48
+ version_requirements: *id002
50
49
  name: bundler
50
+ prerelease: false
51
51
  - !ruby/object:Gem::Dependency
52
- version_requirements: &id003 !ruby/object:Gem::Requirement
52
+ type: :development
53
+ requirement: &id003 !ruby/object:Gem::Requirement
53
54
  none: false
54
55
  requirements:
55
56
  - - ~>
56
57
  - !ruby/object:Gem::Version
57
- hash: 31
58
+ hash: 23
58
59
  segments:
59
60
  - 2
60
- - 4
61
+ - 6
61
62
  - 0
62
- version: 2.4.0
63
- type: :development
64
- requirement: *id003
65
- prerelease: false
63
+ version: 2.6.0
64
+ version_requirements: *id003
66
65
  name: rspec
66
+ prerelease: false
67
67
  - !ruby/object:Gem::Dependency
68
- version_requirements: &id004 !ruby/object:Gem::Requirement
68
+ type: :development
69
+ requirement: &id004 !ruby/object:Gem::Requirement
69
70
  none: false
70
71
  requirements:
71
72
  - - ~>
72
73
  - !ruby/object:Gem::Version
73
- hash: 15
74
+ hash: 7
74
75
  segments:
75
76
  - 0
76
- - 6
77
- - 4
78
- version: 0.6.4
79
- type: :development
80
- requirement: *id004
81
- prerelease: false
77
+ - 7
78
+ - 2
79
+ version: 0.7.2
80
+ version_requirements: *id004
82
81
  name: yard
82
+ prerelease: false
83
83
  - !ruby/object:Gem::Dependency
84
- version_requirements: &id005 !ruby/object:Gem::Requirement
84
+ type: :development
85
+ requirement: &id005 !ruby/object:Gem::Requirement
85
86
  none: false
86
87
  requirements:
87
88
  - - ~>
88
89
  - !ruby/object:Gem::Version
89
- hash: 29
90
+ hash: 11
90
91
  segments:
91
92
  - 2
93
+ - 1
92
94
  - 0
93
- - 9
94
- version: 2.0.9
95
- type: :development
96
- requirement: *id005
97
- prerelease: false
95
+ version: 2.1.0
96
+ version_requirements: *id005
98
97
  name: bluecloth
98
+ prerelease: false
99
99
  - !ruby/object:Gem::Dependency
100
- version_requirements: &id006 !ruby/object:Gem::Requirement
100
+ type: :development
101
+ requirement: &id006 !ruby/object:Gem::Requirement
101
102
  none: false
102
103
  requirements:
103
104
  - - ~>
104
105
  - !ruby/object:Gem::Version
105
- hash: 53
106
+ hash: 51
106
107
  segments:
107
108
  - 0
108
109
  - 10
109
- - 1
110
- version: 0.10.1
111
- type: :development
112
- requirement: *id006
113
- prerelease: false
110
+ - 2
111
+ version: 0.10.2
112
+ version_requirements: *id006
114
113
  name: wlang
114
+ prerelease: false
115
115
  description: |-
116
116
  Quickl helps you creating commandline ruby programs. From simple commands
117
117
  with options to complex delegators with subcommands, global and local
@@ -152,27 +152,37 @@ files:
152
152
  - Rakefile
153
153
  - README.md
154
154
  - spec/spec_helper.rb
155
- - spec/command/usage_spec.rb
156
- - spec/command/command_name_spec.rb
157
- - spec/command/subcommands_spec.rb
158
- - spec/command/requester_spec.rb
159
- - spec/command/subcommand_by_name_spec.rb
160
- - spec/command/run_spec.rb
161
- - spec/command/robustness/valid_read_file_spec.rb
162
- - spec/command/overview_spec.rb
163
- - spec/command/documentation_spec.rb
164
- - spec/command/command_building_spec.rb
155
+ - spec/command/test_command_name.rb
156
+ - spec/command/test_subcommands.rb
157
+ - spec/command/test_subcommand_by_name.rb
158
+ - spec/command/test_overview.rb
159
+ - spec/command/test_command_building.rb
160
+ - spec/command/test_run.rb
161
+ - spec/command/test_usage.rb
162
+ - spec/command/delegator/test_split_argv.rb
163
+ - spec/command/test_parse_options.rb
164
+ - spec/command/test_documentation.rb
165
+ - spec/command/test_requester.rb
166
+ - spec/test_quickl.rb
165
167
  - spec/mini_client.rb
166
168
  - spec/ruby_tools/fixtures.rb
167
- - spec/ruby_tools/class_unqualified_name_spec.rb
168
- - spec/ruby_tools/extract_file_rdoc_spec.rb
169
- - spec/ruby_tools/parent_module_spec.rb
170
- - spec/ruby_tools/optional_args_block_call_spec.rb
169
+ - spec/ruby_tools/test_extract_file_rdoc.rb
170
+ - spec/ruby_tools/test_class_unqualified_name.rb
171
+ - spec/ruby_tools/test_optional_args_block.rb
172
+ - spec/ruby_tools/test_parent_module.rb
171
173
  - spec/ruby_tools/fixtures/RubyTools.rdoc
172
174
  - spec/ruby_tools/fixtures/Utils.rdoc
173
- - spec/quickl_spec.rb
174
- - spec/naming/module2command_spec.rb
175
- - spec/naming/command2module_spec.rb
175
+ - spec/naming/test_command2module.rb
176
+ - spec/naming/test_module2command.rb
177
+ - spec/quickl/test_command_name.rb
178
+ - spec/quickl/test_parse_commandline_args.rb
179
+ - spec/quickl/test_split_commandline_args.rb
180
+ - spec/quickl/test_super_command.rb
181
+ - spec/quickl/test_sub_command.rb
182
+ - spec/quickl/test_overview.rb
183
+ - spec/quickl/test_usage.rb
184
+ - spec/quickl/test_documentation.rb
185
+ - spec/quickl/test_valid_read_file.rb
176
186
  - tasks/debug_mail.rake
177
187
  - tasks/yard.rake
178
188
  - tasks/clean.rake
@@ -209,30 +219,40 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
219
  requirements: []
210
220
 
211
221
  rubyforge_project:
212
- rubygems_version: 1.8.5
222
+ rubygems_version: 1.8.6
213
223
  signing_key:
214
224
  specification_version: 3
215
225
  summary: Helper to create commandline ruby programs
216
226
  test_files:
217
227
  - spec/spec_helper.rb
218
- - spec/command/usage_spec.rb
219
- - spec/command/command_name_spec.rb
220
- - spec/command/subcommands_spec.rb
221
- - spec/command/requester_spec.rb
222
- - spec/command/subcommand_by_name_spec.rb
223
- - spec/command/run_spec.rb
224
- - spec/command/robustness/valid_read_file_spec.rb
225
- - spec/command/overview_spec.rb
226
- - spec/command/documentation_spec.rb
227
- - spec/command/command_building_spec.rb
228
+ - spec/command/test_command_name.rb
229
+ - spec/command/test_subcommands.rb
230
+ - spec/command/test_subcommand_by_name.rb
231
+ - spec/command/test_overview.rb
232
+ - spec/command/test_command_building.rb
233
+ - spec/command/test_run.rb
234
+ - spec/command/test_usage.rb
235
+ - spec/command/delegator/test_split_argv.rb
236
+ - spec/command/test_parse_options.rb
237
+ - spec/command/test_documentation.rb
238
+ - spec/command/test_requester.rb
239
+ - spec/test_quickl.rb
228
240
  - spec/mini_client.rb
229
241
  - spec/ruby_tools/fixtures.rb
230
- - spec/ruby_tools/class_unqualified_name_spec.rb
231
- - spec/ruby_tools/extract_file_rdoc_spec.rb
232
- - spec/ruby_tools/parent_module_spec.rb
233
- - spec/ruby_tools/optional_args_block_call_spec.rb
242
+ - spec/ruby_tools/test_extract_file_rdoc.rb
243
+ - spec/ruby_tools/test_class_unqualified_name.rb
244
+ - spec/ruby_tools/test_optional_args_block.rb
245
+ - spec/ruby_tools/test_parent_module.rb
234
246
  - spec/ruby_tools/fixtures/RubyTools.rdoc
235
247
  - spec/ruby_tools/fixtures/Utils.rdoc
236
- - spec/quickl_spec.rb
237
- - spec/naming/module2command_spec.rb
238
- - spec/naming/command2module_spec.rb
248
+ - spec/naming/test_command2module.rb
249
+ - spec/naming/test_module2command.rb
250
+ - spec/quickl/test_command_name.rb
251
+ - spec/quickl/test_parse_commandline_args.rb
252
+ - spec/quickl/test_split_commandline_args.rb
253
+ - spec/quickl/test_super_command.rb
254
+ - spec/quickl/test_sub_command.rb
255
+ - spec/quickl/test_overview.rb
256
+ - spec/quickl/test_usage.rb
257
+ - spec/quickl/test_documentation.rb
258
+ - spec/quickl/test_valid_read_file.rb
@@ -1,22 +0,0 @@
1
- require File.expand_path('../../spec_helper', __FILE__)
2
- module Quickl
3
- describe "Command::run /" do
4
-
5
- it "when invoked on a terminal command" do
6
- MiniClient::Say::Hello.run.should == :hello
7
- MiniClient::Say::Goodbye.run.should == :goodbye
8
- end
9
-
10
- it "when invoked on a delegator command" do
11
- MiniClient.run(["help"]).should == :help
12
- MiniClient::Say.run(["hello"]).should == :hello
13
- MiniClient::Say.run(["goodbye"]).should == :goodbye
14
- end
15
-
16
- it "when invoked on qualified command names" do
17
- MiniClient.run(["say:hello"]).should == :hello
18
- MiniClient.run(["say:goodbye"]).should == :goodbye
19
- end
20
-
21
- end # Command::command
22
- end # module Quickl
@@ -1,16 +0,0 @@
1
- require File.expand_path('../../spec_helper', __FILE__)
2
- module Quickl
3
- describe "Command::usage /" do
4
-
5
- it "should be installed from inline rdoc" do
6
- MiniClient::Say::Hello.usage.should == "mini-client say:hello"
7
- MiniClient::Say::Goodbye.usage.should == "mini-client say:goodbye"
8
- end
9
-
10
- it "should be accessible on instance" do
11
- MiniClient::Say::Hello.new.usage.should == "mini-client say:hello"
12
- MiniClient::Say::Goodbye.new.usage.should == "mini-client say:goodbye"
13
- end
14
-
15
- end # Command::usage
16
- end # module Quickl
@@ -1,17 +0,0 @@
1
- require File.expand_path('../../spec_helper', __FILE__)
2
- module Quickl
3
- describe "Naming::command2module /" do
4
- include Naming
5
-
6
- it "should capitalize first char" do
7
- command2module("say").should == "Say"
8
- command2module(:say).should == :Say
9
- end
10
-
11
- it "should capitalize support dashes" do
12
- command2module("say-hello").should == "SayHello"
13
- command2module(:"say-hello").should == :SayHello
14
- end
15
-
16
- end # module Quickl
17
- end # module Quickl
@@ -1,21 +0,0 @@
1
- require File.expand_path('../../spec_helper', __FILE__)
2
- module Quickl
3
- describe "Naming::module2command /" do
4
- include Naming
5
-
6
- it "should uncapitalize first char" do
7
- module2command("Say").should == "say"
8
- module2command(:Say).should == :say
9
- end
10
-
11
- it "should uncapitalize and introduce dashes" do
12
- module2command("SayHello").should == "say-hello"
13
- module2command(:"SayHello").should == :"say-hello"
14
- end
15
-
16
- it "should support taking modules as argument" do
17
- module2command(Quickl::Command).should == "command"
18
- end
19
-
20
- end # module Quickl
21
- end # module Quickl