ratch 0.3.0 → 0.4.0

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.
Files changed (132) hide show
  1. data/{log/history → CHANGES} +0 -0
  2. data/{log/todo → TODO} +0 -0
  3. data/bin/manifest +451 -0
  4. data/bin/ratch +3 -3
  5. data/demo/task/config.yaml +4 -0
  6. data/lib/ratch/{batch/argvutils.rb → dsl/argv.rb} +9 -4
  7. data/lib/ratch/dsl/batch.rb +226 -0
  8. data/lib/ratch/{batch → dsl}/build.rb +83 -4
  9. data/lib/ratch/{batch/consoleutils.rb → dsl/console.rb} +13 -5
  10. data/lib/ratch/{batch/emailutils.rb → dsl/email.rb} +21 -25
  11. data/lib/ratch/{batch/fileutils.rb → dsl/file.rb} +56 -56
  12. data/lib/ratch/dsl/meta.rb +132 -0
  13. data/lib/ratch/{batch → dsl}/options.rb +7 -5
  14. data/lib/ratch/dsl/setup.rb +124 -0
  15. data/lib/ratch/{support/signiture.rb → dsl/sign.rb} +9 -18
  16. data/lib/ratch/dsl/stage.rb +147 -0
  17. data/lib/ratch/dsl/task.rb +139 -0
  18. data/lib/ratch/{uploadutils.rb → dsl/upload.rb} +7 -5
  19. data/lib/ratch/{batch/task.rb → dsl/zip.rb} +30 -14
  20. data/lib/ratch/dsl.rb +52 -0
  21. data/lib/ratch/extra/email.rb +5 -0
  22. data/lib/ratch/extra/stage.rb +5 -0
  23. data/lib/ratch/extra/zip.rb +5 -0
  24. data/lib/ratch/manifest.rb +540 -0
  25. data/lib/ratch/{project → metadata}/information.rb +1 -0
  26. data/lib/ratch/{project → metadata}/package.rb +28 -2
  27. data/lib/ratch/{project → metadata}/project.rb +8 -16
  28. data/lib/ratch/{project → metadata}/release.rb +6 -6
  29. data/lib/ratch/support/errors.rb +4 -0
  30. data/lib/ratch/support/filename.rb +18 -0
  31. data/lib/ratch/toolset/ruby/compile +49 -0
  32. data/lib/ratch/toolset/ruby/pack/gem +26 -18
  33. data/lib/ratch/toolset/ruby/pack/tgz +25 -64
  34. data/lib/ratch/toolset/ruby/pack/zip +46 -0
  35. data/lib/ratch/toolset/ruby/publish +23 -24
  36. data/lib/ratch/toolset/ruby/release +8 -0
  37. data/lib/ratch/toolset/ruby/stamp +33 -0
  38. data/lib/ratch/toolset/sandbox +11 -0
  39. data/meta/MANIFEST +101 -23
  40. data/meta/ROLLRC +1 -1
  41. data/meta/config.yaml +10 -0
  42. data/meta/icli.yaml +2 -2
  43. data/meta/project.yaml +9 -10
  44. data/meta/xProjectInfo +41 -0
  45. data/task/release +1 -4
  46. metadata +82 -156
  47. data/demo/task/rdoc +0 -88
  48. data/demo/task/rdoc-old +0 -182
  49. data/doc/images/clipboard.jpg +0 -0
  50. data/doc/images/clipboard2.png +0 -0
  51. data/doc/images/milles-tn.jpg +0 -0
  52. data/doc/images/mints.png +0 -0
  53. data/doc/images/ratch2.png +0 -0
  54. data/doc/images/ruby-sm.png +0 -0
  55. data/doc/images/silver.gif +0 -0
  56. data/doc/images/toolbox.jpg +0 -0
  57. data/doc/index.html +0 -181
  58. data/doc/notes/original.rb +0 -308
  59. data/doc/rdoc/classes/Array.html +0 -194
  60. data/doc/rdoc/classes/Dir.html +0 -317
  61. data/doc/rdoc/classes/Hash.html +0 -217
  62. data/doc/rdoc/classes/Ratch/ArgvUtils/Ext.html +0 -285
  63. data/doc/rdoc/classes/Ratch/ArgvUtils.html +0 -173
  64. data/doc/rdoc/classes/Ratch/BatchFile.html +0 -207
  65. data/doc/rdoc/classes/Ratch/BatchManager.html +0 -250
  66. data/doc/rdoc/classes/Ratch/BatchScript.html +0 -127
  67. data/doc/rdoc/classes/Ratch/Batchable.html +0 -373
  68. data/doc/rdoc/classes/Ratch/Build.html +0 -321
  69. data/doc/rdoc/classes/Ratch/BuildManager.html +0 -319
  70. data/doc/rdoc/classes/Ratch/Buildable.html +0 -202
  71. data/doc/rdoc/classes/Ratch/ConfigUtils.html +0 -281
  72. data/doc/rdoc/classes/Ratch/ConsoleUtils.html +0 -189
  73. data/doc/rdoc/classes/Ratch/EmailUtils.html +0 -209
  74. data/doc/rdoc/classes/Ratch/FileUtils.html +0 -674
  75. data/doc/rdoc/classes/Ratch/GeneralOptions.html +0 -430
  76. data/doc/rdoc/classes/Ratch/Task.html +0 -201
  77. data/doc/rdoc/classes/Ratch/TaskManager.html +0 -330
  78. data/doc/rdoc/classes/Ratch/Taskable.html +0 -231
  79. data/doc/rdoc/classes/Ratch/UploadUtils.html +0 -566
  80. data/doc/rdoc/classes/Ratch.html +0 -201
  81. data/doc/rdoc/created.rid +0 -1
  82. data/doc/rdoc/files/COPYING.html +0 -1003
  83. data/doc/rdoc/files/README.html +0 -143
  84. data/doc/rdoc/files/lib/ratch/argvutils_rb.html +0 -131
  85. data/doc/rdoc/files/lib/ratch/batch_rb.html +0 -155
  86. data/doc/rdoc/files/lib/ratch/batchable_rb.html +0 -131
  87. data/doc/rdoc/files/lib/ratch/batchfile_rb.html +0 -148
  88. data/doc/rdoc/files/lib/ratch/buildable_rb.html +0 -131
  89. data/doc/rdoc/files/lib/ratch/consoleutils_rb.html +0 -131
  90. data/doc/rdoc/files/lib/ratch/emailutils_rb.html +0 -139
  91. data/doc/rdoc/files/lib/ratch/facets/multiglob_rb.html +0 -137
  92. data/doc/rdoc/files/lib/ratch/fileutils_rb.html +0 -139
  93. data/doc/rdoc/files/lib/ratch/options_rb.html +0 -131
  94. data/doc/rdoc/files/lib/ratch/taskable_rb.html +0 -131
  95. data/doc/rdoc/files/lib/ratch/uploadutils_rb.html +0 -150
  96. data/doc/rdoc/fr_class_index.html +0 -48
  97. data/doc/rdoc/fr_file_index.html +0 -41
  98. data/doc/rdoc/fr_method_index.html +0 -133
  99. data/doc/rdoc/index.html +0 -24
  100. data/doc/rdoc/rdoc-style.css +0 -208
  101. data/doc/scrap/flexihead-flip.jpg +0 -0
  102. data/doc/scrap/flexihead.jpg +0 -0
  103. data/doc/scrap/head1.jpg +0 -0
  104. data/doc/scrap/ratch.jpg +0 -0
  105. data/doc/scrap/ratch1.png +0 -0
  106. data/doc/scrap/ratch2.jpg +0 -0
  107. data/doc/scrap/ratch3.png +0 -0
  108. data/doc/scrap/red-ratch.jpg +0 -0
  109. data/doc/scrap/redratchet.jpg +0 -0
  110. data/doc/scrap/ruby-kit/ruby.png +0 -0
  111. data/doc/scrap/scrap.red +0 -256
  112. data/doc/sitemap.yaml +0 -10
  113. data/doc/siteparts/index.red +0 -100
  114. data/doc/siteparts/layout.rhtml +0 -56
  115. data/doc/siteparts/tutorial.red +0 -578
  116. data/doc/style.css +0 -112
  117. data/doc/tutorial.html +0 -722
  118. data/lib/ratch/batch.rb +0 -488
  119. data/lib/ratch/support/setuputils.rb +0 -124
  120. data/lib/ratch/support/stage.rb +0 -292
  121. data/lib/ratch/toolset/ruby/rdoc +0 -88
  122. data/task/rdoc +0 -6
  123. data/work/old/batchfile.rb +0 -95
  124. data/work/project-old.rb +0 -67
  125. data/work/scrap/install +0 -89
  126. data/work/scrap/install.0 +0 -49
  127. data/work/scrap/install.1 +0 -63
  128. data/work/scrap/ludo +0 -25
  129. data/work/scrap/oldtaskable.rb +0 -573
  130. data/work/scrap/ratch.man +0 -39
  131. data/work/scrap/taskable-simple.rb +0 -42
  132. data/work/scrap/taskable.rb +0 -120
@@ -1,292 +0,0 @@
1
- # = TITLE:
2
- #
3
- # Build
4
- #
5
- # = COPYING:
6
- #
7
- # Copyright (c) 2007 Psi T Corp.
8
- #
9
- # This file is part of the ProUtils' Box program.
10
- #
11
- # Box is free software: you can redistribute it and/or modify
12
- # it under the terms of the GNU General Public License as published by
13
- # the Free Software Foundation, either version 3 of the License, or
14
- # (at your option) any later version.
15
- #
16
- # Box is distributed in the hope that it will be useful,
17
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- # GNU General Public License for more details.
20
- #
21
- # You should have received a copy of the GNU General Public License
22
- # along with Box. If not, see <http://www.gnu.org/licenses/>.
23
-
24
- require 'fileutils'
25
- require 'facets/string/lchomp'
26
- require 'facets/hash/rekey'
27
- require 'facets/hash/slice'
28
-
29
- require 'box/buildutils'
30
-
31
- module Box
32
-
33
- # Error when attempting to overwrite prexisting package.
34
- # Presently this is triggered by the existance of the stage
35
- # directory, not any specific package file.
36
-
37
- class OverwriteError < Exception
38
- end
39
-
40
- # Build packages for a given platform. It servers as the basis
41
- # of all package building for Box. It does this by first staging
42
- # the package, ie. hard linking it to the store location,
43
- # then it generates each package format from it.
44
-
45
- class Build
46
-
47
- include BuildUtils
48
-
49
- attr_reader :location
50
-
51
- attr_reader :project
52
-
53
- attr_reader :release
54
-
55
- #attr_reader :build
56
-
57
- # General options. These are parsed and then passed on to the per-format builders.
58
- # TODO: Fully enforce the dryrun and force options.
59
- attr_reader :options
60
-
61
- # Whether to include all files, not just manifests.
62
- #attr_reader :all
63
-
64
- # New package builder.
65
- #
66
- # INPUT:
67
- # location Project location
68
- # project Project metadata
69
- # release Release metadata, eg. version number.
70
- # build Build data hash. This generally differs b/c of platform binary builds.
71
- # options Overrides and runtime options.
72
- #
73
- # Options can be
74
- # types/formats Override build specified types
75
- # store Override build specified store
76
- # force Force build (overwrite old build of same name)
77
- # dryrun Dry-run mode (NOT YET FULLY ENFORCED!)
78
-
79
- def initialize(location, project, release, build, options={})
80
- @location = location
81
-
82
- # per-build project
83
- project = project.clone
84
- project.update(build)
85
-
86
- @project = project
87
- @release = release
88
- @options = options
89
-
90
- assert_valid
91
- end
92
-
93
- #
94
-
95
- def assert_valid
96
- raise "missing location" unless location
97
- raise "missing project" unless project
98
- raise "missing release" unless release
99
- end
100
-
101
- #
102
-
103
- def package
104
- @package ||= (
105
- package = project.instance_data
106
- #package.update(build)
107
- package[:release] = release
108
- package[:filelist] = project.filelist
109
- #package.rekey!
110
- Package.new(location, package)
111
- )
112
- end
113
-
114
- # Force otherwise protected operations.
115
-
116
- def force? ; @options[:force] ; end
117
-
118
- # Dryrun mode? (NOT FULLY ENFORCED YET)
119
-
120
- def dryrun? ; @options[:dryrun] ; end
121
-
122
- # Which package formats to create.
123
-
124
- def formats
125
- @formats ||= (
126
- [project.formats].flatten.collect{ |f| f.to_s.downcase.lchomp('.') }
127
- )
128
- end
129
-
130
- # Where to store the created package(s).
131
-
132
- def store
133
- @project.store
134
- end
135
-
136
- # # Template for stage directory name. Defaults to "%s-%s" for name-version or
137
- # # "%s-%s-%s for name-version-platform."
138
- # #
139
- # def stage_name
140
- # #@stage_name ||= project.stage_name
141
- # end
142
-
143
- # Where to stage the build.
144
-
145
- def stage_directory
146
- @stage_directory ||= File.join(store, stage_name)
147
- end
148
-
149
- # Create package(s).
150
-
151
- def generate
152
- generate_extensions
153
- generate_stage
154
- generate_manifest
155
- generate_packages
156
- end
157
-
158
- # Compile binary extensions -- shell out to compile script if given.
159
- # This is used when creating binary packages.
160
-
161
- def generate_extensions
162
- compile = project.compile
163
- return unless compile
164
- #begin
165
- sh compile
166
- #rescue
167
- #end
168
- end
169
-
170
- # Prepare stage.
171
-
172
- def generate_stage
173
- return stage_directory if dryrun? # Don't link to stage if dryrun.
174
-
175
- clear_stage
176
- mkdir_p(stage_directory) #dir = File.expand_path(stage)
177
-
178
- # TODO Dryrun test here or before folder creation?
179
- files.each do |f| # Link files into staging area.
180
- file = File.join(stage_directory, f)
181
- if File.directory?(f)
182
- mkdir_p(file)
183
- else
184
- unless File.exist?(file) and File.mtime(file) >= File.mtime(f)
185
- ln(f, file) #safe_ln ?
186
- end
187
- end
188
- end
189
- return stage_directory
190
- end
191
-
192
- # Clear old stage, if any.
193
-
194
- def clear_stage
195
- if File.directory?(stage_directory) # Ensure existance of staging area
196
- raise(OverwriteError, stage_directory) unless force?
197
- rm_r(stage_directory)
198
- end
199
- end
200
-
201
- # TODO Build manifest
202
-
203
- def generate_manifest
204
- end
205
-
206
- # Build packages.
207
- # TODO Move this to Manager ?
208
-
209
- def generate_packages
210
- package_files = formats.collect do |format|
211
- #format = clean_type(format)
212
- say '' if format == 'gem' # FIXME This is here b/c Gems outputs on it's own.
213
- file = create_package(format)
214
- unless dryrun? or (format == 'gem')
215
- report_package_built(format, file) if file
216
- end
217
- file
218
- end
219
- report_packaging_complete(package_files.size)
220
- end
221
-
222
- # Create package.
223
-
224
- def create_package(type)
225
- package.format = type
226
-
227
- builder_class = FormatBuilder.registry[type]
228
- builder = builder_class.new(package, stage_directory, options)
229
- file = builder.build
230
-
231
- transfer(file) unless dryrun?
232
-
233
- return file
234
- end
235
-
236
- # Stage name.
237
-
238
- def stage_name
239
- name = package.name
240
- p name
241
- version = package.version
242
- platform = package.platform #arch
243
- buildno = package.buildno
244
-
245
- if project.stage
246
- template = project.stage
247
- else
248
- template = platform ? "%s-%s-%s" : "%s-%s"
249
- end
250
-
251
- if buildno # TODO Make this better.
252
- buildno = Time.now.strftime("%H*60+%M")
253
- version = "#{version}.#{buildno}"
254
- end
255
-
256
- template % [ name, version, platform ]
257
- end
258
-
259
- # Files to be included in package.
260
-
261
- def files
262
- project.filelist #+ [package.manifest_file]
263
- end
264
-
265
- # Transfer package file to storage location.
266
-
267
- def transfer(file)
268
- dest = File.join(store, File.basename(file)) # move to store, unless already there
269
- dest = File.expand_path(dest)
270
- mv(file, store) unless file == dest
271
- end
272
-
273
- # Report that a package has been built.
274
-
275
- def report_package_built(type, file)
276
- r = ''
277
- r << "\n Successfully built #{type}"
278
- r << "\n Name: #{package.name}"
279
- r << "\n Version: #{package.version}"
280
- r << "\n File: #{File.basename(file)}"
281
- say r
282
- end
283
-
284
- # Report that packaging is complete.
285
-
286
- def report_packaging_complete(size)
287
- say "\nSuccessfully built #{size} packages at #{store}/."
288
- end
289
-
290
- end
291
-
292
- end
@@ -1,88 +0,0 @@
1
- #!/usr/bin/env ratch
2
-
3
- # generate rdocs
4
- #
5
- # Generate Rdoc documentation. Settings are
6
- # the same as the rdoc command's options.
7
-
8
- main :rdoc do
9
- config, output, input = *rdoc_configuration
10
-
11
- file output => input do
12
- rdoc_target(config)
13
- end
14
-
15
- file 'README' do
16
- puts "OH YEH README"
17
- end
18
-
19
- build output
20
- end
21
-
22
- # Document target.
23
-
24
- def rdoc_target(config)
25
- output = config['op']
26
- input = config.delete('include')
27
-
28
- # Check for 'doc' directory.
29
- # (Helps to ensure we're in the right place.)
30
- #dir!(File.dirname(site))
31
-
32
- # Remove old rdocs.
33
- rm_r(output) if exist?(output) and safe?(output)
34
-
35
- #input = input.collect{ |i| glob(i) }.flatten
36
- vector = [input, config]
37
- rdoc(vector.to_console)
38
-
39
- insert_ads(output)
40
- end
41
-
42
- # Collect RDocs configuration.
43
-
44
- def rdoc_configuration
45
- config = configuration['rdoc'] || {}
46
-
47
- config = {
48
- 'template' => 'html',
49
- 'op' => 'doc/rdoc',
50
- 'merge' => true,
51
- 'inline-source' => true,
52
- 'exclude' => [],
53
- 'include' => ['lib', '[A-Z]*']
54
- }.merge(config)
55
-
56
- if config['output']
57
- config['op'] = config.delete('output')
58
- end
59
-
60
- output = config['op']
61
-
62
- input = config['include'].collect do |i|
63
- dir?(i) ? File.join(i,'**','*') : i
64
- end
65
-
66
- return config, output, input
67
- end
68
-
69
- # Insert an ad if available.
70
-
71
- def insert_ads(site)
72
- adfile = configuration['ad_file'] || 'meta/site_ad.html'
73
- return unless adfile && File.file?(adfile)
74
- adtext = File.read(adfile)
75
- #puts
76
- dirs = Dir.glob(File.join(site,'*/'))
77
- dirs.each do |dir|
78
- files = Dir.glob(File.join(dir, '**/*.html'))
79
- files.each do |file|
80
- html = file_read(file)
81
- bodi = html.index('<body>')
82
- html[bodi + 7] = "\n" + adtext
83
- #print "Augmenting #{file}..."
84
- file_write(file, html) unless dryrun?
85
- #puts "[done]"
86
- end
87
- end
88
- end
data/task/rdoc DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ratch
2
-
3
- # generater rdocs
4
-
5
- load('ratch/toolset/ruby/rdoc')
6
-
@@ -1,95 +0,0 @@
1
- # TITLE:
2
- #
3
- # BatchFile
4
- #
5
- # COPYING:
6
- #
7
- # Copyright (c) 2007 Psi T Corp.
8
- #
9
- # This file is part of the ProUtils' Ratch program.
10
- #
11
- # Ratch is free software: you can redistribute it and/or modify
12
- # it under the terms of the GNU General Public License as published by
13
- # the Free Software Foundation, either version 3 of the License, or
14
- # (at your option) any later version.
15
- #
16
- # Ratch is distributed in the hope that it will be useful,
17
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- # GNU General Public License for more details.
20
- #
21
- # You should have received a copy of the GNU General Public License
22
- # along with Ratch. If not, see <http://www.gnu.org/licenses/>.
23
-
24
- #require 'shellwords'
25
- require 'yaml'
26
- require 'rbconfig' # replace with facets/rbsystem in future ?
27
- #require 'facets/hash/merge' # for reverse_merge
28
-
29
- require 'ratch/options'
30
-
31
- require 'ratch/consoleutils'
32
- require 'ratch/configutils'
33
- require 'ratch/emailutils'
34
- require 'ratch/fileutils'
35
- require 'ratch/argvutils'
36
-
37
- require 'ratch/taskable'
38
- require 'ratch/buildable'
39
- require 'ratch/batchable'
40
-
41
-
42
- module Ratch
43
-
44
- # Batch File class, is used as an executionm context for a
45
- # ratch script.
46
-
47
- class BatchFile < Module
48
-
49
- include GeneralOptions
50
-
51
- include ConsoleUtils
52
- include ArgvUtils
53
- include FileUtils
54
- include ConfigUtils
55
- include EmailUtils
56
-
57
- include Buildable
58
- include Taskable
59
- include Batchable
60
-
61
- # Quick start, equivalent to calling new.run(file).
62
-
63
- #def self.start(file)
64
- # new(file).call
65
- #end
66
-
67
- # New Batch File
68
-
69
- def initialize(file)
70
- abort "missing batch file -- #{file}" unless File.file?(file)
71
- @file = file
72
- end
73
-
74
- # TODO What todo about arguments?
75
-
76
- def call(arguments=nil)
77
- script = File.read($0 = @file)
78
- puts script
79
- p $0
80
- puts
81
- eval(script, binding, $0) #instance_eval(script)
82
- #@main.call if @main
83
- task_manager.call_main
84
- #run(:main) if task_manager.main
85
- end
86
-
87
- end
88
-
89
- end
90
-
91
- # Load TaskUtils directly into to main runspace.
92
-
93
- #class << self
94
- # include TaskUtils
95
- #end
data/work/project-old.rb DELETED
@@ -1,67 +0,0 @@
1
- # = TITLE:
2
- #
3
- # Project
4
- #
5
- # = COPYING:
6
- #
7
- # Copyright (c) 2007 Psi T Corp.
8
- #
9
- # This file is part of the ProUtils' Box program.
10
- #
11
- # Box is free software: you can redistribute it and/or modify
12
- # it under the terms of the GNU General Public License as published by
13
- # the Free Software Foundation, either version 3 of the License, or
14
- # (at your option) any later version.
15
- #
16
- # Box is distributed in the hope that it will be useful,
17
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- # GNU General Public License for more details.
20
- #
21
- # You should have received a copy of the GNU General Public License
22
- # along with Box. If not, see <http://www.gnu.org/licenses/>.
23
-
24
- require 'facets/filelist'
25
- require 'box/general'
26
-
27
-
28
- module Box
29
-
30
- # Project Class
31
- #
32
- # The Project class contains three sets of metadata. The first is the
33
- # typical general information about a project --title, description, homepage, etc.
34
- # This information is essentially static. Once set, it will probably never vary.
35
- # The second is default packaging informaiton. These both come from the General base
36
- # class. The third set is default build information, which may vary well for various
37
- # packages types, as this information may need to be overridden for specific
38
- # platform builds and package formats. This information describes how to
39
- # pack this project into various packages. Hecne it does not belong to the Package
40
- # class itself.
41
-
42
- class Project < General
43
-
44
-
45
- # # Package formats to create (tar.gz, zip, gem, deb, etc.)
46
- # # Defaults to 'zip' since it's the most universal.
47
- # #
48
- # # TODO: Fewer name choices please!!!
49
- #
50
- # attr_accessor :format, :formats, :type, :types do
51
- # @format || ['zip']
52
- # end
53
- #
54
- # # Where to store package files. Defaults to +pkg/.
55
- # attr_accessor :store do
56
- # @store || 'pkg'
57
- # end
58
- #
59
- # # Where to stage a package.
60
- # attr_accessor :stage # do
61
- # # @stage || name-verison-platform
62
- # #end
63
-
64
-
65
- end
66
-
67
- end
data/work/scrap/install DELETED
@@ -1,89 +0,0 @@
1
- # Magic Rollerball Installer
2
- #
3
- #
4
-
5
- PROJECT_NAME = 'multiton'
6
- PROJECT_VERSION = '2.1.0'
7
-
8
- ##################
9
-
10
- require 'fileutils'
11
- require 'rbconfig'
12
-
13
- include FileUtils::DryRun
14
-
15
-
16
- rubyprefix = Config::CONFIG['prefix']
17
- sitelibdir = Config::CONFIG['sitelibdir']
18
-
19
-
20
- PREFIX = ENV['PREFIX'] || rubyprefix
21
-
22
- RUBYLIB = if PREFIX == rubyprefix then
23
- sitelibdir
24
- else
25
- File.join(PREFIX, sitelibdir[rubyprefix.size..-1])
26
- end
27
-
28
- ROLLLIB = File.join(File.dirname(RUBYLIB), "rolls", File.basename(RUBYLIB))
29
-
30
- RUBY_DEBUG = ENV['RUBY_DEBUG']
31
- RUBY_FLAGS = ENV['RUBY_FLAGS'] ||
32
- "-w -I#{%w(lib ext bin test).join(File::PATH_SEPARATOR)}" +
33
- (RUBY_DEBUG ? " #{RUBY_DEBUG}" : '')
34
-
35
- p PREFIX
36
- p RUBYLIB
37
- p ROLLLIB
38
- #p RUBY_DEBUG
39
- #p RUBY_FLAGS
40
-
41
- HERE = File.expand_path(File.dirname(__FILE__))
42
- DEST = File.join(ROLLLIB, PROJECT_NAME, PROJECT_VERSION)
43
-
44
- files = Dir.glob("**/*")
45
- files -= Dir.glob("INSTALL")
46
- files -= Dir.glob("pkg/**/*") + ['pkg']
47
-
48
- p HERE
49
- p DEST
50
- p files
51
-
52
- mkdir_p DEST unless test ?d, DEST
53
-
54
-
55
- # Install libs
56
-
57
- def project_install(files)
58
- bin_files = files.grep(/^bin/)
59
-
60
- (files - bin_files).each do |file|
61
- install file, DEST, :mode => 0444
62
- end
63
-
64
- bin_files.each do |file|
65
- install file, DEST, :mode => 0555
66
- end
67
- end
68
-
69
-
70
- # Change modes
71
-
72
- def project_chmod(files)
73
- bin_files = Files.grep(/^bin/)
74
-
75
- (files - bin_files).each do |file|
76
- chmod File.join(DEST, file), 0444
77
- end
78
-
79
- bin_files.each do |file|
80
- chmod File.join(DEST, file), 0555
81
- end
82
- end
83
-
84
-
85
- if HERE == DEST
86
- project_chmod(files)
87
- else
88
- project_install(files)
89
- end
data/work/scrap/install.0 DELETED
@@ -1,49 +0,0 @@
1
- #!/usr/bin/env ratch
2
-
3
- # install package to site_ruby
4
-
5
- # This tool installs the package to site_ruby
6
- # using Ruby's defualt configuration settings.
7
- # If you want to change these you can can supply
8
- # config settings for 'prefix' and/or 'sitedir'.
9
-
10
- system_prefix = Config::CONFIG['prefix']
11
- system_libdir = Config::CONFIG['sitelibdir']
12
-
13
- config = config_load('install')
14
-
15
- prefix = config['prefix'] || system_prefix
16
- libdir = config['libdir']
17
-
18
- unless libdir
19
- if (prefix == system_prefix) then
20
- libdir = system_libdir
21
- else
22
- libdir = File.join(prefix, system_libdir[system_prefix.size..-1])
23
- end
24
- end
25
-
26
- # TODO Probably should get files from manifest, if it exists.
27
- # files = projectinfo.filelist
28
- files = Dir.glob("{lib,ext,bin}/**/*").select{ |f| file?(f) }
29
-
30
- lib_files = files.grep(/^(lib|ext)/)
31
- bin_files = files.grep(/^bin/)
32
-
33
- # Copy files to proper locations.
34
-
35
- lib_files.each do |file|
36
- dest = File.dirname(file).sub('lib/', '')
37
- dest = File.join(libdir, dest)
38
- #dest.sub!(/(core|more)\//, '') # SPECIAL FOR FACETS !!!!!
39
- mkdir_p dest unless dir?(dest)
40
- install file, dest, :mode => 0444
41
- end
42
-
43
- bin_files.each do |file|
44
- dest = File.dirname(file)
45
- dest = File.join(prefix, dest)
46
- mkdir_p dest unless dir?(dest)
47
- install file, dest, :mode => 0555
48
- end
49
-