rook 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. data/LGPL +504 -0
  2. data/README.txt +15 -6
  3. data/bin/rook +1 -1
  4. data/doc-api/classes/BZ2/Reader.html +24 -24
  5. data/doc-api/classes/Digest/Base.html +18 -18
  6. data/doc-api/classes/Enumerable.html +55 -55
  7. data/doc-api/classes/File.html +53 -6
  8. data/doc-api/classes/FileUtils.html +90 -90
  9. data/doc-api/classes/Kernel.html +48 -48
  10. data/doc-api/classes/Rook.html +18 -5
  11. data/doc-api/classes/Rook/Assertion.html +29 -14
  12. data/doc-api/classes/Rook/Commands.html +296 -364
  13. data/doc-api/classes/Rook/Cookbook.html +165 -60
  14. data/doc-api/classes/Rook/CookbookError.html +7 -7
  15. data/doc-api/classes/Rook/CookbookValidator.html +24 -24
  16. data/doc-api/classes/Rook/Kitchen.html +379 -224
  17. data/doc-api/classes/Rook/KitchenHelper.html +69 -69
  18. data/doc-api/classes/Rook/Main.html +47 -30
  19. data/doc-api/classes/Rook/Recipe.html +63 -35
  20. data/doc-api/classes/Rook/Util.html +72 -68
  21. data/doc-api/classes/Rook/Util/UndefinedPropertyError.html +6 -6
  22. data/doc-api/classes/Rook/{Parameters.html → ValueTable.html} +129 -123
  23. data/doc-api/created.rid +1 -1
  24. data/doc-api/files/rook/commands_rb.html +2 -2
  25. data/doc-api/files/rook/cookbook_rb.html +2 -2
  26. data/doc-api/files/rook/helper/bz2_rb.html +1 -1
  27. data/doc-api/files/rook/helper/digest_rb.html +1 -1
  28. data/doc-api/files/rook/helper/enumerable_rb.html +1 -1
  29. data/doc-api/files/rook/helper/file_rb.html +2 -2
  30. data/doc-api/files/rook/helper/fileutils_rb.html +1 -1
  31. data/doc-api/files/rook/helper/kernel_rb.html +1 -1
  32. data/doc-api/files/rook/kitchen_rb.html +2 -2
  33. data/doc-api/files/rook/main_rb.html +2 -2
  34. data/doc-api/files/rook/recipe_rb.html +2 -2
  35. data/doc-api/files/rook/util_rb.html +2 -2
  36. data/doc-api/files/rook_rb.html +2 -2
  37. data/doc-api/fr_class_index.html +1 -1
  38. data/doc-api/fr_file_index.html +0 -1
  39. data/doc-api/fr_method_index.html +148 -140
  40. data/doc-api/index.html +1 -1
  41. data/examples/hello_c/Rookbook.rb +1 -1
  42. data/examples/hello_c/Rookbook.yaml +8 -8
  43. data/examples/project/README.txt +2 -2
  44. data/examples/project/Rookbook.rb +20 -19
  45. data/examples/project/Rookbook.yaml +30 -28
  46. data/examples/project/bin/example +2 -2
  47. data/examples/project/example.gemspec +1 -1
  48. data/examples/project/lib/example.rb +2 -2
  49. data/examples/project/test/test.rb +2 -2
  50. data/lib/rook.rb +5 -2
  51. data/lib/rook/commands.rb +28 -17
  52. data/lib/rook/cookbook.rb +107 -92
  53. data/lib/rook/helper/bz2.rb +1 -1
  54. data/lib/rook/helper/digest.rb +1 -1
  55. data/lib/rook/helper/enumerable.rb +1 -1
  56. data/lib/rook/helper/file.rb +28 -3
  57. data/lib/rook/helper/fileutils.rb +1 -1
  58. data/lib/rook/helper/kernel.rb +1 -1
  59. data/lib/rook/kitchen.rb +138 -100
  60. data/lib/rook/main.rb +72 -47
  61. data/lib/rook/recipe.rb +51 -35
  62. data/lib/rook/rookbook.schema.yaml +34 -54
  63. data/lib/rook/util.rb +22 -8
  64. data/rook.gemspec +5 -5
  65. metadata +5 -7
  66. data/COPYING +0 -340
  67. data/doc-api/files/__/README_txt.html +0 -313
@@ -19,6 +19,6 @@
19
19
  <frame src="fr_class_index.html" name="Classes" />
20
20
  <frame src="fr_method_index.html" name="Methods" />
21
21
  </frameset>
22
- <frame src="files/__/README_txt.html" name="docwin" />
22
+ <frame src="files/rook_rb.html" name="docwin" />
23
23
  </frameset>
