reap 0.5.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. data/ANN-0.6.1 +3 -0
  2. data/Rakefile +19 -0
  3. data/Reapfile +46 -33
  4. data/data/site_ruby/reap/template.yaml +94 -0
  5. data/lib/reap/announce-task.rb +159 -0
  6. data/lib/reap/chmod-task.rb +82 -0
  7. data/lib/reap/package-task.rb +165 -0
  8. data/lib/reap/publish-task.rb +53 -0
  9. data/lib/reap/rdoc-task.rb +70 -0
  10. data/lib/reap/reap-all.rb +15 -0
  11. data/lib/reap/task.rb +177 -118
  12. data/lib/reap/template-task.rb +40 -0
  13. data/lib/reap/test-task.rb +159 -0
  14. data/pub/www/Reapfile +99 -0
  15. data/pub/www/images/appleboy.jpg +0 -0
  16. data/pub/www/index.html +49 -5
  17. data/{doc/files/LICENSE.html → pub/www/rdoc/classes/Reap.html} +32 -33
  18. data/pub/www/rdoc/classes/Reap/AnnounceTask.html +154 -0
  19. data/pub/www/rdoc/classes/Reap/AnnounceTask.src/M000031.html +111 -0
  20. data/pub/www/rdoc/classes/Reap/AnnounceTask.src/M000032.html +46 -0
  21. data/pub/www/rdoc/classes/Reap/ChmodTask.html +220 -0
  22. data/pub/www/rdoc/classes/Reap/ChmodTask.src/M000015.html +21 -0
  23. data/pub/www/rdoc/classes/Reap/ChmodTask.src/M000016.html +21 -0
  24. data/pub/www/rdoc/classes/Reap/ChmodTask.src/M000017.html +42 -0
  25. data/pub/www/rdoc/classes/Reap/ChmodTask.src/M000018.html +26 -0
  26. data/pub/www/rdoc/classes/Reap/PackageTask.html +181 -0
  27. data/pub/www/rdoc/classes/Reap/PackageTask.src/M000001.html +49 -0
  28. data/pub/www/rdoc/classes/Reap/PackageTask.src/M000002.html +74 -0
  29. data/pub/www/rdoc/classes/Reap/PackageTask.src/M000003.html +51 -0
  30. data/pub/www/rdoc/classes/Reap/PublishTask.html +160 -0
  31. data/pub/www/rdoc/classes/Reap/PublishTask.src/M000019.html +24 -0
  32. data/pub/www/rdoc/classes/Reap/PublishTask.src/M000020.html +38 -0
  33. data/pub/www/rdoc/classes/Reap/RDocTask.html +220 -0
  34. data/pub/www/rdoc/classes/Reap/RDocTask.src/M000004.html +24 -0
  35. data/pub/www/rdoc/classes/Reap/RDocTask.src/M000005.html +21 -0
  36. data/pub/www/rdoc/classes/Reap/RDocTask.src/M000006.html +53 -0
  37. data/pub/www/rdoc/classes/Reap/Task.html +319 -0
  38. data/pub/www/rdoc/classes/Reap/Task.src/M000024.html +21 -0
  39. data/pub/www/rdoc/classes/Reap/Task.src/M000025.html +18 -0
  40. data/pub/www/rdoc/classes/Reap/Task.src/M000026.html +18 -0
  41. data/pub/www/rdoc/classes/Reap/Task.src/M000027.html +28 -0
  42. data/pub/www/rdoc/classes/Reap/Task.src/M000028.html +16 -0
  43. data/pub/www/rdoc/classes/Reap/Task.src/M000029.html +18 -0
  44. data/pub/www/rdoc/classes/Reap/Task.src/M000030.html +19 -0
  45. data/pub/www/rdoc/classes/Reap/TemplateTask.html +182 -0
  46. data/pub/www/rdoc/classes/Reap/TemplateTask.src/M000021.html +18 -0
  47. data/pub/www/rdoc/classes/Reap/TemplateTask.src/M000022.html +21 -0
  48. data/pub/www/rdoc/classes/Reap/TemplateTask.src/M000023.html +34 -0
  49. data/pub/www/rdoc/classes/Reap/TestTask.html +228 -0
  50. data/pub/www/rdoc/classes/Reap/TestTask.src/M000007.html +25 -0
  51. data/pub/www/rdoc/classes/Reap/TestTask.src/M000008.html +21 -0
  52. data/pub/www/rdoc/classes/Reap/TestTask.src/M000009.html +77 -0
  53. data/pub/www/rdoc/classes/Reap/TestTask.src/M000010.html +27 -0
  54. data/pub/www/rdoc/classes/Reap/TestTask.src/M000011.html +36 -0
  55. data/{doc → pub/www/rdoc}/classes/Reap/TestTask/TestResults.html +23 -55
  56. data/pub/www/rdoc/classes/Reap/TestTask/TestResults.src/M000012.html +21 -0
  57. data/pub/www/rdoc/classes/Reap/TestTask/TestResults.src/M000013.html +21 -0
  58. data/pub/www/rdoc/classes/Reap/TestTask/TestResults.src/M000014.html +23 -0
  59. data/pub/www/rdoc/created.rid +1 -0
  60. data/{doc/files/lib/reap/tasks → pub/www/rdoc/files/lib/reap2}/announce-task_rb.html +3 -3
  61. data/{doc/files/lib/reap/task_rb.html → pub/www/rdoc/files/lib/reap2/chmod-task_rb.html} +5 -5
  62. data/pub/www/{doc/files/lib/reap/tasks → rdoc/files/lib/reap2}/package-task_rb.html +3 -3
  63. data/pub/www/{doc/files/lib/reap/template_rb.html → rdoc/files/lib/reap2/publish-task_rb.html} +10 -4
  64. data/pub/www/{doc/files/lib/reap/task_rb.html → rdoc/files/lib/reap2/rdoc-task_rb.html} +5 -5
  65. data/pub/www/{doc/files/lib/reap/reap_rb.html → rdoc/files/lib/reap2/reap-all_rb.html} +7 -7
  66. data/{doc/files/lib/reap/runner_rb.html → pub/www/rdoc/files/lib/reap2/task_rb.html} +7 -8
  67. data/pub/www/{doc/files/lib/reap/tasks → rdoc/files/lib/reap2}/template-task_rb.html +4 -4
  68. data/{doc/files/lib/reap/tasks → pub/www/rdoc/files/lib/reap2}/test-task_rb.html +10 -4
  69. data/{doc → pub/www/rdoc}/fr_class_index.html +0 -1
  70. data/pub/www/rdoc/fr_file_index.html +35 -0
  71. data/pub/www/rdoc/fr_method_index.html +58 -0
  72. data/{doc → pub/www/rdoc}/index.html +1 -1
  73. data/{doc → pub/www/rdoc}/rdoc-style.css +0 -0
  74. data/test/tc_reap.rb +11 -0
  75. metadata +98 -112
  76. data/bin/reap +0 -103
  77. data/doc/classes/Reap.html +0 -184
  78. data/doc/classes/Reap/AnnounceTask.html +0 -339
  79. data/doc/classes/Reap/ChmodTask.html +0 -277
  80. data/doc/classes/Reap/PackageTask.html +0 -374
  81. data/doc/classes/Reap/PublishTask.html +0 -237
  82. data/doc/classes/Reap/RDocTask.html +0 -254
  83. data/doc/classes/Reap/Runner.html +0 -299
  84. data/doc/classes/Reap/Task.html +0 -438
  85. data/doc/classes/Reap/TemplateTask.html +0 -226
  86. data/doc/classes/Reap/TestTask.html +0 -354
  87. data/doc/created.rid +0 -1
  88. data/doc/files/README.html +0 -194
  89. data/doc/files/lib/reap/reap_rb.html +0 -111
  90. data/doc/files/lib/reap/tasks/chmod-task_rb.html +0 -101
  91. data/doc/files/lib/reap/tasks/package-task_rb.html +0 -108
  92. data/doc/files/lib/reap/tasks/publish-task_rb.html +0 -101
  93. data/doc/files/lib/reap/tasks/rdoc-task_rb.html +0 -101
  94. data/doc/files/lib/reap/tasks/template-task_rb.html +0 -109
  95. data/doc/fr_file_index.html +0 -38
  96. data/doc/fr_method_index.html +0 -73
  97. data/lib/reap/reap.rb +0 -13
  98. data/lib/reap/runner.rb +0 -90
  99. data/lib/reap/tasks/announce-task.rb +0 -149
  100. data/lib/reap/tasks/chmod-task.rb +0 -69
  101. data/lib/reap/tasks/package-task.rb +0 -157
  102. data/lib/reap/tasks/publish-task.rb +0 -39
  103. data/lib/reap/tasks/rdoc-task.rb +0 -55
  104. data/lib/reap/tasks/template-task.rb +0 -39
  105. data/lib/reap/tasks/test-task.rb +0 -140
  106. data/pub/www/doc/classes/Reap.html +0 -184
  107. data/pub/www/doc/classes/Reap/AnnounceTask.html +0 -331
  108. data/pub/www/doc/classes/Reap/ChmodTask.html +0 -278
  109. data/pub/www/doc/classes/Reap/PackageTask.html +0 -372
  110. data/pub/www/doc/classes/Reap/PublishTask.html +0 -231
  111. data/pub/www/doc/classes/Reap/RDocTask.html +0 -254
  112. data/pub/www/doc/classes/Reap/Runner.html +0 -307
  113. data/pub/www/doc/classes/Reap/Task.html +0 -390
  114. data/pub/www/doc/classes/Reap/TemplateTask.html +0 -233
  115. data/pub/www/doc/classes/Reap/TestTask.html +0 -242
  116. data/pub/www/doc/created.rid +0 -1
  117. data/pub/www/doc/files/LICENSE.html +0 -119
  118. data/pub/www/doc/files/README.html +0 -194
  119. data/pub/www/doc/files/lib/reap/runner_rb.html +0 -113
  120. data/pub/www/doc/files/lib/reap/tasks/announce-task_rb.html +0 -113
  121. data/pub/www/doc/files/lib/reap/tasks/chmod-task_rb.html +0 -101
  122. data/pub/www/doc/files/lib/reap/tasks/publish-task_rb.html +0 -101
  123. data/pub/www/doc/files/lib/reap/tasks/rdoc-task_rb.html +0 -101
  124. data/pub/www/doc/files/lib/reap/tasks/test-task_rb.html +0 -101
  125. data/pub/www/doc/fr_class_index.html +0 -36
  126. data/pub/www/doc/fr_file_index.html +0 -39
  127. data/pub/www/doc/fr_method_index.html +0 -69
  128. data/pub/www/doc/index.html +0 -24
  129. data/pub/www/doc/rdoc-style.css +0 -208
  130. data/test/tc_require.rb +0 -11
