quickl 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. data/CHANGELOG.md +23 -0
  2. data/Gemfile +2 -0
  3. data/Gemfile.lock +34 -0
  4. data/LICENCE.md +22 -0
  5. data/Manifest.txt +15 -0
  6. data/README.md +0 -25
  7. data/Rakefile +18 -32
  8. data/lib/quickl/command/builder.rb +18 -1
  9. data/lib/quickl/command/delegator.rb +8 -5
  10. data/lib/quickl/command/robustness.rb +4 -5
  11. data/lib/quickl/command/single.rb +1 -0
  12. data/lib/quickl/command.rb +12 -0
  13. data/lib/quickl/loader.rb +0 -0
  14. data/lib/quickl/version.rb +14 -0
  15. data/lib/quickl.rb +3 -4
  16. data/quickl.gemspec +178 -27
  17. data/quickl.noespec +58 -0
  18. data/spec/command/command_building_spec.rb +16 -0
  19. data/spec/command/command_name_spec.rb +16 -0
  20. data/spec/command/documentation_spec.rb +23 -0
  21. data/spec/command/overview_spec.rb +14 -0
  22. data/spec/command/requester_spec.rb +16 -0
  23. data/spec/command/robustness/valid_read_file_spec.rb +62 -0
  24. data/spec/command/run_spec.rb +22 -0
  25. data/spec/command/subcommand_by_name_spec.rb +15 -0
  26. data/spec/command/subcommands_spec.rb +24 -0
  27. data/spec/command/usage_spec.rb +16 -0
  28. data/spec/mini_client.rb +96 -0
  29. data/spec/naming/command2module_spec.rb +17 -0
  30. data/spec/naming/module2command_spec.rb +21 -0
  31. data/spec/quickl_spec.rb +8 -0
  32. data/spec/ruby_tools/class_unqualified_name_spec.rb +28 -0
  33. data/spec/ruby_tools/extract_file_rdoc_spec.rb +28 -0
  34. data/spec/ruby_tools/fixtures/RubyTools.rdoc +12 -0
  35. data/spec/ruby_tools/fixtures/Utils.rdoc +3 -0
  36. data/spec/ruby_tools/fixtures.rb +27 -0
  37. data/spec/ruby_tools/optional_args_block_call_spec.rb +37 -0
  38. data/spec/ruby_tools/parent_module_spec.rb +23 -0
  39. data/spec/spec_helper.rb +4 -0
  40. data/tasks/debug_mail.rake +78 -0
  41. data/tasks/debug_mail.txt +13 -0
  42. data/tasks/gem.rake +68 -0
  43. data/tasks/spec_test.rake +79 -0
  44. data/tasks/unit_test.rake +77 -0
  45. data/tasks/yard.rake +51 -0
  46. metadata +150 -105
  47. data/examples/delegator/README.md +0 -86
  48. data/examples/delegator/bin/delegator +0 -9
  49. data/examples/delegator/lib/delegator.rb +0 -41
  50. data/examples/delegator/lib/hello_world.rb +0 -39
  51. data/examples/delegator/lib/help.rb +0 -24
  52. data/examples/delegator/test/delegator_test.rb +0 -68
  53. data/examples/hello/README.md +0 -74
  54. data/examples/hello/hello +0 -57
  55. data/examples/hello/hello_test.rb +0 -65
  56. data/examples/helper.rb +0 -6
  57. data/templates/single.erb +0 -40
data/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ # 0.2.1 / 2011.06.19
2
+
3
+ * Enhancements
4
+
5
+ * Delegator delegates the command execution to an execute(argv) methods,
6
+ therefore mimicing Single command
7
+ * Command provides subcommand_by_name (a class method) allowing to resolve
8
+ ':' qualified command names easily. Robustness::has_command! has been
9
+ rewritten to use the latter method, so that it now striclty respects command
10
+ hierarchy
11
+ * Delegator.summarized_subcommands takes an optional argument, allowing
12
+ to specify the list of commands for which documentation must be summarized.
13
+ * The factory methods Quickl::Command and Quickl::Delegator accept an optional
14
+ block which is yield with the command builder.
15
+ * Command::Builder has a command_parent= accessor allowing to bypass the default
16
+ (infered) command strategy feature (advanced usage).
17
+ * Command::Builder accepts callback blocks that are called when a command is
18
+ installed (advanced usage).
19
+
20
+ * On the devel side
21
+
22
+ * The project structure is handled by ruby.noe 1.3.0
23
+
1
24
  # 0.2.0 / 2011-01-10
