foreplay 0.15.2 → 0.15.4

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: d031a72dd4857652d92f44c5ba0c33e08e478cc5
4
- data.tar.gz: 80203d38c89a6cc95d8eef8834935638bdc996f4
3
+ metadata.gz: 3758e074daab2a595d32666e7eb7034efd7eaff2
4
+ data.tar.gz: a40d78f7cbb448bcf8eba79e1b69904f866ac6bc
5
5
  SHA512:
6
- metadata.gz: ed5c6d4b7c435b34f9ffa367cf8bbc6ce13b969c4a01e8f9940105e4b4f7e6a3ee030869524f3184b93fdf258b9445ce41b70aa0fb9df43f61fc01e2e4f2230e
7
- data.tar.gz: 008925d3421721325e330aa3595ae861a1c5f31e3a1e589d3272606fddff32e9f2c3902d6f0973af1fea96bcf7e232995c005f2ff0de01acce67e7e3424cf062
6
+ metadata.gz: fc871cf10d5eec20ae4d665c68b4b7fd64db402a32edc6d2de71aa453b8adbd14a4eefe15ca021a72ba59d2b8ae4839f84c3c508d89cb51881b86d4f86031670
7
+ data.tar.gz: 745f3bf9544292a942718e600ee1a8c12c7caa248a4f86d8e58cfd0b288c19daf913c5d8dffcfbde02afd43297e1e62eccd0eae36e701919c56f33fa94069c31
data/.rubocop.yml CHANGED
@@ -44,3 +44,7 @@ MethodLength:
44
44
 
45
45
  AbcSize:
46
46
  Max: 21 # 23 # 62
47
+
48
+ CyclomaticComplexity:
49
+ Max: 7
50
+
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
1
  source 'https://rubygems.org'
2
- ruby "2.1.9"
2
+ ruby '2.1.9'
3
3
  gemspec
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Foreplay
2
2
 
