hen 0.0.6.195 → 0.0.7.196

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 (6) hide show
  1. data/ChangeLog +7 -0
  2. data/README +1 -1
  3. data/bin/hen +1 -1
  4. data/lib/hen.rb +23 -23
  5. data/lib/hen/version.rb +1 -1
  6. metadata +6 -5
data/ChangeLog CHANGED
@@ -1,5 +1,12 @@
1
1
  = Revision history for hen
2
2
 
3
+ == 0.0.7 [2008-02-01]
4
+
5
+ * Search HENPATH for available hens, allowing to easily add custom hens
6
+ * Added sample custom hen file ('example/hens/sample.rake')
7
+ * Refined 'gem' and 'rdoc' hens
8
+ * Added 'hen version' command
9
+
3
10
  == 0.0.6 [2008-01-09]
4
11
 
5
12
  * Added basic sample project tree (skeleton for 'hen create')
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to hen version 0.0.6
5
+ This documentation refers to hen version 0.0.7
6
6
 
7
7
 
8
8
  == DESCRIPTION
data/bin/hen CHANGED
@@ -78,7 +78,7 @@ case action = ARGV.shift
78
78
  when 'version', '--version'
79
79
  puts "hen v#{Hen::VERSION}"
80
80
  when 'config'
81
- render(File.join(EXAMPLE, '.henrc'), henrc = Hen.henrc(false))
81
+ render(File.join(EXAMPLE, '.henrc'), henrc = Hen.henrc(true))
82
82
 
83
83
  puts
84
84
  puts "Your .henrc has been created: #{henrc}. Now modify it to your needs."
data/lib/hen.rb CHANGED
@@ -38,9 +38,16 @@ require 'hen/version'
38
38
 
39
39
  class Hen
40
40
 
41
- # The directory (directories?) with the hen files
42
- # TODO: Replace/extend with HENPATH
43
- HENS = File.join(File.dirname(__FILE__), 'hens')
41
+ # The directories which contain the hen files
42
+ HENDIRS = [File.join(File.dirname(__FILE__), 'hens')] +
43
+ (ENV['HENPATH'] || '').split(File::PATH_SEPARATOR)
44
+
45
+ # All hens found, mapped by their name
46
+ HENS = Dir[*HENDIRS.map { |d| "#{d}/*.rake" }].uniq.inject(
47
+ Hash.new { |h, k| h[k] = [] }
48
+ ) { |hash, hen|
49
+ hash[File.basename(hen, '.rake')] << hen; hash
50
+ }
44
51
 
45
52
  # Directories to search for .henrc
46
53
  RCDIRS = ['.', ENV['HOME'], File.expand_path('~')]
@@ -130,8 +137,8 @@ class Hen
130
137
  # henrc => aString
131
138
  #
132
139
  # The path to the user's .henrc
133
- def henrc(must_exist = true)
134
- @henrc ||= find_henrc(must_exist)
140
+ def henrc(location_only = false)
141
+ @henrc ||= find_henrc(location_only)
135
142
  end
136
143
 
137
144
  # call-seq:
@@ -157,18 +164,18 @@ class Hen
157
164
  private
158
165
 
159
166
  # call-seq:
160
- # find_henrc(must_exist = true) => aString
167
+ # find_henrc(location_only = false) => aString
161
168
  #
162
- # Search for a readable .henrc, or, if +must_exist+ is false, just return a
163
- # suitable default location.
164
- def find_henrc(must_exist = true)
165
- return ENV['HENRC'] || File.join(RCDIRS.last, '.henrc') unless must_exist
169
+ # Search for a readable .henrc, or, if +location_only+ is true, just return
170
+ # a suitable default location.
171
+ def find_henrc(location_only = false)
172
+ return ENV['HENRC'] || File.join(RCDIRS.last, '.henrc') if location_only
166
173
 
167
174
  if henrc = ENV['HENRC']
168
175
  abort "The specified .henrc file could not be found: #{henrc}" \
169
176
  unless File.readable?(henrc)
170
- elsif henrc = RCDIRS.find { |p|
171
- h = File.join(p, '.henrc')
177
+ elsif henrc = RCDIRS.find { |dir|
178
+ h = File.join(dir, '.henrc')
172
179
  break h if File.readable?(h)
173
180
  }
174
181
  else
@@ -190,18 +197,11 @@ class Hen
190
197
  # By default, include all
191
198
  block ||= lambda { true }
192
199
 
193
- # No hens given means get 'em all
194
- if hens.empty?
195
- # TODO: Search HENPATH for available hens
196
- hens = Dir[File.join(HENS, '*.rake')].map { |hen|
197
- File.basename(hen, '.rake') # This is kind of awkward, but
198
- # simplifies condition checking
199
- }
200
- end
200
+ (hens.empty? ? HENS.keys : hens).each { |hen|
201
+ hen = hen.to_s
202
+ next unless block[hen]
201
203
 
202
- hens.each { |hen|
203
- # TODO: Search HENPATH for hen
204
- load File.join(HENS, "#{hen}.rake") if block[hen.to_s]
204
+ HENS[hen].each { |h| load h }
205
205
  }
206
206
  end
207
207
 
data/lib/hen/version.rb CHANGED
@@ -32,7 +32,7 @@ class Hen
32
32
 
33
33
  MAJOR = 0
34
34
  MINOR = 0
35
- TINY = 6
35
+ TINY = 7
36
36
 
37
37
  class << self
38
38
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6.195
4
+ version: 0.0.7.196
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Wille
@@ -54,21 +54,22 @@ files:
54
54
  - lib/hens/gem.rake
55
55
  - lib/hens/test.rake
56
56
  - lib/hens/rdoc.rake
57
+ - example/hens
57
58
  - example/project
58
59
  - example/.henrc
59
60
  has_rdoc: true
60
61
  homepage: http://prometheus.rubyforge.org/hen
61
62
  post_install_message:
62
63
  rdoc_options:
63
- - --line-numbers
64
- - --all
64
+ - --title
65
+ - hen Application documentation
65
66
  - --main
66
67
  - README
68
+ - --line-numbers
69
+ - --all
67
70
  - --inline-source
68
71
  - --charset
69
72
  - UTF-8
70
- - --title
71
- - hen Application documentation
72
73
  require_paths:
73
74
  - lib
74
75
  required_ruby_version: !ruby/object:Gem::Requirement