ratch 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MANIFEST +21 -4
- data/NEWS +8 -3
- data/VERSION +1 -0
- data/doc/log/basic_stats/index.html +39 -0
- data/doc/log/notes.xml +18 -0
- data/doc/log/stats.log +14 -0
- data/doc/log/syntax.log +0 -0
- data/doc/log/testunit.log +156 -0
- data/lib/ratch/commandline.rb +16 -0
- data/lib/ratch/core_ext/string.rb +1 -3
- data/lib/ratch/core_ext/to_console.rb +1 -1
- data/lib/ratch/dsl.rb +224 -301
- data/lib/ratch/emailer.rb +251 -0
- data/lib/ratch/io.rb +14 -14
- data/lib/ratch/plugin.rb +18 -8
- data/lib/ratch/script.rb +0 -38
- data/man/ratch.1 +28 -0
- data/meta/abstract +4 -0
- data/meta/author +1 -0
- data/meta/contact +1 -0
- data/meta/homepage +1 -0
- data/meta/name +1 -0
- data/meta/requires +4 -0
- data/meta/summary +1 -0
- metadata +47 -12
- data/METADATA +0 -14
- data/lib/ratch/core_ext/filetest.rb +0 -52
- data/lib/ratch/pathglob.rb +0 -73
- data/lib/ratch/runmode.rb +0 -69
data/meta/abstract
ADDED
data/meta/author
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
trans <transfire@gmail.com>
|
data/meta/contact
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
trans <transfire@gmail.com>
|
data/meta/homepage
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
http://ratch.rubyforge.org
|
data/meta/name
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ratch
|
data/meta/requires
ADDED
data/meta/summary
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Ruby-based Batch Scripting
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ratch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
7
|
-
|
6
|
+
authors:
|
7
|
+
- trans <transfire@gmail.com>
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-11-23 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,10 +20,30 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: folio
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: clio
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
24
44
|
version:
|
25
45
|
description: Ratch is a Ruby-based batch scripting language. It's a DSL over regular RUby to make the life of the batch script writter easier.
|
26
|
-
email:
|
46
|
+
email: transfire@gmail.com
|
27
47
|
executables:
|
28
48
|
- ratch
|
29
49
|
extensions: []
|
@@ -32,11 +52,18 @@ extra_rdoc_files:
|
|
32
52
|
- README
|
33
53
|
- MANIFEST
|
34
54
|
- HISTORY
|
35
|
-
-
|
55
|
+
- VERSION
|
36
56
|
- NEWS
|
37
57
|
- COPYING
|
38
58
|
files:
|
39
59
|
- doc
|
60
|
+
- doc/log
|
61
|
+
- doc/log/basic_stats
|
62
|
+
- doc/log/basic_stats/index.html
|
63
|
+
- doc/log/stats.log
|
64
|
+
- doc/log/notes.xml
|
65
|
+
- doc/log/syntax.log
|
66
|
+
- doc/log/testunit.log
|
40
67
|
- MANIFEST
|
41
68
|
- test
|
42
69
|
- test/README
|
@@ -44,19 +71,25 @@ files:
|
|
44
71
|
- test/test_task.rb
|
45
72
|
- README
|
46
73
|
- HISTORY
|
47
|
-
-
|
74
|
+
- meta
|
75
|
+
- meta/homepage
|
76
|
+
- meta/summary
|
77
|
+
- meta/abstract
|
78
|
+
- meta/name
|
79
|
+
- meta/requires
|
80
|
+
- meta/author
|
81
|
+
- meta/contact
|
48
82
|
- demo
|
49
83
|
- demo/tryme1.ratch
|
50
84
|
- demo/tryme-task.ratch
|
51
85
|
- lib
|
52
86
|
- lib/ratch
|
53
|
-
- lib/ratch/
|
54
|
-
- lib/ratch/
|
87
|
+
- lib/ratch/commandline.rb
|
88
|
+
- lib/ratch/emailer.rb
|
55
89
|
- lib/ratch/core_ext
|
56
90
|
- lib/ratch/core_ext/pathname.rb
|
57
91
|
- lib/ratch/core_ext/object.rb
|
58
92
|
- lib/ratch/core_ext/facets.rb
|
59
|
-
- lib/ratch/core_ext/filetest.rb
|
60
93
|
- lib/ratch/core_ext/to_list.rb
|
61
94
|
- lib/ratch/core_ext/to_console.rb
|
62
95
|
- lib/ratch/core_ext/string.rb
|
@@ -69,9 +102,12 @@ files:
|
|
69
102
|
- lib/ratch/task.rb
|
70
103
|
- lib/ratch/task2.rb
|
71
104
|
- lib/ratch/script.rb
|
105
|
+
- VERSION
|
72
106
|
- NEWS
|
73
107
|
- bin
|
74
108
|
- bin/ratch
|
109
|
+
- man
|
110
|
+
- man/ratch.1
|
75
111
|
- COPYING
|
76
112
|
has_rdoc: true
|
77
113
|
homepage: http://ratch.rubyforge.org
|
@@ -104,6 +140,5 @@ signing_key:
|
|
104
140
|
specification_version: 2
|
105
141
|
summary: Ratch is a Ruby-based batch scripting language.
|
106
142
|
test_files:
|
107
|
-
- test/README
|
108
143
|
- test/test_helper.rb
|
109
144
|
- test/test_task.rb
|
data/METADATA
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
project : ratch
|
2
|
-
version : 1.0.0
|
3
|
-
status : beta
|
4
|
-
homepage : http://ratch.rubyforge.org
|
5
|
-
author : trans <transfire@gmail.com>
|
6
|
-
requires : facets >=2.4.3
|
7
|
-
summary : Ruby-based Batch Scripting
|
8
|
-
abstract :
|
9
|
-
Ratch is a Ruby-based batch scripting language.
|
10
|
-
It's a DSL over regular RUby to make the life
|
11
|
-
of the batch script writter easier.
|
12
|
-
requires:
|
13
|
-
- [facets, >=2.4.3]
|
14
|
-
|
@@ -1,52 +0,0 @@
|
|
1
|
-
module FileTest
|
2
|
-
|
3
|
-
module_function
|
4
|
-
|
5
|
-
# Return a cached list of the PATH environment variable.
|
6
|
-
# This is a support method used by #bin?
|
7
|
-
|
8
|
-
def command_paths
|
9
|
-
@command_paths ||= ENV['PATH'].split(/[:;]/)
|
10
|
-
end
|
11
|
-
|
12
|
-
# Is a file a command executable?
|
13
|
-
#
|
14
|
-
# TODO: Make more robust. Probably needs to be fixed for Windows.
|
15
|
-
|
16
|
-
def bin?(fname)
|
17
|
-
is_bin = command_paths.any? do |f|
|
18
|
-
FileTest.exist?(File.join(f, fname))
|
19
|
-
end
|
20
|
-
#is_bin ? File.basename(fname) : false
|
21
|
-
is_bin ? fname : false
|
22
|
-
end
|
23
|
-
|
24
|
-
# Is a path considered reasonably "safe"?
|
25
|
-
#
|
26
|
-
# TODO: Make more robust.
|
27
|
-
|
28
|
-
def safe?(path)
|
29
|
-
case path
|
30
|
-
when *[ '/', '/*', '/**/*' ]
|
31
|
-
return false
|
32
|
-
end
|
33
|
-
true
|
34
|
-
end
|
35
|
-
|
36
|
-
# Does a path need updating, based on given +sources+?
|
37
|
-
# This compares mtimes of give paths. Returns false
|
38
|
-
# if the path needs to be updated.
|
39
|
-
|
40
|
-
def out_of_date?(path, *sources)
|
41
|
-
return true unless File.exist?(path)
|
42
|
-
|
43
|
-
sources = sources.collect{ |source| Dir.glob(source) }.flatten
|
44
|
-
mtimes = sources.collect{ |file| File.mtime(file) }
|
45
|
-
|
46
|
-
return true if mtimes.empty? # TODO: This the way to go here?
|
47
|
-
|
48
|
-
File.mtime(path) < mtimes.max
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
|
data/lib/ratch/pathglob.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
# NOT USED. Expiremental.
|
2
|
-
|
3
|
-
require 'pathname'
|
4
|
-
|
5
|
-
=begin
|
6
|
-
class Pathname
|
7
|
-
|
8
|
-
def glob(*options)
|
9
|
-
opts = 0
|
10
|
-
options.each do |option|
|
11
|
-
case option
|
12
|
-
when :nocase
|
13
|
-
opts += File::FNM_CASEFOLD
|
14
|
-
else
|
15
|
-
opts += option
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
self.class.glob(to_s, opts).collect{ |f| Pathname.new(f) }
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
=end
|
24
|
-
|
25
|
-
# How does this differ from facets/filelist?
|
26
|
-
|
27
|
-
class PathGlob #:nodoc:
|
28
|
-
|
29
|
-
#
|
30
|
-
attr :patterns
|
31
|
-
attr :options
|
32
|
-
|
33
|
-
def <<(pattern)
|
34
|
-
patterns << pattern
|
35
|
-
end
|
36
|
-
|
37
|
-
#
|
38
|
-
def match?(path)
|
39
|
-
patterns.find{ |pattern| File.fnmatch?(pattern, path) }
|
40
|
-
end
|
41
|
-
|
42
|
-
#
|
43
|
-
def match(*options)
|
44
|
-
opts = 0
|
45
|
-
options.each do
|
46
|
-
case options
|
47
|
-
when :nocase
|
48
|
-
opts += File::FNM_CASEFOLD
|
49
|
-
end
|
50
|
-
end
|
51
|
-
patterns.collect{ |pattern| File.glob(pattern, opts) }.flatten
|
52
|
-
end
|
53
|
-
|
54
|
-
def file?(*options)
|
55
|
-
match(options).all?{ |f| File.file?(f) }
|
56
|
-
end
|
57
|
-
|
58
|
-
def directory?(*options)
|
59
|
-
match(options).all?{ |f| File.directory?(f) }
|
60
|
-
end
|
61
|
-
|
62
|
-
private
|
63
|
-
|
64
|
-
def initialize(*patterns)
|
65
|
-
@patterns = patterns
|
66
|
-
end
|
67
|
-
|
68
|
-
def self.[](*patterns)
|
69
|
-
new(*patterns)
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
|
data/lib/ratch/runmode.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
module Ratch
|
2
|
-
|
3
|
-
# = Runmode
|
4
|
-
#
|
5
|
-
# The Runmode class encapsulates common options for command line scripts.
|
6
|
-
# The built-in modes are:
|
7
|
-
#
|
8
|
-
# force
|
9
|
-
# trace
|
10
|
-
# debug
|
11
|
-
# dryrun -or- noharm
|
12
|
-
# silent -or- quiet
|
13
|
-
# verbose
|
14
|
-
#
|
15
|
-
class Runmode
|
16
|
-
|
17
|
-
def self.load_argv!
|
18
|
-
options = {
|
19
|
-
:force => %w{--force}.any?{ |x| ARGV.delete(x) },
|
20
|
-
:trace => %w{--trace}.any?{ |x| ARGV.delete(x) },
|
21
|
-
:debug => %w{--debug}.any?{ |x| ARGV.delete(x) },
|
22
|
-
:dryrun => %w{--noharm --dryrun --dry-run}.any?{ |x| ARGV.delete(x) },
|
23
|
-
:silent => %w{--silent --quiet}.any?{ |x| ARGV.delete(x) },
|
24
|
-
:verbose => %w{--verbose}.any?{ |x| ARGV.delete(x) }
|
25
|
-
}
|
26
|
-
new(options)
|
27
|
-
end
|
28
|
-
|
29
|
-
def initialize(options={})
|
30
|
-
options.rekey(&:to_sym)
|
31
|
-
|
32
|
-
@force = options[:force]
|
33
|
-
@trace = options[:trace]
|
34
|
-
@debug = options[:debug]
|
35
|
-
@noharm = options[:noharm] || options[:dryrun]
|
36
|
-
@silent = options[:silent] || options[:quiet]
|
37
|
-
@verbose = options[:verbose]
|
38
|
-
end
|
39
|
-
|
40
|
-
attr_accessor :force
|
41
|
-
|
42
|
-
attr_accessor :trace
|
43
|
-
|
44
|
-
attr_accessor :verbose
|
45
|
-
|
46
|
-
attr_accessor :silent
|
47
|
-
|
48
|
-
attr_accessor :debug
|
49
|
-
|
50
|
-
attr_accessor :noharm
|
51
|
-
|
52
|
-
alias_method :dryrun, :noharm
|
53
|
-
alias_method :dryrun=,:noharm
|
54
|
-
|
55
|
-
alias_method :quiet, :silent
|
56
|
-
alias_method :quiet=, :silent=
|
57
|
-
|
58
|
-
def force? ; @force ; end
|
59
|
-
def trace? ; @trace ; end
|
60
|
-
def debug? ; @debug ; end
|
61
|
-
def noharm? ; @noharm ; end
|
62
|
-
def dryrun? ; @noharm ; end
|
63
|
-
def quiet? ; @silent ; end
|
64
|
-
def verbose? ; @verbose ; end
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
69
|
-
|