ratch 0.1 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,10 +19,8 @@ require 'ratch/consoleutils'
19
19
  require 'ratch/configutils'
20
20
  require 'ratch/emailutils'
21
21
  require 'ratch/fileutils'
22
+ require 'ratch/argvutils'
22
23
  require 'ratch/taskable'
23
- require 'ratch/runnable'
24
-
25
-
26
24
 
27
25
  module Ratch
28
26
 
@@ -32,13 +30,12 @@ module Ratch
32
30
  include GeneralOptions
33
31
 
34
32
  include ConsoleUtils
33
+ include ArgvUtils
35
34
  include FileUtils
36
35
  include ConfigUtils
37
36
  include EmailUtils
38
37
 
39
38
  include Taskable
40
- include Runnable
41
- include OpenRunnable
42
39
  end
43
40
 
44
41
  end
@@ -1,20 +1,24 @@
1
1
  # -x doc -x pkg
2
- LICENSE.txt
3
- README.txt
2
+ LICENSE
3
+ README
4
4
  bin
5
5
  bin/lt
6
6
  bin/ludo
7
7
  bin/ratch
8
8
  data
9
- data/mint
10
- data/mint/ratch
11
- data/mint/ratch/announce
12
- data/mint/ratch/install
13
- data/mint/ratch/notes
14
- data/mint/ratch/publish
15
- data/mint/ratch/rdoc
16
- data/mint/ratch/setup
17
- data/mint/ratch/stats
9
+ data/ratch
10
+ data/ratch/rubyproject
11
+ data/ratch/rubyproject/announce
12
+ data/ratch/rubyproject/extest
13
+ data/ratch/rubyproject/install
14
+ data/ratch/rubyproject/install2
15
+ data/ratch/rubyproject/install3
16
+ data/ratch/rubyproject/load
17
+ data/ratch/rubyproject/notes
18
+ data/ratch/rubyproject/publish
19
+ data/ratch/rubyproject/rdoc
20
+ data/ratch/rubyproject/setup
21
+ data/ratch/rubyproject/stats
18
22
  demo
19
23
  demo/README
20
24
  demo/doc
@@ -41,29 +45,28 @@ demo/util/one
41
45
  demo/util/rdoc
42
46
  demo/util/tryme
43
47
  dev
48
+ dev/install
49
+ dev/ludo
50
+ dev/oldtaskable.rb
44
51
  dev/taskable-simple.rb
45
52
  dev/taskable.rb
46
53
  lib
47
54
  lib/ratch
55
+ lib/ratch/argvutils.rb
48
56
  lib/ratch/batch.rb
49
- lib/ratch/cli
50
- lib/ratch/cli/lt.rb
51
- lib/ratch/cli/ludo.rb
52
- lib/ratch/cli/ratch.rb
57
+ lib/ratch/batchable.rb
58
+ lib/ratch/buildable.rb
53
59
  lib/ratch/configutils.rb
54
60
  lib/ratch/consoleutils.rb
55
61
  lib/ratch/emailutils.rb
56
62
  lib/ratch/fileutils.rb
57
63
  lib/ratch/options.rb
58
- lib/ratch/runnable.rb
59
64
  lib/ratch/taskable.rb
60
65
  lib/ratch/taskutils.rb
61
66
  lib/ratch/uploadutils.rb
62
67
  meta
63
- meta/manifest.txt
64
- meta/project.yaml
65
- misc
66
- misc/original.rb
68
+ meta/MANIFEST
69
+ meta/RATCH-0.2.1.roll
67
70
  task
68
71
  task/setup
69
72
  task/stats
@@ -6,8 +6,6 @@ description: >
6
6
  Ratch is batch file system suitable for creating project build scripts
7
7
  and any variety of command line utilities.
8
8
 
9
- project : ratch
10
- version : '0.1'
11
9
  author : Thomas Sawyer <transfire@gmail.com>
12
10
  created : "2007-08-09"
13
11
  homepage : "http://proutils.rubyforge.org"
@@ -22,3 +20,7 @@ rubyforge:
22
20
  username : transami
23
21
  groupid : 4411
24
22
  package : ratch
23
+
24
+ lib_path:
25
+ - lib/ratch
26
+
metadata CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: ratch
5
5
  version: !ruby/object:Gem::Version
6
- version: "0.1"
7
- date: 2007-09-09 00:00:00 -07:00
6
+ version: 0.2.1
7
+ date: 2007-10-29 00:00:00 -04:00
8
8
  summary: Ruby-based Batch Fils
9
9
  require_paths:
10
10
  - lib
11
11
  email: Thomas Sawyer <transfire@gmail.com>
12
12
  homepage: http://proutils.rubyforge.org
13
13
  rubyforge_project:
14
- description: Ratch is batch file system suitable for creating project build scripts and any variety of command line utilities.
14
+ description: Ruby-based Batch Fils
15
15
  autorequire:
16
16
  default_executable:
17
17
  bindir: bin
@@ -29,22 +29,26 @@ post_install_message:
29
29
  authors:
30
30
  - Thomas Sawyer <transfire@gmail.com>
31
31
  files:
32
- - LICENSE.txt
33
- - README.txt
32
+ - LICENSE
33
+ - README
34
34
  - bin
35
35
  - bin/lt
36
36
  - bin/ludo
37
37
  - bin/ratch
38
38
  - data
39
- - data/mint
40
- - data/mint/ratch
41
- - data/mint/ratch/announce
42
- - data/mint/ratch/install
43
- - data/mint/ratch/notes
44
- - data/mint/ratch/publish
45
- - data/mint/ratch/rdoc
46
- - data/mint/ratch/setup
47
- - data/mint/ratch/stats
39
+ - data/ratch
40
+ - data/ratch/rubyproject
41
+ - data/ratch/rubyproject/announce
42
+ - data/ratch/rubyproject/extest
43
+ - data/ratch/rubyproject/install
44
+ - data/ratch/rubyproject/install2
45
+ - data/ratch/rubyproject/install3
46
+ - data/ratch/rubyproject/load
47
+ - data/ratch/rubyproject/notes
48
+ - data/ratch/rubyproject/publish
49
+ - data/ratch/rubyproject/rdoc
50
+ - data/ratch/rubyproject/setup
51
+ - data/ratch/rubyproject/stats
48
52
  - demo
49
53
  - demo/README
50
54
  - demo/doc
@@ -71,29 +75,28 @@ files:
71
75
  - demo/util/rdoc
72
76
  - demo/util/tryme
73
77
  - dev
78
+ - dev/install
79
+ - dev/ludo
80
+ - dev/oldtaskable.rb
74
81
  - dev/taskable-simple.rb
75
82
  - dev/taskable.rb
76
83
  - lib
77
84
  - lib/ratch
85
+ - lib/ratch/argvutils.rb
78
86
  - lib/ratch/batch.rb
79
- - lib/ratch/cli
80
- - lib/ratch/cli/lt.rb
81
- - lib/ratch/cli/ludo.rb
82
- - lib/ratch/cli/ratch.rb
87
+ - lib/ratch/batchable.rb
88
+ - lib/ratch/buildable.rb
83
89
  - lib/ratch/configutils.rb
84
90
  - lib/ratch/consoleutils.rb
85
91
  - lib/ratch/emailutils.rb
86
92
  - lib/ratch/fileutils.rb
87
93
  - lib/ratch/options.rb
88
- - lib/ratch/runnable.rb
89
94
  - lib/ratch/taskable.rb
90
95
  - lib/ratch/taskutils.rb
91
96
  - lib/ratch/uploadutils.rb
92
97
  - meta
93
- - meta/manifest.txt
94
- - meta/project.yaml
95
- - misc
96
- - misc/original.rb
98
+ - meta/MANIFEST
99
+ - meta/RATCH-0.2.1.roll
97
100
  - task
98
101
  - task/setup
99
102
  - task/stats
