hen 0.0.4.153 → 0.0.4.163

Sign up to get free protection for your applications and to get access to all the features.
data/bin/hen CHANGED
@@ -35,4 +35,5 @@ Will most probably provide the following functionality:
35
35
 
36
36
  - config: Create a fresh .henrc file
37
37
  - create: Create a new project directory tree
38
+ - list: List available hens with their tasks
38
39
  EOT
data/lib/hen.rb CHANGED
@@ -28,6 +28,7 @@
28
28
 
29
29
  require 'rake'
30
30
  require 'yaml'
31
+ require 'forwardable'
31
32
 
32
33
  require 'rubygems'
33
34
  require 'nuggets/proc/bind'
@@ -54,8 +55,9 @@ class Hen
54
55
  RCDIRS.find { |path|
55
56
  henrc = File.join(path, '.henrc')
56
57
  break henrc if File.readable?(henrc)
57
- } or abort "No .henrc file could be found! " <<
58
- "Please create one first ('hen config')."
58
+ } or abort %q{
59
+ No .henrc file could be found! Please create one first with 'hen config'.
60
+ }
59
61
  end
60
62
 
61
63
  # The path to the user's .henrc
@@ -169,6 +171,11 @@ class Hen
169
171
 
170
172
  end
171
173
 
174
+ extend Forwardable
175
+
176
+ # Forward to the class
177
+ def_delegators self, :verbose
178
+
172
179
  attr_reader :name, :dependencies, :block
173
180
 
174
181
  # call-seq:
@@ -207,14 +214,6 @@ class Hen
207
214
  warn "#{name}: #{err} (#{err.class})" if verbose
208
215
  end
209
216
 
210
- # call-seq:
211
- # hen.verbose
212
- #
213
- # Just an accessor to the class attribute.
214
- def verbose
215
- self.class.verbose
216
- end
217
-
218
217
  private
219
218
 
220
219
  # call-seq:
@@ -228,7 +227,7 @@ class Hen
228
227
  when Hash
229
228
  raise ArgumentError, "Too many hen names: #{args.keys.join(' ')}" \
230
229
  if args.size > 1
231
- raise ArgumentError, "No hen name given" \
230
+ raise ArgumentError, 'No hen name given' \
232
231
  if args.size < 1
233
232
 
234
233
  [args.keys.first, [*args.values.first]]
data/lib/hen/dsl.rb CHANGED
@@ -81,6 +81,27 @@ class Hen
81
81
  rf
82
82
  end
83
83
 
84
+ # Encapsulates tasks targeting at Rubyforge, skipping those if no
85
+ # Rubyforge project is defined. Yields the Rubyforge configuration
86
+ # hash and, optionally, a proc to obtain RubyForge objects from (via
87
+ # +call+; reaching out to init_rubyforge).
88
+ def rubyforge(&block)
89
+ rf_config = config[:rubyforge]
90
+
91
+ raise 'Skipping Rubyforge tasks' unless rf_config[:project]
92
+ raise LocalJumpError, 'no block given' unless block
93
+
94
+ require 'rubyforge'
95
+
96
+ block_args = [rf_config]
97
+
98
+ block_args << lambda { |*args|
99
+ init_rubyforge(args.empty? || args.first)
100
+ } if block.arity > 1
101
+
102
+ block[*block_args]
103
+ end
104
+
84
105
  end
85
106
 
86
107
  end
data/lib/hens/gem.rake CHANGED
@@ -3,7 +3,6 @@ Hen :gem => :rdoc do
3
3
  require 'rake/gempackagetask'
4
4
 
5
5
  gem_options = config[:gem]
6
- rubyforge = config[:rubyforge]
7
6
 
8
7
  if Object.const_defined?(:RDOC_OPTIONS)
9
8
  gem_options[:rdoc_options] ||= RDOC_OPTIONS[:options]
@@ -14,15 +13,15 @@ Hen :gem => :rdoc do
14
13
 
15
14
  ### name
16
15
 
17
- gem_options[:name] ||= rubyforge[:package]
16
+ gem_options[:name] ||= config[:rubyforge][:package]
18
17
 
19
- abort "Gem name missing" unless gem_options[:name]
18
+ abort 'Gem name missing' unless gem_options[:name]
20
19
 
21
20
  ### version
22
21
 
23
22
  abort 'Gem version missing' unless gem_options[:version]
24
23
 
25
- if gem_options.delete(:append_svnversion) && svnversion = `svnversion`.chomp[/\d+/]
24
+ if gem_options.delete(:append_svnversion) && svnversion = `svnversion`[/\d+/]
26
25
  gem_options[:version] << '.' << svnversion
27
26
  end
28
27
 
@@ -32,7 +31,7 @@ Hen :gem => :rdoc do
32
31
 
33
32
  ### rubyforge project, homepage
34
33
 
35
- gem_options[:rubyforge_project] ||= rubyforge[:project]
34
+ gem_options[:rubyforge_project] ||= config[:rubyforge][:project]
36
35
 
37
36
  if rf_project = gem_options[:rubyforge_project]
38
37
  gem_options[:homepage] ||= "#{rf_project}.rubyforge.org/#{gem_options[:name]}"
@@ -49,9 +48,11 @@ Hen :gem => :rdoc do
49
48
  gem_options[:files] += gem_options.delete(:extra_files) || []
50
49
 
51
50
  gem_options[:executables] ||= gem_options[:files].grep(/\Abin\//)
52
- gem_options[:bindir] ||= File.dirname(gem_options[:executables].first)
53
51
 
54
- gem_options[:executables].map! { |executable| File.basename(executable) }
52
+ unless gem_options[:executables].empty?
53
+ gem_options[:bindir] ||= File.dirname(gem_options[:executables].first)
54
+ gem_options[:executables].map! { |executable| File.basename(executable) }
55
+ end
55
56
 
56
57
  ### dependencies
57
58
 
@@ -66,7 +67,7 @@ Hen :gem => :rdoc do
66
67
  }