3
3
  ![Gem Version](http://img.shields.io/gem/v/foreplay.svg?style=flat) [![Code Climate](http://img.shields.io/codeclimate/github/Xenapto/foreplay.svg?style=flat)](https://codeclimate.com/github/Xenapto/foreplay) [![Coverage Status](https://img.shields.io/coveralls/Xenapto/foreplay.svg?style=flat)](https://coveralls.io/r/Xenapto/foreplay?branch=develop)
4
+ [![Dependency Status](https://dependencyci.com/github/Xenapto/foreplay/badge)](https://dependencyci.com/github/Xenapto/foreplay)
4
5
  [![Developer status](http://img.shields.io/badge/developer-awesome-brightgreen.svg?style=flat)](http://xenapto.com)
5
6
  ![build status](https://circleci.com/gh/Xenapto/foreplay.png?circle-token=dd3a51864d33f6506b18a355bc901b90c0df3b3b) [![Join the chat at https://gitter.im/Xenapto/foreplay](https://badges.gitter.im/Xenapto/foreplay.svg)](https://gitter.im/Xenapto/foreplay?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
6
7
 
data/lib/foreplay.rb CHANGED
@@ -12,7 +12,7 @@ module Foreplay
12
12
  end
13
13
 
14
14
  def terminate(message)
15
- fail message
15
+ raise message
16
16
  end
17
17
  end
18
18
 
@@ -28,20 +28,20 @@ class Hash
28
28
  # h1.supermerge(h2)
29
29
  # #=> {:x=>{:y=>[4, 5, 6, 7, 8, 9]}, :z=>[7, 8, 9, "xyz"]}
30
30
  def supermerge(other_hash)
31
- fail "supermerge needs a Hash, not a #{other_hash.class}." unless other_hash.is_a?(Hash)
31
+ raise "supermerge needs a Hash, not a #{other_hash.class}." unless other_hash.is_a?(Hash)
32
32
 
33
33
  new_hash = deep_dup
34
34
 
35
35
  other_hash.each_pair do |k, v|
36
36
  tv = new_hash[k]
37
37
 
38
- if tv.is_a?(Hash) && v.is_a?(Hash)
39
- new_hash[k] = tv.supermerge(v)
40
- elsif tv.is_a?(Array) || v.is_a?(Array)
41
- new_hash[k] = Array.wrap(tv) + Array.wrap(v)
42
- else
43
- new_hash[k] = v
44
- end
38
+ new_hash[k] = if tv.is_a?(Hash) && v.is_a?(Hash)
39
+ tv.supermerge(v)
40
+ elsif tv.is_a?(Array) || v.is_a?(Array)
41
+ Array.wrap(tv) + Array.wrap(v)
42
+ else
43
+ v
44
+ end
45
45
  end
46
46
 
47
47
  new_hash
@@ -3,8 +3,8 @@ module Foreplay
3
3
  module Defaults
4
4
  include Foreplay
5
5
 
6
- DEFAULT_CONFIG_FILE = "#{Dir.getwd}/config/foreplay.yml"
7
- DEFAULTS_KEY = 'defaults'
6
+ DEFAULT_CONFIG_FILE = "#{Dir.getwd}/config/foreplay.yml".freeze
7
+ DEFAULTS_KEY = 'defaults'.freeze
8
8
 
9
9
  def defaults
10
10
  return @defaults if @defaults
@@ -19,9 +19,9 @@ module Foreplay
19
19
 
20
20
  def formatted_message
21
21
  @formatted_message ||= header + message
22
- .gsub(/\A\s+/, '')
23
- .gsub(/\s+\z/, '')
24
- .gsub(/(\r\n|\r|\n)/, "\n#{margin}")
22
+ .gsub(/\A\s+/, '')
23
+ .gsub(/\s+\z/, '')
24
+ .gsub(/(\r\n|\r|\n)/, "\n#{margin}")
25
25
  end
26
26
 
27
27
  def header
@@ -51,7 +51,7 @@ module Foreplay
51
51
  .strip
52
52
  .to_i
53
53
 
54
- if @current_port_remote == 0
54
+ if @current_port_remote.zero?
55
55
  message = 'No instance is currently deployed'
56
56
  @current_port_remote = DEFAULT_PORT + PORT_GAP
57
57
  else
@@ -13,7 +13,7 @@ module Foreplay
13
13
 
14
14
  def perform
15
15
  steps.each do |step|
16
- log "#{(step['commentary'] || step['command']).yellow}", host: host, silent: step['silent']
16
+ log (step['commentary'] || step['command']).yellow.to_s, host: host, silent: step['silent']
17
17
 
18
18
  if step.key? 'key'
19
19
  list_file_contents step['key']
@@ -23,7 +23,7 @@ module Foreplay
23
23
  process = shell.execute command
24
24
  process.on_output { |_, po| o += po }
25
25
  shell.wait!
26
- terminate(o) unless step['ignore_error'] == true || process.exit_status == 0
26
+ terminate(o) unless step['ignore_error'] == true || process.exit_status.zero?
27
27
  o
28
28
  end
29
29
 
@@ -114,7 +114,7 @@ module Foreplay
114
114
  end
115
115
 
116
116
  def announce
117
- log "#{(step['commentary'] || command).yellow}", host: host, silent: silent?
117
+ log (step['commentary'] || command).yellow.to_s, host: host, silent: silent?
118
118
  log command.cyan, host: host, silent: silent? if instructions['verbose'] && step['commentary'] && command
119
119
  end
120
120
  end
@@ -52,7 +52,7 @@
52
52
  commentary: 'Updating the bundler version'
53
53
  - command: 'sudo ln -f `which bundle` /usr/bin/bundle || echo Using default version of bundle'
54
54
  commentary: 'Setting the current version of bundle to be the default'
55
- - command: '/usr/bin/bundle install --deployment --clean --jobs 2 --without development test'
55
+ - command: '/usr/bin/bundle install --deployment --clean --full-index --jobs 2 --without development test'
56
56
  commentary: 'Using bundler to install the required gems in deployment mode'
57
57
  - command: 'mkdir -p ../cache/vendor && rsync -aW --no-compress --delete --info=STATS1 vendor/bundle/ ../cache/vendor/bundle'
58
58
  commentary: 'Caching bundle'
@@ -1,3 +1,3 @@
1
1
  module Foreplay
2
- VERSION = '0.15.2'
2
+ VERSION = '0.15.4'.freeze
3
3
  end
@@ -173,7 +173,7 @@ describe Foreplay::Launcher do
173
173
  ' ; else echo No bundle to restore ; fi',
174
174
  'gem install bundler -v "> 1.8"',
175
175
  'sudo ln -f `which bundle` /usr/bin/bundle || echo Using default version of bundle',
176
- '/usr/bin/bundle install --deployment --clean --jobs 2 --without development test',
176
+ '/usr/bin/bundle install --deployment --clean --full-index --jobs 2 --without development test',
177
177
  'mkdir -p ../cache/vendor && '\
178
178
  'rsync -aW --no-compress --delete --info=STATS1 vendor/bundle/ ../cache/vendor/bundle',
179
179
  'if [ -f public/assets/manifest.yml ] ; then echo "Not precompiling assets"'\
@@ -9,12 +9,12 @@ describe YAML do
9
9
  end
10
10
 
11
11
  it 'correctly escape a basic string' do
12
- expect(YAML.escape 'brian').to eq('brian')
12
+ expect(YAML.escape('brian')).to eq('brian')
13
13
  end
14
14
 
15
15
  it 'correctly escape a troublesome string' do
16
- expect(YAML.escape '{{moustache}} beard').to eq('"{{moustache}} beard"')
17
- expect(YAML.escape "Brian O'Brien").to eq("Brian O'Brien")
16
+ expect(YAML.escape('{{moustache}} beard')).to eq('"{{moustache}} beard"')
17
+ expect(YAML.escape("Brian O'Brien")).to eq("Brian O'Brien")
18
18
  end
19
19
  end
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreplay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.2
4
+ version: 0.15.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xenapto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-12 00:00:00.000000000 Z
11
+ date: 2016-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foreman
@@ -368,7 +368,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
368
368
  version: '0'
369
369
  requirements: []
370
370
  rubyforge_project:
371
- rubygems_version: 2.6.4
371
+ rubygems_version: 2.6.7
372
372
  signing_key:
373
373
  specification_version: 4
374
374
  summary: 'Example: foreplay deploy production'