hen 0.4.9 → 0.5.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f082dccc6c68ce2ac6dd82122bc73252f3e56aa
4
- data.tar.gz: 577ca2a99cb316c4a654444d819dc330f652a537
3
+ metadata.gz: 7cca013795ab8838dedb03aab88a80addc25210e
4
+ data.tar.gz: e5394e737b54e49e6066ae511c830d94f2486c68
5
5
  SHA512:
6
- metadata.gz: 12c0385cfc7705247ba458c4cb6b8b3988cf73594167301fd35a529df83f4001826752e8436b889d2b9cebe628ec12809c56657109d2f250767250971c7305cb
7
- data.tar.gz: ef0cccbbcaa0bddfc5b15f8d53a52130807003c36882c30e14b23b44f2dfe0b27a9bbfb0ed1db4e373824039dfc4d580b11a098e8920d7f4544d828ad35fae4d
6
+ metadata.gz: da08775b2518dfa345cf05f854ea928a03dd972d32e094c22da59ffdbf9e5b91d29b9f375ddb4a08409b261e9b0fa4088669b83c922d35f00ae6641a46a0b618
7
+ data.tar.gz: 89321c2b52aa71714342fd731c64ce9b2da52063bcc215f9679bdce87433a11a6fefaa2d7134cdad7558ba605c3d6779e461a8398f03adad36b4b5d5a28560a9
data/ChangeLog CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  = Revision history for hen
4
4
 
5
+ == 0.5.0 [2013-12-19]
6
+
7
+ * Added support for substitution directives in RDoc titles.
8
+ * General cleanup and refactoring.
9
+
5
10
  == 0.4.9 [2013-10-25]
6
11
 
7
12
  * Added post install message to gem spec.
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ Hen.lay! {{
10
10
  "helper that fits my own personal style.",
11
11
  :author => %q{Jens Wille},
12
12
  :email => %q{jens.wille@gmail.com},
13
- :license => %q{AGPL},
13
+ :license => %q{AGPL-3.0},
14
14
  :homepage => :blackwinter,
15
15
  :extra_files => FileList['lib/hens/*.rake'].to_a,
16
16
  :dependencies => [['ruby-nuggets', '>= 0.8.4'], 'highline']
@@ -10,7 +10,7 @@ begin
10
10
  :summary => %q{<%= progdesc %>},
11
11
  :author => %q{<%= fullname %>},
12
12
  :email => %q{<%= emailaddress %>},
13
- :license => %q{AGPL},
13
+ :license => %q{AGPL-3.0},
14
14
  :dependencies => %w[]
15
15
  }
16
16
  }}
data/lib/hen.rb CHANGED
@@ -87,13 +87,13 @@ class Hen
87
87
  # Extract potential options hash
88
88
  options = args.last.is_a?(Hash) ? args.pop : {}
89
89
 
90
- @verbose = options[:verbose] if options.has_key?(:verbose)
90
+ @verbose = options[:verbose] if options.key?(:verbose)
91
91
 
92
92
  yield.each { |key, value| config[key].update(value) } if block_given?
93
93
 
94
94
  # Handle include/exclude requirements
95
95
  excl = options[:exclude]
96
- args, default = args.empty? ? [excl ? [*excl] : [], true] : [args, false]
96
+ args, default = args.empty? ? [Array(excl), true] : [args, false]
97
97
 
98
98
  inclexcl = Hash.new(default)
99
99
  args.each { |arg| inclexcl[arg.to_s] = !default }
@@ -242,13 +242,13 @@ class Hen
242
242
  def initialize(args, overwrite = false, &block)
243
243
  @name, @dependencies = resolve_args(args)
244
244
 
245
+ @laid = false
246
+
245
247
  unless @block = block
246
248
  raise LocalJumpError, "#{@name}: no block given" if verbose
247
249
  return
248
250
  end
249
251
 
250
- @laid = false
251
-
252
252
  self.class.add_hen(self, overwrite)
253
253
  end
254
254
 
@@ -259,6 +259,8 @@ class Hen
259
259
  def lay!
260
260
  return if laid?
261
261
 
262
+ @laid = true
263
+
262
264
  # Call dependencies first
263
265
  dependencies.each { |hen| self.class[hen].lay! }
264
266
 
@@ -306,10 +308,7 @@ class Hen
306
308
  #
307
309
  # Keeps track of whether the block has already been executed.
308
310
  def laid?
309
- return @laid if @laid
310
-
311
- @laid = true
312
- false
311
+ @laid
313
312
  end
314
313
 