24
24
  </html>
@@ -17,7 +17,7 @@ recipe command , "#{command}.o" do
17
17
  end
18
18
 
19
19
 
20
- recipe '*.o' , '$(1).c', :options=>['$(1).h'] do
20
+ recipe '*.o' , '$(1).c', :toppings=>['$(1).h'] do
21
21
  sys "#{@cc} #{@cflags} -c #{@ingred}"
22
22
  end
23
23
 
@@ -1,8 +1,8 @@
1
1
  ##
2
2
  ## Rookbook.yaml
3
3
  ##
4
- ## $Release: 0.1.0 $
5
- ## copyright(c) 2006 kuwata-lab.com all rights reserved.
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
- variables:
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
- options: [ $(1).h ]
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
 
@@ -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 :pakcages
7
- * rook -b Rookbook.rb --release=1.2.3 :pakcages
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: 0.1.0 $
5
- ## copyright(c) 2006 kuwata-lab.com all rights reserved.
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
- ## variables
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
- tmpdir = @ingreds[0] # or @ingred
31
+ dir = @ingred # or @ingreds[0]
32
32
  rm_f @product
33
- tar_czf @product, tmpdir
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
- tmpdir = @ingreds[0] # or @ingred
40
+ dir = @ingred # or @ingreds[0]
41
41
  rm_f @product
42
- zip_r @product, tmpdir
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
- tmpdir = @ingreds[0] # or @ingred
50
- chdir tmpdir do
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 "#{tmpdir}/#{@product}", '.'
56
+ mv "#{dir}/#{@product}", '.'
57
57
  end
58
58
 
59
59
 
60
60
  recipe "#{project}-*" , :doc do
61
61
  comment "create temporary directory"
62
- tmpdir = @product
63
- rm_rf tmpdir
64
- mkdir_p tmpdir
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, tmpdir do |file| file !~ /\bCVS\b/ end
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 = "#{tmpdir}/#{srcdir}"
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 "#{tmpdir}/**/*" do |content, filename|
85
- next if filename == "#{tmpdir}/setup.rb"
86
- content.gsub!(/\$Release\$/, @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: 0.1.0 $
5
- ## copyright(c) 2006 kuwata-lab.com all rights reserved.
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
- variables:
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
- tmpdir = @ingreds[0]
34
- tar_czf @product, tmpdir
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
- tmpdir = @ingreds[0]
43
- zip_r @product, tmpdir
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
- tmpdir = @ingreds[0]
52
- chdir tmpdir do
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 "#{tmpdir}/#{@product}", '.'
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
- tmpdir = @product
66
- rm_rf tmpdir
67
- mkdir_p tmpdir
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, tmpdir do |file| file !~ /\bCVS\b/ end
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 = "#{tmpdir}/#{srcdir}"
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 "#{tmpdir}/**/*" do |content, filename|
88
- next if filename == "#{tmpdir}/setup.rb"
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
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  ##
4
4
  ## $Id$
5
- ## $Release: 0.1.0 $
6
- ## copyright(c) 2006 kuwata-lab.com all rights reserved.
5
+ ## $Release$
6
+ ## $Copyright$
7
7
  ##
8
8
 
9
9
  require 'example'
@@ -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: 0.1.0 $'
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'
@@ -1,7 +1,7 @@
1
1
  ##
2
2
  ## $Id$
3
- ## $Release: 0.1.0 $
4
- ## copyright(c) 2006 kuwata-lab.com all rights reserved.
3
+ ## $Release$
4
+ ## $Copyright$
5
5
  ##
6
6
  require 'example/foo'
7
7
  require 'example/bar'
@@ -1,7 +1,7 @@
1
1
  ##
2
2
  ## $Id$
3
- ## $Release: 0.1.0 $
4
- ## copyright(c) 2006 kuwata-lab.com all rights reserved.
3
+ ## $Release$
4
+ ## $Copyright$
5
5
  ##
6
6
 
7
7
  $LOAD_PATH << 'lib' if test(?f, 'lib/example.rb')
@@ -1,6 +1,6 @@
1
1
  ##
2
- ## $Rev: 29 $
3
- ## $Release: 0.1.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
@@ -1,6 +1,6 @@
1
1
  ##
2
- ## $Rev: 29 $
3
- ## $Release: 0.1.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
- def cmd(str) # :doc:
117
- _system(:cmd, str, false)
118
- end
119
-
120
- def cmd!(str) # :doc:
121
- _system(:'cmd!', str, true)
122
- end
123
-
124
- def system(str) # :doc:
125
- _system(:system, str, false)
126
- end
127
-
128
- def system!(str) # :doc:
129
- _system(:'system!', str, true)
130
- end
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