reap 4.3.4 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -647,6 +647,10 @@ module FileOperations
647
647
  }
648
648
  File.chmod mode, realdest
649
649
 
650
+ # Do not make InstalledFiles entry if to alternate root.
651
+ # This prevents problem with root permissions on this file.
652
+ return true unless $setup_install_root
653
+
650
654
  File.open("#{objdir_root()}/InstalledFiles", 'a') {|f|
651
655
  if prefix
652
656
  f.puts realdest.sub(prefix, '')
@@ -0,0 +1,24 @@
1
+ Hey, today I'm gald to have gotten Reap 4.3.4 out the door.
2
+
3
+ This realease fixes a bunch nagging no-ops that have been
4
+ real turn-offs for those who have only dipped their
5
+ first big toe into the Reaping fields. Like the template
6
+ and scaffold commands actually do something now!
7
+
8
+ I've also added some hot off the skillet features.
9
+ Reap can now cook you up a DOAP XML project file
10
+ (<Project> section only as of yet). She can
11
+ now release directly to Rubyforge -- Woohoo! is life easier
12
+ without all that point-and-clickery. And best of all
13
+ Reap can not plunk down a .deb package as easy as a
14
+ .tar.gz or .gem. You gotta love that! (Note, that you'll need to
15
+ use Reap's slightly modified version of setup.rb for this.
16
+ Just copy it out of the installation if you need it.)
17
+
18
+ Boy oh boy, more of goodies, good fixes and solidity.
19
+ Reaps coming along nice. She'll move to version 4.4 once
20
+ all the little undiscovered cockaroaches are scurried away.
21
+
22
+ Ciao,
23
+ T.
24
+
@@ -4,14 +4,15 @@ require 'rbconfig'
4
4
 
5
5
  require 'facets'
6
6
  require 'consoleapp'
7
+ #require 'console/command'
7
8
 
8
9
  require 'reap/reap'
9
10
 
10
11
 
11
- class ReapCommand < Console::Application
12
+ class ReapCommand < Console::Command
12
13
 
13
14
  # to do first for every task
14
- #def application_setup
15
+ #def command_setup
15
16
  # $PROJECT_INFO = ProjectInfo.new( $PROJECT_FILE )
16
17
  #end
17
18
 
@@ -65,7 +66,7 @@ class ReapCommand < Console::Application
65
66
  # display version
66
67
 
67
68
  def version
68
- puts "Reap v.#{Reap::Version}"
69
+ puts "Reap v#{Reap::Version}"
69
70
  exit 0
70
71
  end
71
72
 
@@ -94,8 +95,11 @@ class ReapCommand < Console::Application
94
95
  def tasks
95
96
  if Reap.projectfile?
96
97
  puts
97
- Reap.tasks.each do |name,task_class|
98
- puts " #{name}".ljust(20) + "#{task_class.task_desc}"
98
+ sorted_names = Reap.tasks.keys.sort
99
+ margin = sorted_names.collect{ |n| n.size }.max + 6
100
+ sorted_names.each do |name|
101
+ task_class = Reap.tasks[name]
102
+ puts " #{name}".ljust(margin) + "#{task_class.task_desc}"
99
103
  end
100
104
  puts
101
105
  else
@@ -147,12 +151,15 @@ class ReapCommand < Console::Application
147
151
  end
148
152
 
149
153
  # Add all the reap tasks.
154
+
150
155
  if Reap.register
156
+
151
157
  Reap.tasks.each do |sym,taskclass|
152
158
  define_method(sym) do |*args|
153
- taskclass.new(*args)
159
+ taskclass.new(*args).execute
154
160
  end
155
161
  end
162
+
156
163
  end
157
164
 
158
165
  end
@@ -166,7 +173,7 @@ HELP = <<-HERE
166
173
 
167
174
  COMMANDS:
168
175
 
169
- tasks (default)
176
+ tasks
170
177
  List all the current tasks with descriptions.
171
178
  This is the default action if no command
172
179
  is given. (Also aliased as 'ls'.)
@@ -178,7 +185,7 @@ HELP = <<-HERE
178
185
 
179
186
  template
180
187
  Copies a ProjectInfo template into the current
181
- directory, if it does not already exist.
188
+ directory (if it does not already exist).
182
189
 
183
190
  scaffold [directory] [type]
184
191
  Builds a starter project directory. There are
@@ -5,6 +5,12 @@ require 'facet/hash/traverse'
5
5
  require 'facet/string/tabto'
6
6
  require 'facet/dir/self/ascend'
7
7
 
8
+ require 'facet/basicobject'
9
+
10
+
11
+ #--
12
+ # NOTE At some point get past the use of the global variable perhaps?
13
+ #++
8
14
 
9
15
  class ProjectInfo
10
16
 
@@ -15,66 +21,117 @@ class ProjectInfo
15
21
  'reapfile'
16
22
  ]
17
23
 
18
- def self.add_info_file( f )
19
- INFO_FILES.unshift( f )
24
+ class << self
25
+
26
+ # Load the project information from a file. Generally
27
+ # no file needs to be specified; the file will be found
28
+ # by ascending up the current path until a default
29
+ # file name is found (eg. ProjectInfo or Reapfile).
30
+
31
+ def load( fpath=nil, report=false )
32
+ if fpath
33
+ new.read( fpath, report )
34
+ else
35
+ new.read( find, report )
36
+ end
37
+ end
38
+
39
+ # Find project information file.
40
+
41
+ def find
42
+ info_dir, info_file = nil, nil
43
+ Dir.ascend(Dir.pwd) do |info_dir|
44
+ info_file = INFO_FILES.find{ |f| File.file?( File.join( info_dir, f ) ) }
45
+ break if info_file
46
+ end
47
+ return File.join( info_dir, info_file )
48
+ end
49
+
50
+ #def add_file( f )
51
+ # INFO_FILES.unshift( f )
52
+ #end
53
+
20
54
  end
21
55
 
22
- #def self.[](name)
23
- # @self ||= self.new
24
- # @self[name]
25
- #end
26
56
 
27
- attr_reader :info, :info_stream, :info_dir
57
+ attr_reader :info, :info_stream, :info_dir, :info_file
28
58
 
29
- def initialize( alt_info_file=nil )
59
+ def initialize( &block )
60
+ @info = {}
61
+ @info_stream = nil
30
62
 
31
- # Consider alternative info files?
32
- # NOTE Should this work out of the current working dir only?
33
- add_info_file( alt_info_file ) if alt_info_file
63
+ define( &block ) if block_given?
34
64
 
35
- info_dir = nil
36
- info_file = nil
65
+ $PROJECT_INFO = self
66
+ end
37
67
 
38
- Dir.ascend(Dir.pwd) do |info_dir|
39
- #Dir.chdir(info_dir)
40
- info_file = INFO_FILES.find{ |f| File.file?( File.join( info_dir, f ) ) }
41
- break if info_file
42
- end
68
+ # Define project information programmatically.
43
69
 
44
- return unless info_file
70
+ def define( &block )
71
+ return unless block
45
72
 
46
- info_file = File.basename( info_file )
47
- @info_dir = info_dir
48
- @info_file = info_file
49
- Dir.chdir(info_dir)
73
+ @info = HashBuilder.new( &block ).to_h
74
+ @info_stream = @info.to_yaml
50
75
 
51
- puts "(in #{Dir.pwd})" #unless dir == Dir.pwd
76
+ validate
77
+ defaults
78
+
79
+ self
80
+ end
52
81
 
53
- info_stream = File.read( info_file ).strip
82
+ # Load project information from YAML file.
54
83
 
55
- begin
56
- info = YAML::load( info_stream )
57
- rescue
58
- #info_proc = lambda { instance_eval( info_stream ) }
59
- info = HashBuilder.new( info_stream ).to_h
84
+ def read( fpath, report=true )
85
+ return unless fpath
86
+
87
+ @info_dir = File.dirname( fpath )
88
+ @info_file = fpath #File.basename( fpath )
89
+ @info_stream = File.read( fpath ).strip
90
+ @info = YAML::load( info_stream ).traverse{ |k,v| [k.to_s.downcase, v] }
91
+
92
+ Dir.chdir(@info_dir)
93
+ if report
94
+ puts "(in #{Dir.pwd})" #unless dir == Dir.pwd
60
95
  end
61
96
 
62
- @info_stream = info_stream
63
- @info = info.traverse{ |k,v| [k.to_s.downcase, v] }
97
+ validate
98
+ defaults
99
+
100
+ self
101
+ end
102
+
103
+ # Update project information.
104
+
105
+ def update( info=nil, &block )
106
+ if info
107
+ @info.update( info.traverse{ |k,v| [k.to_s.downcase, v] } )
108
+ end
109
+ if block_given?
110
+ @info.update( HashBuilder.new( &block ).to_h )
111
+ end
112
+ @info_stream = @info.to_yaml
64
113
 
65
114
  validate
66
115
  defaults
116
+
117
+ self
67
118
  end
68
119
 
120
+ # Project information file exists? (may need to change to info exists?)
121
+
69
122
  def exists?
70
- @info_dir
123
+ @info_file
71
124
  end
72
125
 
126
+ # Validate project information.
127
+
73
128
  def validate
74
129
  raise "NAME is a required piece of information" unless info['name']
75
130
  raise "VERSION is a required piece of informatiomn" unless info['version']
76
131
  end
77
132
 
133
+ # Project information defaults.
134
+
78
135
  def defaults
79
136
  self['title'] ||= self['name'].capitalize
80
137
  self['series'] ||= '1'