67
68
  }
68
69
 
69
- desc "Display the gem specification"
70
+ desc 'Display the gem specification'
70
71
  task :debug_gem do
71
72
  puts gem_spec.to_ruby
72
73
  end
@@ -76,17 +77,27 @@ Hen :gem => :rdoc do
76
77
  pkg.need_zip = true
77
78
  end
78
79
 
79
- desc "Package and upload the release to Rubyforge"
80
- task :release => [:package, :publish_docs] do
81
- rf = init_rubyforge
80
+ rubyforge do |rf_config, rf_pool|
81
+
82
+ desc 'Package and upload the release to Rubyforge'
83
+ task :release => [:package, :publish_docs] do
84
+ rf = rf_pool.call
85
+
86
+ files = Dir[File.join('pkg', "#{pkg_task.package_name}.*")]
87
+ abort 'Nothing to release!' if files.empty?
82
88
 
83
- files = Dir[File.join('pkg', "#{pkg_task.package_name}.*")]
84
- abort "Nothing to release!" if files.empty?
89
+ # shorten to (at most) three digits
90
+ version = pkg_task.version.to_s.split(/([.])/)[0..4].join
85
91
 
86
- # shorten to (at most) three digits
87
- version = pkg_task.version.to_s.split(/([.])/)[0..4].join
92
+ # TODO: Add release notes and changes.
93
+ #uc = rf.userconfig
94
+ #uc['release_notes'] = description if description
95
+ #uc['release_changes'] = changes if changes
96
+ #uc['preformatted'] = true
97
+
98
+ rf.add_release rf_config[:project], pkg_task.name, version, *files
99
+ end
88
100
 
89
- rf.add_release rubyforge[:project], pkg_task.name, version, *files
90
101
  end
91
102
 
92
103
  end
data/lib/hens/rdoc.rake CHANGED
@@ -2,9 +2,8 @@ Hen :rdoc do
2
2
  require 'rake/rdoctask'
3
3
 
4
4
  rdoc_options = config[:rdoc]
5
- rubyforge = config[:rubyforge]
6
5
 
7
- if rf_package = rubyforge[:package]
6
+ if rf_package = config[:rubyforge][:package]
8
7
  rdoc_options[:title] ||= "#{rf_package} Application documentation"
9
8
  end
10
9
 
@@ -23,31 +22,35 @@ Hen :rdoc do
23
22
  rdoc.options = RDOC_OPTIONS[:options]
24
23
  }
25
24
 
26
- desc "Publish RDoc to Rubyforge"
27
- task :publish_docs => :doc do
28
- rf_project = rubyforge[:project]
29
- abort "Rubyforge project name missing" unless rf_project
25
+ rubyforge do |rf_config|
30
26
 
31
- rf_user = rubyforge[:username]
32
- abort "Rubyforge user name missing" unless rf_user
27
+ desc 'Publish RDoc to Rubyforge'
28
+ task :publish_docs => :doc do
29
+ rf_project = rf_config[:project]
30
+ abort 'Rubyforge project name missing' unless rf_project
33
31
 
34
- user__host = "#{rf_user}@rubyforge.org"
32
+ rf_user = rf_config[:username]
33
+ abort 'Rubyforge user name missing' unless rf_user
35
34
 
36
- local_dir = rdoc_task.rdoc_dir + '/'
37
- remote_dir = "/var/www/gforge-projects/#{rf_project}/"
35
+ user__host = "#{rf_user}@rubyforge.org"
38
36
 
39
- if rdoc_dir = rubyforge[:rdoc_dir]
40
- if rf_package = rubyforge[:package]
41
- rdoc_dir = rf_package if rdoc_dir == :package
37
+ local_dir = rdoc_task.rdoc_dir + '/'
38
+ remote_dir = "/var/www/gforge-projects/#{rf_project}/"
39
+
40
+ if rdoc_dir = rf_config[:rdoc_dir]
41
+ if rf_package = rf_config[:package]
42
+ rdoc_dir = rf_package if rdoc_dir == :package
43
+ end
44
+
45
+ remote_dir += rdoc_dir + '/'
42
46
  end
43
47
 
44
- remote_dir += rdoc_dir + '/'
48
+ execute(
49
+ "rsync -av --delete #{local_dir} #{user__host}:#{remote_dir}",
50
+ "scp -r #{local_dir} #{user__host}:#{remote_dir}"
51
+ )
45
52
  end
46
53
 
47
- execute(
48
- "rsync -av --delete #{local_dir} #{user__host}:#{remote_dir}",
49
- "scp -r #{local_dir} #{user__host}:#{remote_dir}"
50
- )
51
54
  end
52
55
 
53
56
  end
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.4.153
4
+ version: 0.0.4.163
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Wille
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-01-07 00:00:00 +01:00
12
+ date: 2008-01-08 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -59,15 +59,15 @@ has_rdoc: true
59
59
  homepage: http://prometheus.rubyforge.org/hen
60
60
  post_install_message:
61
61
  rdoc_options:
62
- - --charset
63
- - UTF-8
64
62
  - --title
65
63
  - hen Application documentation
66
- - --main
67
- - README
68
- - --line-numbers
69
64
  - --all
65
+ - --line-numbers
70
66
  - --inline-source
67
+ - --main
68
+ - README
69
+ - --charset
70
+ - UTF-8
71
71
  require_paths:
72
72
  - lib
73
73
  required_ruby_version: !ruby/object:Gem::Requirement