2
25
 
3
26
  * Enhancements
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'http://rubygems.org'
2
+ gemspec :name => "quickl"
data/Gemfile.lock ADDED
@@ -0,0 +1,34 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ quickl (0.2.1)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ bluecloth (2.0.9)
10
+ diff-lcs (1.1.2)
11
+ rake (0.8.7)
12
+ rspec (2.4.0)
13
+ rspec-core (~> 2.4.0)
14
+ rspec-expectations (~> 2.4.0)
15
+ rspec-mocks (~> 2.4.0)
16
+ rspec-core (2.4.0)
17
+ rspec-expectations (2.4.0)
18
+ diff-lcs (~> 1.1.2)
19
+ rspec-mocks (2.4.0)
20
+ wlang (0.10.1)
21
+ yard (0.6.4)
22
+
23
+ PLATFORMS
24
+ java
25
+ ruby
26
+
27
+ DEPENDENCIES
28
+ bluecloth (~> 2.0.9)
29
+ bundler (~> 1.0)
30
+ quickl!
31
+ rake (~> 0.8.7)
32
+ rspec (~> 2.4.0)
33
+ wlang (~> 0.10.1)
34
+ yard (~> 0.6.4)
data/LICENCE.md ADDED
@@ -0,0 +1,22 @@
1
+ # The MIT Licence
2
+
3
+ Copyright (c) 2011 - Bernard Lambeau
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Manifest.txt ADDED
@@ -0,0 +1,15 @@
1
+ quickl.gemspec
2
+ quickl.noespec
3
+ .gemtest
4
+ CHANGELOG.md
5
+ Gemfile
6
+ Gemfile.lock
7
+ bin/**/*
8
+ lib/**/*
9
+ LICENCE.md
10
+ Manifest.txt
11
+ Rakefile
12
+ README.md
13
+ spec/**/*
14
+ tasks/**/*
15
+ test/**/*
data/README.md CHANGED
@@ -91,28 +91,3 @@ Until version 1.0.0, to preserve your application from hurting changes you shoul
91
91
 
92
92
  gem 'quickl', '< 0.2.0' # Assuming current version is 0.1.xx
93
93
  require 'quickl'
94
-
95
- ## Licence
96
-
97
- (The MIT License)
98
-
99
- Copyright (c) 2010 Bernard Lambeau <blambeau@gmail.com>
100
-
101
- Permission is hereby granted, free of charge, to any person obtaining
102
- a copy of this software and associated documentation files (the
103
- 'Software'), to deal in the Software without restriction, including
104
- without limitation the rights to use, copy, modify, merge, publish,
105
- distribute, sublicense, and/or sell copies of the Software, and to
106
- permit persons to whom the Software is furnished to do so, subject to
107
- the following conditions:
108
-
109
- The above copyright notice and this permission notice shall be
110
- included in all copies or substantial portions of the Software.
111
-
112
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
113
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
114
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
115
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
116
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
117
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
118
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,37 +1,23 @@
1
- # -*- ruby -*-
2
- require 'rubygems'
3
- require "rake/testtask"
4
- require "rspec/core/rake_task"
5
- require "yard"
6
- require "rake/gempackagetask"
7
-
8
- task :default => :test
9
- task :test => [:spec, :examples]
10
-
11
- # About yard documentation
12
- YARD::Rake::YardocTask.new do |t|
13
- t.files = ['lib/**/*.rb', 'examples/**/*.rb']
14
- t.options = ['--output-dir', 'doc/api', '-', "README.md", "CHANGELOG.md"]
1
+ begin
2
+ gem "bundler", "~> 1.0"
3
+ require "bundler/setup"
4
+ rescue LoadError => ex
5
+ puts ex.message
6
+ abort "Bundler failed to load, (did you run 'gem install bundler' ?)"
15
7
  end
