vendorer 0.1.1 → 0.1.2

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.1)
4
+ vendorer (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/Readme.md CHANGED
@@ -1,7 +1,7 @@
1
- Vendorer keeps your vendor files up to date.
1
+ Vendorer
2
2
 
3
- - updateable AND documented dependencies
4
- - copy-paste-free
3
+ - documented dependencies
4
+ - automatic updates
5
5
  - no unwanted/accidental updates
6
6
 
7
7
  Install
@@ -12,10 +12,10 @@ Install curl and git, then:
12
12
 
13
13
  Usage
14
14
  =====
15
- Add a Vendorfile to your project root:
15
+ Add a `Vendorfile` to your project root:
16
16
 
17
- file 'public/javascripts/jquery.min.js' => 'http://code.jquery.com/jquery-latest.min.js'
18
- folder 'vendor/plugins/parallel_tests' => 'https://github.com/grosser/parallel_tests.git'
17
+ file 'public/javascripts/jquery.min.js', 'http://code.jquery.com/jquery-latest.min.js'
18
+ folder 'vendor/plugins/parallel_tests', 'https://github.com/grosser/parallel_tests.git'
19
19
 
20
20
  Call `vendorer`
21
21
 
@@ -30,6 +30,8 @@ TODO
30
30
  ====
31
31
  - git branch/commit support
32
32
  - `folder 'vendor' do` which will remove everything that is not vendored via Vendorfile on `vendorer update` or `vendorer update vendor`
33
+ - nice error message when no Vendorfile was found
34
+ - block support `folder(....){|folder| `rm -rf "#{folder}/.gitignore"` }`
33
35
 
34
36
  Author
35
37
  ======
@@ -1,3 +1,3 @@
1
1
  class Vendorer
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
data/lib/vendorer.rb CHANGED
@@ -6,23 +6,19 @@ class Vendorer
6
6
 
7
7
  private
8
8
 
9
- def file(options)
10
- options.each do |file, url|
11
- update_or_not file do
12
- run "mkdir -p #{File.dirname(file)}"
13
- run "curl '#{url}' -o #{file}"
14
- raise "Downloaded empty file" unless File.exist?(file)
15
- end
9
+ def file(path, url)
10
+ update_or_not path do
11
+ run "mkdir -p #{File.dirname(path)}"
12
+ run "curl '#{url}' -o #{path}"
13
+ raise "Downloaded empty file" unless File.exist?(path)
16
14
  end
17
15
  end
18
16
 
19
- def folder(options)
20
- options.each do |path, url|
21
- update_or_not path do
22
- run "mkdir -p #{File.dirname(path)}"
23
- run "git clone '#{url}' #{path}"
24
- run "rm -rf #{path}/.git"
25
- end
17
+ def folder(path, url)
18
+ update_or_not path do
19
+ run "mkdir -p #{File.dirname(path)}"
20
+ run "git clone '#{url}' #{path}"
21
+ run "rm -rf #{path}/.git"
26
22
  end
27
23
  end
28
24
 
@@ -59,7 +59,7 @@ describe Vendorer do
59
59
  describe '.file' do
60
60
  context "with working Vendorfile" do
61
61
  before do
62
- write 'Vendorfile', "file 'public/javascripts/jquery.min.js' => 'http://code.jquery.com/jquery-latest.min.js'"
62
+ write 'Vendorfile', "file 'public/javascripts/jquery.min.js', 'http://code.jquery.com/jquery-latest.min.js'"
63
63
  run
64
64
  end
65
65
 
@@ -82,8 +82,8 @@ describe Vendorer do
82
82
 
83
83
  it "can update a single file" do
84
84
  write 'Vendorfile', "
85
- file 'public/javascripts/jquery.min.js' => 'http://code.jquery.com/jquery-latest.min.js'
86
- file 'public/javascripts/jquery.js' => 'http://code.jquery.com/jquery-latest.js'
85
+ file 'public/javascripts/jquery.min.js', 'http://code.jquery.com/jquery-latest.min.js'
86
+ file 'public/javascripts/jquery.js', 'http://code.jquery.com/jquery-latest.js'
87
87
  "
88
88
  run
89
89
  read('public/javascripts/jquery.js').should include('jQuery')
@@ -98,29 +98,31 @@ describe Vendorer do
98
98
  end
99
99
 
100
100
  it "fails with a nice message" do
101
- write 'Vendorfile', "file 'xxx.js' => 'http://NOTFOUND'"
101
+ write 'Vendorfile', "file 'xxx.js', 'http://NOTFOUND'"
102
102
  result = run '', :raise => true
103
- result.should include('Downloaded empty file')
103
+ # different errors on travis / local
104
+ raise result unless result.include?("resolve host 'NOTFOUND'") or result.include?('Downloaded empty file')
104
105
  end
105
106
  end
106
107
 
107
108
  describe '.folder' do
108
109
  it "can download via hash syntax" do
109
- write 'Vendorfile', "folder 'vendor/plugins/parallel_tests' => 'https://github.com/grosser/parallel_tests.git'"
110
+ write 'Vendorfile', "folder 'vendor/plugins/parallel_tests', 'https://github.com/grosser/parallel_tests.git'"
110
111
  run
111
112
  ls('vendor/plugins').should == ["parallel_tests"]
112
113
  read('vendor/plugins/parallel_tests/Gemfile').should include('parallel')
113
114
  end
114
115
 
115
116
  it "reports errors" do
116
- write 'Vendorfile', "folder 'vendor/plugins/parallel_tests' => 'https://blob'"
117
+ write 'Vendorfile', "folder 'vendor/plugins/parallel_tests', 'https://blob'"
117
118
  output = run '', :raise => true
118
- output.should include('Connection refused')
119
+ # different errors on travis / local
120
+ raise unless output.include?('Connection refused') or output.include?('resolve host')
119
121
  end
120
122
 
121
123
  context "with a fast,local repository" do
122
124
  before do
123
- write 'Vendorfile', "folder 'its_recursive' => '../../.git'"
125
+ write 'Vendorfile', "folder 'its_recursive', '../../.git'"
124
126
  run
125
127
  end
126
128
 
@@ -147,8 +149,8 @@ describe Vendorer do
147
149
 
148
150
  it "can update a single file" do
149
151
  write 'Vendorfile', "
150
- folder 'its_recursive' => '../../.git'
151
- folder 'its_really_recursive' => '../../.git'
152
+ folder 'its_recursive', '../../.git'
153
+ folder 'its_really_recursive', '../../.git'
152
154
  "
153
155
  run
154
156
  write('its_recursive/Gemfile', 'Foo')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vendorer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Grosser
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-12-12 00:00:00 -08:00
18
+ date: 2011-12-13 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies: []
21
21