315
314
  end
data/lib/hen/dsl.rb CHANGED
@@ -63,14 +63,14 @@ class Hen
63
63
 
64
64
  # Define task +t+, but overwrite any existing task of that name!
65
65
  # (Rake usually just adds them up.)
66
- def task!(t, *args)
66
+ def task!(t, *args, &block)
67
67
  Rake.application.instance_variable_get(:@tasks).delete(t.to_s)
68
- task(t, *args, &block_given? ? Proc.new : nil)
68
+ task(t, *args, &block)
69
69
  end
70
70
 
71
71
  # Return true if task +t+ is defined, false otherwise.
72
72
  def have_task?(t)
73
- Rake.application.instance_variable_get(:@tasks).has_key?(t.to_s)
73
+ Rake.application.instance_variable_get(:@tasks).key?(t.to_s)
74
74
  end
75
75
 
76
76
  # Find a command that is executable and run it. Intended for
@@ -102,10 +102,10 @@ class Hen
102
102
  managed_files = [:git, :svn].find { |scm|
103
103
  res = send(scm) { |scm_obj| scm_obj.managed_files }
104
104
  break res if res
105
- } if !options.has_key?(:managed) || options[:managed]
105
+ } if !options.key?(:managed) || options[:managed]
106
106
 
107
- args.each { |files|
108
- files ? files.uniq! : next
107
+ args.compact.each { |files|
108
+ files.uniq!
109
109
 
110
110
  if managed_files
111
111
  files.replace(files & managed_files)
@@ -147,14 +147,14 @@ class Hen
147
147
  # RubyForge project is defined. Yields the RubyForge configuration
148
148
  # hash and, optionally, a proc to obtain RubyForge objects from (via
149
149
  # +call+; reaching out to #init_rubyforge).
150
- def rubyforge
150
+ def rubyforge(&block)
151
151
  rf_config = config[:rubyforge]
152
152
  rf_project = rf_config[:project]
153
153
 
154
154
  if rf_project && !rf_project.empty? && have_rubyforge?
155
155
  rf_config[:package] ||= rf_project
156
156
 
157
- call_block(Proc.new, rf_config) { |*args|
157
+ call_block(block, rf_config) { |*args|
158
158
  init_rubyforge(args.empty? || args.first)
159
159
  }
160
160
  else
@@ -166,28 +166,28 @@ class Hen
166
166
  # RubyGem's 'push' command is not available. Yields an optional
167
167
  # proc to obtain RubyGems (pseudo-)objects from (via +call+;
168
168
  # reaching out to #init_rubygems).
169
- def rubygems
169
+ def rubygems(&block)
170
170
  if have_rubygems?
171
- call_block(Proc.new) { |*args| init_rubygems }
171
+ call_block(block) { |*args| init_rubygems }
172
172
  else
173
173
  skipping 'RubyGems'
174
174
  end
175
175
  end
176
176
 
177
177
  # DEPRECATED: Use #rubygems instead.
178
- def gemcutter
178
+ def gemcutter(&block)
179
179
  warn "#{self}#gemcutter is deprecated; use `rubygems' instead."
180
- rubygems(&block_given? ? Proc.new : nil)
180
+ rubygems(&block)
181
181
  end
182
182
 
183
183
  # Encapsulates tasks targeting at Git, skipping those if the current
184
- # project us not controlled by Git. Yields a Git object via #init_git.
184
+ # project is not controlled by Git. Yields a Git object via #init_git.
185
185
  def git
186
186
  have_git? ? yield(init_git) : skipping('Git')
187
187
  end
188
188
 
189
189
  # Encapsulates tasks targeting at SVN, skipping those if the current
190
- # project us not controlled by SVN. Yields an SVN object via #init_svn.
190
+ # project is not controlled by SVN. Yields an SVN object via #init_svn.
191
191
  def svn
192
192
  have_svn? ? yield(init_svn) : skipping('SVN')
193
193
  end
@@ -229,7 +229,7 @@ class Hen
229
229
 
230
230
  Gem::Commands::PushCommand
231
231
  rescue LoadError, NameError
232
- missing_lib 'gemcutter'
232
+ missing_lib 'rubygems (gemcutter)'
233
233
  end
234
234
 
235
235
  # Checks whether the current project is managed by Git.
@@ -256,6 +256,8 @@ class Hen
256
256
  # Prepare the use of RubyGems.org. Returns the RubyGems
257
257
  # (pseudo-)object.
258
258
  def init_rubygems
259
+ return unless have_rubygems?
260
+
259
261
  pseudo_object {
260
262
  def method_missing(cmd, *args) # :nodoc:
261
263
  run(cmd, *args)
@@ -264,15 +266,17 @@ class Hen
264
266
  def run(cmd, *args) # :nodoc:
265
267
  Gem::CommandManager.instance.run([cmd.to_s.tr('_', '-'), *args])
266
268
  end
267
- } if have_rubygems?
269
+ }
268
270
  end
269
271
 
270
272
  # Prepare the use of Git. Returns the Git (pseudo-)object.
271
273
  def init_git
274
+ return unless have_git?
275
+
272
276
  pseudo_object {
273
277
  def method_missing(cmd, *args) # :nodoc:
274
278
  options = args.last.is_a?(Hash) ? args.pop : {}
275
- options[:verbose] = Hen.verbose unless options.has_key?(:verbose)
279
+ options[:verbose] = Hen.verbose unless options.key?(:verbose)
276
280
 
277
281
  DSL.send(:sh, 'git', cmd.to_s.tr('_', '-'), *args << options)
278
282
  end
@@ -323,15 +327,17 @@ class Hen
323
327
  def managed_files # :nodoc:
324
328
  run(:ls_files).split($/)
325
329
  end
326
- } if have_git?
330
+ }
327
331
  end
328
332
 
329
333
  # Prepare the use of SVN. Returns the SVN (pseudo-)object.
330
334
  def init_svn
335
+ return unless have_svn?
336
+
331
337
  pseudo_object {
332
338
  def method_missing(cmd, *args) # :nodoc:
333
339
  options = args.last.is_a?(Hash) ? args.pop : {}
334
- options[:verbose] = Hen.verbose unless options.has_key?(:verbose)
340
+ options[:verbose] = Hen.verbose unless options.key?(:verbose)
335
341
 
336
342
  DSL.send(:sh, 'svn', cmd.to_s.tr('_', '-'), *args << options)
337
343
  end
@@ -347,16 +353,14 @@ class Hen
347
353
  def managed_files # :nodoc:
348
354
  run(:list, '--recursive').split($/)
349
355
  end
350
- } if have_svn?
356
+ }
351
357
  end
