bindep 0.0.4 → 0.0.5

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
  !binary "U0hBMQ==":
3
- metadata.gz: efaacbf7d22b5b1a56065c0637bd033c08cfe882
4
- data.tar.gz: 5a9da55da0c0169b1deacaacdb28252cb5bfb1da
3
+ metadata.gz: d27f78a2ad658f6815603eae4fd3da46f8ebf9b7
4
+ data.tar.gz: 15ff0d3c12371bc02d10e64f1fb6f4672cc014da
5
5
  SHA512:
6
- metadata.gz: 27538adddfa34a99552e5df3afdec80902001c04140c70aeed4e621a6cb2cbc88d164a6525bb2778e1087f74d3f8fa0410e5c91c2fd4365803ea6474fc1852f2
7
- data.tar.gz: 36e600db1e96ae819abeae43ba75c7c830b8f871d68928194889d080f543dfc4749b95f52763ab1bccf3ee001eaf630d416a67fcc4b1465e84e3e84ed55d22ef
6
+ metadata.gz: f5b51d74c60bc541884240f3ded327c310bf3626ca6ce1d1c3eb6492325fdaaa45638b5ba86296e06a7163cb9d458f24808724b69d468c93bafeb6bdba5a5074
7
+ data.tar.gz: ce4a6f27c33acab3038586a627188c1ca3c4f57e83fcff1d8b8abfeb97431fa04eca6bbe16e32b6878be82096d3fcff3dbb0a9a3866ea110d8f4d7810153855c
@@ -6,7 +6,7 @@ module Bindep
6
6
  def initialize(id)
7
7
  @id = id.to_sym
8
8
  end
9
-
9
+
10
10
  # Get the command for the current system. Return nil if command is not available.
11
11
  def local_command(reset = false)
12
12
  @local_command = nil if reset
@@ -16,20 +16,19 @@ module Bindep
16
16
  end
17
17
  end
18
18
 
19
- # Get the installation commands for the current system as a single string.
19
+ # Get the installation commands for the current system as a single string.
20
20
  # Return nil if there is no command that fits the current system.
21
21
  def install_command
22
22
  list = []
23
-
24
- list << OS.apt_install(apt) if apt && OS.apt?
25
- list << OS.yum_install(yum) if yum && OS.yum?
23
+
24
+ list << OS.apt_install(apt) if apt && OS.apt? && !OS.yum?
25
+ list << OS.yum_install(yum) if yum && OS.yum? && !OS.apt?
26
26
  list << OS.brew_install(brew) if brew && OS.brew?
27
27
  list << OS.npm_install(npm) if npm && OS.npm?
28
- list << OS.rubygem_install(rubygem) if rubygem && OS.rubygem?
28
+ list << OS.rubygem_install(rubygem) if rubygem && OS.rubygem?
29
29
  list << @install_command if @install_command
30
30
 
31
31
  list.empty? ? nil : list.join("; ")
32
32
  end
33
33
  end
34
34
  end
35
-
@@ -1,3 +1,3 @@
1
1
  module Bindep
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -72,7 +72,7 @@ describe Bindep::Item do
72
72
  item.command = [ "foo_bar_not_here", "cat" ]
73
73
 
74
74
  expect(item.local_command).to eq "cat"
75
-
75
+
76
76
  item.command = "foo_bar_not_here"
77
77
 
78
78
  expect(item.local_command).to eq "cat"
@@ -83,12 +83,12 @@ describe Bindep::Item do
83
83
  item.command = [ "foo_bar_not_here", "cat" ]
84
84
 
85
85
  expect(item.local_command).to eq "cat"
86
-
86
+
87
87
  item.command = "grep"
88
88
 
89
89
  expect(item.local_command(true)).to eq "grep"
90
90
  end
91
- end
91
+ end
92
92
 
93
93
  # cannot cover all tests (would be 2^n test cases, n = package handler count),
94
94
  # so we choose a few general ones and edge cases
@@ -104,21 +104,20 @@ describe Bindep::Item do
104
104
  expect(item.install_command).to eq cmd
105
105
  end
106
106
 
107
- it "works all commands given and all available" do
107
+ it "works all commands given and all available (except yum)" do
108
108
  Bindep::OS.instance_variable_set :@command_exists_cache, {
109
- apt: true, npm: true, brew: true, yum: true, rubygem: true
109
+ apt: true, npm: true, brew: true, yum: false, rubygem: true
110
110
  }
111
111
 
112
112
  item.apt = "p_apt"
113
- item.npm = "p_npm"
114
113
  item.yum = "p_yum"
114
+ item.npm = "p_npm"
115
115
  item.brew = "p_brew"
116
116
  item.rubygem = "p_gem"
117
117
  item.install_command = "my package"
118
-
118
+
119
119
  results = [
120
120
  Bindep::OS.apt_install("p_apt"),
121
- Bindep::OS.yum_install("p_yum"),
122
121
  Bindep::OS.brew_install("p_brew"),
123
122
  Bindep::OS.npm_install("p_npm"),
124
123
  Bindep::OS.rubygem_install("p_gem"),
@@ -128,24 +127,38 @@ describe Bindep::Item do
128
127
  expect(item.install_command).to eq results.join("; ")
129
128
  end
130
129
 
131
- it "works some commands given and some available" do
130
+ it "does not run any of apt or yum if both are available" do
132
131
  Bindep::OS.instance_variable_set :@command_exists_cache, {
133
- apt: true, npm: true, brew: false, yum: true, rubygem: false
132
+ apt: true, npm: true, brew: true, yum: true, rubygem: true
134
133
  }
135
134
 
136
135
  item.apt = "p_apt"
136
+ item.yum = "p_yum"
137
+ item.brew = "p_brew"
138
+
139
+ results = [
140
+ Bindep::OS.brew_install("p_brew"),
141
+ ]
142
+
143
+ expect(item.install_command).to eq results.join("; ")
144
+ end
145
+
146
+ it "works some commands given and some available" do
147
+ Bindep::OS.instance_variable_set :@command_exists_cache, {
148
+ apt: false, npm: true, brew: false, yum: true, rubygem: false
149
+ }
150
+
137
151
  item.npm = nil
138
152
  item.yum = "p_yum"
139
153
  item.brew = "p_brew"
140
154
  item.rubygem = "p_gem"
141
155
  item.install_command = nil
142
-
156
+
143
157
  results = [
144
- Bindep::OS.apt_install("p_apt"),
145
158
  Bindep::OS.yum_install("p_yum"),
146
159
  ]
147
160
 
148
161
  expect(item.install_command).to eq results.join("; ")
149
162
  end
150
- end
163
+ end
151
164
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bindep
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niko Dziemba
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-17 00:00:00.000000000 Z
11
+ date: 2014-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler