librarian-ansible 1.0.6 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 72c8d1017901562889ad9a7037f3fc503cadf518
4
- data.tar.gz: 640bcfe4416e2cc3ff0bab763c7da9fb72a73b05
3
+ metadata.gz: 0683e7fc9b74bcea066972c85e9f7fbbff517afb
4
+ data.tar.gz: 763e25bb2ce03666350d38404d3727d2f36b4730
5
5
  SHA512:
6
- metadata.gz: 5d799b4e7a4cae5deddd9379c70ee53c28b6e709d9c32d2f8d87816cbc5ed23e241afc013cbd8dcccbca1df842f7b9456eefc006dfcef146802aa9e6cbb73e41
7
- data.tar.gz: 6970dac352e1426e85c1a516e0196486fbe6eb9a52a3742fceb6584912102c4dfb1d3c831383d8af619e3031c1feced49f20df4df37fe925fed4c04d730d14cd
6
+ metadata.gz: 4c12598b8cd93c8aa75266038dc25621d0c19fa6fbd8c90898d571c06c5d5da4f7b9cf963d486c33297689c348625451bf4750f9422fa878e69e30ebbf993811
7
+ data.tar.gz: 360b30fbbec8de2dda91347910b4ea22dc46efa18999d7d2f1835c535dc54926235542eeb75a9fa487b116985e14dac464659fb22c6c86a3b042e109b57c5da2
data/README.md CHANGED
@@ -180,6 +180,9 @@ Configuration can be set by passing specific options to other commands.
180
180
  the `--strip-dot-git` option to the `install` command. It can be unset at the
181
181
  local level by passing the `--no-strip-dot-git` option.
182
182
 
183
+ Note that the directories will be purged if you run librarian-ansible with the
184
+ --clean or --destructive flags.
185
+
183
186
  ## Contributing
184
187
 
