quickl 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ # 0.2.2 / 2011.07.12
2
+
3
+ * Enhancements
4
+
5
+ * Added a template/delegator.erb template (quickl --layout=delegator ...)
6
+ * Added --[no-]header and --[no-]footer options to the template generator
7
+
8
+ * Bug fixes
9
+
10
+ * The gem is now shipped with the template/single.erb file. This fixes the
11
+ 'quickl' commandline that generates skeletons as illustrated in README
12
+ (patch and thanks to Rit Li)
13
+ * Broken links to the examples from the README are fixed (Travis Briggs)
14
+ * Other typos fixed that led to failures on --help in examples (Tomasz Łoszko)
15
+
1
16
  # 0.2.1 / 2011.06.19
2
17
 
3
18
  * Enhancements
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- quickl (0.2.1)
4
+ quickl (0.2.2)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
8
8
  specs:
9
- bluecloth (2.0.9)
9
+ bluecloth (2.0.11)
10
10
  diff-lcs (1.1.2)
11
- rake (0.8.7)
11
+ rake (0.9.2)
12
12
  rspec (2.4.0)
13
13
  rspec-core (~> 2.4.0)
14
14
  rspec-expectations (~> 2.4.0)
@@ -17,8 +17,8 @@ GEM
17
17
  rspec-expectations (2.4.0)
18
18
  diff-lcs (~> 1.1.2)
19
19
  rspec-mocks (2.4.0)
20
- wlang (0.10.1)
21
- yard (0.6.4)
20
+ wlang (0.10.2)
21
+ yard (0.6.8)
22
22
 
23
23
  PLATFORMS
24
24
  java
@@ -28,7 +28,7 @@ DEPENDENCIES
28
28
  bluecloth (~> 2.0.9)
29
29
  bundler (~> 1.0)
30
30
  quickl!
31
- rake (~> 0.8.7)
31
+ rake (~> 0.9.2)
32
32
  rspec (~> 2.4.0)
33
33
  wlang (~> 0.10.1)
34
34
  yard (~> 0.6.4)
data/Manifest.txt CHANGED
@@ -6,10 +6,11 @@ Gemfile
6
6
  Gemfile.lock
7
7
  bin/**/*
8
8
  lib/**/*
9
+ templates/single.erb
9
10
  LICENCE.md
10
11
  Manifest.txt
11
12
  Rakefile
12
13
  README.md
13
14
  spec/**/*
14
15
  tasks/**/*
15
- test/**/*
16
+ test/**/*
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Quickl
2
2
 
3
3
  * http://github.com/blambeau/quickl
4
+ * http://rubydoc.info/github/blambeau/quickl/master/frames
4
5
 
5
6
  ## Description
6
7
 
@@ -13,7 +14,7 @@ Quickl helps you create commandline programs as simply as:
13
14
  # Usage: ...
14
15
  #
15
16
  # OPTIONS:
16
- # #{sumarized_options}
17
+ # #{summarized_options}
17
18
  #
18
19
  # DESCRIPTION
19
20
  # Long description here...
@@ -36,7 +37,8 @@ Running them as simply as:
36
37
 
37
38
  SimpleCommand.run(ARGV)
38
39
 
39
- From simple command to complex delegator (_ala_ 'git [--version] [--help] COMMAND [cmd options] ARGS...'), Quickl provides (or aims at providing) the following features:
40
+ From simple command to complex delegator (_ala_ 'git [--version] [--help] COMMAND [cmd options] ARGS...'),
41
+ Quickl provides (or aims at providing) the following features:
40
42
 
41
43
  * Simple command creations via simple classes
42
44
  * Delegator commands and categories via ruby namespaces and naming conventions
@@ -69,12 +71,31 @@ Try this:
69
71
 
70
72
  Additional examples (see examples folder):
71
73
 
72
- * [hello world example](https://github.com/blambeau/quickl/blob/master/examples/hello_world)
74
+ * [hello world example](https://github.com/blambeau/quickl/blob/master/examples/hello)
73
75
  * [delegator example](https://github.com/blambeau/quickl/blob/master/examples/delegator)
74
76
 
77
+ ## Related work
78
+
79
+ A few other gems similarly provide tools to generate commandline app.
80
+
81
+ * https://github.com/wycats/thor provides a way to bundle command line utilities
82
+ as class methods. It also provides an alternative to Rake and therefore sees
83
+ commands as tasks. It is more mature that quickl but is also a bit more
84
+ opinionated IMHO. If you want one command by class, use quickl; one command by
85
+ method, go for thor instead.
86
+ * https://github.com/mdub/clamp is very similar to quickl as well, even more
87
+ similar than thor in fact. Clamp supports subcommands and options (not through
88
+ OptionParser, though). It does not have the quickl's auto-documentation
89
+ feature, but has an automatic --help. I would say that Clamp is maybe a bit
90
+ lighter and 'straight to the point' than quickl, but also more magic and
91
+ opinionated.
92
+ * See also: http://trollop.rubyforge.org/, http://clip.rubyforge.org/
93
+
75
94
  ## Version policy
76
95
 
77
- Until version 1.0.0, moditications of public interfaces increase the minor version, while other changes increase the tiny version. After version 1.0.0, same changes will affect major and minor versions, respectively.
96
+ Until version 1.0.0, moditications of public interfaces increase the minor version,
97
+ while other changes increase the tiny version. After version 1.0.0, same changes will
98
+ affect major and minor versions, respectively.
78
99
 
79
100
  0.1.0 -> 0.1.1 # enhancements and private API changes
80
101
  0.1.0 -> 0.2.0 # broken API on public interfaces
@@ -87,7 +108,8 @@ Public interfaces are:
87
108
  * Naming conventions (module <-> command conversions)
88
109
  * Default reactions to errors (Quickl::Help, Quickl::Exit, ...)
89
110
 
90
- Until version 1.0.0, to preserve your application from hurting changes you should require quickl as follows:
111
+ Until version 1.0.0, to preserve your application from hurting changes you should
112
+ require quickl as follows:
91
113
 
92
- gem 'quickl', '< 0.2.0' # Assuming current version is 0.1.xx
114
+ gem 'quickl', '~> 0.2.0' # Assuming current version is 0.2.xx
93
115
  require 'quickl'
data/bin/quickl CHANGED
@@ -34,6 +34,12 @@ class Quickl::Main < Quickl::Command(__FILE__, __LINE__)
34
34
  # Name of the command to generate
35
35
  attr_reader :cmd_name
36
36
 
37
+ # Generate require header
38
+ attr_reader :header
39
+
40
+ # Generate require footer
41
+ attr_reader :footer
42
+
37
43
  # Creates a command instance
38
44
  def initialize
39
45
  @layout = :single
@@ -43,8 +49,8 @@ class Quickl::Main < Quickl::Command(__FILE__, __LINE__)
43
49
  # Install options
44
50
  options do |opt|
45
51
 
46
- opt.on("--layout=LAYOUT", [:single],
47
- "Select specific command layout (single)") do |l|
52
+ opt.on("--layout=LAYOUT", [:single, :delegator],
53
+ "Select specific command layout (single,delegator)") do |l|
48
54
  @layout = l
49
55
  end
50
56
 
@@ -55,6 +61,18 @@ class Quickl::Main < Quickl::Command(__FILE__, __LINE__)
55
61
  raise Quickl::InvalidOption, "Unknown option helpers: #{unknown.join(',')}"
56
62
  end
57
63
  end
64
+
65
+ @header = true
66
+ opt.on('--[no-]header',
67
+ "Generate header (require rubygems + quickl)"){|value|
68
+ @header = value
69
+ }
70
+
71
+ @footer = true
72
+ opt.on('--[no-]footer',
73
+ "Generate footer (command execution)"){|value|
74
+ @footer = value
75
+ }
58
76
 
59
77
  # Show the help and exit
60
78
  opt.on_tail("--help", "Show help") do
data/lib/quickl/naming.rb CHANGED
@@ -35,15 +35,11 @@ module Quickl
35
35
  def module2command(mod)
36
36
  case mod
37
37
  when Module
38
- name = RubyTools::class_unqualified_name(mod)
39
- name = name.gsub(/[A-Z]/){|x| "-#{x.downcase}"}[1..-1]
38
+ module2command(RubyTools::class_unqualified_name(mod))
40
39
  when String
41
- name = mod.to_s
42
- name = name.gsub(/[A-Z]/){|x| "-#{x.downcase}"}[1..-1]
40
+ mod.gsub(/[A-Z]/){|x| "-#{x.downcase}"}[1..-1]
43
41
  when Symbol
44
- name = mod.to_s
45
- name = name.gsub(/[A-Z]/){|x| "-#{x.downcase}"}[1..-1]
46
- name.to_sym
42
+ module2command(mod.to_s).to_sym
47
43
  else
48
44
  raise ArgumentError, "Invalid module argument #{mod.class}"
49
45
  end
@@ -3,7 +3,7 @@ module Quickl
3
3
 
4
4
  MAJOR = 0
5
5
  MINOR = 2
6
- TINY = 1
6
+ TINY = 2
7
7
 
8
8
  def self.to_s
9
9
  [ MAJOR, MINOR, TINY ].join('.')
data/quickl.gemspec CHANGED
@@ -123,7 +123,7 @@ Gem::Specification.new do |s|
123
123
  # One call to add_development_dependency('gem_name', 'gem version requirement')
124
124
  # for each development dependency. These gems are required for developers
125
125
  #
126
- s.add_development_dependency("rake", "~> 0.8.7")
126
+ s.add_development_dependency("rake", "~> 0.9.2")
127
127
  s.add_development_dependency("bundler", "~> 1.0")
128
128
  s.add_development_dependency("rspec", "~> 2.4.0")
129
129
  s.add_development_dependency("yard", "~> 0.6.4")
data/quickl.noespec CHANGED
@@ -18,7 +18,7 @@ variables:
18
18
 
19
19
  # Version of your library
20
20
  version:
21
- 0.2.1
21
+ 0.2.2
22
22
 
23
23
  # Project summary (~ 1 line).
24
24
  summary: |-
@@ -42,7 +42,7 @@ variables:
42
42
  # Gem dependencies. (- {name: ..., version: ..., groups: [...]}, ...)
43
43
  dependencies:
44
44
  # Rake is required for developers, as usual
45
- - {name: rake, version: "~> 0.8.7", groups: [development]}
45
+ - {name: rake, version: "~> 0.9.2", groups: [development]}
46
46
  # Bundler is required for developers and is used by the Rakefile
47
47
  - {name: bundler, version: "~> 1.0", groups: [development]}
48
48
  # RSpec is required to run 'rake spec'. See tasks/spec.rake
data/tasks/clean.rake ADDED
@@ -0,0 +1,3 @@
1
+ task :clean do
2
+ Dir["**/*.rbc"].each{|f| FileUtils.rm_rf(f)}
3
+ end
@@ -0,0 +1,42 @@
1
+ <% if header %>
2
+ begin
3
+ require 'quickl'
4
+ rescue LoadError
5
+ require 'rubygems'
6
+ gem 'quickl'
7
+ retry
8
+ end
9
+ <% end %>
10
+ #
11
+ # FIX: overview
12
+ #
13
+ # SYNOPSIS
14
+ # #{command_name} [options] ARGS...
15
+ #
16
+ # OPTIONS
17
+ # #{summarized_options}
18
+ #
19
+ # DESCRIPTION
20
+ # FIX: description
21
+ #
22
+ class <%= cmd_class_name %> < Quickl::Command(__FILE__, __LINE__)
23
+
24
+ VERSION = "0.1.0"
25
+
26
+ # Install options
27
+ options do |opt|
28
+ <%= option_helpers.collect{|s| tabto(s,4)}.join("\n") %>
29
+ end
30
+
31
+ # Run the command
32
+ def execute(args)
33
+ # FIX: do something here
34
+ puts "Hello #{args.join(' and ')} from #{program_name}"
35
+ end
36
+
37
+ end # class <%= cmd_class_name %>
38
+ <% if footer %>
39
+ if __FILE__ == $0
40
+ <%= cmd_class_name %>.run(ARGV)
41
+ end
42
+ <% end %>
metadata CHANGED
@@ -1,95 +1,132 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: quickl
3
- version: !ruby/object:Gem::Version
4
- version: 0.2.1
3
+ version: !ruby/object:Gem::Version
4
+ hash: 19
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 2
10
+ version: 0.2.2
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Bernard Lambeau
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2011-06-19 00:00:00.000000000 +02:00
13
- default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: rake
17
- requirement: &83708950 !ruby/object:Gem::Requirement
17
+
18
+ date: 2011-07-12 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ version_requirements: &id001 !ruby/object:Gem::Requirement
18
22
  none: false
19
- requirements:
23
+ requirements:
20
24
  - - ~>
21
- - !ruby/object:Gem::Version
22
- version: 0.8.7
25
+ - !ruby/object:Gem::Version
26
+ hash: 63
27
+ segments:
28
+ - 0
29
+ - 9
30
+ - 2
31
+ version: 0.9.2
23
32
  type: :development
33
+ requirement: *id001
24
34
  prerelease: false
25
- version_requirements: *83708950
26
- - !ruby/object:Gem::Dependency
27
- name: bundler
28
- requirement: &83708460 !ruby/object:Gem::Requirement
35
+ name: rake
36
+ - !ruby/object:Gem::Dependency
37
+ version_requirements: &id002 !ruby/object:Gem::Requirement
29
38
  none: false
30
- requirements:
39
+ requirements:
31
40
  - - ~>
32
- - !ruby/object:Gem::Version
33
- version: '1.0'
41
+ - !ruby/object:Gem::Version
42
+ hash: 15
43
+ segments:
44
+ - 1
45
+ - 0
46
+ version: "1.0"
34
47
  type: :development
48
+ requirement: *id002
35
49
  prerelease: false
36
- version_requirements: *83708460
37
- - !ruby/object:Gem::Dependency
38
- name: rspec
39
- requirement: &83707960 !ruby/object:Gem::Requirement
50
+ name: bundler
51
+ - !ruby/object:Gem::Dependency
52
+ version_requirements: &id003 !ruby/object:Gem::Requirement
40
53
  none: false
41
- requirements:
54
+ requirements:
42
55
  - - ~>
43
- - !ruby/object:Gem::Version
56
+ - !ruby/object:Gem::Version
57
+ hash: 31
58
+ segments:
59
+ - 2
60
+ - 4
61
+ - 0
44
62
  version: 2.4.0
45
63
  type: :development
64
+ requirement: *id003
46
65
  prerelease: false
47
- version_requirements: *83707960
48
- - !ruby/object:Gem::Dependency
49
- name: yard
50
- requirement: &83707400 !ruby/object:Gem::Requirement
66
+ name: rspec
67
+ - !ruby/object:Gem::Dependency
68
+ version_requirements: &id004 !ruby/object:Gem::Requirement
51
69
  none: false
52
- requirements:
70
+ requirements:
53
71
  - - ~>
54
- - !ruby/object:Gem::Version
72
+ - !ruby/object:Gem::Version
73
+ hash: 15
74
+ segments:
75
+ - 0
76
+ - 6
77
+ - 4
55
78
  version: 0.6.4
56
79
  type: :development
80
+ requirement: *id004
57
81
  prerelease: false
58
- version_requirements: *83707400
59
- - !ruby/object:Gem::Dependency
60
- name: bluecloth
61
- requirement: &83706930 !ruby/object:Gem::Requirement
82
+ name: yard
83
+ - !ruby/object:Gem::Dependency
84
+ version_requirements: &id005 !ruby/object:Gem::Requirement
62
85
  none: false
63
- requirements:
86
+ requirements:
64
87
  - - ~>
65
- - !ruby/object:Gem::Version
88
+ - !ruby/object:Gem::Version
89
+ hash: 29
90
+ segments:
91
+ - 2
92
+ - 0
93
+ - 9
66
94
  version: 2.0.9
67
95
  type: :development
96
+ requirement: *id005
68
97
  prerelease: false
69
- version_requirements: *83706930
70
- - !ruby/object:Gem::Dependency
71
- name: wlang
72
- requirement: &83706160 !ruby/object:Gem::Requirement
98
+ name: bluecloth
99
+ - !ruby/object:Gem::Dependency
100
+ version_requirements: &id006 !ruby/object:Gem::Requirement
73
101
  none: false
74
- requirements:
102
+ requirements:
75
103
  - - ~>
76
- - !ruby/object:Gem::Version
104
+ - !ruby/object:Gem::Version
105
+ hash: 53
106
+ segments:
107
+ - 0
108
+ - 10
109
+ - 1
77
110
  version: 0.10.1
78
111
  type: :development
112
+ requirement: *id006
79
113
  prerelease: false
80
- version_requirements: *83706160
81
- description: ! "Quickl helps you creating commandline ruby programs. From simple commands
82
- \nwith options to complex delegators with subcommands, global and local \noptions."
83
- email:
114
+ name: wlang
115
+ description: |-
116
+ Quickl helps you creating commandline ruby programs. From simple commands
117
+ with options to complex delegators with subcommands, global and local
118
+ options.
119
+ email:
84
120
  - blambeau@gmail.com
85
- executables:
121
+ executables:
86
122
  - quickl
87
123
  extensions: []
88
- extra_rdoc_files:
124
+
125
+ extra_rdoc_files:
89
126
  - README.md
90
127
  - CHANGELOG.md
91
128
  - LICENCE.md
92
- files:
129
+ files:
93
130
  - quickl.gemspec
94
131
  - quickl.noespec
95
132
  - CHANGELOG.md
@@ -109,6 +146,7 @@ files:
109
146
  - lib/quickl/ruby_tools.rb
110
147
  - lib/quickl/command.rb
111
148
  - lib/quickl/version.rb
149
+ - templates/single.erb
112
150
  - LICENCE.md
113
151
  - Manifest.txt
114
152
  - Rakefile
@@ -137,42 +175,45 @@ files:
137
175
  - spec/naming/command2module_spec.rb
138
176
  - tasks/debug_mail.rake
139
177
  - tasks/yard.rake
178
+ - tasks/clean.rake
140
179
  - tasks/gem.rake
141
180
  - tasks/spec_test.rake
142
181
  - tasks/unit_test.rake
143
182
  - tasks/debug_mail.txt
144
- has_rdoc: true
145
183
  homepage: http://github.com/blambeau/quickl
146
184
  licenses: []
185
+
147
186
  post_install_message:
148
187
  rdoc_options: []
149
- require_paths:
188
+
189
+ require_paths:
150
190
  - lib
151
- required_ruby_version: !ruby/object:Gem::Requirement
191
+ required_ruby_version: !ruby/object:Gem::Requirement
152
192
  none: false
153
- requirements:
154
- - - ! '>='
155
- - !ruby/object:Gem::Version
156
- version: '0'
157
- segments:
193
+ requirements:
194
+ - - ">="
195
+ - !ruby/object:Gem::Version
196
+ hash: 3
197
+ segments:
158
198
  - 0
159
- hash: 178817935
160
- required_rubygems_version: !ruby/object:Gem::Requirement
199
+ version: "0"
200
+ required_rubygems_version: !ruby/object:Gem::Requirement
161
201
  none: false
162
- requirements:
163
- - - ! '>='
164
- - !ruby/object:Gem::Version
165
- version: '0'
166
- segments:
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ hash: 3
206
+ segments:
167
207
  - 0
168
- hash: 178817935
208
+ version: "0"
169
209
  requirements: []
210
+
170
211
  rubyforge_project:
171
- rubygems_version: 1.6.2
212
+ rubygems_version: 1.8.5
172
213
  signing_key:
173
214
  specification_version: 3
174
215
  summary: Helper to create commandline ruby programs
175
- test_files:
216
+ test_files:
176
217
  - spec/spec_helper.rb
177
218
  - spec/command/usage_spec.rb
178
219
  - spec/command/command_name_spec.rb