vendorer 0.1.8 → 0.1.9

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.8)
4
+ vendorer (0.1.9)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/Readme.md CHANGED
@@ -34,6 +34,7 @@ Usage
34
34
  Add a `Vendorfile` to your project root:
35
35
 
36
36
 
37
+ <!-- extracted by vendorer init -->
37
38
  ``` ruby
38
39
  file 'vendor/assets/javascripts/jquery.min.js', 'http://code.jquery.com/jquery-latest.min.js'
39
40
  folder 'vendor/plugins/parallel_tests', 'https://github.com/grosser/parallel_tests.git'
@@ -52,8 +53,9 @@ folder 'vendor/assets/javascripts' do
52
53
  file 'jquery.js', 'http://code.jquery.com/jquery-latest.js'
53
54
  end
54
55
  ```
56
+ <!-- extracted by vendorer init -->
55
57
 
56
-
58
+ - Create a new Vendorfile: `vendorer init`
57
59
  - excute all installations: `vendorer`
58
60
  - Update all dependencies: `vendorer update`
59
61
  - update a single dependency: `vendorer update vendor/assets/javascripts/jquery.min.js`
@@ -69,6 +71,7 @@ Author
69
71
 
70
72
  ### [Contributors](http://github.com/grosser/vendorer/contributors)
71
73
  - [Kurtis Rainbolt-Greene](https://github.com/krainboltgreene)
74
+ - [Ivan K.](https://github.com/divout)
72
75
 
73
76
  [Michael Grosser](http://grosser.it)<br/>
74
77
  michael@grosser.it<br/>
data/bin/vendorer CHANGED
@@ -15,6 +15,7 @@ Create a Vendorfile in your project root with:
15
15
  file 'public/javascripts/jquery.min.js' => 'http://code.jquery.com/jquery-latest.min.js'
16
16
  folder 'vendor/plugins/parallel_tests' => 'https://github.com/grosser/parallel_tests.git'
17
17
 
18
+ Run `vendorer init` to create Vendorfile.
18
19
  Run `vendorer` to install.
19
20
  Run `vendorer update` to update.
20
21
 
@@ -30,5 +31,7 @@ end
30
31
  parser.parse!
31
32
 
32
33
  require 'vendorer'
33
- v = Vendorer.new(:update => (ARGV[1] || true if ARGV[0] == 'update'))
34
+ v = Vendorer.new(:update => (ARGV[1] || true if ARGV[0] == 'update'),
35
+ :init => (true if ARGV[0] == 'init'))
36
+ v.init and exit if ARGV[0] == 'init'
34
37
  v.parse(File.read('Vendorfile'))
@@ -1,3 +1,3 @@
1
1
  class Vendorer
2
- VERSION = '0.1.8'
2
+ VERSION = '0.1.9'
3
3
  end
data/lib/vendorer.rb CHANGED
@@ -47,6 +47,18 @@ class Vendorer
47
47
  File.open(path,'w'){|f| f.write(result) }
48
48
  end
49
49
 
50
+ # Creates Vendorfile with examples
51
+ def init
52
+ separator = "<!-- extracted by vendorer init -->"
53
+ readme = File.read(File.expand_path('../../Readme.md', __FILE__))
54
+ examples = readme.split(separator)[1]
55
+ examples.gsub!(/```.*/,'') # remove ``` from readme
56
+ examples = examples.split("\n").map do |l|
57
+ (l.start_with? '#' or l.empty?) ? l : "# #{l}"
58
+ end.join("\n")
59
+ File.open('Vendorfile', 'w') { |f| f.write(examples.strip) }
60
+ end
61
+
50
62
  private
51
63
 
52
64
  def update_or_not(path)
@@ -346,7 +346,7 @@ describe Vendorer do
346
346
  create_git_repo 'b', 'touch .gitmodules'
347
347
 
348
348
  # create submodules on a branch
349
- run "cd b && git co -b with_submodules"
349
+ run "cd b && git checkout -b with_submodules"
350
350
  run "cd b && git submodule add `cd ../a/.git && pwd` sub_b"
351
351
  run "cd b && git add . && git commit -am 'submodules'"
352
352
  run "cd b && git checkout master"
@@ -382,4 +382,36 @@ describe Vendorer do
382
382
  $test.should == v
383
383
  end
384
384
  end
385
+
386
+ describe "#init" do
387
+ it "creates a Vendorfile via cli" do
388
+ vendorer("init")
389
+ read("Vendorfile").should include("folder")
390
+ end
391
+
392
+ it "creates a Vendorfile via ruby" do
393
+ Vendorer.new('init').init
394
+ read("Vendorfile").should include("folder")
395
+ end
396
+
397
+ it "created Vendorfile contains commented out examples" do
398
+ Vendorer.new('init').init
399
+ read("Vendorfile").split("\n").each{|l| l.should =~ /^(#|\s*$)/ }
400
+ end
401
+
402
+ it "created Vendorfile contains many examples" do
403
+ Vendorer.new('init').init
404
+ read("Vendorfile").should include("folder 'vendor/")
405
+ read("Vendorfile").should include("file 'vendor/")
406
+ read("Vendorfile").should include("rewrite(path)")
407
+ end
408
+
409
+ it "created Vendorfile does not contain other instructions" do
410
+ Vendorer.new('init').init
411
+ read("Vendorfile").should_not include("vendorer init")
412
+ read("Vendorfile").should_not include("Gemfile")
413
+ read("Vendorfile").should_not include("gem install")
414
+ read("Vendorfile").should_not include("```")
415
+ end
416
+ end
385
417
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vendorer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-09 00:00:00.000000000 Z
12
+ date: 2012-01-12 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: michael@grosser.it
@@ -44,7 +44,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
44
44
  version: '0'
45
45
  segments:
46
46
  - 0
47
- hash: -191468703
47
+ hash: -844902927
48
48
  required_rubygems_version: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
@@ -53,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
53
  version: '0'
54
54
  segments:
55
55
  - 0
56
- hash: -191468703
56
+ hash: -844902927
57
57
  requirements: []
58
58
  rubyforge_project:
59
59
  rubygems_version: 1.8.10