vagrant-application-cookbooks 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,4 +1,9 @@
1
1
 
2
+ # 0.1.2 (Oct 5, 2013)
3
+
4
+ * Silence output of git commands
5
+ * Fix several issues with checkout and updating of refs
6
+
2
7
  # 0.1.1 (Oct 5, 2013)
3
8
 
4
9
  * Fix missing berkshelf dependency
data/TODO.md CHANGED
@@ -13,5 +13,5 @@
13
13
  [ ] add spec tests for the clone action
14
14
  [ ] check if url is a valid url
15
15
  [ ] use i18n
16
- [ ] suppress stdout / stderr when shelling out git commands
16
+ [x] suppress stdout / stderr when shelling out git commands
17
17
  [ ] add support for more provisioners / dependency managers
@@ -52,20 +52,31 @@ module VagrantPlugins
52
52
  def clean_and_clone_repo
53
53
  FileUtils.rm_rf cloned_repo_path
54
54
  FileUtils.mkdir_p cloned_repo_path
55
- unless system("git clone #{git_url} #{cloned_repo_path}")
55
+ unless system("git clone -q #{git_url} #{cloned_repo_path}")
56
56
  raise "something went wrong while cloning '#{git_url}'"
57
57
  end
58
58
  end
59
59
 
60
- def update_and_checkout
61
- unless system("cd #{cloned_repo_path} && git pull && git checkout #{git_ref}")
62
- raise "something went wrong while updating / checking out '#{git_ref}'"
60
+ def checkout_and_update
61
+ Dir.chdir(cloned_repo_path) do
62
+ # retrieve all refs
63
+ system("git fetch -q --all")
64
+ # checkout ref
65
+ unless system("git checkout -q #{git_ref}")
66
+ raise "something went wrong while checking out '#{git_ref}'"
67
+ end
68
+ # update ref only if we are on a branch, i.e. not on a detached HEAD
69
+ unless `git symbolic-ref -q HEAD`.empty?
70
+ system("git pull -q")
71
+ end
63
72
  end
64
73
  end
65
74
 
66
75
  def install_cookbooks
67
- unless system("cd #{cloned_repo_path} && berks install --path #{cookbook_install_path}")
68
- raise "something went wrong while installing cookbook dependencies"
76
+ Dir.chdir(cloned_repo_path) do
77
+ unless system("berks install --path #{cookbook_install_path}")
78
+ raise "something went wrong while installing cookbook dependencies"
79
+ end
69
80
  end
70
81
  end
71
82
 
@@ -91,7 +102,7 @@ module VagrantPlugins
91
102
  end
92
103
 
93
104
  log "Ensuring application cookbook is checked out at '#{git_ref}'"
94
- update_and_checkout
105
+ checkout_and_update
95
106
 
96
107
  log "Installing application cookbook dependencies to '#{cookbook_install_path}'"
97
108
  install_cookbooks
@@ -100,6 +111,8 @@ module VagrantPlugins
100
111
  configure_chef_solo
101
112
  end
102
113
 
114
+ raise "boo"
115
+
103
116
  # continue if ok
104
117
  @app.call(env)
105
118
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module ApplicationCookbooks
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-application-cookbooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
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: 2013-10-04 00:00:00.000000000 Z
12
+ date: 2013-10-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: berkshelf
@@ -129,7 +129,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
129
129
  version: '0'
130
130
  segments:
131
131
  - 0
132
- hash: -664377357
132
+ hash: 702792593
133
133
  required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  none: false
135
135
  requirements: