ratch 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,49 +1,77 @@
1
1
  #!/usr/bin/env ratch
2
2
 
3
- # install package to site_ruby
4
-
5
- # This tool installs the package to site_ruby
3
+ # Install package to site_ruby.
4
+ #
5
+ # This script installs Facets to site_ruby location
6
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'.
7
+ # If you want to change these, you can supply
8
+ # configuration settings for 'prefix' and/or 'sitedir'.
9
+
10
+ main :install do
11
+
12
+ system_prefix = Config::CONFIG['prefix']
13
+ system_libdir = Config::CONFIG['sitelibdir']
9
14
 
10
- system_prefix = Config::CONFIG['prefix']
11
- system_libdir = Config::CONFIG['sitelibdir']
15
+ config = configuration['install'] || {}
12
16
 
13
- config = config_load('install')
17
+ prefix = config['prefix'] || system_prefix
18
+ libdir = config['libdir']
14
19
 
15
- prefix = config['prefix'] || system_prefix
16
- libdir = config['libdir']
20
+ unless libdir
21
+ if (prefix == system_prefix) then
22
+ libdir = system_libdir
23
+ else
24
+ libdir = File.join(prefix, system_libdir[system_prefix.size..-1])
25
+ end
26
+ end
27
+
28
+ # If Rolls is being used.
17
29
 
18
- unless libdir
19
- if (prefix == system_prefix) then
20
- libdir = system_libdir
30
+ if roll_file = File.glob('{,meta/}*.roll').first
31
+ roll = Roll::Package.open
32
+ lib_paths = roll.lib_paths
21
33
  else
22
- libdir = File.join(prefix, system_libdir[system_prefix.size..-1])
34
+ lib_paths = config['lib_path'] || ['lib']
23
35
  end
24
- end
25
36
 
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) }
37
+ # We need to copy them into site_ruby in the opposite order they
38
+ # would be searched for by require.
29
39
 
30
- lib_files = files.grep(/^(lib|ext)/)
31
- bin_files = files.grep(/^bin/)
40
+ lib_paths.reverse!
32
41
 
33
- # Copy files to proper locations.
42
+ # Copy lib files to site_ruby location, in proper order!
34
43
 
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
44
+ lib_paths.each do |loc|
45
+ files = glob(File.join(loc, "**/*"))
46
+ files = files.select{ |f| File.file?(f) }
47
+ files.each do |file|
48
+ dest = File.dirname(file)
49
+ dest.sub!(loc, '')
50
+ dest = File.join(libdir, dest)
51
+ if noharm?
52
+ puts "mkdir -p #{dest}" unless File.directory?(dest)
53
+ puts "install -m 0444 #{file} #{dest}"
54
+ else
55
+ mkdir_p dest unless File.directory?(dest)
56
+ install file, dest, :mode => 0444
57
+ end
58
+ end
59
+ end
42
60
 
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
61
+ # Copy bin files to site_ruby location.
49
62
 
63
+ bin_files = glob("bin/*")
64
+ bin_files = bin_files.select{ |f| File.file?(f) }
65
+ bin_files.each do |file|
66
+ dest = File.dirname(file)
67
+ dest = File.join(prefix, dest)
68
+ if noharm?
69
+ puts "mkdir -p #{dest}" unless File.directory?(dest)
70
+ puts "install -m 0555 #{file} #{dest}"
71
+ else
72
+ mkdir_p dest unless File.directory?(dest)
73
+ install file, dest, :mode => 0555
74
+ end
75
+ end
76
+
77
+ end
@@ -1,20 +1,23 @@
1
1
  #!/usr/bin/env ratch
2
2
 
3
- # Create the tasks defined by this task lib.
3
+ # scan for notes
4
4
  #
5
- # This task scan source code for developer notes and writes to
5
+ # This task scans source code for developer notes and writes to
6
6
  # well organized files.
7
7
 
8
+ # TODO Add ability to read header notes.
8
9
  # FIXME Should each label of note be written to it's own file?
9
10
 
10
- main :note do
11
- notes
12
- end
13
-
14
11
  DEFAULT_NOTE_FILES = ['lib/**/*', 'ext/**/*']
15
12
  DEFAULT_NOTE_LABELS = ['TODO', 'FIXME']
16
13
  DEFAULT_NOTE_FORMAT = 'rdoc'
17
- DEFAULT_NOTE_OUTPUT = 'note'
14
+ DEFAULT_NOTE_OUTPUT = 'doc/note'
15
+
16
+ #
17
+
18
+ main :note do
19
+ notes
20
+ end
18
21
 
19
22
  # Notes tool can lookup and list TODO, FIXME and
20
23
  # other types of labeled comments from source code.
@@ -135,7 +138,6 @@ end
135
138
 
136
139
 
137
140
 
138
-
139
141
  # out = ''
140
142
  #
141
143
  # case format
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ratch
2
2
 
3
3
  # generate rdocs
4
-
4
+ #
5
5
  # Generate Rdoc documentation. Settings are
6
6
  # the same as the rdoc command's options.
7
7
 
@@ -10,16 +10,18 @@ main :rdoc do
10
10
 
11
11
  config = configuration['rdoc']
12
12
 
13
+ config['op'] = config.delete('output') if config['output']
14
+
13
15
  config = {
14
16
  'template' => 'html',
15
17
  'op' => 'doc/rdoc',
16
18
  'merge' => true,
17
19
  'inline-source' => true,
18
- 'exclude' => %w{InstalledFiles Manifest Project dev util},
19
- 'include' => %w{[A-Z]* lib}
20
+ 'exclude' => %w{MANIFEST},
21
+ 'include' => %w{[A-Z]* lib ext}
20
22
  }.update(config)
21
23
 
22
- output = config['output'] || config['op']
24
+ output = config['op']
23
25
 
24
26
  # Check for 'doc' directory.
25
27
  # (Helps to ensure we're in the right place.)
data/dev/install.0 ADDED
@@ -0,0 +1,49 @@
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
+
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ratch
2
2
 
3
3
  # install package to site_ruby
4
-
4
+ #
5
5
  # This tool installs the package to site_ruby
6
6
  # using Ruby's defualt configuration settings.
7
7
  # If you want to change these you can can supply
@@ -9,11 +9,13 @@ module Ratch
9
9
 
10
10
  def configuration(file=nil)
11
11
  @configuration ||= {}
12
- if file = config_file(file)
13
- @configuration[file] ||= config_read(file)
14
- else
15
- @configuration[file] ||= Hash.new{ |h,k| h[k] = {} }
16
- end
12
+ @configuration[file] ||= (
13
+ if file = config_file(file)
14
+ config_read(file)
15
+ else
16
+ Hash.new{ |h,k| h[k] = {} }
17
+ end
18
+ )
17
19
  end
18
20
 
19
21
  #
@@ -35,7 +37,7 @@ module Ratch
35
37
  def config_read(path)
36
38
  find = "{#{utility_directory}/,}#{path}{.yaml,.yml,}"
37
39
  if file = Dir.glob(find)[0]
38
- YAML::load(File.open(file))
40
+ YAML::load(File.open(file)) || {} # The || {} is in case the file is empty.
39
41
  else
40
42
  raise LoadError, "Missing file -- #{path}"
41
43
  end
data/lib/ratch/t.rb ADDED
File without changes
@@ -82,7 +82,8 @@ module Ratch
82
82
  task.preqs.each do |need|
83
83
  need = need.to_s
84
84
  next if list.include?(need)
85
- @tasks[need].plan(need, list)
85
+ #@tasks[need].plan(need, list)
86
+ plan(need, list)
86
87
  end
87
88
  list << task.name
88
89
  return list
data/meta/MANIFEST CHANGED
@@ -11,8 +11,6 @@ data/ratch/rubyproject
11
11
  data/ratch/rubyproject/announce
12
12
  data/ratch/rubyproject/extest
13
13
  data/ratch/rubyproject/install
14
- data/ratch/rubyproject/install2
15
- data/ratch/rubyproject/install3
16
14
  data/ratch/rubyproject/load
17
15
  data/ratch/rubyproject/notes
18
16
  data/ratch/rubyproject/publish
@@ -46,6 +44,8 @@ demo/util/rdoc
46
44
  demo/util/tryme
47
45
  dev
48
46
  dev/install
47
+ dev/install.0
48
+ dev/install.1
49
49
  dev/ludo
50
50
  dev/oldtaskable.rb
51
51
  dev/taskable-simple.rb
@@ -61,13 +61,16 @@ lib/ratch/consoleutils.rb
61
61
  lib/ratch/emailutils.rb
62
62
  lib/ratch/fileutils.rb
63
63
  lib/ratch/options.rb
64
+ lib/ratch/t.rb
64
65
  lib/ratch/taskable.rb
65
66
  lib/ratch/taskutils.rb
66
67
  lib/ratch/uploadutils.rb
67
68
  meta
68
69
  meta/MANIFEST
69
- meta/RATCH-0.2.1.roll
70
+ meta/RATCH-0.2.2.roll
70
71
  task
72
+ task/config.yaml
73
+ task/publish
71
74
  task/setup
72
75
  task/stats
73
76
  test
@@ -1,26 +1,27 @@
1
1
  ---
2
2
 
3
3
  title : Ratch
4
- summary : Ruby-based Batch Fils
4
+ subtitle : Ruby-based Batch Files
5
+ slogan : Ratch It Up!
5
6
  description: >
6
7
  Ratch is batch file system suitable for creating project build scripts
7
8
  and any variety of command line utilities.
8
9
 
10
+ status : beta
9
11
  author : Thomas Sawyer <transfire@gmail.com>
10
12
  created : "2007-08-09"
11
13
  homepage : "http://proutils.rubyforge.org"
12
14
  download : "https://rubyforge.org/frs/?group_id=4411"
13
15
  repository : "http://proutils.rubyforge.org/ratch"
14
- slogan : Ratch It Up!
15
16
 
16
- formats : [gem, tgz]
17
-
18
- rubyforge:
19
- project : protutils
20
- username : transami
21
- groupid : 4411
22
- package : ratch
23
17
 
24
18
  lib_path:
25
19
  - lib/ratch
26
20
 
21
+ formats : [gem, tgz]
22
+
23
+ #rubyforge:
24
+ # project : protutils
25
+ # username : transami
26
+ # groupid : 4411
27
+ # package : ratch
data/task/config.yaml ADDED
@@ -0,0 +1,6 @@
1
+
2
+ publish:
3
+ project : proutils
4
+ subdir : ratch
5
+ username : transami
6
+
data/task/publish ADDED
@@ -0,0 +1,51 @@
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
+ main :publish do
9
+ config = configuration['publish']
10
+
11
+ project = config['project']
12
+ subdir = config['subdir']
13
+ source = config['source'] || "doc"
14
+ username = config['username'] || ENV['RUBYFORGE_USERNAME']
15
+ protect = %w{usage statcvs statsvn robot.txt wiki}
16
+ exclude = %w{.svn}
17
+
18
+ abort "no project" unless project
19
+ abort "no username" unless username
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
+ op = ['-rLvz', '--delete'] # maybe -p ?
31
+
32
+ # add filter options. The commandline version didn't seem
33
+ # to work, so I opted for creating an .rsync_filter file for
34
+ # all cases.
35
+
36
+ filter_file = File.join(source,'.rsync-filter')
37
+
38
+ unless file?(filter_file)
39
+ File.open(filter_file, 'w') do |f|
40
+ exclude.map{|e| f << "- #{e}\n"}
41
+ protect.map{|e| f << "P #{e}\n"}
42
+ end
43
+ end
44
+
45
+ op << "--filter='dir-merge #{filter_file}'"
46
+
47
+ args = op + [dir, url]
48
+
49
+ rsync(*args.to_params)
50
+ end
51
+
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.2.1
7
- date: 2007-10-29 00:00:00 -04:00
8
- summary: Ruby-based Batch Fils
6
+ version: 0.2.2
7
+ date: 2007-11-01 00:00:00 -04:00
8
+ summary: Ruby-based Batch Files
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: Ruby-based Batch Fils
14
+ description: Ratch is batch file system suitable for creating project build scripts and any variety of command line utilities.
15
15
  autorequire:
16
16
  default_executable:
17
17
  bindir: bin
@@ -41,8 +41,6 @@ files:
41
41
  - data/ratch/rubyproject/announce
42
42
  - data/ratch/rubyproject/extest
43
43
  - data/ratch/rubyproject/install
44
- - data/ratch/rubyproject/install2
45
- - data/ratch/rubyproject/install3
46
44
  - data/ratch/rubyproject/load
47
45
  - data/ratch/rubyproject/notes
48
46
  - data/ratch/rubyproject/publish
@@ -76,6 +74,8 @@ files:
76
74
  - demo/util/tryme
77
75
  - dev
78
76
  - dev/install
77
+ - dev/install.0
78
+ - dev/install.1
79
79
  - dev/ludo
80
80
  - dev/oldtaskable.rb
81
81
  - dev/taskable-simple.rb
@@ -91,13 +91,16 @@ files:
91
91
  - lib/ratch/emailutils.rb
92
92
  - lib/ratch/fileutils.rb
93
93
  - lib/ratch/options.rb
94
+ - lib/ratch/t.rb
94
95
  - lib/ratch/taskable.rb
95
96
  - lib/ratch/taskutils.rb
96
97
  - lib/ratch/uploadutils.rb
97
98
  - meta
98
99
  - meta/MANIFEST
99
- - meta/RATCH-0.2.1.roll
100
+ - meta/RATCH-0.2.2.roll
100
101
  - task
102
+ - task/config.yaml
103
+ - task/publish
101
104
  - task/setup
102
105
  - task/stats
103
106
  - test
@@ -1,74 +0,0 @@
1
- #!/usr/bin/env ratch
2
-
3
- # Install package to site_ruby.
4
- #
5
- # This script installs Facets to site_ruby location
6
- # using Ruby's defualt configuration settings.
7
- # If you want to change these, you can supply
8
- # configuration settings for 'prefix' and/or 'sitedir'.
9
-
10
- main :install do
11
-
12
- system_prefix = Config::CONFIG['prefix']
13
- system_libdir = Config::CONFIG['sitelibdir']
14
-
15
- config = configuration['install'] || {}
16
-
17
- prefix = config['prefix'] || system_prefix
18
- libdir = config['libdir']
19
-
20
- unless libdir
21
- if (prefix == system_prefix) then
22
- libdir = system_libdir
23
- else
24
- libdir = File.join(prefix, system_libdir[system_prefix.size..-1])
25
- end
26
- end
27
-
28
- libpaths = configuration('meta/project.yaml')['libpaths']
29
-
30
- # We need to copy them into site_ruby in the opposite order they
31
- # would be searched for by require.
32
-
33
- libpaths.reverse!
34
-
35
- # Copy lib files to site_ruby location, in proper order!
36
-
37
- lib_files = Dir.glob("lib/**/*").select{ |f| File.file?(f) }
38
-
39
- #['core', 'fore', 'more' ]
40
- libpaths.each do |loc|
41
- files = lib_files.grep(/^#{loc}/)
42
- files.each do |file|
43
- dest = File.dirname(file)
44
- #dest.sub!('lib/', '')
45
- #dest.sub!(loc, '')
46
- dest.sub!(loc, '')
47
- dest = File.join(libdir, dest)
48
- if noharm?
49
- puts "mkdir -p #{dest}" unless File.directory?(dest)
50
- puts "install -m 0444 #{file} #{dest}"
51
- else
52
- mkdir_p dest unless File.directory?(dest)
53
- install file, dest, :mode => 0444
54
- end
55
- end
56
- lib_files -= files # speed things up be removing what we've already covered.
57
- end
58
-
59
- # Copy bin files to site_ruby location.
60
-
61
- bin_files = Dir.glob("bin/*").select{ |f| File.file?(f) }
62
- bin_files.each do |file|
63
- dest = File.dirname(file)
64
- dest = File.join(prefix, dest)
65
- if noharm?
66
- puts "mkdir -p #{dest}" unless File.directory?(dest)
67
- puts "install -m 0555 #{file} #{dest}"
68
- else
69
- mkdir_p dest unless File.directory?(dest)
70
- install file, dest, :mode => 0555
71
- end
72
- end
73
-
74
- end