data/README.txt DELETED
@@ -1,10 +0,0 @@
1
- == Ruby Ratchets
2
-
3
- Ratchets is a build tool, like make, ant, maven, rake, rant, et al.
4
-
5
- Ratchets is designed in such a way as to provided core functionality is a set
6
- of reusable build libraries. So indifferent to it's build system functionaility,
7
- one can completely set that aside and just use it as a resource of one's own
8
- applications. For instance, if you prefere rake as a build tool, you can still
9
- take advantage of Ratchets' library in your rake tasks.
10
-
@@ -1,44 +0,0 @@
1
- #!/usr/bin/env ratch
2
-
3
- # publish website to rubyforge
4
-
5
- # This task publishes the source dir (deafult doc/)
6
- # to a rubyforge website.
7
-
8
- config = config_load('publish')
9
-
10
- project = config['project']
11
- subdir = config['subdir']
12
- source = config['source'] || %w{web site doc}.find{|f| dir?(f)}
13
- username = config['username']
14
- protect = %w{usage statcvs statsvn robot.txt wiki}
15
- exclude = %w{.svn}
16
-
17
- abort("no project name") unless project
18
- abort("no username") unless username
19
- abort("no source dir") unless source
20
-
21
- if subdir
22
- destination = File.join(project, subdir)
23
- else
24
- destination = project
25
- end
26
-
27
- dir = source.chomp('/') + '/'
28
- url = "#{username}@rubyforge.org:/var/www/gforge-projects/#{destination}"
29
-
30
- # maybe -p ?
31
- op = ['-rLvz', '--delete']
32
- if File.file?(File.join(source,'.rsync-filter'))
33
- op << "--filter='dir-merge #{source}/.rsync-filter'"
34
- else
35
- op.concat exclude.map{|e| "--filter='- #{e}'"}
36
- op.concat protect.map{|e| "--filter='P #{e}'"}
37
- end
38
-
39
- args = op + [dir, url]
40
-
41
- #cd source do
42
- rsync *args
43
- #end
44
-
data/lib/ratch/cli/lt.rb DELETED
@@ -1,56 +0,0 @@
1
- #! /usr/bin/ruby1.8
2
-
3
- # scan task scripts for descriptions
4
-
5
- def script_desc( dir )
6
- help = {}
7
- files = Dir.glob( File.join( dir, '*' ) )
8
- files.each do |fname|
9
- next if FileTest.directory?( fname )
10
- next unless FileTest.executable?( fname )
11
- desc = ''
12
- File.open(fname) do |f|
13
- line = ''
14
- until f.eof?
15
- line = f.gets
16
- case line
17
- when /^(#!|\s*$)/
18
- next
19
- when /^\s*#(.*)/
20
- desc = $1.strip; break
21
- else
22
- desc = nil; break
23
- end
24
- end
25
- end
26
- help[File.basename(fname)] = desc
27
- end
28
- help
29
- end
30
-
31
- def show( dir )
32
- tasks = script_desc( dir )
33
- max = tasks.keys.max{ |a,b| a.size <=> b.size }.size
34
- if dir == ''
35
- max += 4 + 2
36
- else
37
- max += dir.size + 2
38
- end
39
- tasks.each do |name, sum|
40
- #sum = Sake.help_summary( type )
41
- if dir == ''
42
- cmd = "sake #{name}"
43
- else
44
- cmd = File.join( dir.chomp('/'), name )
45
- end
46
- puts "%-#{max}s # %s" % [cmd, sum]
47
- end
48
- end
49
-
50
- dir = ARGV[0] || '.'
51
-
52
- if File.directory?( dir )
53
- show( dir )
54
- else
55
- puts "#{dir} is not a directory"
56
- end
@@ -1,14 +0,0 @@
1
- #! /usr/bin/ruby1.8
2
-
3
- require 'facets/filetest'
4
-
5
- name = ARGV[0]
6
-
7
- if name
8
- Dir.chdir '..' until FileTest.executable?(name) or FileTest.root?(Dir.pwd)
9
- if FileTest.executable?( name )
10
- system name
11
- end
12
- else
13
- puts "Script #{name} not found."
14
- end
@@ -1,47 +0,0 @@
1
- #require 'shellwords'
2
- require 'rbconfig' # replace with facets/rbsystem in future ?
3
- require 'ratch/batch'
4
-
5
- module Ratch
6
-
7
- class RatchCommand
8
-
9
- # Quick start.
10
-
11
- def self.start(file)
12
- new.run(file)
13
- end
14
-
15
- # Run task.
16
-
17
- def run(file)
18
- if file
19
- BatchFile.new(file).call
20
- else
21
- help
22
- end
23
- end
24
-
25
- # Dispaly help.
26
-
27
- def help
28
- help = <<-END
29
- USAGE:
30
-
31
- ratch [options] <taskfile>
32
-
33
- OPTIONS:
34
-
35
- --dryrun --nohram
36
-
37
- --trace
38
-
39
- --debug
40
- END
41
- puts help.gsub(/^\s+/, '')
42
- end
43
-
44
- end
45
-
46
-
47
- end
data/misc/original.rb DELETED
@@ -1,308 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- PKG_TITLE = 'WhiteCloth'
4
- PKG_NAME = 'whitecloth'
5
- PKG_VERSION = '1'
6
- PKG_AUTHOR = 'Thomas Sawyer'
7
- PKG_EMAIL = 'transami@runbox.com'
8
- PKG_SUMMARY = 'WhiteCloth is an implementation of ArtML'
9
- PKG_DESCRIPTION = 'WhiteCloth is a Ruby implementation of ArtML'
10
-
11
- # site info
12
- # remark out if you don't need
13
- PKG_HOMEPAGE = 'http://whitecloth.rubyforge.org'
14
- PKG_RUBYFORGE_PROJECT = 'whitecloth'
15
- PKG_RUBYFORGE_PASS = nil
16
-
17
- # all package files
18
- PKG_FILES = [ 'lib/**/*', 'test/**/*', 'samples/**/*', 'doc/**/*', '[A-Z]*', 'Rakefile' ]
19
-
20
- # rdoc
21
- RDOC_TITLE = PKG_TITLE
22
- RDOC_DIR = 'doc'
23
- RDOC_TEMPLATE = 'kilmer'
24
- RDOC_OPTIONS = ''
25
- RDOC_INCLUDE = [ 'VERSION', 'README', 'CHANGELOG', 'TODO', 'COPYING', 'lib/**/*.rb', 'bin/**/*.rb' ]
26
- RDOC_EXCLUDE = []
27
-
28
- # include in distribution
29
- PKG_DIST_DIRS = [ 'bin', 'lib', 'test', 'samples' ]
30
- PKG_DIST_FILES = [ 'README', 'TODO', 'CHANGELOG', 'VERSION', 'LICENSE', 'Rakefile' ]
31
-
32
- # tests
33
- PKG_TEST_DIR = 'test'
34
- PKG_TEST_FILES = [ 'test/*_test.rb', 'test/**/*_test.rb' ]
35
-
36
- =begin
37
- # library files for manual install
38
- PKG_LIB_DIR = 'lib'
39
- PKG_LIB_MKDIRS = '**/*/'
40
- PKG_LIB_FILES = [ '**/*.rb', '**/*.yaml' ]
41
- PKG_LIB_DEPRECATE = []
42
-
43
- # binary files for manual install
44
- PKG_BIN_DIR = 'bin'
45
- PKG_BIN_FILES = '**/*'
46
- PKG_BIN_DEPRECATE = []
47
- =end
48
-
49
- #***************************************************************************
50
- # The PackMule Rakefile v0.1
51
- # PackMule can run tests, build packages and gems, manually install,
52
- # generate rdocs, and publish them. CVS support might be added later.
53
- #
54
- # In general, layout your project directory as follows:
55
- # - lib/
56
- # - lib/#{lib_name}/ if you need a lib dir
57
- # - bin/
58
- # - test/
59
- # - demo/ -or- examples/ -or- samples/
60
- # - doc/ -and;or- rdoc/
61
- # The test dir can have subdirs, but tests should be named
62
- # like '#{name}_test.rb' or 'test_#{name}.rb'.
63
- #
64
- # Then use the Rake.yaml config file designed for this form.
65
- # To get a blank config for this form type:
66
- # > rake form
67
- # This will send the form to stdout. There may be a line like
68
- # "(in ...)" at the beginning, just remove it or remark it.
69
- #***************************************************************************
70
-
71
- require 'rake'
72
- require 'rubygems'
73
- require 'rake/testtask'
74
- require 'rake/rdoctask'
75
- require 'rake/packagetask'
76
- require 'rake/gempackagetask'
77
- require 'rake/contrib/rubyforgepublisher'
78
-
79
- #################################################
80
- # load config from Rake.yaml and make constants #
81
- #################################################
82
- #YAML::load( File.open('Rake.yaml') ).each{|c,v| self.class.const_set(c,v)}
83
-
84
-
85
- ##
86
- # = Default Task
87
- ##
88
-
89
- desc "Default Task (test)"
90
- task :default => [ :test ]
91
-
92
-
93
- ##
94
- # = Run Unit Tests
95
- ##
96
-
97
- Rake::TestTask.new("test") { |t|
98
- #t.desc "Run all tests"
99
- t.libs << PKG_TEST_DIR
100
- PKG_TEST_FILES.each { |pat| t.pattern = pat }
101
- t.verbose = true
102
- }
103
-
104
-
105
- ##
106
- # = Genereate RDoc Documentation
107
- ##
108
-
109
- Rake::RDocTask.new { |rdoc|
110
- rdoc.rdoc_dir = RDOC_DIR
111
- rdoc.template = RDOC_TEMPLATE
112
- rdoc.title = RDOC_TITLE
113
- rdoc.options << '--line-numbers --inline-source ' + RDOC_OPTIONS
114
- rdoc.rdoc_files.include(*RDOC_INCLUDE)
115
- rdoc.rdoc_files.exclude(*RDOC_EXCLUDE)
116
- rdoc.rdoc_files.delete_if { |f| ! File.exist?(f) }
117
- }
118
-
119
-
120
- ##
121
- # = Publish Documentation
122
- ##
123
-
124
- # Publish documentation
125
- #desc "Publish the API documentation"
126
- #task :pdoc => [:rdoc] do
127
- # Rake::SshDirPublisher.new("david@hunter.5th.dk", "sites/rubyonrails.org/ar", "doc").upload
128
- #end
129
-
130
- if PKG_RUBYFORGE_PROJECT
131
- desc "Publish to RubyForge"
132
- task :rubyforge do
133
- Rake::RubyForgePublisher.new(PKG_RUBYFORGE_PROJECT, PKG_RUBYFORGE_PASS).upload
134
- end
135
- end
136
-
137
-
138
- ##
139
- # = Create Compressed Packages
140
- ##
141
-
142
- dist_dirs = PKG_DIST_DIRS
143
-
144
- spec = Gem::Specification.new do |s|
145
- s.name = PKG_NAME
146
- s.version = PKG_VERSION
147
- s.summary = PKG_SUMMARY
148
- s.description = PKG_DESCRIPTION
149
-
150
- s.files = PKG_DIST_FILES
151
- dist_dirs.each do |dir|
152
- s.files.concat Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "CVS" ) }
153
- end
154
- #s.files.delete "test/fixtures/fixture_database.sqlite"
155
- s.require_path = 'lib'
156
- s.autorequire = '#{PKG_NAME}'
157
- s.has_rdoc = true
158
- s.author = PKG_AUTHOR
159
- s.email = PKG_EMAIL
160
- s.homepage = PKG_HOMEPAGE if PKG_HOMEPAGE
161
- s.rubyforge_project = PKG_RUBYFORGE_PROJECT if PKG_RUBYFORGE_PROJECT
162
- end
163
-
164
- Rake::GemPackageTask.new(spec) do |p|
165
- p.gem_spec = spec
166
- p.need_tar = true
167
- p.need_zip = true
168
- end
169
-
170
-
171
- ##
172
- # = Line Count
173
- ##
174
-
175
- desc "Line Count"
176
- task :lines do
177
- lines = 0
178
- codelines = 0
179
- Dir.foreach("lib/#{PKG_NAME}") { |file_name|
180
- next unless file_name =~ /.*rb/
181
-
182
- f = File.open("lib/#{PKG_NAME}/" + file_name)
183
-
184
- while line = f.gets
185
- lines += 1
186
- next if line =~ /^\s*$/
187
- next if line =~ /^\s*#/
188
- codelines += 1
189
- end
190
- }
191
- puts "Lines #{lines}, LOC #{codelines}"
192
- end
193
-
194
-
195
- =begin
196
- ##
197
- # = Manual Install
198
- ##
199
-
200
- desc "Manual Installation"
201
- task :install do
202
-
203
- # install
204
- # this was adapted from active record's install.rb
205
- # by way of rdoc's install.rb
206
- # by way of Log4r's install.rb
207
- # with some modifications from ruby-gems' install.rb ;)
208
-
209
- require 'rbconfig'
210
- require 'find'
211
- require 'ftools'
212
- require 'fileutils'
213
-
214
- include Config
215
-
216
- #$sitedir = CONFIG["sitelibdir"]
217
- #unless $sitedir
218
- # version = CONFIG["MAJOR"] + "." + CONFIG["MINOR"]
219
- # $libdir = File.join(CONFIG["libdir"], "ruby", version)
220
- #
221
- # $sitedir = $:.find {|x| x =~ /site_ruby/ }
222
- # if !$sitedir
223
- # $sitedir = File.join($libdir, "site_ruby")
224
- # elsif $sitedir !~ Regexp.quote(version)
225
- # $sitedir = File.join($sitedir, version)
226
- # end
227
- #end
228
-
229
- $srcdir = CONFIG["srcdir"]
230
- $version = CONFIG["MAJOR"]+"."+CONFIG["MINOR"]
231
- $libdir = File.join(CONFIG["libdir"], "ruby", $version)
232
- $bindir = CONFIG['bindir']
233
- $archdir = File.join($libdir, CONFIG["arch"])
234
- $sitedir = CONFIG["sitelibdir"]
235
- if !$sitedir
236
- $sitedir = $:.find {|x| x =~ /site_ruby$/}
237
- if !$sitedir
238
- $sitedir = File.join($libdir, "site_ruby")
239
- elsif $sitedir !~ Regexp.new(Regexp.quote($version))
240
- $sitedir = File.join($site_libdir, $version)
241
- end
242
- end
243
-
244
- # get current dir
245
- current_dir = Dir.pwd
246
-
247
- ### install lib files
248
-
249
- if FileTest.directory?(PKG_LIB_DIR)
250
-
251
- # change dir to package lib dir
252
- Dir.chdir(PKG_LIB_DIR)
253
-
254
- # make lib dirs in ruby sitelibdir
255
- makedirs = FileList[*PKG_LIB_MKDIRS].to_a
256
- makedirs.each {|f| File::makedirs( File.join( $sitedir, *f.split(/\//) ) ) }
257
-
258
- # deprecated files that should be removed
259
- deprecated = FileList[*PKG_LIB_DEPRECATE].to_a
260
-
261
- # files to install in library path
262
- files = FileList[*PKG_LIB_FILES].to_a
263
-
264
- # the actual gruntwork
265
- File::safe_unlink *deprecated.collect{|f| File.join($sitedir, f.split(/\//))}
266
- files.each do |f|
267
- File::install(f, File.join($sitedir, *f.split(/\//)), 0644, true)
268
- end
269
-
270
- # change dir back
271
- Dir.chdir(current_dir)
272
-
273
- end
274
-
275
- ### install bin files
276
-
277
- if FileTest.directory?(PKG_BIN_DIR)
278
-
279
- # change dir to package bin dir
280
- Dir.chdir(PKG_BIN_DIR)
281
-
282
- is_windows_platform = CONFIG["arch"] =~ /dos|win32/i
283
-
284
- # files to install in bin path
285
- files = FileList[*PKG_BIN_FILES].to_a
286
-
287
- # deprecated files that should be removed
288
- deprecated = FileList[*PKG_BIN_DEPRECATE].to_a
289
-
290
- # the actual gruntwork
291
- File::safe_unlink *deprecated.collect{|f| File.join($bindir, f.split(/\//))}
292
- files.each do |f|
293
- target = File.join($bindir, *f.split(/\//))
294
- File::install(f, target, 0755, true)
295
- if is_windows_platform
296
- File.open("#{target}.cmd", "w") do |file|
297
- file.puts "@ruby #{target} %1 %2 %3 %4 %5 %6 %7 %8 %9"
298
- end
299
- end
300
- end
301
-
302
- # change dir back
303
- Dir.chdir(current_dir)
304
-
305
- end
306
- =end
307
-
308
- end