352
358
 
353
359
  # Extend +object+ with given +blocks+.
354
- def extend_object(object, *blocks)
355
- blocks << Proc.new if block_given?
356
-
360
+ def extend_object(object, *blocks, &block2)
357
361
  singleton_class = object.singleton_class
358
362
 
359
- blocks.compact.reverse_each { |block|
363
+ blocks.push(block2).compact.reverse_each { |block|
360
364
  singleton_class.class_eval(&block)
361
365
  }
362
366
 
@@ -364,8 +368,8 @@ class Hen
364
368
  end
365
369
 
366
370
  # Create a (pseudo-)object.
367
- def pseudo_object
368
- extend_object(Object.new, block_given? ? Proc.new : nil) {
371
+ def pseudo_object(&block)
372
+ extend_object(Object.new, block) {
369
373
  instance_methods.each { |method|
370
374
  undef_method(method) unless method =~ /\A__|\Aobject_id\z/
371
375
  }
@@ -374,8 +378,8 @@ class Hen
374
378
 
375
379
  # Calls block +block+ with +args+, appending an
376
380
  # optional passed block if requested by +block+.
377
- def call_block(block, *args)
378
- args << Proc.new if block.arity > args.size
381
+ def call_block(block, *args, &block2)
382
+ args << block2 if block.arity > args.size
379
383
  block[*args]
380
384
  end
381
385
 
data/lib/hen/version.rb CHANGED
@@ -3,8 +3,8 @@ class Hen
3
3
  module Version
4
4
 
5
5
  MAJOR = 0
6
- MINOR = 4
7
- TINY = 9
6
+ MINOR = 5
7
+ TINY = 0
8
8
 
9
9
  class << self
10
10
 
data/lib/hens/gem.rake CHANGED
@@ -248,11 +248,7 @@ Hen :gem => :rdoc do
248
248
  pkg.need_zip = true
249
249
 
250
250
  if defined?(ZIP_COMMANDS)
251
- pkg.zip_command = begin
252
- require 'nuggets/file/which'
253
- File.which_command(ZIP_COMMANDS)
254
- rescue LoadError
255
- end || ZIP_COMMANDS.first
251
+ pkg.zip_command = File.which_command(ZIP_COMMANDS) || ZIP_COMMANDS.first
256
252
  end
257
253
  }
258
254
 
@@ -296,7 +292,7 @@ Hen :gem => :rdoc do
296
292
  extension_options[:lib_dir] ||= File.join(['lib', ext_name, ENV['FAT_DIR']].compact)
297
293
  extension_options[:ext_dir] ||= File.join(['ext', ext_name])
298
294
 
299
- unless extension_options.has_key?(:cross_compile)
295
+ unless extension_options.key?(:cross_compile)
300
296
  extension_options[:cross_compile] = true
301
297
  end
302
298
 
data/lib/hens/rdoc.rake CHANGED
@@ -3,6 +3,7 @@ Hen :rdoc do
3
3
  rdoc_options = {
4
4
  :rdoc_dir => 'doc',
5
5
  :rdoc_files => %w[README COPYING ChangeLog lib/**/*.rb ext/**/*.c],
6
+ :title => '{name:%s }Application documentation{version: (v%s)}',
6
7
  :charset => 'UTF-8',
7
8
  :inline_source => true,
8
9
  :line_numbers => true,
@@ -21,19 +22,13 @@ Hen :rdoc do
21
22
  Rake::RDocTask
22
23
  end
23
24
 
24
- rdoc_options[:title] ||= begin
25
- title = 'Application documentation'
26
-
27
- if name = project_name(*config.values_at(:rubyforge, :gem))
28
- title.insert(0, "#{name} ")
29
- end
30
-
31
- if version = config[:gem][:version]
32
- title << " (v#{version})"
33
- end
25
+ info = {
26
+ 'name' => project_name(*config.values_at(:rubyforge, :gem)),
27
+ 'version' => config[:gem][:version],
28
+ 'date' => Date.today.to_s
29
+ }
34
30
 
35
- title
36
- end
31
+ rdoc_options[:title].gsub!(/\{(\w+):(.*?)\}/) { i = info[$1] and $2 % i }
37
32
 
38
33
  ### rdoc_dir
39
34
 
@@ -95,7 +90,7 @@ Hen :rdoc do
95
90
  }
96
91
  end
97
92
 
98
- publish_desc = "Publish RDoc documentation"
93
+ publish_desc = 'Publish RDoc documentation'
99
94
 
100
95
  git do |git|
101
96
 
data/lib/hens/spec.rake CHANGED
@@ -46,7 +46,7 @@ Hen :spec do
46
46
  spec_opts = map_options(spec_options)
47
47
 
48
48
  if opts_file && File.readable?(opts_file)
49
- File.readlines(opts_file).each { |l| spec_opts << l.chomp }
49
+ File.readlines(opts_file).each { |line| spec_opts << line.chomp }
50
50
  end
51
51
 
52
52
  spec_block = lambda { |t|
@@ -69,12 +69,12 @@ Hen :spec do
69
69
  end
70
70
 
71
71
  #desc "Run specs with RCov"
72
- spec_klass.new('spec:rcov') do |t|
72
+ spec_klass.new('spec:rcov') { |t|
73
73
  spec_block[t]
74
74
 
75
75
  t.rcov = true
76
76
  t.rcov_opts = rcov_opts
77
- end
77
+ }
78
78
  end
79
79
 
80
80
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.9
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Wille
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-25 00:00:00.000000000 Z
11
+ date: 2013-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-nuggets
@@ -74,22 +74,22 @@ files:
74
74
  - example/project/lib/__progname__/version.rb
75
75
  homepage: http://github.com/blackwinter/hen
76
76
  licenses:
77
- - AGPL
77
+ - AGPL-3.0
78
78
  metadata: {}
79
79
  post_install_message: |2+
80
80
 
81
- hen-0.4.9 [2013-10-25]:
81
+ hen-0.5.0 [2013-12-19]:
82
82
 
83
- * Added post install message to gem spec.
84
- * Refactored +hen+ executable into Hen::Command module.
83
+ * Added support for substitution directives in RDoc titles.
84
+ * General cleanup and refactoring.
85
85
 
86
86
  rdoc_options:
87
+ - "--title"
88
+ - hen Application documentation (v0.5.0)
87
89
  - "--charset"
88
90
  - UTF-8
89
91
  - "--line-numbers"
90
92
  - "--all"
91
- - "--title"
92
- - hen Application documentation (v0.4.9)
93
93
  - "--main"
94
94
  - README
95
95
  require_paths:
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  requirements: []
108
108
  rubyforge_project:
109
- rubygems_version: 2.1.10
109
+ rubygems_version: 2.1.11
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: Hoe or Echoe? No, thanks! Just a Rake helper that fits my own personal style.