data/ANN-0.6.1 ADDED
@@ -0,0 +1,3 @@
1
+
2
+ This is a test.
3
+
data/Rakefile ADDED
@@ -0,0 +1,19 @@
1
+
2
+ require 'reap/reap-all'
3
+
4
+ #require 'reap/template-task'
5
+ #require 'reap/chmod-task'
6
+ #require 'reap/test-task'
7
+ #require 'reap/rdoc-task'
8
+ #require 'reap/announce-task'
9
+ #require 'reap/publish-task'
10
+ #require 'reap/package-task'
11
+
12
+ #Reap::TemplateTask.new
13
+ #Reap::ChmodTask.new
14
+ #Reap::TestTask.new
15
+ #Reap::RDocTask.new
16
+ #Reap::AnnounceTask.new
17
+ #Reap::PublishTask.new
18
+ #Reap::PackageTask.new
19
+
data/Reapfile CHANGED
@@ -2,38 +2,50 @@
2
2
 
3
3
  TITLE: &title Reap
4
4
  NAME: &pkg reap
5
- VERSION: '0.5.0'
6
- AUTHOR: Trans Onoma
5
+ VERSION: '0.6.1'
6
+ AUTHOR: Thomas Sawyer
7
7
  EMAIL: transfire@gmail.com
8
-
9
8
  HOMEPAGE: "http://reap.rubyforge.org"
10
-
11
- SUMMARY: Packaging Assitant for Ruby Developers
9
+ SUMMARY: Rake extensions for project management assitance.
12
10
 
13
11
  DESCRIPTION: >
14
- Reap is a build tool specifically designed for Ruby developers. It operates
15
- solely from a YAML configuration file so it especially easy to maintian your
16
- Ruby projects. Reap can run tests, build .tgz, .bzip2 and .zip packages, create
17
- gem packages, perform manual installs, generate rdocs and publish them to the
18
- web, etc.
12
+ The Reap extensions for Rake comprise a set of commonly
13
+ needed tasks for Ruby package developers/deployers.
14
+ Because of the commonality, Reap utilizes a YAML
15
+ configuration file to harvest project information,
16
+ significantly simplifying Rake usage. In fact,
17
+ when using Reap, it will not be uncommon to see a
18
+ Rakefile containinf nothing but require 'reap-all'.
19
19
 
20
20
  RUBYFORGE:
21
- PROJECT: 'reap'
21
+ PROJECT: reap
22
+ USERNAME: reap
23
+
24
+ PUBLISH:
25
+ HOST: rubyforge
26
+ TYPE: web
22
27
  USERNAME: transami
28
+ DIR: www
29
+
30
+ #=====================================================#
31
+ # From here down the default settings usually suffice #
32
+ #=====================================================#
23
33
 
24
34
  TEST:
25
35
  FILES:
26
- - 'test/**/tc_*.rb'
27
- OPTIONS: ~
36
+ - 'test/**/tc*.rb'
37
+ - 'test/**/test*.rb'
38
+ - 'test/**/*test.rb'
39
+ OPTIONS: ~ # not used yet
28
40
 
29
41
  RDOC:
30
42
  TITLE: *title
31
- DIR: 'doc'
32
- TEMPLATE: html #ruby-red
33
- OPTIONS: ['--merge', '--inline-source', '--all']
43
+ DIR: 'pub/www/rdoc'
44
+ TEMPLATE: html
45
+ OPTIONS: ['--merge', '--all']
34
46
  MAIN: README
35
47
  INCLUDE:
36
- - 'README'
48
+ - 'README*'
37
49
  - 'LICEN*'
38
50
  - 'COPY*'
39
51
  - 'lib/**/*.rb'
@@ -44,43 +56,44 @@ PACKAGE:
44
56
  DIR: pkg
45
57
  INCLUDE:
46
58
  - 'lib/**/*'
59
+ - 'data/**/*'
60
+ - 'ext/**/*'
47
61
  - 'bin/**/*'
48
62
  - 'bench/**/*'
49
63
  - 'test/**/*'
50
64
  - 'doc/**/*'
51
65
  - 'rdoc/**/*'
52
66
  - 'pub/**/*'
67
+ - 'www/**/*'
53
68
  - 'demo/**/*'
54
69
  - 'samples/**/*'
55
70
  - 'examples/**/*'
71
+ - 'bench/**/*'
56
72
  - 'setup.rb'
57
73
  - '[A-Z]*'
58
74
  EXCLUDE:
59
75
  - InstalledFiles
60
- AUTOREQUIRE: 'reap/reap'
61
- EXECUTABLES: ['reap']
62
- DEPENDENCIES:
63
- - nano
64
- - mega
76
+ AUTOREQUIRE: ~
77
+ REQUIREMENTS: []
78
+ DEPENDENCIES: []
79
+ EXECUTABLES: []
65
80
  GEM: true
66
81
  ZIP: true
67
82
  GZIP: true
68
83
  BZIP2: true
69
84
 
70
85
  ANNOUNCE:
71
- TO: ruby-talk@ruby-lang.org
72
- FROM: transfire@gmail.com
73
- DOMAIN: jupiterzeus.net
86
+ TO: transfire@gmail.com #ruby-talk@ruby-lang.org
87
+ FROM: *email
88
+ DOMAIN: reap.rubyforge.org
74
89
  SERVER: smtp.gmail.com
