derelict 0.2.1.travis.79 → 0.2.1.travis.81

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NmExNDJjMGEzMGZjYTczYjY1ODkyZjMxOTFkNDdmNTNjMDM3YTNiZg==
4
+ MjIxYjFmNGVlMTc1NzJjZjhjODhkNWQzODdkYjNhNTdkODM3YWExNw==
5
5
  data.tar.gz: !binary |-
6
- NTMwZmUyMzBhYmMwNWM1ODAxYTUxOGVmMWYzNGY3NGEyMmEwZmY5ZA==
6
+ NTZkZTQyYjBlMmMyZDViNTI3MDRhZGYzZTY3MTdhYzdiYjIwOTliZg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- N2Y5MDcwYjI3YWQ0OWRiNjhmMGI0MTI0MTlkNWE2MDRlOTg2NTJlN2JmNTQw
10
- ZWExY2YxNWMxYThhNjdlOTNkZjljZWE4ZjIxYTllMjE2MTEyOWQ2NWRjNTEx
11
- ZmM1MmRjOGNiYmE1MWI1NTVkYzIzMmViN2QxOWY3ZjBjMDYwZDU=
9
+ MjQwYThhZTFkYjQwODk3NTBlZmI5OWM4ODNiNTEyNTMzZTExNDVmMTA3ODRm
10
+ Y2FkYWY3YzIxMjczMmIyNWEzZDI3ZmQxYWU4ZjM0NGEzNTJjNGZhYjliZjgw
11
+ ZDVmMmZmZGMyYjQ4NzEzNmVjNjQzMjlhZTdmZTE5YjQ5MWUxMTE=
12
12
  data.tar.gz: !binary |-
13
- MmY2MjkwM2VjOGUwYWMzNjA1MTE2NzU5NTQzYWMyMTUyZmIzMGZhMmU2YmM1
14
- Njc0N2JlZWEwMWNiNDc5MWNjMTExMmI3NTA5YjFmNzU1Y2FmMzdhZDQ0Mzlk
15
- ZTgxMTZmNzdiZjdiNTUxZTUzZTdhZmM2M2MxNzBjOGYzZjg3NTk=
13
+ YmI3NmFiNDBiYzNlOGI1NjI1ODIyZmRkYTU3NjlmNDg5ZGEwNzIxZTE1MzBi
14
+ YTk3NGViMjkzN2JlYThiOTk2ZTgxZjFlYjZmM2M4MzBlMDIyZDcxZjY4ZjIx
15
+ ZjFiMjcyNDU4MjEwODlkMDA2ZDQ2ZjZmNzczY2JjNDFmYzFhMTM=
@@ -30,8 +30,8 @@ module Derelict
30
30
  # Determines whether a particular plugin is installed
31
31
  #
32
32
  # * plugin_name: Name of the plugin to look for (as a string)
33
- def installed?(plugin_name)
34
- fetch plugin_name; true
33
+ def installed?(plugin_name, version = nil)
34
+ fetch(plugin_name).version == version or version.nil?
35
35
  rescue Plugin::NotFound
36
36
  false
37
37
  end
@@ -56,7 +56,9 @@ module Derelict
56
56
  command.concat ["--plugin-version", version] unless version.nil?
57
57
 
58
58
  log_block = options[:log] ? shell_log_block : nil
59
- instance.execute! *command, &log_block
59
+ instance.execute!(*command, &log_block).tap do
60
+ flush_cache # flush memoized method return values
61
+ end
60
62
  end
61
63
 
62
64
  # Uninstalls a particular Vagrant plugin
@@ -67,7 +69,9 @@ module Derelict
67
69
  logger.info "Uninstalling plugin '#{plugin_name}' using #{description}"
68
70
 
69
71
  log_block = options[:log] ? shell_log_block : nil
70
- instance.execute! :plugin, "uninstall", plugin_name, &log_block
72
+ instance.execute!(:plugin, "uninstall", plugin_name, &log_block).tap do
73
+ flush_cache # flush memoized method return values
74
+ end
71
75
  end
72
76
 
73
77
  # Updates a particular Vagrant plugin
@@ -78,7 +82,9 @@ module Derelict
78
82
  logger.info "Updating plugin '#{plugin_name}' using #{description}"
79
83
 
80
84
  log_block = options[:log] ? shell_log_block : nil
81
- instance.execute! :plugin, "update", plugin_name, &log_block
85
+ instance.execute!(:plugin, "update", plugin_name, &log_block).tap do
86
+ flush_cache # flush memoized method return values
87
+ end
82
88
  end
83
89
 
84
90
  # Retrieves a plugin with a particular name
@@ -38,17 +38,42 @@ describe Derelict::Plugin::Manager do
38
38
 
39
39
  describe "#installed?" do
40
40
  let(:plugin_name) { double("plugin_name") }
41
- let(:result) { double("result") }
42
- subject { manager.installed? plugin_name }
41
+ let(:plugin) { double("plugin", :version => plugin_version) }
42
+ let(:plugin_version) { nil }
43
+ let(:version) { nil }
44
+ subject { manager.installed? plugin_name, version }
43
45
 
44
46
  context "with known plugin" do
45
- before { expect(manager).to receive(:fetch).with(plugin_name).and_return(result) }
46
- it { should be true }
47
+ before { expect(manager).to receive(:fetch).with(plugin_name).and_return(plugin) }
48
+
49
+ context "with version" do
50
+ let(:version) { "1.2.3" }
51
+ let(:plugin_version) { "1.2.3" }
52
+ it { should be true }
53
+ end
54
+
55
+ context "with wrong version" do
56
+ let(:version) { "1.2.3" }
57
+ let(:plugin_version) { "2.3.4" }
58
+ it { should be false }
59
+ end
60
+
61
+ context "without version" do
62
+ it { should be true }
63
+ end
47
64
  end
48
65
 
49
66
  context "with unknown plugin" do
50
67
  before { expect(manager).to receive(:fetch).with(plugin_name).and_raise(Derelict::Plugin::NotFound.new plugin_name) }
51
- it { should be false }
68
+
69
+ context "with version" do
70
+ let(:version) { "3.4.5" }
71
+ it { should be false }
72
+ end
73
+
74
+ context "without version" do
75
+ it { should be false }
76
+ end
52
77
  end
53
78
 
54
79
  include_context "logged messages"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: derelict
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1.travis.79
4
+ version: 0.2.1.travis.81
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Feehan