evoker 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/evoker.rb +61 -8
  2. data/lib/evoker/version.rb +1 -1
  3. metadata +5 -5
@@ -29,7 +29,7 @@ module Evoker
29
29
  def initialize(*args, &block)
30
30
  super(*args, &block)
31
31
  @stampname = "#{@name}.stamp"
32
- @actions << lambda { |*args| rm_rf @name }
32
+ @actions << lambda { |*args| FileUtils::rm_rf @name }
33
33
  CLOBBER.add([@stampname, @name])
34
34
  ENTITIES.add(@name)
35
35
 
@@ -109,14 +109,14 @@ module Evoker
109
109
  entity name do |t|
110
110
  cmd = "#{opts[:svn]}"
111
111
  cmd << " #{opts[:svn_args]}" if opts[:svn_args]
112
- cmd << " #{t.config[:svn_args]}" if t.config[:svn_args]
112
+ cmd << " #{t.config[:svn_args]}" if t.config && t.config[:svn_args]
113
113
  cmd << " checkout -q"
114
114
  cmd << " #{opts[:checkout_args]}" if opts[:checkout_args]
115
- cmd << " #{t.config[:checkout_args]}" if t.config[:checkout_args]
115
+ cmd << " #{t.config[:checkout_args]}" if t.config && t.config[:checkout_args]
116
116
  cmd << " -r #{opts[:revision]}" if opts[:revision]
117
- cmd << " -r #{t.config[:revision]}" if t.config[:revision]
117
+ cmd << " -r #{t.config[:revision]}" if t.config && t.config[:revision]
118
118
  cmd << " #{opts[:url]}" if opts[:url]
119
- cmd << " #{t.config[:url]}" if t.config[:url]
119
+ cmd << " #{t.config[:url]}" if t.config && t.config[:url]
120
120
  cmd << " #{t.name}"
121
121
  sh cmd
122
122
  end
@@ -129,12 +129,12 @@ module Evoker
129
129
  entity name do |t|
130
130
  cmd = "#{opts[:git]} clone"
131
131
  cmd << " #{opts[:clone_args]}" if opts[:clone_args]
132
- cmd << " #{t.config[:clone_args]}" if t.config[:clone_args]
132
+ cmd << " #{t.config[:clone_args]}" if t.config && t.config[:clone_args]
133
133
  cmd << " #{opts[:url]}" if opts[:url]
134
- cmd << " #{t.config[:url]}" if t.config[:url]
134
+ cmd << " #{t.config[:url]}" if t.config && t.config[:url]
135
135
  cmd << " #{t.name}"
136
136
 
137
- if rev = opts[:revision] || t.config[:revision]
137
+ if rev = opts[:revision] || ( t.config && t.config[:revision] )
138
138
  cmd << " && cd #{t.name}" \
139
139
  " && #{opts[:git]} checkout -b evoker-checkout #{rev}"
140
140
  end
@@ -143,6 +143,59 @@ module Evoker
143
143
  end
144
144
  module_function :git
145
145
 
146
+ # Check out Mercurial repository
147
+ def mercurial(name, opts={})
148
+ opts[:hg] ||= "hg"
149
+ entity name do |t|
150
+ cmd = "#{opts[:hg]} clone"
151
+ cmd << " #{args}" if args = opts[:clone_args] || ( t.config && t.config[:clone_args] )
152
+ cmd << " -r #{opts[:revision]}" if opts[:revision]
153
+ cmd << " -r #{t.config[:revision]}" if t.config && t.config[:revision]
154
+ cmd << " #{opts[:url]}" if opts[:url]
155
+ cmd << " #{t.config[:url]}" if t.config && t.config[:url]
156
+ cmd << " #{t.name}"
157
+ sh cmd
158
+ end
159
+ end
160
+ module_function :mercurial
161
+
162
+ # Download & unpack a tarball
163
+ def tarball(basename, options={})
164
+ tarball = wget options[:url], options[:wget_options]||{}
165
+ entity basename => tarball do |t|
166
+ dirname = options[:dirname] || File.basename(tarball.name, options[:ext] || '.tar.gz')
167
+ rm_rf dirname
168
+ sh "#{options[:decompress] || 'tar -xzf'} #{tarball}"
169
+ ln_s dirname, basename unless options[:no_symlink]
170
+ end
171
+ end
172
+ module_function :tarball
173
+
174
+ # Apply patch to an entity
175
+ def patch(entity_name, patches, patch_args=nil)
176
+ task entity_name => patches do |t|
177
+ patches = [ patches ] unless patches.respond_to?(:each)
178
+ cmd = "set -e -x\ncd #{t.name}\n"
179
+ patches.each do |patch|
180
+ cmd << "patch #{patch_args} < ../#{patch}\n"
181
+ end
182
+ sh cmd
183
+ end
184
+ end
185
+ module_function :patch
186
+
187
+ # Entity that is a symlink to another path
188
+ # (FIXME:rename)
189
+ def symlink_(target, original, args={})
190
+ entity target => original do
191
+ require 'pathname'
192
+ original = Pathname.new(original.to_s).relative_path_from(
193
+ Pathname.new(File.dirname(original.to_s)))
194
+ ln_sf original.to_s, target.to_s
195
+ end
196
+ end
197
+ module_function :symlink_
198
+
146
199
  private
147
200
 
148
201
  # Define smart constant's default
@@ -2,7 +2,7 @@ module Evoker
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 6
5
+ TINY = 7
6
6
  STRING = [MAJOR, MINOR, TINY].join('.')
7
7
 
8
8
  def VERSION.require_version(major, minor=0, tiny=0)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evoker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-25 00:00:00.000000000Z
12
+ date: 2012-01-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &2152986940 !ruby/object:Gem::Requirement
16
+ requirement: &70101198893500 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 0.9.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2152986940
24
+ version_requirements: *70101198893500
25
25
  description: ! 'Evoker is an add-on to Rake to download and manage project''s external
26
26
 
27
27
  dependencied, update them as needed, cache them, etc.
@@ -58,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  version: 1.3.6
59
59
  requirements: []
60
60
  rubyforge_project:
61
- rubygems_version: 1.8.6
61
+ rubygems_version: 1.8.10
62
62
  signing_key:
63
63
  specification_version: 3
64
64
  summary: Rake add-on to download and manage project's external dependencies