75
- PORT: 25
90
+ PORT: 587
76
91
  ACCOUNT: transfire@gmail.com
77
- AUTHTYPE: login #cram_md5 #plain
78
- FILE: ANN
79
- SLOGAN: Reap Your Rewards!
92
+ AUTHTYPE: login #cram_md5 #plain
93
+ TLS: false # not working yet
94
+ FILE: ANN-0.6.1 # which file contains announcement
95
+ SLOGAN: REAP THE REWARDS!
80
96
  INFO:
81
97
  - http://reap.rubyforge.org
82
-
83
- CHMOD:
84
- user: trans
85
- group: users
98
+ - http://rake.rubyforge.org
86
99
 
@@ -0,0 +1,94 @@
1
+ --- %YAML:1.0
2
+
3
+ TITLE: &title Your App's Title
4
+ NAME: &pkg your_unix_name
5
+ VERSION: '0.0.1'
6
+ AUTHOR: Your Name
7
+ EMAIL: youremail@address.com
8
+ HOMEPAGE: "http://your_package_name.rubyforge.org"
9
+ SUMMARY: One line summary
10
+
11
+ DESCRIPTION: >
12
+ Multline description
13
+ goes here.
14
+
15
+ RUBYFORGE:
16
+ PROJECT: your_projects_unix_name
17
+ USERNAME: your_rubyforge_username
18
+
19
+ PUBLISH:
20
+ - HOST: rubyforge
21
+ TYPE: web
22
+ USERNAME: your_username
23
+ DIR: www
24
+
25
+ #=================================================
26
+ # Usually the following defaults are sufficiant
27
+ #=================================================
28
+
29
+ TEST:
30
+ FILES:
31
+ - 'test/**/tc*.rb'
32
+ - 'test/**/test*.rb'
33
+ - 'test/**/*test.rb'
34
+ OPTIONS: ~ # not used yet
35
+
36
+ RDOC:
37
+ TITLE: *title
38
+ DIR: 'rdoc' # 'pub/www/rdoc'
39
+ TEMPLATE: html
40
+ OPTIONS: ['--merge', '--all']
41
+ MAIN: README
42
+ INCLUDE:
43
+ - 'README'
44
+ - 'LICEN*'
45
+ - 'COPY*'
46
+ - 'lib/**/*.rb'
47
+ - 'bin/**/*.rb'
48
+ EXCLUDE: []
49
+
50
+ PACKAGE:
51
+ DIR: pkg
52
+ INCLUDE:
53
+ - 'lib/**/*'
54
+ - 'data/**/*'
55
+ - 'ext/**/*'
56
+ - 'bin/**/*'
57
+ - 'bench/**/*'
58
+ - 'test/**/*'
59
+ - 'doc/**/*'
60
+ - 'rdoc/**/*'
61
+ - 'pub/**/*'
62
+ - 'www/**/*'
63
+ - 'demo/**/*'
64
+ - 'samples/**/*'
65
+ - 'examples/**/*'
66
+ - 'bench/**/*'
67
+ - 'setup.rb'
68
+ - '[A-Z]*'
69
+ EXCLUDE:
70
+ - InstalledFiles
71
+ AUTOREQUIRE: ~
72
+ REQUIREMENTS: []
73
+ DEPENDENCIES: []
74
+ EXECUTABLES: []
75
+ GEM: true
76
+ ZIP: true
77
+ GZIP: true
78
+ BZIP2: true
79
+
80
+ ANNOUNCE:
81
+ TO: ruby-talk@ruby-lang.org
82
+ FROM: *email
83
+ DOMAIN: your_domain.net
84
+ SERVER: smtp.your_email_server.com
85
+ PORT: 25
86
+ ACCOUNT: email_account_name
87
+ AUTHTYPE: login #cram_md5 #plain
88
+ TLS: false # not working yet
89
+ FILE: ANN # which file contains announcement
90
+ SLOGAN: ALL YOUR BASE ARE BELONG TO RUBY!
91
+ INFO:
92
+ - http://your_homepage.org
93
+ - http://other_links.com
94
+
@@ -0,0 +1,159 @@
1
+ require 'reap/task'
2
+
3
+ require 'net/smtp'
4
+
5
+ require 'nano/string/margin'
6
+ require 'nano/string/tab'
7
+ require 'nano/string/align_center'
8
+ require 'nano/string/fold'
9
+ require 'nano/string/word_wrap'
10
+
11
+ class Reap::AnnounceTask < Reap::Task
12
+
13
+ section_name :announce
14
+
15
+ attr_accessor :address, :from, :server, :port, :domain, :account, :authtype, :tls, :ssl
16
+ attr_accessor :title, :summary, :description, :links, :slogan, :memo, :file
17
+ attr_accessor :subject
18
+
19
+ def init
20
+ @address = section['to']
21
+ @from = section['from'].to_s
22
+ @server = section['server'].to_s.strip
23
+ @port = section['port'] || 25
24
+ @domain = section['domain'].to_s.strip
25
+ @account = section['account'].to_s
26
+ @authtype = section['authtype'].to_s
27
+ @tls = section['tls'] ? true : false
28
+ @ssl = section['ssl'] ? true : false
29
+
30
+ @title = master['title']
31
+ @version = master['version']
32
+ @summary = master['summary']
33
+ @description = master['description']
34
+
35
+ @links = section['links'] || []
36
+ @slogan = section['slogan']
37
+ @memo = section['memo']
38
+ @msg_file = section['file']
39
+
40
+ @subject = "[ANN] #{@title}, v#{@version}"
41
+
42
+ #raise "DOMAIN is a required field" if @domain.empty?
43
+
44
+ # header
45
+ announce = %Q{
46
+ |
47
+ |A N N O U N C I N G
48
+ |
49
+ |#{@title}, v#{@version}
50
+ |
51
+ |#{@summary}
52
+ |
53
+ }.margin.align_center(66)
54
+
55
+ # abstract
56
+ abstract = ''
57
+ if @description
58
+ abstract << "\n\n"
59
+ abstract << "ABSTRACT: #{@description}".word_wrap(72)
60
+ abstract << "\n"
61
+ end
62
+
63
+ # more info
64
+ info = ''
65
+ unless @links.empty?
66
+ info << "\n"
67
+ info << "For More Information".center(67)
68
+ info << "\n"
69
+ @links.each{ |mi| info << "#{mi}".center(67) }
70
+ info << "\n\n"
71
+ end
72
+
73
+ # slogan
74
+ slogan = ''
75
+ if @slogan
76
+ slogan << "\n\n"
77
+ slogan << @slogan.center(67)
78
+ slogan << "\n\n"
79
+ end
80
+
81
+ # memo
82
+ memo = ''
83
+ if @memo
84
+ memo = ''
85
+ memo << "\n" << ('-' * 72) << "\n"
86
+ memo << "(Memo)\n\n"
87
+ memo << @memo.fold.word_wrap(72)
88
+ #memo << "\n"
89
+ end
90
+
91
+ # msg file
92
+ msg = ''
93
+ if @msg_file and File.file?( @msg_file )
94
+ msg << "\n" << ("-" * 72) << "\n"
95
+ msg << "(from #{@msg_file})\n\n"
96
+ mg = ''
97
+ File.open( @msg_file ) { |f| mg << f.gets(nil) }
98
+ msg << mg.fold.word_wrap(72)
99
+ end
100
+
101
+ # stamp
102
+ stamp = ''
103
+ stamp << "\n" << ("-" * 72) << "\n"
104
+ stamp << %Q{
105
+ |Generated by Reap, a Rake-based Ruby Project Assistant.
106
+ |Do you Ruby? (http://www.ruby-lang.org)
107
+ }.margin
108
+ stamp << "\n\n"
109
+
110
+ @message = ''
111
+ @message << announce
112
+ @message << abstract
113
+ @message << info
114
+ @message << slogan
115
+ @message << memo
116
+ @message << msg
117
+ @message << stamp
118
+ end
119
+
120
+ def define
121
+ desc "send [ANN] email to ruby-talk or other list *"
122
+ task :announce do
123
+ run_announce
124
+ end
125
+ end
126
+
127
+ def run_announce
128
+ puts "\n#{@message}\n\n"
129
+ print "Send? [Y/n] "
130
+ until inp = $stdin.gets[0,1] ; sleep 1 ; end
131
+ if (inp || 'y').downcase == 'y'
132
+ # ask for password
133
+ print "Password for #{@account}: "
134
+ until passwd = $stdin.gets.strip ; sleep 1 ; end
135
+ mail = %Q{
136
+ |From: #{@from}
137
+ |To: #{@address}
138
+ |Subject: #{@subject}
139
+ |
140
+ |#{@message}
141
+ }.margin
142
+ begin
143
+ # --- Send using SMTP object and an adaptor
144
+ Net::SMTP.enable_tls if Net::SMTP.respond_to?(:enable_tls) and @tls
145
+ Net::SMTP.start(@server, @port, @domain, @account, passwd, @authtype) do |s|
146
+ s.send_message mail, @from, @address
147
+ end
148
+ puts "Email sent successfully to #{@address}."
149
+ rescue => e
150
+ puts "Email delivery failed."
151
+ puts e
152
+ end
153
+ else
154
+ puts "Reap announce task canceled."
155
+ exit 0
156
+ end
157
+ end
158
+
159
+ end
@@ -0,0 +1,82 @@
1
+
2
+ require 'reap/task'
3
+
4
+ #
5
+ # Chmod Task
6
+ #
7
+ class Reap::ChmodTask < Reap::Task
8
+
9
+ section_name 'chmod'
10
+
11
+ attr_accessor :user, :group, :filemod, :dirmod
12
+
13
+ def init
14
+ @user = section['user']
15
+ @group = section['group']
16
+ @filemod = section['filemod']
17
+ @dirmod = section['dirmod']
18
+ end
19
+
20
+ def define
21
+ desc "normalize permissions of package files *"
22
+ task :chmod do
23
+ run_chmod
24
+ end
25
+ end
26
+
27
+ private
28
+
29
+ def run_chmod
30
+ puts "Reap is shelling out work to chmod..."
31
+
32
+ # misc
33
+ misc = FileList.new
34
+ misc.include('[A-Z]*')
35
+ misc.exclude('InstalledFiles')
36
+ chmod( misc ) unless misc.empty?
37
+
38
+ # lib
39
+ libs = FileList.new
40
+ libs.include('lib/**/*')
41
+ libs.exclude('lib/CVS/**/*')
42
+ libs.include('packages/*/lib/**/*')
43
+ libs.exclude('packages/*/lib/CVS/**/*')
44
+ libs.exclude('packages/CVS/**/*')
45
+ chmod( libs ) unless libs.empty?
46
+
47
+ # bin
48
+ bins = FileList.new
49
+ bins.include('bin/**/*')
50
+ bins.exclude('bin/CVS/**/*')
51
+ bins.include('packages/*/bin/**/*')
52
+ bins.exclude('packages/*/bin/CVS/**/*')
53
+ bins.exclude('packages/CVS/**/*')
54
+ chmod( bins, 755 ) unless bins.empty?
55
+ end
56
+
57
+ private
58
+
59
+ def chmod( file_list, file_mode=644, dir_mode=755 )
60
+ dirs, files = file_list.partition{ |l| File.directory?(l) }
61
+ unless files.empty?
62
+ fstr = '"' + files.join('" "') + '"'
63
+ sh %{chmod #{file_mode} #{fstr}}
64
+ end
65
+ unless dirs.empty?
66
+ fstr = '"' + dirs.join('" "') + '"'
67
+ sh %{chmod #{dir_mode} #{fstr}}
68
+ end
69
+ end
70
+
71
+ # def chown( file_list, user, group )
72
+ # fstr = '"' + file_list.join('" "') + '"'
73
+ # if user
74
+ # if group
75
+ # sh %{chown #{user}.#{group} #{fstr}}
76
+ # else
77
+ # sh %{chown #{user} #{fstr}}
78
+ # end
79
+ # end
80
+ # end
81
+
82
+ end