16
8
 
17
- desc "Lauches unit tests on examples"
18
- Rake::TestTask.new(:examples) do |test|
19
- test.libs = [ "lib" ]
20
- test.test_files = Dir["examples/**/*_test.rb"]
21
- test.verbose = true
22
- end
9
+ # Dynamically load the gem spec
10
+ $gemspec_file = File.expand_path('../quickl.gemspec', __FILE__)
11
+ $gemspec = Kernel.eval(File.read($gemspec_file))
23
12
 
24
- desc "Run all examples"
25
- RSpec::Core::RakeTask.new(:spec) do |t|
26
- t.rspec_opts = %w[--color]
27
- t.verbose = false
28
- end
13
+ # We run tests by default
14
+ task :default => :test
29
15
 
30
- desc "Create the .gem package"
31
- $spec = Kernel.eval(File.read(File.expand_path('../quickl.gemspec', __FILE__)))
32
- Rake::GemPackageTask.new($spec) do |pkg|
33
- pkg.need_tar = true
16
+ #
17
+ # Install all tasks found in tasks folder
18
+ #
19
+ # See .rake files there for complete documentation.
20
+ #
21
+ Dir["tasks/*.rake"].each do |taskfile|
22
+ instance_eval File.read(taskfile), taskfile
34
23
  end
35
-
36
-
37
- # vim: syntax=ruby
@@ -28,6 +28,18 @@ module Quickl
28
28
  end
29
29
  alias :instance_module instance_modules
30
30
 
31
+ # Sets the parent of the command currently built
32
+ def command_parent=(p)
33
+ @parent = p
34
+ end
35
+
36
+ # Installs a callback block to execute at
37
+ # install time
38
+ def callback(&block)
39
+ @callbacks ||= []
40
+ @callbacks << block
41
+ end
42
+
31
43
  # Installs on a command subclass
32
44
  def run(command)
33
45
  # install class and instance methods
@@ -44,11 +56,16 @@ module Quickl
44
56
  end
45
57
 
46
58
  # install hierarchy
47
- parent = RubyTools::parent_module(command)
59
+ parent = @parent || RubyTools::parent_module(command)
48
60
  if parent && parent.ancestors.include?(Command)
49
61
  command.super_command = parent
50
62
  parent.subcommands << command
51
63
  end
64
+
65
+ # execute callbacks
66
+ @callbacks.each do |blk|
67
+ blk.call(command)
68
+ end if @callbacks
52
69
 
53
70
  command
54
71
  end
@@ -10,8 +10,10 @@ module Quickl
10
10
  my_argv << argv.shift
11
11
  end
12
12
  parse_options(my_argv)
13
+ execute(argv)
14
+ end
13
15
 
14
- # Run the subcommand now
16
+ def execute(argv)
15
17
  if cmd = argv.shift
16
18
  cmd = has_command!(cmd).run(argv, self)
17
19
  else
@@ -22,8 +24,8 @@ module Quickl
22
24
  end
23
25
  module ClassMethods
24
26
 
25
- def summarized_subcommands
26
- doc = subcommands.collect{|cmd|
27
+ def summarized_subcommands(subs = subcommands)
28
+ doc = subs.collect{|cmd|
27
29
  [cmd.command_name, cmd.overview]
28
30
  }
29
31
  max = doc.inject(0){|memo,pair|
@@ -46,13 +48,14 @@ module Quickl
46
48
  b.document *args
47
49
  b.class_module Command::Delegator::ClassMethods
48
50
  b.instance_module Command::Delegator::InstanceMethods
51
+ yield(b) if block_given?
49
52
  end
50
53
  Command
51
54
  end
52
55
 
53
56
  # @see Delegator
54
- def self.Delegate(*args)
55
- self.Delegator(*args)
57
+ def self.Delegate(*args, &block)
58
+ self.Delegator(*args, &block)
56
59
  end
57
60
 
58
61
  end # module Quickl
@@ -6,11 +6,10 @@ module Quickl
6
6
  # Checks that a command whose name is given exists
7
7
  # or raises a NoSuchCommand.
8
8
  def has_command!(name, referer = self.class)
9
- name.split(':').inject(referer){|cur,look|
10
- cur.const_get(command2module(look))
11
- }
12
- rescue NameError => ex
13
- raise NoSuchCommand, "No such command #{name}", ex.backtrace
9
+ unless cmd = referer.subcommand_by_name(name)
10
+ raise NoSuchCommand, "No such command #{name}"
11
+ end
12
+ cmd
14
13
  end
15
14
 
16
15
  # Checks that _file_ is a readable file or raises an error.
@@ -20,6 +20,7 @@ module Quickl
20
20
  command_builder do |b|
21
21
  b.document *args
22
22
  b.instance_module Command::Single
23
+ yield(b) if block_given?
23
24
  end
24
25
  Command
25
26
  end
@@ -17,6 +17,18 @@ module Quickl
17
17
  @subcommands ||= []
18
18
  end
19
19
 
20
+ # Returns a subcommand by its name, or nil
21
+ def subcommand_by_name(name)
22
+ return nil unless has_sub_commands?
23
+ look = name.split(':')
24
+ found = subcommands.find{|cmd| cmd.command_name == look.first}
25
+ if found.nil? or (look.size == 1)
26
+ return found
27
+ else
28
+ found.subcommand_by_name(look[1..-1].join(':'))
29
+ end
30
+ end
31
+
20
32
  # Returns true if this command has at least one
21
33
  # subcommand
22
34
  def has_sub_commands?
File without changes
@@ -0,0 +1,14 @@
1
+ module Quickl
2
+ module Version
3
+
4
+ MAJOR = 0
5
+ MINOR = 2
6
+ TINY = 1
7
+
8
+ def self.to_s
9
+ [ MAJOR, MINOR, TINY ].join('.')
10
+ end
11
+
12
+ end
13
+ VERSION = Version.to_s
14
+ end
data/lib/quickl.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'quickl/loader'
2
+ require 'quickl/version'
1
3
  require 'quickl/ext/object'
2
4
  require 'quickl/errors'
3
5
  require 'quickl/ruby_tools'
@@ -5,9 +7,6 @@ require 'quickl/naming'
5
7
  require 'quickl/command'
6
8
  module Quickl
7
9
 
8
- # Quickl's VERSION
9
- VERSION = '0.2.0'.freeze
10
-
11
10
  # Quickl's COPYRIGHT info
12
11
  COPYRIGHT = "(c) 2010, Bernard Lambeau"
13
12
 
@@ -44,4 +43,4 @@ module Quickl
44
43
  end
45
44
  end
46
45
 
47
- end # module Quickl
46
+ end # module Quickl
data/quickl.gemspec CHANGED
@@ -1,39 +1,190 @@
1
- $LOAD_PATH.unshift(File.expand_path('../lib', __FILE__))
2
- require 'rubygems'
3
- require 'quickl'
1
+ # We require your library, mainly to have access to the VERSION number.
2
+ # Feel free to set $version manually.
3
+ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
4
+ require "quickl/version"
5
+ $version = Quickl::Version.to_s
4
6
 
7
+ #
8
+ # This is your Gem specification. Default values are provided so that your library
9
+ # should be correctly packaged given what you have described in the .noespec file.
10
+ #
5
11
  Gem::Specification.new do |s|
6
- s.name = 'quickl'
7
- s.version = Quickl::VERSION.dup
8
- s.date = Time.now.strftime('%Y-%m-%d')
12
+
13
+ ################################################################### ABOUT YOUR GEM
14
+
15
+ # Gem name (required)
16
+ s.name = "quickl"
17
+
18
+ # Gem version (required)
19
+ s.version = $version
20
+
21
+ # A short summary of this gem
22
+ #
23
+ # This is displayed in `gem list -d`.
24
+ s.summary = "Helper to create commandline ruby programs"
9
25
 
10
- s.summary = 'Generate Ruby command line apps quickly'
11
- s.description = 'Generate Ruby command line apps quickly'
26
+ # A long description of this gem (required)
27
+ #
28
+ # The description should be more detailed than the summary. For example,
29
+ # you might wish to copy the entire README into the description.
30
+ s.description = "Quickl helps you creating commandline ruby programs. From simple commands \nwith options to complex delegators with subcommands, global and local \noptions."
31
+
32
+ # The URL of this gem home page (optional)
33
+ s.homepage = "http://github.com/blambeau/quickl"
12
34
 
13
- s.author = 'Bernard Lambeau'
14
- s.email = 'blambeau@gmail.com'
35
+ # Gem publication date (required but auto)
36
+ #
37
+ # Today is automatically used by default, uncomment only if
38
+ # you know what you do!
39
+ #
40
+ # s.date = Time.now.strftime('%Y-%m-%d')
41
+
42
+ # The license(s) for the library. Each license must be a short name, no
43
+ # more than 64 characters.
44
+ #
45
+ # s.licences = %w{}
15
46
 
16
- s.require_paths = %w{ lib }
47
+ # The rubyforge project this gem lives under (optional)
48
+ #
49
+ # s.rubyforge_project = nil
17
50
 
18
- s.files =
19
- Dir['lib/**/*'] +
20
- Dir['examples/**/*'] +
21
- Dir['templates/**/*'] +
22
- Dir['bin/**/*'] +
23
- Dir['test/**/*'] +
24
- %w{ quickl.gemspec Rakefile README.md CHANGELOG.md }
51
+ ################################################################### ABOUT THE AUTHORS
52
+
53
+ # The list of author names who wrote this gem.
54
+ #
55
+ # If you are providing multiple authors and multiple emails they should be
56
+ # in the same order.
57
+ #
58
+ s.authors = ["Bernard Lambeau"]
59
+
60
+ # Contact emails for this gem
61
+ #
62
+ # If you are providing multiple authors and multiple emails they should be
63
+ # in the same order.
64
+ #
65
+ # NOTE: Somewhat strangly this attribute is always singular!
66
+ # Don't replace by s.emails = ...
67
+ s.email = ["blambeau@gmail.com"]
25
68
 
69
+ ################################################################### PATHS, FILES, BINARIES
70
+
71
+ # Paths in the gem to add to $LOAD_PATH when this gem is
72
+ # activated (required).
73
+ #
74
+ # The default 'lib' is typically sufficient.
75
+ s.require_paths = ["lib"]
76
+
77
+ # Files included in this gem.
78
+ #
79
+ # By default, we take all files included in the Manifest.txt file on root
80
+ # of the project. Entries of the manifest are interpreted as Dir[...]
81
+ # patterns so that lazy people may use wilcards like lib/**/*
82
+ #
83
+ here = File.expand_path(File.dirname(__FILE__))
84
+ s.files = File.readlines(File.join(here, 'Manifest.txt')).
85
+ inject([]){|files, pattern| files + Dir[File.join(here, pattern.strip)]}.
86
+ collect{|x| x[(1+here.size)..-1]}
87
+
88
+ # Test files included in this gem.
89
+ #
90
+ s.test_files = Dir["test/**/*"] + Dir["spec/**/*"]
91
+
92
+ # The path in the gem for executable scripts (optional)
93
+ #
26
94
  s.bindir = "bin"
27
- s.executables = ["quickl"]
28
95
 
29
- s.add_development_dependency('rake')
30
- s.add_development_dependency('rspec', ">= 2.4.0")
31
- s.add_development_dependency('yard', ">= 0.6.4")
32
- s.add_development_dependency('bluecloth', ">= 0.6.4")
96
+ # Executables included in the gem.
97
+ #
98
+ s.executables = (Dir["bin/*"]).collect{|f| File.basename(f)}
99
+
100
+ ################################################################### REQUIREMENTS & INSTALL
101
+ # Remember the gem version requirements operators and schemes:
102
+ # = Equals version
103
+ # != Not equal to version
104
+ # > Greater than version
105
+ # < Less than version
106
+ # >= Greater than or equal to
107
+ # <= Less than or equal to
108
+ # ~> Approximately greater than
109
+ #
110
+ # Don't forget to have a look at http://lmgtfy.com/?q=Ruby+Versioning+Policies
111
+ # for setting your gem version.
112
+ #
113
+ # For your requirements to other gems, remember that
114
+ # ">= 2.2.0" (optimistic: specify minimal version)
115
+ # ">= 2.2.0", "< 3.0" (pessimistic: not greater than the next major)
116
+ # "~> 2.2" (shortcut for ">= 2.2.0", "< 3.0")
117
+ # "~> 2.2.0" (shortcut for ">= 2.2.0", "< 2.3.0")
118
+ #
119
+
120
+ #
121
+ # One call to add_dependency('gem_name', 'gem version requirement') for each
122
+ # runtime dependency. These gems will be installed with your gem.
123
+ # One call to add_development_dependency('gem_name', 'gem version requirement')
124
+ # for each development dependency. These gems are required for developers
125
+ #
126
+ s.add_development_dependency("rake", "~> 0.8.7")
127
+ s.add_development_dependency("bundler", "~> 1.0")
128
+ s.add_development_dependency("rspec", "~> 2.4.0")
129
+ s.add_development_dependency("yard", "~> 0.6.4")
130
+ s.add_development_dependency("bluecloth", "~> 2.0.9")
131
+ s.add_development_dependency("wlang", "~> 0.10.1")
132
+
133
+
134
+ # The version of ruby required by this gem
135
+ #
136
+ # Uncomment and set this if your gem requires specific ruby versions.
137
+ #
138
+ # s.required_ruby_version = ">= 0"
139
+
140
+ # The RubyGems version required by this gem
141
+ #
142
+ # s.required_rubygems_version = ">= 0"
143
+
144
+ # The platform this gem runs on. See Gem::Platform for details.
145
+ #
146
+ # s.platform = nil
147
+
148
+ # Extensions to build when installing the gem.
149
+ #
150
+ # Valid types of extensions are extconf.rb files, configure scripts
151
+ # and rakefiles or mkrf_conf files.
152
+ #
153
+ s.extensions = []
154
+
155
+ # External (to RubyGems) requirements that must be met for this gem to work.
156
+ # It’s simply information for the user.
157
+ #
158
+ s.requirements = nil
159
+
160
+ # A message that gets displayed after the gem is installed
161
+ #
162
+ # Uncomment and set this if you want to say something to the user
163
+ # after gem installation
164
+ #
165
+ s.post_install_message = nil
166
+
167
+ ################################################################### SECURITY
168
+
169
+ # The key used to sign this gem. See Gem::Security for details.
170
+ #
171
+ # s.signing_key = nil
172
+
173
+ # The certificate chain used to sign this gem. See Gem::Security for
174
+ # details.
175
+ #
176
+ # s.cert_chain = []
177
+
178
+ ################################################################### RDOC
179
+
180
+ # An ARGV style array of options to RDoc
181
+ #
182
+ # See 'rdoc --help' about this
183
+ #
184
+ s.rdoc_options = []
33
185
 
34
- s.has_rdoc = true
35
- s.rdoc_options = %w< --line-numbers --inline-source --title Quickl --main Quickl >
36
- s.extra_rdoc_files = %w< README.md >
186
+ # Extra files to add to RDoc such as README
187
+ #
188
+ s.extra_rdoc_files = Dir["README.md"] + Dir["CHANGELOG.md"] + Dir["LICENCE.md"]
37
189
 
38
- s.homepage = 'http://github.com/blambeau/quickl'
39
190
  end
data/quickl.noespec ADDED
@@ -0,0 +1,58 @@
1
+ # Noe template for ruby gem libraries (https://github.com/blambeau/noe) - short version
2
+ # Run 'noe show-spec' and 'noe help show-spec' for additional details.
3
+
4
+ # Don't remove this entry!
5
+ template-info:
6
+ name: "ruby"
7
+ version: 1.3.0
8
+
9
+ # Update to match your own configuration.
10
+ variables:
11
+ # A ruby lower case project name.
12
+ lower:
13
+ quickl
14
+
15
+ # A ruby upper case project name.
16
+ upper:
17
+ Quickl
18
+
19
+ # Version of your library
20
+ version:
21
+ 0.2.1
22
+
23
+ # Project summary (~ 1 line).
24
+ summary: |-
25
+ Helper to create commandline ruby programs
26
+
27
+ # Project description (~ 5 lines). Project description should be more complete
28
+ # than the summary and will be used to describe your gem on rubygems.org
29
+ description: |-
30
+ Quickl helps you creating commandline ruby programs. From simple commands
31
+ with options to complex delegators with subcommands, global and local
32
+ options.
33
+
34
+ # Authors of the project (- {name: Bob, email: bob@gmail.com}, ...)
35
+ authors:
36
+ - { name: "Bernard Lambeau", email: blambeau@gmail.com }
37
+
38
+ # Web links for the project (- http://..., - http://...).
39
+ links:
40
+ - http://github.com/blambeau/quickl
41
+
42
+ # Gem dependencies. (- {name: ..., version: ..., groups: [...]}, ...)
43
+ dependencies:
44
+ # Rake is required for developers, as usual
45
+ - {name: rake, version: "~> 0.8.7", groups: [development]}
46
+ # Bundler is required for developers and is used by the Rakefile
47
+ - {name: bundler, version: "~> 1.0", groups: [development]}
48
+ # RSpec is required to run 'rake spec'. See tasks/spec.rake
49
+ - {name: rspec, version: "~> 2.4.0", groups: [development]}
50
+ # YARD and BlueCloth are required to run 'rake yard'. See tasks/yard.rake
51
+ - {name: yard, version: "~> 0.6.4", groups: [development]}
52
+ - {name: bluecloth, version: "~> 2.0.9", groups: [development]}
53
+ # wlang is required to run 'rake debug_mail'. See tasks/debug_mail.rake
54
+ - {name: wlang, version: "~> 0.10.1", groups: [development]}
55
+
56
+ rake_tasks:
57
+ unit_test:
58
+ pattern: examples/**/*_test.rb
@@ -0,0 +1,16 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+ module Quickl
3
+ describe "Command building /" do
4
+
5
+ it "should execute callback methods" do
6
+ MiniClient::Factored.run.should == :hello
7
+ end
8
+
9
+ it "should install hierarchy correctly when command_parent= is used" do
10
+ MiniClient::Factored.super_command.should == MiniClient::Requester
11
+ MiniClient::Requester.subcommands.should include(MiniClient::Factored)
12
+ lambda{ MiniClient::Requester.new.has_command!("factored") }.should_not raise_error
13
+ end
14
+
15
+ end # Command::command_name
16
+ end # module Quickl
@@ -0,0 +1,16 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+ module Quickl
3
+ describe "Command::command_name /" do
4
+
5
+ it "should be installed from inline rdoc" do
6
+ MiniClient::Say::Hello.command_name.should == "hello"
7
+ MiniClient::Say::Goodbye.command_name.should == "goodbye"
8
+ end
9
+
10
+ it "should be accessible on instance" do
11
+ MiniClient::Say::Hello.new.command_name.should == "hello"
12
+ MiniClient::Say::Goodbye.new.command_name.should == "goodbye"
13
+ end
14
+
15
+ end # Command::command_name
16
+ end # module Quickl