toque 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d73dad6ccfc72b57e6f052ad6d0b1c0e0e6fccaf
4
- data.tar.gz: f86abf5d88d0be9e04c83130b9c485fe974a4999
3
+ metadata.gz: e731ee8504df30f8ad85efbd8235ebe23ad1548a
4
+ data.tar.gz: 52187cfc3e09a96d524cb15dca1f5ef6cb373aef
5
5
  SHA512:
6
- metadata.gz: ae0e96e825701c42abb8aebae252d95d5ae8d3cdc2f3f36392237db9eb338eb34a5f4ee96169b70f7000b8b0720e70c2b72e5c0f31fcff8f5450892436176e12
7
- data.tar.gz: 051acc336cbbd24b5530811cd28f478aa27b459754a48f1d9b1da545a29558a80e6dacde8f286eb33058ec60751be05e9715ed156bd3ded2845a4e4c6ecadef4
6
+ metadata.gz: f4869364d22d99093ec11a8aed5c15db576a903e368ac58203cfe46e90867f7fb9c8ee31946b471637e009734a956b0deed72ce9904d719f92e908acc0f36fd7
7
+ data.tar.gz: 2301bdee31eafc80c1f0c7c326b48601dc2e526a68554d36649de92ff964e89cb138f79f7e13619185184ccf2cb1673879644acb1d2c3bce4c5bb55456c91c6b
@@ -38,7 +38,10 @@ module Toque
38
38
  # Search if curl is present
39
39
  #
40
40
  def curl?
41
- !(capture('curl || true') =~ /not found/)
41
+ run 'curl'
42
+ true
43
+ rescue ::Capistrano::CommandError
44
+ false
42
45
  end
43
46
 
44
47
  # Install curl if not present
@@ -1,7 +1,7 @@
1
1
  module Toque
2
2
  module VERSION
3
3
  MAJOR = 1
4
- MINOR = 6
4
+ MINOR = 7
5
5
  PATCH = 0
6
6
  STAGE = nil
7
7
 
@@ -27,13 +27,26 @@ describe Toque::Helpers, 'loaded into capistrano' do
27
27
 
28
28
  describe '#curl?' do
29
29
  it 'return true if curl exists' do
30
- @configuration.stub_command 'curl || true', data: "curl: try 'curl --help' or 'curl --manual' for more information"
30
+ @configuration.stub_command 'curl', data: "curl: try 'curl --help' or 'curl --manual' for more information"
31
31
  expect(@configuration.toque.curl?).to be_true
32
32
  end
33
33
 
34
34
  it 'return false if curl is missing' do
35
- @configuration.stub_command 'curl || true', data: "sh: command not found"
35
+ @configuration.stub_command 'curl', fail: true
36
36
  expect(@configuration.toque.curl?).to be_false
37
37
  end
38
38
  end
39
+
40
+ describe '#require_curl' do
41
+ it 'should install curl if not present' do
42
+ @configuration.stub_command 'curl', fail: true
43
+ @configuration.stub_command "sudo -p 'sudo password: ' apt-get install --no-install-recommends -yq curl" do |_|
44
+ @configuration.stub_command 'curl', data: "curl: try 'curl --help' or 'curl --manual' for more information"
45
+ end
46
+
47
+ expect(@configuration.toque.curl?).to be_false
48
+ @configuration.toque.require_curl
49
+ expect(@configuration.toque.curl?).to be_true
50
+ end
51
+ end
39
52
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toque
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen