reap 5.10.10 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (224) hide show
  1. data/COPYING +400 -8
  2. data/README +136 -75
  3. data/bin/reap +2 -2
  4. data/bin/rubytest +5 -0
  5. data/data/reap/scaffold/standard/COPYING +403 -0
  6. data/data/reap/scaffold/{ChangeLog → standard/ChangeLog} +0 -0
  7. data/data/reap/scaffold/standard/INSTALL +14 -0
  8. data/data/reap/scaffold/{ProjectInfo → standard/ProjectInfo} +23 -24
  9. data/data/reap/scaffold/standard/README +3 -0
  10. data/data/reap/scaffold/standard/Rakefile +10 -0
  11. data/{Rakefile → data/reap/scaffold/standard/TODO} +0 -0
  12. data/data/reap/scaffold/{setup.rb → standard/setup.rb} +287 -270
  13. data/data/reap/scaffold/subversion/trunk/COPYING +403 -0
  14. data/data/reap/scaffold/{INSTALL → subversion/trunk/ChangeLog} +0 -0
  15. data/data/reap/scaffold/subversion/trunk/INSTALL +14 -0
  16. data/data/reap/scaffold/subversion/trunk/ProjectInfo +76 -0
  17. data/data/reap/scaffold/subversion/trunk/README +3 -0
  18. data/data/reap/scaffold/subversion/trunk/Rakefile +10 -0
  19. data/data/reap/scaffold/{README → subversion/trunk/TODO} +0 -0
  20. data/data/reap/scaffold/subversion/trunk/setup.rb +1568 -0
  21. data/data/reap/setup.rb +1568 -0
  22. data/lib/reap/bin/reap.rb +176 -80
  23. data/lib/reap/bin/rubytest.rb +53 -0
  24. data/lib/reap/class/announce.rb +220 -0
  25. data/lib/reap/class/doap.rb +80 -0
  26. data/lib/reap/class/extest.rb +151 -0
  27. data/lib/reap/class/filer.rb +62 -0
  28. data/lib/reap/class/installer.rb +178 -0
  29. data/lib/reap/class/manifest.rb +72 -0
  30. data/lib/reap/class/package.rb +468 -0
  31. data/lib/reap/class/publish.rb +152 -0
  32. data/lib/reap/class/rdoc.rb +131 -0
  33. data/lib/reap/class/test.rb +269 -0
  34. data/lib/reap/projectinfo.rb +187 -30
  35. data/lib/reap/rake.rb +42 -0
  36. data/lib/reap/reap.rb +89 -0
  37. data/lib/reap/tasks.rb +672 -11
  38. data/lib/reap/taskutils.rb +122 -0
  39. data/sample/ProjectInfo +96 -0
  40. data/sample/Rakefile +9 -0
  41. data/sample/Reapfile +11 -0
  42. data/sample/task/demo.rb +15 -0
  43. data/setup.rb +287 -272
  44. metadata +99 -257
  45. data/ANN +0 -3
  46. data/ChangeLog +0 -25
  47. data/ProjectInfo +0 -65
  48. data/data/reap/scaffold/COPYING +0 -11
  49. data/data/reap/scaffold/Rakefile +0 -146
  50. data/data/reap/scaffold/Todo +0 -0
  51. data/dev/Rakefile +0 -60
  52. data/dev/composite_task.rb +0 -27
  53. data/dev/compositepublisher.rb +0 -24
  54. data/dev/ftptools.rb +0 -139
  55. data/dev/license-each.rb +0 -85
  56. data/dev/publisher.rb +0 -75
  57. data/dev/rubyforgepublisher.rb +0 -18
  58. data/dev/sshpublisher.rb +0 -47
  59. data/dev/suby-cvs.rb +0 -46
  60. data/dev/template.rb +0 -72
  61. data/lib/reap/lint.rb +0 -0
  62. data/lib/reap/readymade.rb +0 -21
  63. data/lib/reap/task.rb +0 -187
  64. data/lib/reap/task/announce.rb +0 -156
  65. data/lib/reap/task/fileperm.rb +0 -82
  66. data/lib/reap/task/info.rb +0 -20
  67. data/lib/reap/task/install.rb +0 -33
  68. data/lib/reap/task/noop.rb +0 -26
  69. data/lib/reap/task/package.rb +0 -204
  70. data/lib/reap/task/publish.rb +0 -49
  71. data/lib/reap/task/rdoc.rb +0 -82
  72. data/lib/reap/task/scaffold.rb +0 -114
  73. data/lib/reap/task/test.rb +0 -186
  74. data/lib/reap/task/testext.rb +0 -110
  75. data/lib/reap/task/webpublish.rb +0 -43
  76. data/lib/reap/test.rb +0 -138
  77. data/test/tc_reap.rb +0 -11
  78. data/web/ProjectInfo +0 -57
  79. data/web/images/appleboy.jpg +0 -0
  80. data/web/images/grape.jpg +0 -0
  81. data/web/index.html +0 -124
  82. data/web/rdoc/classes/Object.html +0 -121
  83. data/web/rdoc/classes/ProjectInfo.html +0 -207
  84. data/web/rdoc/classes/ProjectInfo.src/M000094.html +0 -18
  85. data/web/rdoc/classes/ProjectInfo.src/M000095.html +0 -24
  86. data/web/rdoc/classes/ProjectInfo.src/M000096.html +0 -22
  87. data/web/rdoc/classes/ProjectInfo.src/M000097.html +0 -21
  88. data/web/rdoc/classes/ProjectInfo.src/M000098.html +0 -18
  89. data/web/rdoc/classes/Reap.html +0 -248
  90. data/web/rdoc/classes/Reap.src/M000023.html +0 -16
  91. data/web/rdoc/classes/Reap.src/M000024.html +0 -21
  92. data/web/rdoc/classes/Reap.src/M000025.html +0 -16
  93. data/web/rdoc/classes/Reap.src/M000026.html +0 -21
  94. data/web/rdoc/classes/Reap/Announce.html +0 -262
  95. data/web/rdoc/classes/Reap/Announce.src/M000030.html +0 -18
  96. data/web/rdoc/classes/Reap/Announce.src/M000031.html +0 -114
  97. data/web/rdoc/classes/Reap/Announce.src/M000032.html +0 -46
  98. data/web/rdoc/classes/Reap/Info.html +0 -176
  99. data/web/rdoc/classes/Reap/Info.src/M000033.html +0 -18
  100. data/web/rdoc/classes/Reap/Info.src/M000034.html +0 -17
  101. data/web/rdoc/classes/Reap/Info.src/M000035.html +0 -18
  102. data/web/rdoc/classes/Reap/Install.html +0 -193
  103. data/web/rdoc/classes/Reap/Install.src/M000036.html +0 -18
  104. data/web/rdoc/classes/Reap/Install.src/M000037.html +0 -20
  105. data/web/rdoc/classes/Reap/Install.src/M000038.html +0 -26
  106. data/web/rdoc/classes/Reap/Noop.html +0 -192
  107. data/web/rdoc/classes/Reap/Noop.src/M000027.html +0 -18
  108. data/web/rdoc/classes/Reap/Noop.src/M000028.html +0 -17
  109. data/web/rdoc/classes/Reap/Noop.src/M000029.html +0 -18
  110. data/web/rdoc/classes/Reap/Package.html +0 -310
  111. data/web/rdoc/classes/Reap/Package.src/M000055.html +0 -18
  112. data/web/rdoc/classes/Reap/Package.src/M000056.html +0 -68
  113. data/web/rdoc/classes/Reap/Package.src/M000057.html +0 -84
  114. data/web/rdoc/classes/Reap/Package.src/M000058.html +0 -61
  115. data/web/rdoc/classes/Reap/Perm.html +0 -236
  116. data/web/rdoc/classes/Reap/Perm.src/M000078.html +0 -18
  117. data/web/rdoc/classes/Reap/Perm.src/M000079.html +0 -21
  118. data/web/rdoc/classes/Reap/Perm.src/M000080.html +0 -42
  119. data/web/rdoc/classes/Reap/Perm.src/M000081.html +0 -26
  120. data/web/rdoc/classes/Reap/Perm.src/M000082.html +0 -18
  121. data/web/rdoc/classes/Reap/Publish.html +0 -213
  122. data/web/rdoc/classes/Reap/Publish.src/M000070.html +0 -18
  123. data/web/rdoc/classes/Reap/Publish.src/M000071.html +0 -22
  124. data/web/rdoc/classes/Reap/Publish.src/M000072.html +0 -37
  125. data/web/rdoc/classes/Reap/RDoc.html +0 -218
  126. data/web/rdoc/classes/Reap/RDoc.src/M000059.html +0 -18
  127. data/web/rdoc/classes/Reap/RDoc.src/M000060.html +0 -24
  128. data/web/rdoc/classes/Reap/RDoc.src/M000061.html +0 -70
  129. data/web/rdoc/classes/Reap/Task.html +0 -396
  130. data/web/rdoc/classes/Reap/Task.src/M000039.html +0 -18
  131. data/web/rdoc/classes/Reap/Task.src/M000040.html +0 -16
  132. data/web/rdoc/classes/Reap/Task.src/M000041.html +0 -16
  133. data/web/rdoc/classes/Reap/Task.src/M000042.html +0 -16
  134. data/web/rdoc/classes/Reap/Task.src/M000043.html +0 -16
  135. data/web/rdoc/classes/Reap/Task.src/M000044.html +0 -22
  136. data/web/rdoc/classes/Reap/Task.src/M000045.html +0 -16
  137. data/web/rdoc/classes/Reap/Task.src/M000046.html +0 -16
  138. data/web/rdoc/classes/Reap/Task.src/M000047.html +0 -16
  139. data/web/rdoc/classes/Reap/Task.src/M000048.html +0 -16
  140. data/web/rdoc/classes/Reap/Task.src/M000049.html +0 -16
  141. data/web/rdoc/classes/Reap/Task.src/M000050.html +0 -27
  142. data/web/rdoc/classes/Reap/Task.src/M000051.html +0 -19
  143. data/web/rdoc/classes/Reap/Task.src/M000052.html +0 -18
  144. data/web/rdoc/classes/Reap/Task.src/M000053.html +0 -18
  145. data/web/rdoc/classes/Reap/Task.src/M000054.html +0 -19
  146. data/web/rdoc/classes/Reap/Test.html +0 -253
  147. data/web/rdoc/classes/Reap/Test.src/M000062.html +0 -18
  148. data/web/rdoc/classes/Reap/Test.src/M000063.html +0 -26
  149. data/web/rdoc/classes/Reap/Test.src/M000064.html +0 -77
  150. data/web/rdoc/classes/Reap/Test.src/M000065.html +0 -27
  151. data/web/rdoc/classes/Reap/Test.src/M000066.html +0 -50
  152. data/web/rdoc/classes/Reap/Test/TestResults.html +0 -205
  153. data/web/rdoc/classes/Reap/Test/TestResults.src/M000067.html +0 -21
  154. data/web/rdoc/classes/Reap/Test/TestResults.src/M000068.html +0 -21
  155. data/web/rdoc/classes/Reap/Test/TestResults.src/M000069.html +0 -23
  156. data/web/rdoc/classes/Reap/TestExt.html +0 -234
  157. data/web/rdoc/classes/Reap/TestExt.src/M000073.html +0 -18
  158. data/web/rdoc/classes/Reap/TestExt.src/M000074.html +0 -20
  159. data/web/rdoc/classes/Reap/TestExt.src/M000075.html +0 -49
  160. data/web/rdoc/classes/Reap/TestExt.src/M000076.html +0 -34
  161. data/web/rdoc/classes/Reap/TestExt.src/M000077.html +0 -27
  162. data/web/rdoc/classes/Reap/WebPublish.html +0 -213
  163. data/web/rdoc/classes/Reap/WebPublish.src/M000083.html +0 -18
  164. data/web/rdoc/classes/Reap/WebPublish.src/M000084.html +0 -21
  165. data/web/rdoc/classes/Reap/WebPublish.src/M000085.html +0 -32
  166. data/web/rdoc/classes/ReapCommand.html +0 -425
  167. data/web/rdoc/classes/ReapCommand.src/M000001.html +0 -16
  168. data/web/rdoc/classes/ReapCommand.src/M000003.html +0 -16
  169. data/web/rdoc/classes/ReapCommand.src/M000005.html +0 -16
  170. data/web/rdoc/classes/ReapCommand.src/M000007.html +0 -16
  171. data/web/rdoc/classes/ReapCommand.src/M000009.html +0 -16
  172. data/web/rdoc/classes/ReapCommand.src/M000011.html +0 -16
  173. data/web/rdoc/classes/ReapCommand.src/M000013.html +0 -18
  174. data/web/rdoc/classes/ReapCommand.src/M000014.html +0 -19
  175. data/web/rdoc/classes/ReapCommand.src/M000015.html +0 -19
  176. data/web/rdoc/classes/ReapCommand.src/M000016.html +0 -24
  177. data/web/rdoc/classes/ReapCommand.src/M000018.html +0 -29
  178. data/web/rdoc/classes/Scaffold.html +0 -211
  179. data/web/rdoc/classes/Scaffold.src/M000086.html +0 -16
  180. data/web/rdoc/classes/Scaffold.src/M000087.html +0 -28
  181. data/web/rdoc/classes/Scaffold.src/M000088.html +0 -32
  182. data/web/rdoc/classes/Scaffold.src/M000089.html +0 -18
  183. data/web/rdoc/classes/UnitTestKernel.html +0 -176
  184. data/web/rdoc/classes/UnitTestKernel.src/M000019.html +0 -18
  185. data/web/rdoc/classes/UnitTestKernel.src/M000020.html +0 -18
  186. data/web/rdoc/classes/UnitTestKernel.src/M000021.html +0 -22
  187. data/web/rdoc/classes/UnitTestKernel.src/M000022.html +0 -22
  188. data/web/rdoc/classes/UnitTesting.html +0 -165
  189. data/web/rdoc/classes/UnitTesting.src/M000090.html +0 -34
  190. data/web/rdoc/classes/UnitTesting.src/M000091.html +0 -18
  191. data/web/rdoc/classes/UnitTesting/Failure.html +0 -156
  192. data/web/rdoc/classes/UnitTesting/Failure.src/M000092.html +0 -18
  193. data/web/rdoc/classes/UnitTesting/Failure.src/M000093.html +0 -21
  194. data/web/rdoc/created.rid +0 -1
  195. data/web/rdoc/files/ANN.html +0 -107
  196. data/web/rdoc/files/COPYING.html +0 -119
  197. data/web/rdoc/files/ChangeLog.html +0 -144
  198. data/web/rdoc/files/ProjectInfo.html +0 -190
  199. data/web/rdoc/files/README.html +0 -274
  200. data/web/rdoc/files/Rakefile.html +0 -101
  201. data/web/rdoc/files/lib/reap/bin/reap_rb.html +0 -129
  202. data/web/rdoc/files/lib/reap/lint_rb.html +0 -101
  203. data/web/rdoc/files/lib/reap/projectinfo_rb.html +0 -110
  204. data/web/rdoc/files/lib/reap/readymade_rb.html +0 -123
  205. data/web/rdoc/files/lib/reap/task/announce_rb.html +0 -114
  206. data/web/rdoc/files/lib/reap/task/fileperm_rb.html +0 -108
  207. data/web/rdoc/files/lib/reap/task/info_rb.html +0 -108
  208. data/web/rdoc/files/lib/reap/task/install_rb.html +0 -108
  209. data/web/rdoc/files/lib/reap/task/noop_rb.html +0 -108
  210. data/web/rdoc/files/lib/reap/task/package_rb.html +0 -109
  211. data/web/rdoc/files/lib/reap/task/publish_rb.html +0 -108
  212. data/web/rdoc/files/lib/reap/task/rdoc_rb.html +0 -108
  213. data/web/rdoc/files/lib/reap/task/scaffold_rb.html +0 -107
  214. data/web/rdoc/files/lib/reap/task/test_rb.html +0 -110
  215. data/web/rdoc/files/lib/reap/task/testext_rb.html +0 -109
  216. data/web/rdoc/files/lib/reap/task/webpublish_rb.html +0 -108
  217. data/web/rdoc/files/lib/reap/task_rb.html +0 -120
  218. data/web/rdoc/files/lib/reap/tasks_rb.html +0 -116
  219. data/web/rdoc/files/lib/reap/test_rb.html +0 -109
  220. data/web/rdoc/fr_class_index.html +0 -47
  221. data/web/rdoc/fr_file_index.html +0 -51
  222. data/web/rdoc/fr_method_index.html +0 -124
  223. data/web/rdoc/index.html +0 -24
  224. data/web/rdoc/rdoc-style.css +0 -208
@@ -1,11 +0,0 @@
1
- = BUTTERED PANCAKES LICENSE
2
-
3
- The following stipulations:
4
-
5
- 1) Butter my panakes
6
- 2) Don't feed the lawyers
7
-
8
- Which means:
9
-
10
- 1) Acknowledge arthor and sources
11
- 2) Don't sue any one over it
@@ -1,146 +0,0 @@
1
-
2
- require 'reap/tasks'
3
-
4
- =begin
5
- # Traditionally, a pre-built rake task would be utilized like this:
6
- #
7
- # Reap::PublishTask.new :mypublisher do |s|
8
- # s.type = 'web'
9
- # s.host = 'rubyforge.org'
10
- # s.username = 'transami'
11
- # s.dir = 'pub/www'
12
- # end
13
- #
14
- # Reap provides a way to use YAML and specilized methods to make
15
- # this even cleaner.
16
- #
17
- # publish_task( :mypublisher ) {"
18
- # type : web
19
- # host : rubyforge.org
20
- # username : transami
21
- # dir : pub/www
22
- # "}
23
- #
24
- # Of course, one can still use a traditional block with the
25
- # special methods.
26
- #
27
- # publish_task :mypublisher do |s|
28
- # s.type = 'web'
29
- # s.host = 'rubyforge.org'
30
- # s.username = 'transami'
31
- # s.dir = 'pub/www'
32
- # end
33
- #
34
- # But there is an additional advantage to the YAML approach. Reap prepends
35
- # the task YAML with the YAML in the ProjectInfo file. This way it is easy
36
- # to reuse master information in indivial tasks. For exmaple you might have
37
- # an &author anchor defined in ProjectInfo.
38
- #
39
- # publish_task( :mypublisher ) {"
40
- # type : web
41
- # host : rubyforge.org
42
- # username : *author
43
- # dir : pub/www
44
- # "}
45
- #
46
- # The special method notation actually works for some prebuilt rake tasks too.
47
- # But do not expect the YAML string block to work /w them.
48
- =end
49
-
50
- include ReapTask
51
-
52
- install_task( :install )
53
- info_task( :info )
54
-
55
- publish_task :publish do"
56
- type : web
57
- host : rubyforge.org
58
- username : transami
59
- dir : www
60
- "end
61
-
62
- announce_task :announce do"
63
- to : transfire@gmail.com # ruby-talk@ruby-lang.org
64
- from : *email
65
- domain : unit.rubyforge.org
66
- server : smtp.gmail.com
67
- port : 587
68
- account : *email # transfire@gmail.com
69
- authtype : login # cram_md5, plain
70
- sectype : tls # ~, tls, ssl (not working yet)
71
- file : ANN # which file contains announcement
72
- slogan : REAP THE REWARDS!
73
- links :
74
- - http://unit.rubyforge.org
75
- - http://rake.rubyforge.org
76
- "end
77
-
78
- fileperm_task :fileperm do"
79
- filemod: 644
80
- dirmod: 755
81
- user: trans
82
- group: users
83
- "end
84
-
85
- extract_tests_task :exttests do"
86
- files:
87
- - 'lib/**/*.rb'
88
- "end
89
-
90
- test_task :test do"
91
- files:
92
- - 'test/**/tc*.rb'
93
- - 'test/**/test*.rb'
94
- - 'test/**/*test.rb'
95
- options: ~ # not used yet
96
- "end
97
-
98
- rdoc_task :rdoc do"
99
- title: *title
100
- dir: 'pub/www/rdoc'
101
- template: jamis #html
102
- options: ['--merge', '--all']
103
- main: README
104
- include:
105
- - 'README*'
106
- - 'LICEN*'
107
- - 'COPY*'
108
- - 'lib/**/*.rb'
109
- - 'bin/**/*.rb'
110
- exclude: []
111
- "end
112
-
113
- package_task :package do"
114
- #dir: ../tag
115
- include:
116
- - 'lib/**/*'
117
- - 'data/**/*'
118
- - 'ext/**/*'
119
- - 'bin/**/*'
120
- - 'bench/**/*'
121
- - 'test/**/*'
122
- - 'doc/**/*'
123
- - 'rdoc/**/*'
124
- - 'pub/**/*'
125
- - 'www/**/*'
126
- - 'demo/**/*'
127
- - 'samples/**/*'
128
- - 'examples/**/*'
129
- - 'bench/**/*'
130
- - 'setup.rb'
131
- - '[A-Z]*'
132
- exclude:
133
- - InstalledFiles
134
- autorequire: ~
135
- requirements: []
136
- dependencies: *dep #[]
137
- executables: *exe #[]
138
- gem: true
139
- zip: false
140
- gzip: false
141
- bzip2: true
142
- "end
143
-
144
- noop_task :noop do"
145
- message: 'Hello, World!'
146
- "end
File without changes
@@ -1,60 +0,0 @@
1
- # Rakefile for rubypants -*-ruby-*-
2
- require 'rake/rdoctask'
3
-
4
-
5
- desc "Run all the tests"
6
- task :default => [:test]
7
-
8
- desc "Do predistribution stuff"
9
- task :predist => [:changelog, :doc]
10
-
11
-
12
- desc "Run all the tests"
13
- task :test do
14
- ruby 'rand.rb'
15
- end
16
-
17
- desc "Make an archive as .tar.gz"
18
- task :dist => :test do
19
- system "export DARCS_REPO=#{File.expand_path "."}; " +
20
- "darcs dist -d rand#{get_darcs_tree_version}"
21
- end
22
-
23
- desc "Generate a ChangeLog"
24
- task :changelog do
25
- system "darcs changes --repo=#{ENV["DARCS_REPO"] || "."} >ChangeLog"
26
- end
27
-
28
- desc "Generate RDoc documentation"
29
- Rake::RDocTask.new(:doc) do |rdoc|
30
- rdoc.options << '--line-numbers --inline-source --all'
31
- rdoc.rdoc_files.include 'README'
32
- rdoc.rdoc_files.include 'rand.rb'
33
- end
34
-
35
-
36
- # Helper to retrieve the "revision number" of the darcs tree.
37
- def get_darcs_tree_version
38
- return "" unless File.directory? "_darcs"
39
-
40
- changes = `darcs changes`
41
- count = 0
42
- tag = "0.0"
43
-
44
- changes.each("\n\n") { |change|
45
- head, title, desc = change.split("\n", 3)
46
-
47
- if title =~ /^ \*/
48
- # Normal change.
49
- count += 1
50
- elsif title =~ /tagged (.*)/
51
- # Tag. We look for these.
52
- tag = $1
53
- break
54
- else
55
- warn "Unparsable change: #{change}"
56
- end
57
- }
58
-
59
- "-" + tag + "." + count.to_s
60
- end
@@ -1,27 +0,0 @@
1
-
2
- require 'reap/reap'
3
- require 'reap/task'
4
-
5
- class Reap::CompositeTask < Reap::Task
6
-
7
- register "composite"
8
-
9
- #def default_name ; "" ; end
10
- def default_desc
11
- "run tasks #{subtasks.join(',')} [reap]"
12
- end
13
-
14
- #attr_accessor :subtasks
15
-
16
- def init
17
- #@subtasks = section['subtasks']
18
- end
19
-
20
- private
21
-
22
- def run
23
- #@subtasks.each do |st|
24
- #end
25
- end
26
-
27
- end
@@ -1,24 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- module Rake
4
-
5
- # Manage several publishers as a single entity.
6
- class CompositePublisher
7
- def initialize
8
- @publishers = []
9
- end
10
-
11
- # Add a publisher to the composite.
12
- def add(pub)
13
- @publishers << pub
14
- end
15
-
16
- # Upload all the individual publishers.
17
- def upload
18
- @publishers.each { |p| p.upload }
19
- end
20
- end
21
-
22
- end
23
-
24
-
@@ -1,139 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # = Tools for FTP uploading.
4
- #
5
- # This file is still under development and is not released for general
6
- # use.
7
-
8
- require 'date'
9
- require 'parsedate'
10
- require 'net/ftp'
11
-
12
- module Rake # :nodoc:
13
-
14
- ####################################################################
15
- # <b>Note:</b> <em> Not released for general use.</em>
16
- class FtpFile
17
- attr_reader :name, :size, :owner, :group, :time
18
-
19
- def self.date
20
- @date_class ||= Date
21
- end
22
-
23
- def initialize(path, entry)
24
- @path = path
25
- @mode, line, @owner, @group, size, d1, d2, d3, @name = entry.split(' ')
26
- @size = size.to_i
27
- @time = determine_time(d1, d2, d3)
28
- end
29
-
30
- def path
31
- File.join(@path, @name)
32
- end
33
-
34
- def directory?
35
- @mode[0] == ?d
36
- end
37
-
38
- def mode
39
- parse_mode(@mode)
40
- end
41
-
42
- def symlink?
43
- @mode[0] == ?l
44
- end
45
-
46
- private # --------------------------------------------------------
47
-
48
- def parse_mode(m)
49
- result = 0
50
- (1..9).each do |i|
51
- result = 2*result + ((m[i]==?-) ? 0 : 1)
52
- end
53
- result
54
- end
55
-
56
- def determine_time(d1, d2, d3)
57
- elements = ParseDate.parsedate("#{d1} #{d2} #{d3}")
58
- if elements[0].nil?
59
- today = self.class.date.today
60
- if elements[1] > today.month
61
- elements[0] = today.year - 1
62
- else
63
- elements[0] = today.year
64
- end
65
- end
66
- elements = elements.collect { |el| el.nil? ? 0 : el }
67
- Time.mktime(*elements[0,7])
68
- end
69
- end
70
-
71
- ####################################################################
72
- # Manage the uploading of files to an FTP account.
73
- class FtpUploader
74
-
75
- # Log uploads to standard output when true.
76
- attr_accessor :verbose
77
-
78
- class << FtpUploader
79
- # Create an uploader and pass it to the given block as +up+.
80
- # When the block is complete, close the uploader.
81
- def connect(path, host, account, password)
82
- up = self.new(path, host, account, password)
83
- begin
84
- yield(up)
85
- ensure
86
- up.close
87
- end
88
- end
89
- end
90
-
91
- # Create an FTP uploader targetting the directory +path+ on +host+
92
- # using the given account and password. +path+ will be the root
93
- # path of the uploader.
94
- def initialize(path, host, account, password)
95
- @created = Hash.new
96
- @path = path
97
- @ftp = Net::FTP.new(host, account, password)
98
- makedirs(@path)
99
- @ftp.chdir(@path)
100
- end
101
-
102
- # Create the directory +path+ in the uploader root path.
103
- def makedirs(path)
104
- route = []
105
- File.split(path).each do |dir|
106
- route << dir
107
- current_dir = File.join(route)
108
- if @created[current_dir].nil?
109
- @created[current_dir] = true
110
- puts "Creating Directory #{current_dir}" if @verbose
111
- @ftp.mkdir(current_dir) rescue nil
112
- end
113
- end
114
- end
115
-
116
- # Upload all files matching +wildcard+ to the uploader's root
117
- # path.
118
- def upload_files(wildcard)
119
- Dir[wildcard].each do |fn|
120
- upload(fn)
121
- end
122
- end
123
-
124
- # Close the uploader.
125
- def close
126
- @ftp.close
127
- end
128
-
129
- private # --------------------------------------------------------
130
-
131
- # Upload a single file to the uploader's root path.
132
- def upload(file)
133
- puts "Uploading #{file}" if @verbose
134
- dir = File.dirname(file)
135
- makedirs(dir)
136
- @ftp.putbinaryfile(file, file) unless File.directory?(file)
137
- end
138
- end
139
- end
@@ -1,85 +0,0 @@
1
- # Ruby Treasures 0.4
2
- # Copyright (C) 2002 Paul Brannan <paul@atdesk.com>
3
- #
4
- # You may distribute this software under the same terms as Ruby (see the file
5
- # COPYING that was distributed with this library).
6
- #
7
- # Ruby Treasures 0.2
8
- # Copyright (C) 2002 Paul Brannan <paul@atdesk.com>
9
- #
10
- # You may distribute this software under the same terms as Ruby (see the file
11
- # COPYING that was distributed with this library).
12
- #
13
- # Run this Ruby script to prepare the RubyTreasures distribution for
14
- # publication.
15
-
16
- require 'find'
17
- require 'ftools'
18
-
19
-
20
- # Add licences to the top of every file and remove unnecessary files
21
-
22
- license = IO.readlines('LICENSE')
23
- ruby_license_comment = license.map { |i| i.sub(/^/, '# ') }
24
- c_license_comment = ["/*\n"] + license.map { |i| i.sub(/^/, ' * ') } + [" */\n"]
25
-
26
- def rm_rf(dir)
27
- Dir.foreach(dir) do |f|
28
- if not f =~ /\.?\.$/ then
29
- filename = File.join(dir, f)
30
- if File.directory?(filename) then
31
- rm_rf(filename)
32
- else
33
- puts "Removing file #{filename}"
34
- File.rm_f(filename)
35
- end
36
- end
37
- end
38
- puts "Removing directory #{dir}"
39
- Dir.rmdir(dir)
40
- end
41
-
42
- Find.find('.') do |file|
43
- if File.directory?(file) then
44
- case file
45
- when /\/CVS$/
46
- # Remove CVS directories
47
- rm_rf(file)
48
- else
49
- # Remove empty directories
50
- entries = Dir.entries(file)
51
- entries.delete('.')
52
- entries.delete('..')
53
- entries.delete('CVS')
54
- if entries.length == 0 then
55
- rm_rf(file)
56
- end
57
- end
58
- else
59
- case file
60
- when /\.rb$/
61
- # Add LICENSE to ruby sources
62
- puts "Adding license to #{file}"
63
- lines = ruby_license_comment + IO.readlines(file)
64
- File.open(file, 'w') do |out|
65
- lines.each do |line|
66
- out.puts line
67
- end
68
- end
69
- when /\.c$/
70
- # Add LICENSE to C sources
71
- puts "Adding license to #{file}"
72
- lines = c_license_comment + IO.readlines(file)
73
- File.open(file, 'w') do |out|
74
- lines.each do |line|
75
- out.puts line
76
- end
77
- end
78
- when /~$/
79
- # Remove temporary files
80
- puts "Removing file #{file}"
81
- File.rm_f(file)
82
- end
83
- end
84
- end
85
-