185
188
  1. Fork it ( http://github.com/bcoe/librarian-ansible/fork )
@@ -1 +1,2 @@
1
1
  require 'librarian/ansible/extension'
2
+ require 'librarian/action/install'
@@ -0,0 +1 @@
1
+ require "librarian/ansible/action/install"
@@ -0,0 +1,22 @@
1
+ require 'librarian/action/install'
2
+
3
+ module Librarian
4
+ module Ansible
5
+ module Action
6
+ class Install < Librarian::Action::Install
7
+
8
+ private
9
+
10
+ def create_install_path
11
+ install_path.rmtree if install_path.exist? && destructive?
12
+ install_path.mkpath
13
+ end
14
+
15
+ def destructive?
16
+ environment.config_db.local['destructive'] == 'true'
17
+ end
18
+
19
+ end
20
+ end
21
+ end
22
+ end
@@ -2,6 +2,7 @@ require 'librarian/helpers'
2
2
 
3
3
  require 'librarian/cli'
4
4
  require 'librarian/ansible'
5
+ require 'librarian/ansible/action'
5
6
 
6
7
  module Librarian
7
8
  module Ansible
@@ -28,9 +29,13 @@ module Librarian
28
29
  option "clean", :type => :boolean, :default => false
29
30
  option "strip-dot-git", :type => :boolean
30
31
  option "path", :type => :string
32
+ option "destructive", :type => :boolean, :default => false
31
33
  def install
32
34
  ensure!
33
35
  clean! if options["clean"]
36
+ unless options["destructive"].nil?
37
+ environment.config_db.local['destructive'] = options['destructive'].to_s
38
+ end
34
39
  if options.include?("strip-dot-git")
35
40
  strip_dot_git_val = options["strip-dot-git"] ? "1" : nil
36
41
  environment.config_db.local["install.strip-dot-git"] = strip_dot_git_val
@@ -38,10 +43,18 @@ module Librarian
38
43
  if options.include?("path")
39
44
  environment.config_db.local["path"] = options["path"]
40
45
  end
46
+
41
47
  resolve!
42
48
  install!
43
49
  end
44
50
 
51
+ private
52
+
53
+ # override the actions to use our own
54
+
55
+ def install!(options = { })
56
+ Action::Install.new(environment, options).run
57
+ end
45
58
  end
46
59
  end
47
60
  end
@@ -1,4 +1,5 @@
1
1
  require 'librarian/ansible/environment'
2
+ require 'librarian/action/base'
2
3
 
3
4
  module Librarian
4
5
  module Ansible
@@ -55,7 +55,7 @@ module Librarian
55
55
  else
56
56
  json = JSON.parse(response.body)
57
57
  package = json['results'].find do |r|
58
- r['summary_fields']['owner']['username'] == username &&
58
+ r['namespace'] == username &&
59
59
  r['name'] == name
60
60
  end
61
61
  return package if package
@@ -1,5 +1,5 @@
1
1
  module Librarian
2
2
  module Ansible
3
- VERSION = "1.0.6"
3
+ VERSION = "2.0.0"
4
4
  end
5
5
  end
@@ -81,12 +81,12 @@ module Librarian
81
81
 
82
82
  context "the resolve" do
83
83
  it "should not raise an exception" do
84
- expect { Action::Resolve.new(env).run }.to_not raise_error
84
+ expect { Librarian::Action::Resolve.new(env).run }.to_not raise_error
85
85
  end
86
86
  end
87
87
 
88
88
  context "the results" do
89
- before { Action::Resolve.new(env).run }
89
+ before { Librarian::Action::Resolve.new(env).run }
90
90
 
91
91
  it "should create the lockfile" do
92
92
  repo_path.join("Ansiblefile.lock").should exist
@@ -110,7 +110,7 @@ module Librarian
110
110
  ANSIBLEFILE
111
111
  repo_path.join("Ansiblefile").open("wb") { |f| f.write(ansiblefile) }
112
112
 
113
- Action::Resolve.new(env).run
113
+ Librarian::Action::Resolve.new(env).run
114
114
  end
115
115
 
116
116
  context "the install" do
@@ -148,7 +148,7 @@ module Librarian
148
148
  ANSIBLEFILE
149
149
  repo_path.join("Ansiblefile").open("wb") { |f| f.write(ansiblefile) }
150
150
 
151
- Action::Resolve.new(env).run
151
+ Librarian::Action::Resolve.new(env).run
152
152
  repo_path.join("tmp").rmtree if repo_path.join("tmp").exist?
153
153
  end
154
154
 
@@ -210,7 +210,7 @@ module Librarian
210
210
  end
211
211
 
212
212
  it "should not resolve" do
213
- expect{ Action::Resolve.new(env).run }.to raise_error
213
+ expect{ Librarian::Action::Resolve.new(env).run }.to raise_error
214
214
  end
215
215
  end
216
216
 
@@ -230,7 +230,7 @@ module Librarian
230
230
  end
231
231
 
232
232
  it "should not resolve" do
233
- expect{ Action::Resolve.new(env).run }.to raise_error
233
+ expect{ Librarian::Action::Resolve.new(env).run }.to raise_error
234
234
  end
235
235
  end
236
236
 
@@ -251,12 +251,12 @@ module Librarian
251
251
 
252
252
  context "the resolve" do
253
253
  it "should not raise an exception" do
254
- expect { Action::Resolve.new(env).run }.to_not raise_error
254
+ expect { Librarian::Action::Resolve.new(env).run }.to_not raise_error
255
255
  end
256
256
  end
257
257
 
258
258
  context "the results" do
259
- before { Action::Resolve.new(env).run }
259
+ before { Librarian::Action::Resolve.new(env).run }
260
260
 
261
261
  it "should create the lockfile" do
262
262
  repo_path.join("Ansiblefile.lock").should exist
@@ -307,7 +307,7 @@ module Librarian
307
307
  :ref => "some-branch"
308
308
  ANSIBLEFILE
309
309
  repo_path.join("Ansiblefile").open("wb") { |f| f.write(ansiblefile) }
310
- Action::Resolve.new(env).run
310
+ Librarian::Action::Resolve.new(env).run
311
311
 
312
312
  # change the upstream copy of that branch: we expect to be able to pull the latest
313
313
  # when we re-resolve
@@ -326,7 +326,7 @@ module Librarian
326
326
 
327
327
  context "when updating not a role from that source" do
328
328
  before do
329
- Action::Update.new(env).run
329
+ Librarian::Action::Update.new(env).run
330
330
  end
331
331
 
332
332
  it "should pull the tip from upstream" do
@@ -341,7 +341,7 @@ module Librarian
341
341
 
342
342
  context "when updating a role from that source" do
343
343
  before do
344
- Action::Update.new(env, :names => %w(sample)).run
344
+ Librarian::Action::Update.new(env, :names => %w(sample)).run
345
345
  end
346
346
 
347
347
  it "should pull the tip from upstream" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: librarian-ansible
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Coe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-12 00:00:00.000000000 Z
11
+ date: 2016-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: librarian
@@ -85,6 +85,8 @@ files:
85
85
  - lib/ext/librarian/lockfile/parser.rb
86
86
  - lib/librarian-ansible.rb
87
87
  - lib/librarian/ansible.rb
88
+ - lib/librarian/ansible/action.rb
89
+ - lib/librarian/ansible/action/install.rb
88
90
  - lib/librarian/ansible/cli.rb
89
91
  - lib/librarian/ansible/dsl.rb
90
92
  - lib/librarian/ansible/environment.rb
@@ -124,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
126
  version: '0'
125
127
  requirements: []
126
128
  rubyforge_project:
127
- rubygems_version: 2.2.2
129
+ rubygems_version: 2.0.14
128
130
  signing_key:
129
131
  specification_version: 4
130
132
  summary: A Bundler for your Ansible roles.