vendorer 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vendorer (0.1.2)
4
+ vendorer (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/Readme.md CHANGED
@@ -17,6 +17,11 @@ Add a `Vendorfile` to your project root:
17
17
  file 'public/javascripts/jquery.min.js', 'http://code.jquery.com/jquery-latest.min.js'
18
18
  folder 'vendor/plugins/parallel_tests', 'https://github.com/grosser/parallel_tests.git'
19
19
 
20
+ # execute a block after updates
21
+ file 'public/javascripts/jquery.js', 'http://code.jquery.com/jquery.js' do |path|
22
+ puts "Do something useful with #{path}"
23
+ end
24
+
20
25
  Call `vendorer`
21
26
 
22
27
  If you added something new: `vendorer`
@@ -31,7 +36,6 @@ TODO
31
36
  - git branch/commit support
32
37
  - `folder 'vendor' do` which will remove everything that is not vendored via Vendorfile on `vendorer update` or `vendorer update vendor`
33
38
  - nice error message when no Vendorfile was found
34
- - block support `folder(....){|folder| `rm -rf "#{folder}/.gitignore"` }`
35
39
 
36
40
  Author
37
41
  ======
@@ -1,3 +1,3 @@
1
1
  class Vendorer
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
data/lib/vendorer.rb CHANGED
@@ -11,6 +11,7 @@ class Vendorer
11
11
  run "mkdir -p #{File.dirname(path)}"
12
12
  run "curl '#{url}' -o #{path}"
13
13
  raise "Downloaded empty file" unless File.exist?(path)
14
+ yield path if block_given?
14
15
  end
15
16
  end
16
17
 
@@ -19,6 +20,7 @@ class Vendorer
19
20
  run "mkdir -p #{File.dirname(path)}"
20
21
  run "git clone '#{url}' #{path}"
21
22
  run "rm -rf #{path}/.git"
23
+ yield path if block_given?
22
24
  end
23
25
  end
24
26
 
@@ -97,12 +97,28 @@ describe Vendorer do
97
97
  end
98
98
  end
99
99
 
100
- it "fails with a nice message" do
100
+ it "fails with a nice message if the Vendorfile is broken" do
101
101
  write 'Vendorfile', "file 'xxx.js', 'http://NOTFOUND'"
102
102
  result = run '', :raise => true
103
103
  # different errors on travis / local
104
104
  raise result unless result.include?("resolve host 'NOTFOUND'") or result.include?('Downloaded empty file')
105
105
  end
106
+
107
+ context "with a passed block" do
108
+ before do
109
+ write 'Vendorfile', "file('public/javascripts/jquery.js', 'http://code.jquery.com/jquery-latest.js'){|path| puts 'THE PATH IS ' + path }"
110
+ @output = "THE PATH IS public/javascripts/jquery.js"
111
+ end
112
+
113
+ it "runs the block after update" do
114
+ run.should include(@output)
115
+ end
116
+
117
+ it "does not run the block when not updating" do
118
+ run
119
+ run.should_not include(@output)
120
+ end
121
+ end
106
122
  end
107
123
 
108
124
  describe '.folder' do
@@ -113,7 +129,7 @@ describe Vendorer do
113
129
  read('vendor/plugins/parallel_tests/Gemfile').should include('parallel')
114
130
  end
115
131
 
116
- it "reports errors" do
132
+ it "reports errors when the Vendorfile is broken" do
117
133
  write 'Vendorfile', "folder 'vendor/plugins/parallel_tests', 'https://blob'"
118
134
  output = run '', :raise => true
119
135
  # different errors on travis / local
@@ -160,5 +176,21 @@ describe Vendorer do
160
176
  size('its_recursive/Gemfile').should > 30
161
177
  end
162
178
  end
179
+
180
+ context "with a passed block" do
181
+ before do
182
+ write 'Vendorfile', "folder('its_recursive', '../../.git'){|path| puts 'THE PATH IS ' + path }"
183
+ @output = 'THE PATH IS its_recursive'
184
+ end
185
+
186
+ it "runs the block after update" do
187
+ run.should include(@output)
188
+ end
189
+
190
+ it "does not run the block when not updating" do
191
+ run
192
+ run.should_not include(@output)
193
+ end
194
+ end
163
195
  end
164
196
  end
metadata CHANGED
@@ -1,33 +1,23 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: vendorer
3
- version: !ruby/object:Gem::Version
4
- hash: 31
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 2
10
- version: 0.1.2
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Michael Grosser
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-12-13 00:00:00 -08:00
19
- default_executable:
12
+ date: 2011-12-14 00:00:00.000000000 Z
20
13
  dependencies: []
21
-
22
14
  description:
23
15
  email: michael@grosser.it
24
- executables:
16
+ executables:
25
17
  - vendorer
26
18
  extensions: []
27
-
28
19
  extra_rdoc_files: []
29
-
30
- files:
20
+ files:
31
21
  - .travis.yml
32
22
  - Gemfile
33
23
  - Gemfile.lock
@@ -39,39 +29,35 @@ files:
39
29
  - spec/spec_helper.rb
40
30
  - spec/vendorer_spec.rb
41
31
  - vendorer.gemspec
42
- has_rdoc: true
43
32
  homepage: http://github.com/grosser/vendorer
44
- licenses:
33
+ licenses:
45
34
  - MIT
46
35
  post_install_message:
47
36
  rdoc_options: []
48
-
49
- require_paths:
37
+ require_paths:
50
38
  - lib
51
- required_ruby_version: !ruby/object:Gem::Requirement
39
+ required_ruby_version: !ruby/object:Gem::Requirement
52
40
  none: false
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- hash: 3
57
- segments:
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ segments:
58
46
  - 0
59
- version: "0"
60
- required_rubygems_version: !ruby/object:Gem::Requirement
47
+ hash: 36649393
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
49
  none: false
62
- requirements:
63
- - - ">="
64
- - !ruby/object:Gem::Version
65
- hash: 3
66
- segments:
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ segments:
67
55
  - 0
68
- version: "0"
56
+ hash: 36649393
69
57
  requirements: []
70
-
71
58
  rubyforge_project:
72
- rubygems_version: 1.6.2
59
+ rubygems_version: 1.8.10
73
60
  signing_key:
74
61
  specification_version: 3
75
62
  summary: Keep your vendor files up to date
76
63
  test_files: []
77
-