herkko 0.0.9 → 0.0.10

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: f393b03d0f4118e1150a7f929eea8e581789bcbc
4
- data.tar.gz: 39d8803698ed63fc0bdccbd71a64a4ae13026aee
3
+ metadata.gz: 81586564c5621abc9ed86e17e1064e88bad114c5
4
+ data.tar.gz: 14ccc4f0394f4f9ef457fe17a4480db56f74b105
5
5
  SHA512:
6
- metadata.gz: 227a665dd980b62df7bd070739f92d9cdb798c0000ed965998ac2a8065e83543068a5b15d88e7bdf3f0d13fae405b8216a60f92e860c019fc9027ac9cf677646
7
- data.tar.gz: 1ab6a1f154230937b1ae2d94fcf2212d4339643d162d3bed6a8c1ad9df2f0788f0357c18f8d4ac07dd2bef180540a35f4d4d442c0867855948fd5c87c38c3822
6
+ metadata.gz: e221dd5c64b107d04762907024010a60de2b4954d26a81fac9a1392d1e4ededefc07713eb06971d6649bf0c0d11208ccdfb8339e3d965d5a4ff6e07e63cabab6
7
+ data.tar.gz: 4f0ad63ecb906f3162fa6373ad6fb0ec011c288616fd7fc07f38869f578503e2fccdba49b7d8634f44f1d091dd6d8b422ebe303aaec2a68d5e59bd1790b08544
data/lib/herkko/runner.rb CHANGED
@@ -95,7 +95,7 @@ END
95
95
  elsif ci_state == :yellow
96
96
  Herkko.info "CI is running. Wait a while."
97
97
  else
98
- Herkko.info "CI is red. Fix it!"
98
+ Herkko.info "CI is in unknown state. Can't continue."
99
99
  end
100
100
  end
101
101
 
@@ -126,7 +126,8 @@ END
126
126
 
127
127
  def check_ci
128
128
  Herkko.info "Checking CI..."
129
- Herkko::Travis.status_for(current_branch)
129
+
130
+ travis_client.status_for(current_branch)
130
131
  end
131
132
 
132
133
  def deploy!
@@ -183,5 +184,9 @@ END
183
184
  def git_changelog
184
185
  Herkko.run("git", "log", "--pretty=format:%C(yellow)%h %Cblue%ad%Creset %an %Cgreen%s%Creset", "--date=short", "#{currently_deployed_to(environment)}..#{to_be_deployed_sha}")[0]
185
186
  end
187
+
188
+ def travis_client
189
+ @travis_client ||= Herkko::Travis.new
190
+ end
186
191
  end
187
192
  end
data/lib/herkko/travis.rb CHANGED
@@ -2,27 +2,36 @@
2
2
  # travis history -l1 -bmaster
3
3
  module Herkko
4
4
  class Travis
5
- def self.status_for(branch)
6
- status = fetch_status(branch)
7
- if status[1].length > 0
8
- Herkko.info "There was an error with checking Travis: #{status[1]}"
9
- :red
10
- else
11
- case status[0].split(":")[0]
12
- when /passed/
13
- :green
14
- when /started/
15
- :yellow
16
- else
5
+ def status_for(branch)
6
+ if travis_cli_installed?
7
+ status = fetch_status(branch)
8
+ if status[1].length > 0
9
+ Herkko.info "There was an error with checking Travis: #{status[1]}"
17
10
  :red
11
+ else
12
+ case status[0].split(":")[0]
13
+ when /passed/
14
+ :green
15
+ when /started/
16
+ :yellow
17
+ else
18
+ :red
19
+ end
18
20
  end
21
+ else
22
+ Herkko.info "Travis CLI has not been installed, run: gem install travis"
23
+ :unknown
19
24
  end
20
25
  end
21
26
 
22
27
  private
23
28
 
24
- def self.fetch_status(branch)
29
+ def fetch_status(branch)
25
30
  Herkko.run("travis", "history", "--skip-version-check", "-l", "1", "-b", branch)
26
31
  end
32
+
33
+ def travis_cli_installed?
34
+ system("which travis > /dev/null 2>&1")
35
+ end
27
36
  end
28
37
  end
@@ -1,3 +1,3 @@
1
1
  module Herkko
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: herkko
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vesa Vänskä
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-22 00:00:00.000000000 Z
11
+ date: 2016-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  version: '0'
80
80
  requirements: []
81
81
  rubyforge_project:
82
- rubygems_version: 2.5.1
82
+ rubygems_version: 2.2.2
83
83
  signing_key:
84
84
  specification_version: 4
85
85
  summary: Herkko is a deployment tool for Heroku.