rook 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LGPL +504 -0
- data/README.txt +15 -6
- data/bin/rook +1 -1
- data/doc-api/classes/BZ2/Reader.html +24 -24
- data/doc-api/classes/Digest/Base.html +18 -18
- data/doc-api/classes/Enumerable.html +55 -55
- data/doc-api/classes/File.html +53 -6
- data/doc-api/classes/FileUtils.html +90 -90
- data/doc-api/classes/Kernel.html +48 -48
- data/doc-api/classes/Rook.html +18 -5
- data/doc-api/classes/Rook/Assertion.html +29 -14
- data/doc-api/classes/Rook/Commands.html +296 -364
- data/doc-api/classes/Rook/Cookbook.html +165 -60
- data/doc-api/classes/Rook/CookbookError.html +7 -7
- data/doc-api/classes/Rook/CookbookValidator.html +24 -24
- data/doc-api/classes/Rook/Kitchen.html +379 -224
- data/doc-api/classes/Rook/KitchenHelper.html +69 -69
- data/doc-api/classes/Rook/Main.html +47 -30
- data/doc-api/classes/Rook/Recipe.html +63 -35
- data/doc-api/classes/Rook/Util.html +72 -68
- data/doc-api/classes/Rook/Util/UndefinedPropertyError.html +6 -6
- data/doc-api/classes/Rook/{Parameters.html → ValueTable.html} +129 -123
- data/doc-api/created.rid +1 -1
- data/doc-api/files/rook/commands_rb.html +2 -2
- data/doc-api/files/rook/cookbook_rb.html +2 -2
- data/doc-api/files/rook/helper/bz2_rb.html +1 -1
- data/doc-api/files/rook/helper/digest_rb.html +1 -1
- data/doc-api/files/rook/helper/enumerable_rb.html +1 -1
- data/doc-api/files/rook/helper/file_rb.html +2 -2
- data/doc-api/files/rook/helper/fileutils_rb.html +1 -1
- data/doc-api/files/rook/helper/kernel_rb.html +1 -1
- data/doc-api/files/rook/kitchen_rb.html +2 -2
- data/doc-api/files/rook/main_rb.html +2 -2
- data/doc-api/files/rook/recipe_rb.html +2 -2
- data/doc-api/files/rook/util_rb.html +2 -2
- data/doc-api/files/rook_rb.html +2 -2
- data/doc-api/fr_class_index.html +1 -1
- data/doc-api/fr_file_index.html +0 -1
- data/doc-api/fr_method_index.html +148 -140
- data/doc-api/index.html +1 -1
- data/examples/hello_c/Rookbook.rb +1 -1
- data/examples/hello_c/Rookbook.yaml +8 -8
- data/examples/project/README.txt +2 -2
- data/examples/project/Rookbook.rb +20 -19
- data/examples/project/Rookbook.yaml +30 -28
- data/examples/project/bin/example +2 -2
- data/examples/project/example.gemspec +1 -1
- data/examples/project/lib/example.rb +2 -2
- data/examples/project/test/test.rb +2 -2
- data/lib/rook.rb +5 -2
- data/lib/rook/commands.rb +28 -17
- data/lib/rook/cookbook.rb +107 -92
- data/lib/rook/helper/bz2.rb +1 -1
- data/lib/rook/helper/digest.rb +1 -1
- data/lib/rook/helper/enumerable.rb +1 -1
- data/lib/rook/helper/file.rb +28 -3
- data/lib/rook/helper/fileutils.rb +1 -1
- data/lib/rook/helper/kernel.rb +1 -1
- data/lib/rook/kitchen.rb +138 -100
- data/lib/rook/main.rb +72 -47
- data/lib/rook/recipe.rb +51 -35
- data/lib/rook/rookbook.schema.yaml +34 -54
- data/lib/rook/util.rb +22 -8
- data/rook.gemspec +5 -5
- metadata +5 -7
- data/COPYING +0 -340
- data/doc-api/files/__/README_txt.html +0 -313
data/doc-api/index.html
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
##
|
2
2
|
## Rookbook.yaml
|
3
3
|
##
|
4
|
-
## $Release
|
5
|
-
##
|
4
|
+
## $Release$
|
5
|
+
## $Copyright$
|
6
6
|
##
|
7
7
|
|
8
8
|
|
@@ -13,7 +13,7 @@ properties:
|
|
13
13
|
- rook_product : :all
|
14
14
|
|
15
15
|
|
16
|
-
|
16
|
+
parameters:
|
17
17
|
- command : hello
|
18
18
|
|
19
19
|
|
@@ -21,25 +21,25 @@ recipes:
|
|
21
21
|
|
22
22
|
- product: $(command)
|
23
23
|
ingreds: [ $(command).o ]
|
24
|
-
method
|
24
|
+
method*: |
|
25
25
|
sys "$(cc) $(cflags) -o #{@product} #{@ingred}"
|
26
26
|
|
27
27
|
- product: *.o
|
28
28
|
ingreds: [ $(1).c ]
|
29
|
-
|
30
|
-
method
|
29
|
+
toppings: [ $(1).h ]
|
30
|
+
method*: |
|
31
31
|
sys "$(cc) $(cflags) -c #{@ingred}"
|
32
32
|
|
33
33
|
- product: :all
|
34
34
|
ingreds: [ $(command) ]
|
35
35
|
|
36
36
|
- product: :clean
|
37
|
-
method
|
37
|
+
method*: |
|
38
38
|
byprods = Dir.glob('*.o')
|
39
39
|
rm_f byprods unless byprods.empty?
|
40
40
|
|
41
41
|
- product: :clear
|
42
42
|
ingreds: [ :clean ]
|
43
|
-
method
|
43
|
+
method*: |
|
44
44
|
rm_f command
|
45
45
|
|
data/examples/project/README.txt
CHANGED
@@ -3,6 +3,6 @@
|
|
3
3
|
This is an example project for Rook.
|
4
4
|
|
5
5
|
Try the following command:
|
6
|
-
* rook -b Rookbook.yaml --release=1.2.3 :
|
7
|
-
* rook -b Rookbook.rb --release=1.2.3 :
|
6
|
+
* rook -b Rookbook.yaml --release=1.2.3 :packages
|
7
|
+
* rook -b Rookbook.rb --release=1.2.3 :packages
|
8
8
|
|
@@ -1,21 +1,21 @@
|
|
1
1
|
##
|
2
2
|
## Rookbook.yaml
|
3
3
|
##
|
4
|
-
## $Release
|
5
|
-
##
|
4
|
+
## $Release$
|
5
|
+
## $Copyright$
|
6
6
|
##
|
7
7
|
|
8
8
|
|
9
9
|
## properties
|
10
10
|
|
11
11
|
property :release, '0.0.0', :desc=>'release number'
|
12
|
-
#property :rook_product, :packages
|
13
12
|
|
14
13
|
|
15
|
-
##
|
14
|
+
## parameters
|
16
15
|
|
17
16
|
copyright = 'copyright(c) 2006 kuwata-lab all rights reserved'
|
18
17
|
project = 'example'
|
18
|
+
#parameter :rook_product, :packages
|
19
19
|
|
20
20
|
|
21
21
|
## recipes
|
@@ -28,45 +28,45 @@ recipe :packages , "#{base}.tar.gz", "#{base}.zip", "#{base}.gem"
|
|
28
28
|
desc 'create *.tar.gz'
|
29
29
|
recipe "#{project}-*.tar.gz" , "#{project}-$(1)" do
|
30
30
|
comment @desc
|
31
|
-
|
31
|
+
dir = @ingred # or @ingreds[0]
|
32
32
|
rm_f @product
|
33
|
-
tar_czf @product,
|
33
|
+
tar_czf @product, dir
|
34
34
|
end
|
35
35
|
|
36
36
|
|
37
37
|
desc 'create *.zip'
|
38
38
|
recipe "#{project}-*.zip" , "#{project}-$(1)" do
|
39
39
|
comment @desc
|
40
|
-
|
40
|
+
dir = @ingred # or @ingreds[0]
|
41
41
|
rm_f @product
|
42
|
-
zip_r @product,
|
42
|
+
zip_r @product, dir
|
43
43
|
end
|
44
44
|
|
45
45
|
|
46
46
|
desc 'generate *.gem package'
|
47
47
|
recipe "#{project}-*.gem" , "#{project}-$(1)" do
|
48
48
|
comment @desc
|
49
|
-
|
50
|
-
chdir
|
49
|
+
dir = @ingred # or @ingreds[0]
|
50
|
+
chdir dir do
|
51
51
|
specfile = "#{project}.gemspec"
|
52
52
|
#sys "gem build #{specfile}"
|
53
53
|
Gem.manage_gems
|
54
54
|
Gem::GemRunner.new.run ['build', specfile]
|
55
55
|
end
|
56
|
-
mv "#{
|
56
|
+
mv "#{dir}/#{@product}", '.'
|
57
57
|
end
|
58
58
|
|
59
59
|
|
60
60
|
recipe "#{project}-*" , :doc do
|
61
61
|
comment "create temporary directory"
|
62
|
-
|
63
|
-
rm_rf
|
64
|
-
mkdir_p
|
62
|
+
dir = @product
|
63
|
+
rm_rf dir
|
64
|
+
mkdir_p dir
|
65
65
|
|
66
66
|
comment "store all files but CVS directory"
|
67
67
|
files = %W[lib/**/*.rb bin/* test/* doc
|
68
68
|
README.txt setup.rb #{project}.gemspec]
|
69
|
-
store files,
|
69
|
+
store files, dir do |file| file !~ /\bCVS\b/ end
|
70
70
|
|
71
71
|
### `store' is equivarent to the following:
|
72
72
|
# files = %w[lib/**/*.rb bin/* test/**/* doc README.txt setup.rb]
|
@@ -75,16 +75,17 @@ recipe "#{project}-*" , :doc do
|
|
75
75
|
# list.each do |file|
|
76
76
|
# next if file !~ /\bCVS\b/ # filter
|
77
77
|
# srcdir = File.dirname(file)
|
78
|
-
# destdir = "#{
|
78
|
+
# destdir = "#{dir}/#{srcdir}"
|
79
79
|
# mkdir_p(destdir) unless test(?e, destdir)
|
80
80
|
# cp_r(file, destdir)
|
81
81
|
# end
|
82
82
|
|
83
83
|
comment "replace '$Release\$' and '$Copyright\$'"
|
84
|
-
edit "#{
|
85
|
-
next if filename == "#{
|
86
|
-
content.gsub!(/\$Release\$/,
|
84
|
+
edit "#{dir}/**/*" do |content, filename|
|
85
|
+
next if filename == "#{dir}/setup.rb"
|
86
|
+
content.gsub!(/\$Release\$/, "$Release: #{@release} $")
|
87
87
|
content.gsub!(/\$Copyright\$/, copyright)
|
88
|
+
content
|
88
89
|
end
|
89
90
|
|
90
91
|
end
|
@@ -1,21 +1,21 @@
|
|
1
1
|
##
|
2
2
|
## Rookbook.yaml
|
3
3
|
##
|
4
|
-
## $Release
|
5
|
-
##
|
4
|
+
## $Release$
|
5
|
+
## $Copyright$
|
6
6
|
##
|
7
7
|
|
8
8
|
|
9
9
|
properties:
|
10
10
|
- release : 0.0.0
|
11
|
-
#- rook_product : :packages
|
12
11
|
|
13
12
|
|
14
|
-
|
13
|
+
parameters:
|
15
14
|
- copyright : copyright(c) 2006 kuwata-lab all rights reserved.
|
16
15
|
- project : example
|
17
16
|
- base : $(project)-$(release)
|
18
17
|
- pkglist : [ $(base).tar.gz, $(base).zip, $(base).gem ]
|
18
|
+
#- rook_product : :packages
|
19
19
|
|
20
20
|
|
21
21
|
recipes:
|
@@ -23,53 +23,54 @@ recipes:
|
|
23
23
|
- product: :packages
|
24
24
|
desc: create packages
|
25
25
|
ingreds: [ $(pkglist) ]
|
26
|
-
|
26
|
+
|
27
27
|
|
28
28
|
- product: $(project)-*.tar.gz
|
29
29
|
desc: create *.tar.gz
|
30
30
|
ingreds: [ $(project)-$(1) ]
|
31
|
-
method
|
31
|
+
method*: |
|
32
32
|
comment @desc
|
33
|
-
|
34
|
-
tar_czf @product,
|
33
|
+
dir = @ingred # or ingreds[0]
|
34
|
+
tar_czf @product, dir
|
35
35
|
|
36
36
|
|
37
37
|
- product: $(project)-*.zip
|
38
38
|
desc: create *.zip
|
39
39
|
ingreds: [ $(project)-$(1) ]
|
40
|
-
method
|
40
|
+
method*: |
|
41
41
|
comment @desc
|
42
|
-
|
43
|
-
|
42
|
+
rm_f @product
|
43
|
+
dir = @ingred # or ingreds[0]
|
44
|
+
zip_r @product, dir
|
44
45
|
|
45
46
|
|
46
47
|
- product: $(project)-*.gem
|
47
48
|
desc: generate *.gem package
|
48
49
|
ingreds: [ $(project)-$(1) ]
|
49
|
-
method
|
50
|
+
method*: |
|
50
51
|
comment @desc
|
51
|
-
|
52
|
-
chdir
|
52
|
+
dir = @ingred # or ingreds[0]
|
53
|
+
chdir dir do
|
53
54
|
specfile = "$(project).gemspec"
|
54
55
|
#sys "gem build #{specfile}"
|
55
56
|
Gem.manage_gems
|
56
57
|
Gem::GemRunner.new.run ['build', specfile]
|
57
58
|
end
|
58
|
-
mv "#{
|
59
|
+
mv "#{dir}/#{@product}", '.'
|
59
60
|
|
60
61
|
|
61
62
|
- product: $(project)-*
|
62
63
|
ingreds: [ :doc ]
|
63
|
-
method
|
64
|
+
method*: |
|
64
65
|
comment "create temporary directory"
|
65
|
-
|
66
|
-
rm_rf
|
67
|
-
mkdir_p
|
66
|
+
dir = @product
|
67
|
+
rm_rf dir
|
68
|
+
mkdir_p dir
|
68
69
|
|
69
70
|
comment "store all files but CVS directory"
|
70
71
|
files = %w[lib/**/*.rb bin/* test/**/* doc
|
71
72
|
README.txt setup.rb $(project).gemspec]
|
72
|
-
store files,
|
73
|
+
store files, dir do |file| file !~ /\bCVS\b/ end
|
73
74
|
|
74
75
|
### `store' is equivarent to the following:
|
75
76
|
# files = %w[lib/**/*.rb bin/* test/**/* doc README.txt setup.rb]
|
@@ -78,22 +79,23 @@ recipes:
|
|
78
79
|
# list.each do |file|
|
79
80
|
# next if file !~ /\bCVS\b/ # filter
|
80
81
|
# srcdir = File.dirname(file)
|
81
|
-
# destdir = "#{
|
82
|
+
# destdir = "#{dir}/#{srcdir}"
|
82
83
|
# mkdir_p(destdir) unless test(?e, destdir)
|
83
84
|
# cp_r(file, destdir)
|
84
85
|
# end
|
85
86
|
|
86
87
|
comment "replace '$Release\$' and '$Copyright\$'"
|
87
|
-
edit "#{
|
88
|
-
next if filename == "#{
|
89
|
-
content.gsub!(/\$Release\$/, @release)
|
88
|
+
edit "#{dir}/**/*" do |content, filename|
|
89
|
+
next if filename == "#{dir}/setup.rb"
|
90
|
+
content.gsub!(/\$Release\$/, "$Release: #{@release} $")
|
90
91
|
content.gsub!(/\$Copyright\$/, copyright)
|
92
|
+
content
|
91
93
|
end
|
92
94
|
|
93
95
|
|
94
96
|
- product: :doc
|
95
97
|
desc: create api-document by RDoc
|
96
|
-
method
|
98
|
+
method*: |
|
97
99
|
comment @desc
|
98
100
|
rm_rf 'doc'
|
99
101
|
chdir 'lib' do
|
@@ -102,16 +104,16 @@ recipes:
|
|
102
104
|
|
103
105
|
|
104
106
|
- product: :test
|
105
|
-
method
|
107
|
+
method*: |
|
106
108
|
sys "ruby -I lib test/test.rb"
|
107
109
|
|
108
110
|
|
109
111
|
- product: :clean
|
110
|
-
method
|
112
|
+
method*: |
|
111
113
|
rm_rf "$(project)-*/"
|
112
114
|
|
113
115
|
|
114
116
|
- product: :clear
|
115
|
-
method
|
117
|
+
method*: |
|
116
118
|
rm_rf "$(project)-*", 'doc'
|
117
119
|
|
@@ -6,7 +6,7 @@ spec = Gem::Specification.new do |s|
|
|
6
6
|
## package information
|
7
7
|
s.name = 'example'
|
8
8
|
s.author = 'foobar'
|
9
|
-
s.version = '$Release
|
9
|
+
s.version = ('$Release$' =~ /[.\d]+/) && $&
|
10
10
|
s.platform = Gem::Platform::RUBY
|
11
11
|
s.homepage = 'http://www.example.com'
|
12
12
|
s.summary = 'example project for Rook'
|
data/lib/rook.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
##
|
2
|
-
## $Rev:
|
3
|
-
## $Release: 0.
|
2
|
+
## $Rev: 37 $
|
3
|
+
## $Release: 0.2.0 $
|
4
4
|
## copyright(c) 2006 kuwata-lab.com all rights reserved.
|
5
5
|
##
|
6
6
|
|
@@ -25,6 +25,8 @@ require 'fileutils'
|
|
25
25
|
##
|
26
26
|
module Rook
|
27
27
|
|
28
|
+
RELEASE = ('$Release: 0.2.0 $' =~ /\$Release: 0.2.0 $/) && $1
|
29
|
+
|
28
30
|
class RookError < StandardError
|
29
31
|
end
|
30
32
|
|
@@ -38,6 +40,7 @@ module Rook
|
|
38
40
|
def assert_failed(message)
|
39
41
|
raise AssertionError.new(message)
|
40
42
|
end
|
43
|
+
alias assert! assert_failed
|
41
44
|
end
|
42
45
|
|
43
46
|
end
|
data/lib/rook/commands.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
##
|
2
|
-
## $Rev:
|
3
|
-
## $Release: 0.
|
2
|
+
## $Rev: 36 $
|
3
|
+
## $Release: 0.2.0 $
|
4
4
|
## copyright(c) 2006 kuwata-lab.com all rights reserved.
|
5
5
|
##
|
6
6
|
|
@@ -113,21 +113,23 @@ module Rook
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
116
|
+
#--
|
117
|
+
#def cmd(str) # :doc:
|
118
|
+
# _system(:cmd, str, false)
|
119
|
+
#end
|
120
|
+
#
|
121
|
+
#def cmd!(str) # :doc:
|
122
|
+
# _system(:'cmd!', str, true)
|
123
|
+
#end
|
124
|
+
#
|
125
|
+
#def system(str) # :doc:
|
126
|
+
# _system(:system, str, false)
|
127
|
+
#end
|
128
|
+
#
|
129
|
+
#def system!(str) # :doc:
|
130
|
+
# _system(:'system!', str, true)
|
131
|
+
#end
|
132
|
+
#++
|
131
133
|
|
132
134
|
def sys(str) # :doc:
|
133
135
|
_system(:sys, str, false)
|
@@ -355,6 +357,15 @@ module Rook
|
|
355
357
|
end
|
356
358
|
|
357
359
|
|
360
|
+
def replace(*args, &block) # :doc:
|
361
|
+
args, opts = _handle_args(:edit, args)
|
362
|
+
return if $rook_noexec
|
363
|
+
args.each do |filename|
|
364
|
+
File.replace(filename, &block) if test(?f, filename)
|
365
|
+
end
|
366
|
+
end
|
367
|
+
|
368
|
+
|
358
369
|
def _zip(method_name, args) # :nodoc:
|
359
370
|
args, opts = _handle_args(method_name, args)
|
360
371
|
return if $rook_noexec
|