@@ -88,14 +145,20 @@ class ProjectInfo
88
145
  self['homepage'] ||= self['rubyforge'] ? self['rubyforge']['homepage'] : nil
89
146
  end
90
147
 
148
+ # Information fetch.
149
+
91
150
  def [](name)
92
151
  info[name]
93
152
  end
94
153
 
154
+ # Information sore.
155
+
95
156
  def []=(name, x)
96
157
  info[name] = x
97
158
  end
98
159
 
160
+ # Information to hash.
161
+
99
162
  def to_h
100
163
  @info
101
164
  end
@@ -121,6 +184,7 @@ class ProjectInfo::HashBuilder < BasicObject
121
184
  def to_h ; @hash ; end
122
185
 
123
186
  def method_missing( sym, *args, &block )
187
+ sym = sym.to_s.downcase
124
188
 
125
189
  if @hash.key?(sym)
126
190
  unless @flag[sym]
@@ -128,13 +192,13 @@ class ProjectInfo::HashBuilder < BasicObject
128
192
  @flag[sym] = true
129
193
  end
130
194
  if block_given?
131
- @hash[sym] << HashBuilder.new( &block ).to_h
195
+ @hash[sym] << self.__class__.new( &block ).to_h
132
196
  else
133
197
  @hash[sym] << args[0]
134
198
  end
135
199
  else
136
200
  if block_given?
137
- @hash[sym] = HashBuilder.new( &block ).to_h
201
+ @hash[sym] = self.__class__.new( &block ).to_h
138
202
  else
139
203
  @hash[sym] = args[0]
140
204
  end
@@ -143,3 +207,4 @@ class ProjectInfo::HashBuilder < BasicObject
143
207
  end
144
208
 
145
209
  end
210
+
@@ -0,0 +1,16 @@
1
+
2
+ # This file requires all rake adapted reap tasks.
3
+
4
+ require 'rake'
5
+
6
+ require 'reap/rake/announce.rb'
7
+ require 'reap/rake/package.rb'
8
+ require 'reap/rake/test.rb'
9
+ require 'reap/rake/extest.rb'
10
+ require 'reap/rake/release.rb'
11
+ require 'reap/rake/publish.rb'
12
+ require 'reap/rake/info.rb'
13
+ require 'reap/rake/doap.rb'
14
+ require 'reap/rake/install.rb'
15
+ require 'reap/rake/rdoc.rb'
16
+ require 'reap/rake/manifest.rb'
@@ -0,0 +1,50 @@
1
+
2
+ #require 'rake'
3
+ require 'rake/tasklib'
4
+
5
+ require 'reap/projectinfo.rb'
6
+ require 'facet/hash/keys_to_s'
7
+
8
+
9
+ module Reap
10
+
11
+ def self.RakeAdapter( reapclass )
12
+
13
+ Class.new( ::Rake::TaskLib ) do
14
+
15
+ define_method( :reapclass ) { reapclass }
16
+
17
+ attr_accessor :name, :options
18
+
19
+ # Create task.
20
+ def initialize(name=reapclass.task_name) # :yield:
21
+ @name = name
22
+ @options = nil
23
+ if block_given?
24
+ options = OpenObject.new
25
+ yield( options )
26
+ @options = options.to_h.keys_to_s
27
+ #reapclass.master[reapclass.task_name].update( @options )
28
+ end
29
+ define
30
+ end
31
+
32
+ # Create the tasks defined by this task lib.
33
+ def define
34
+ desc reapclass.task_desc
35
+ task name do
36
+ rc = reapclass.new
37
+ if @options
38
+ rc.execute( @options.to_h )
39
+ else
40
+ rc.execute
41
+ end
42
+ end
43
+ self
44
+ end
45
+
46
+ end
47
+
48
+ end
49
+
50
+ end
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'reap/rake/adapter'
4
+ require 'reap/task/announce'
5
+
6
+ module Rake
7
+
8
+ ReapAnnounce = ::Reap::RakeAdapter( ::Reap::Announce )
9
+
10
+ end
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'reap/rake/adapter'
4
+ require 'reap/task/doap'
5
+
6
+ module Rake
7
+
8
+ ReapDoap = ::Reap::RakeAdapter( ::Reap::Doap )
9
+
10
+ end
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'reap/rake/adapter'
4
+ require 'reap/task/extest'
5
+
6
+ module Rake
7
+
8
+ ReapExTest = ::Reap::RakeAdapter( ::Reap::ExTest )
9
+
10
+ end
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'reap/rake/adapter'
4
+ require 'reap/task/info'
5
+
6
+ module Rake
7
+
8
+ ReapInfo = ::Reap::RakeAdapter( ::Reap::Info )
9
+
10
+ end
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'reap/rake/adapter'
4
+ require 'reap/task/install'
5
+
6
+ module Rake
7
+
8
+ ReapInstall = ::Reap::RakeAdapter( ::Reap::Install )
9
+
10
+ end