hen 0.0.4.163 → 0.0.5.164
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.
- data/ChangeLog +5 -0
- data/README +1 -1
- data/bin/hen +61 -9
- data/example/.henrc +3 -4
- data/example/Rakefile +10 -8
- data/lib/hen.rb +1 -1
- data/lib/hen/cli.rb +53 -0
- data/lib/hen/dsl.rb +3 -2
- data/lib/hen/version.rb +1 -1
- metadata +3 -2
data/ChangeLog
CHANGED
data/README
CHANGED
data/bin/hen
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
# #
|
|
6
6
|
# hen -- Just a Rake helper #
|
|
7
7
|
# #
|
|
8
|
-
# Copyright (C) 2007 University of Cologne,
|
|
9
|
-
#
|
|
10
|
-
#
|
|
8
|
+
# Copyright (C) 2007-2008 University of Cologne, #
|
|
9
|
+
# Albertus-Magnus-Platz, #
|
|
10
|
+
# 50932 Cologne, Germany #
|
|
11
11
|
# #
|
|
12
12
|
# Authors: #
|
|
13
13
|
# Jens Wille <jens.wille@uni-koeln.de> #
|
|
@@ -28,12 +28,64 @@
|
|
|
28
28
|
###############################################################################
|
|
29
29
|
#++
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
Coming...
|
|
31
|
+
# TODO: Add 'list' - List available hens with their tasks (?)
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
$: << File.join(File.dirname(__FILE__), '..', 'lib')
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
require 'hen'
|
|
36
|
+
require 'hen/cli'
|
|
37
|
+
|
|
38
|
+
include Hen::CLI
|
|
39
|
+
|
|
40
|
+
ACTIONS = {
|
|
41
|
+
'config' => 'Create a fresh .henrc file',
|
|
42
|
+
'create' => 'Create a new project directory tree',
|
|
43
|
+
'list' => 'List available hens with their tasks'
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
USAGE = <<EOT
|
|
47
|
+
Usage: #{$0} {#{ACTIONS.keys.sort.join('|')}}
|
|
48
|
+
#{$0} [-h|--help]
|
|
39
49
|
EOT
|
|
50
|
+
|
|
51
|
+
abort USAGE if ARGV.empty?
|
|
52
|
+
|
|
53
|
+
case action = ARGV.shift
|
|
54
|
+
when '-h', '--help'
|
|
55
|
+
puts USAGE
|
|
56
|
+
puts
|
|
57
|
+
puts 'Actions:'
|
|
58
|
+
|
|
59
|
+
m = ACTIONS.keys.map { |a| a.length }.max
|
|
60
|
+
|
|
61
|
+
ACTIONS.sort.each { |a, d|
|
|
62
|
+
puts " %-#{m}s - %s" % [a, d]
|
|
63
|
+
}
|
|
64
|
+
when 'config'
|
|
65
|
+
henrc = File.join(File.dirname(__FILE__), '..', 'example', '.henrc')
|
|
66
|
+
|
|
67
|
+
# TODO: DRY up with lib/hen.rb
|
|
68
|
+
target = File.join(ENV['HOME'] || File.expand_path('~'), '.henrc')
|
|
69
|
+
|
|
70
|
+
render(henrc, target)
|
|
71
|
+
|
|
72
|
+
puts "Your .henrc has been created: #{target}. Modify to your needs."
|
|
73
|
+
when 'create'
|
|
74
|
+
path = ARGV.shift
|
|
75
|
+
abort 'Path argument missing!' unless path
|
|
76
|
+
|
|
77
|
+
abort "Target directory already exists: #{path}. Won't touch." if File.directory?(path)
|
|
78
|
+
|
|
79
|
+
rakefile = File.join(File.dirname(__FILE__), '..', 'example', 'Rakefile')
|
|
80
|
+
target = File.join(path, 'Rakefile')
|
|
81
|
+
|
|
82
|
+
# 1. create directory
|
|
83
|
+
Dir.mkdir(path)
|
|
84
|
+
|
|
85
|
+
# 2. copy Rakefile
|
|
86
|
+
render(rakefile, target)
|
|
87
|
+
when 'list'
|
|
88
|
+
abort 'Sorry, not yet available...'
|
|
89
|
+
else
|
|
90
|
+
abort "Illegal action: #{action}\n#{USAGE}"
|
|
91
|
+
end
|
data/example/.henrc
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
|
|
3
3
|
:rubyforge:
|
|
4
|
-
:username:
|
|
5
|
-
:project: your_project
|
|
4
|
+
:username: <%= ask 'Rubyforge user name (Leave empty for none)' %>
|
|
6
5
|
:rdoc_dir: :package
|
|
7
6
|
|
|
8
7
|
:rdoc:
|
|
@@ -15,8 +14,8 @@
|
|
|
15
14
|
:charset: UTF-8
|
|
16
15
|
|
|
17
16
|
:gem:
|
|
18
|
-
:author:
|
|
19
|
-
:email:
|
|
17
|
+
:author: <%= ask 'Full name' %>
|
|
18
|
+
:email: <%= ask 'E-mail address' %>
|
|
20
19
|
:has_rdoc: true
|
|
21
20
|
:append_svnversion: true
|
|
22
21
|
:require_path: lib
|
data/example/Rakefile
CHANGED
|
@@ -4,19 +4,21 @@ rescue LoadError
|
|
|
4
4
|
abort "Please install the 'hen' gem first."
|
|
5
5
|
end
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
PROGNAME = %q{<%= ask 'Program name' %>}
|
|
8
|
+
|
|
9
|
+
require File.join('lib', PROGNAME, 'version')
|
|
8
10
|
|
|
9
11
|
Hen.lay! {{
|
|
10
12
|
:rubyforge => {
|
|
11
|
-
:project => '
|
|
12
|
-
:package =>
|
|
13
|
+
:project => %q{<%= ask 'Rubyforge project name' %>},
|
|
14
|
+
:package => PROGNAME
|
|
13
15
|
},
|
|
14
16
|
|
|
15
17
|
:gem => {
|
|
16
|
-
:version =>
|
|
17
|
-
:summary =>
|
|
18
|
-
:files => FileList['lib/**/*.rb'
|
|
19
|
-
:extra_files => FileList['[A-Z]*'
|
|
20
|
-
:dependencies => %w[
|
|
18
|
+
:version => <%= ask 'Module/Class name' %>::VERSION,
|
|
19
|
+
:summary => %q{<%= ask 'Program description summary' %>},
|
|
20
|
+
:files => FileList['lib/**/*.rb'].to_a,
|
|
21
|
+
:extra_files => FileList['[A-Z]*'].to_a,
|
|
22
|
+
:dependencies => %w[]
|
|
21
23
|
}
|
|
22
24
|
}}
|
data/lib/hen.rb
CHANGED
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
###############################################################################
|
|
27
27
|
#++
|
|
28
28
|
|
|
29
|
-
require 'rake'
|
|
30
29
|
require 'yaml'
|
|
31
30
|
require 'forwardable'
|
|
32
31
|
|
|
33
32
|
require 'rubygems'
|
|
33
|
+
require 'rake'
|
|
34
34
|
require 'nuggets/proc/bind'
|
|
35
35
|
|
|
36
36
|
require 'hen/dsl'
|
data/lib/hen/cli.rb
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#--
|
|
2
|
+
###############################################################################
|
|
3
|
+
# #
|
|
4
|
+
# hen -- Just a Rake helper #
|
|
5
|
+
# #
|
|
6
|
+
# Copyright (C) 2007-2008 University of Cologne, #
|
|
7
|
+
# Albertus-Magnus-Platz, #
|
|
8
|
+
# 50932 Cologne, Germany #
|
|
9
|
+
# #
|
|
10
|
+
# Authors: #
|
|
11
|
+
# Jens Wille <jens.wille@uni-koeln.de> #
|
|
12
|
+
# #
|
|
13
|
+
# hen is free software; you can redistribute it and/or modify it under the #
|
|
14
|
+
# terms of the GNU General Public License as published by the Free Software #
|
|
15
|
+
# Foundation; either version 3 of the License, or (at your option) any later #
|
|
16
|
+
# version. #
|
|
17
|
+
# #
|
|
18
|
+
# hen is distributed in the hope that it will be useful, but WITHOUT ANY #
|
|
19
|
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
|
20
|
+
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more #
|
|
21
|
+
# details. #
|
|
22
|
+
# #
|
|
23
|
+
# You should have received a copy of the GNU General Public License along #
|
|
24
|
+
# with hen. If not, see <http://www.gnu.org/licenses/>. #
|
|
25
|
+
# #
|
|
26
|
+
###############################################################################
|
|
27
|
+
#++
|
|
28
|
+
|
|
29
|
+
require 'erb'
|
|
30
|
+
|
|
31
|
+
require 'rubygems'
|
|
32
|
+
require 'highline/import'
|
|
33
|
+
|
|
34
|
+
module Hen::CLI
|
|
35
|
+
|
|
36
|
+
alias_method :original_ask, :ask
|
|
37
|
+
def ask(key)
|
|
38
|
+
original_ask("Please enter your #{key}: ")
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def render(template, target)
|
|
42
|
+
abort "Sample file not found: #{template}" unless File.readable?(template)
|
|
43
|
+
|
|
44
|
+
if File.readable?(target)
|
|
45
|
+
abort unless agree("Target file already exists: #{target}. Overwrite? ")
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
File.open(target, 'w') { |f|
|
|
49
|
+
f.puts ERB.new(File.read(template)).result(binding)
|
|
50
|
+
}
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
data/lib/hen/dsl.rb
CHANGED
|
@@ -86,9 +86,10 @@ class Hen
|
|
|
86
86
|
# hash and, optionally, a proc to obtain RubyForge objects from (via
|
|
87
87
|
# +call+; reaching out to init_rubyforge).
|
|
88
88
|
def rubyforge(&block)
|
|
89
|
-
rf_config
|
|
89
|
+
rf_config = config[:rubyforge]
|
|
90
|
+
rf_project = rf_config[:project]
|
|
90
91
|
|
|
91
|
-
raise 'Skipping Rubyforge tasks'
|
|
92
|
+
raise 'Skipping Rubyforge tasks' if rf_project.nil? || rf_project.empty?
|
|
92
93
|
raise LocalJumpError, 'no block given' unless block
|
|
93
94
|
|
|
94
95
|
require 'rubyforge'
|
data/lib/hen/version.rb
CHANGED
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
|
+
version: 0.0.5.164
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jens Wille
|
|
@@ -43,6 +43,7 @@ extra_rdoc_files:
|
|
|
43
43
|
files:
|
|
44
44
|
- lib/hen/version.rb
|
|
45
45
|
- lib/hen/dsl.rb
|
|
46
|
+
- lib/hen/cli.rb
|
|
46
47
|
- lib/hen.rb
|
|
47
48
|
- bin/hen
|
|
48
49
|
- COPYING
|
|
@@ -63,9 +64,9 @@ rdoc_options:
|
|
|
63
64
|
- hen Application documentation
|
|
64
65
|
- --all
|
|
65
66
|
- --line-numbers
|
|
66
|
-
- --inline-source
|
|
67
67
|
- --main
|
|
68
68
|
- README
|
|
69
|
+
- --inline-source
|
|
69
70
|
- --charset
|
|
70
71
|
- UTF-8
|
|
71
72
|
require_paths:
|