foreplay 0.17.0 → 0.17.1

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: 26c9d6cbed4a92a4b4b5563d9206615b6437f0fe
4
- data.tar.gz: e05eb4274e0dc08923dd61b90fdeeeb3391818c8
3
+ metadata.gz: 2549644d6810e287084e17740a653682877e6243
4
+ data.tar.gz: 15a78061f9c39aefa585063eb6c389cc58af37d5
5
5
  SHA512:
6
- metadata.gz: 62f9aabc395352d3b843ff1b193f57514d82e73683b71ae615bd65116b686a6042bbbacfbd733c32d4176fe56cea9a057674066051b6b68a39d41fdbac515a47
7
- data.tar.gz: 123400f0bc6adb4fcb878405da223a0f360a78e5af47713fb3cdf7a64f706afb24d7abf80f08aa8426c759f5420d6e818c06893ccf8d13e37991543324badf21
6
+ metadata.gz: 50658886356018efd8556c0066c01747c8cf2b26a641116dcd1f621978c1fb5ae212d2eaaf3fcbd669eea65dca4f7b65095fc90a7d90a97944ac4bcfd929b732
7
+ data.tar.gz: de2640d6018a3aa287fe0e6ca3e9eae2f8f317abe51e7d362bf6457f56b5c658f76fd5f564793ff97a28a8cbfcf4d581b6687446ab0e7e7385f8947ec451f658
data/.codeclimate.yml ADDED
@@ -0,0 +1,17 @@
1
+ ---
2
+ engines:
3
+ duplication:
4
+ enabled: true
5
+ config:
6
+ languages:
7
+ - ruby
8
+ fixme:
9
+ enabled: false # Too many permanent TODOs included in the templates
10
+ rubocop:
11
+ enabled: true
12
+ ratings:
13
+ paths:
14
+ - "**.rb"
15
+ exclude_paths:
16
+ - script/
17
+ - spec/
data/.rubocop.yml CHANGED
@@ -1,10 +1,19 @@
1
1
  ---
2
2
  AllCops:
3
+ TargetRubyVersion: 2.1
4
+ DisplayCopNames: true
3
5
  Exclude:
4
- - '*.gemspec'
5
- - 'spec/**/*'
6
+ - 'tmp/**/*'
7
+
8
+ Style/MixinGrouping:
9
+ Exclude:
10
+ - 'spec/**/*.rb'
11
+
12
+ Metrics/BlockLength:
13
+ CountComments: false # count full line comments?
14
+ Exclude:
15
+ - '**/*_spec.rb'
6
16
 
7
- # These are OK:
8
17
  StringLiterals:
9
18
  EnforcedStyle: single_quotes
10
19
  Enabled: true
@@ -23,24 +32,36 @@ Documentation:
23
32
  Description: 'Document classes and non-namespace modules.'
24
33
  Enabled: false
25
34
 
26
- Output:
27
- Description: 'Checks for calls to puts, print, etc.'
28
- Enabled: false
29
-
30
- ExtraSpacing:
31
- Enabled: false
32
-
33
35
  FileName:
34
36
  Description: 'Use snake_case for source file names.'
35
37
  Enabled: true
36
38
 
37
- Eval:
38
- Enabled: false
39
-
40
39
  LineLength:
41
40
  Max: 120
42
41
  Enabled: true
43
42
 
43
+ Style/ExtraSpacing:
44
+ Description: 'Do not use unnecessary spacing.'
45
+ Enabled: true
46
+
47
+ Lint/LiteralInInterpolation:
48
+ Description: 'Avoid interpolating literals in strings'
49
+ AutoCorrect: true
50
+
51
+ Style/ModuleFunction:
52
+ EnforcedStyle: extend_self # Allows us to have private methods too
53
+
54
+ Style/PercentLiteralDelimiters:
55
+ # Hound and CodeClimate are currently using an old version of Rubocop with
56
+ # different defaults, so we set them explicitly here.
57
+ PreferredDelimiters:
58
+ default: ()
59
+ '%i': '[]'
60
+ '%I': '[]'
61
+ '%r': '{}'
62
+ '%w': '[]'
63
+ '%W': '[]'
64
+
44
65
  # Work on these:
45
66
 
46
67
  MethodLength:
data/.travis.yml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ language: ruby
3
+ dist: trusty
4
+ rvm:
5
+ - 2.4.0
6
+ - 2.3
7
+ - 2.2
8
+ - 2.1
9
+ # - 2.0 # undefined method `safe_load' for Psych:Module
10
+ before_install:
11
+ - gem update bundler
12
+ script:
13
+ - bundle exec rspec
14
+ - rake features
15
+ after_success: bundle exec codeclimate-test-reporter
data/Gemfile CHANGED
@@ -1,19 +1,19 @@
1
1
  source 'https://rubygems.org'
2
- ruby '2.1.9'
2
+ ruby RUBY_VERSION
3
3
  gemspec
4
4
 
5
5
  group :test do
6
+ gem 'aruba'
7
+ gem 'codeclimate-test-reporter'
8
+ gem 'coveralls'
9
+ gem 'cucumber'
6
10
  gem 'rspec'
7
11
  gem 'rspec_junit_formatter'
8
- gem 'cucumber'
9
- gem 'aruba'
10
12
  gem 'simplecov'
11
- gem 'coveralls'
12
- gem 'codeclimate-test-reporter'
13
13
  end
14
14
 
15
15
  local_gemfile = 'Gemfile.local'
16
16
 
17
17
  if File.exist?(local_gemfile)
18
- eval(File.read(local_gemfile)) # rubocop:disable Lint/Eval
18
+ eval(File.read(local_gemfile)) # rubocop:disable Security/Eval
19
19
  end
@@ -4,7 +4,7 @@ group :development do
4
4
  gem 'rake'
5
5
  gem 'gem-release'
6
6
  gem 'rubocop'
7
- gem 'listen', '~> 3.0', '< 3.1' # Dependency of guard, 3.1 requires Ruby 2.2+
7
+ gem 'listen', '~> 3.0', (RUBY_VERSION < '2.2' ? '< 3.1' : '> 0') # Dependency of guard, 3.1 requires Ruby 2.2+
8
8
  gem 'guard'
9
9
  gem 'guard-rspec'
10
10
  gem 'guard-rubocop'
data/README.md CHANGED
@@ -1,9 +1,12 @@
1
- # Foreplay
2
-
3
- ![Gem Version](http://img.shields.io/gem/v/foreplay.svg?style=flat)&nbsp;[![Code Climate](http://img.shields.io/codeclimate/github/Xenapto/foreplay.svg?style=flat)](https://codeclimate.com/github/Xenapto/foreplay)&nbsp;[![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)
5
- [![Developer status](http://img.shields.io/badge/developer-awesome-brightgreen.svg?style=flat)](http://xenapto.com)
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)
1
+ ## Foreplay
2
+
3
+ [![Gem version](https://badge.fury.io/rb/foreplay.svg)](https://rubygems.org/gems/foreplay)
4
+ [![Gem downloads](https://img.shields.io/gem/dt/foreplay.svg)](https://rubygems.org/gems/foreplay)
5
+ [![Build Status](https://travis-ci.org/dominicsayers/foreplay.svg?branch=master)](https://travis-ci.org/dominicsayers/foreplay)
6
+ [![Code Climate](https://codeclimate.com/github/dominicsayers/foreplay/badges/gpa.svg)](https://codeclimate.com/github/dominicsayers/foreplay)
7
+ [![Test Coverage](https://codeclimate.com/github/dominicsayers/foreplay/badges/coverage.svg)](https://codeclimate.com/github/dominicsayers/foreplay/coverage)
8
+ [![Dependency Status](https://gemnasium.com/badges/github.com/dominicsayers/foreplay.svg)](https://gemnasium.com/github.com/dominicsayers/foreplay)
9
+ [![Security](https://hakiri.io/github/dominicsayers/foreplay/master.svg)](https://hakiri.io/github/dominicsayers/foreplay/master)
7
10
 
8
11
  Deploying Rails projects to Ubuntu using Foreman
9
12
 
data/Rakefile CHANGED
@@ -1,26 +1,12 @@
1
1
  #!/usr/bin/env rake
2
+ require 'rubygems'
3
+
2
4
  begin
3
5
  require 'bundler/setup'
4
6
  rescue LoadError
5
7
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
8
  end
7
9
 
8
- begin
9
- require 'rdoc/task'
10
- rescue LoadError
11
- require 'rdoc/rdoc'
12
- require 'rake/rdoctask'
13
- RDoc::Task = Rake::RDocTask
14
- end
15
-
16
- RDoc::Task.new(:rdoc) do |rdoc|
17
- rdoc.rdoc_dir = 'rdoc'
18
- rdoc.title = 'Foreplay'
19
- rdoc.options << '--line-numbers'
20
- rdoc.rdoc_files.include('README.rdoc')
21
- rdoc.rdoc_files.include('lib/**/*.rb')
22
- end
23
-
24
10
  Bundler::GemHelper.install_tasks
25
11
  Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each { |f| load f }
26
12
 
@@ -32,3 +18,17 @@ begin
32
18
  rescue LoadError
33
19
  nil
34
20
  end
21
+
22
+ begin
23
+ require 'cucumber'
24
+ require 'cucumber/rake/task'
25
+
26
+ Cucumber::Rake::Task.new(:features) do |t|
27
+ t.cucumber_opts = "--format pretty"
28
+ end
29
+ rescue LoadError
30
+ desc 'Cucumber rake task not available'
31
+ task :features do
32
+ abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
33
+ end
34
+ end
data/bin/console ADDED
@@ -0,0 +1,2 @@
1
+ #!/bin/sh
2
+ bundle exec irb -rubygems -I lib -r foreplay.rb
data/foreplay.gemspec CHANGED
@@ -5,19 +5,19 @@ require 'foreplay/version'
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'foreplay'
7
7
  s.version = Foreplay::VERSION
8
- s.authors = ['Xenapto']
9
- s.email = ['developers@xenapto.com']
8
+ s.authors = ['Dominic Sayers']
9
+ s.email = ['dominic@sayers.cc']
10
10
  s.description = 'Deploying Rails projects to Ubuntu using Foreman'
11
11
  s.summary = 'Example: foreplay deploy production'
12
- s.homepage = 'https://github.com/Xenapto/foreplay'
12
+ s.homepage = 'https://github.com/dominicsayers/foreplay'
13
13
  s.license = 'MIT'
14
14
 
15
- s.files = `git ls-files`.split($RS).reject { |file| file =~ /^spec\// }
15
+ s.files = `git ls-files`.split($RS).reject { |file| file =~ %r{^spec/} }
16
16
  s.test_files = []
17
- s.executables = s.files.grep(%r{^bin\/}) { |f| File.basename(f) }
17
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  s.require_paths = ['lib']
19
19
 
20
20
  s.add_runtime_dependency 'foreman', '>= 0.76', '< 1.0'
21
21
  s.add_runtime_dependency 'ssh-shell', '>= 0.4', '< 1.0'
22
- s.add_runtime_dependency 'activesupport', '>= 3.2', '< 5.0'
22
+ s.add_runtime_dependency 'activesupport', '>= 3.2.22', '<= 5'
23
23
  end
data/lib/foreplay.rb CHANGED
@@ -50,7 +50,7 @@ end
50
50
 
51
51
  # Some useful additions to the String class
52
52
  class String
53
- colors = %w(black red green yellow blue magenta cyan white)
53
+ colors = %w[black red green yellow blue magenta cyan white]
54
54
 
55
55
  colors.each_with_index do |fg_color, i|
56
56
  fg = 30 + i
@@ -66,7 +66,7 @@ class String
66
66
  end
67
67
 
68
68
  def fake_erb
69
- gsub(/(<%=\s+([^%]+)\s+%>)/) { |e| eval "_ = #{e.split[1]}" }
69
+ gsub(/(<%=\s+([^%]+)\s+%>)/) { |e| eval "_ = #{e.split[1]}" } # rubocop:disable Security/Eval
70
70
  end
71
71
 
72
72
  def escape_double_quotes
data/lib/foreplay/cli.rb CHANGED
@@ -40,8 +40,8 @@ module Foreplay
40
40
  method_option :db_adapter, aliases: '-a'
41
41
  method_option :db_encoding, aliases: '-e'
42
42
  method_option :db_name, aliases: '-d'
43
- method_option :db_pool, type: :numeric
44
- method_option :db_host, aliases: '-h'
43
+ method_option :db_pool, type: :numeric
44
+ method_option :db_host, aliases: '-h'
45
45
  method_option :db_user
46
46
  method_option :db_password
47
47
  method_option :resque_redis
@@ -20,7 +20,7 @@ module Foreplay
20
20
  @roles_all = nil
21
21
  end
22
22
 
23
- [:deploy, :check].each { |m| define_method(m) { execute m } }
23
+ %i[deploy check].each { |m| define_method(m) { execute m } }
24
24
 
25
25
  def execute(m)
26
26
  @mode = m
@@ -54,7 +54,7 @@ module Foreplay
54
54
  instructions = defaults.supermerge(additional_instructions)
55
55
  instructions['role'] = role
56
56
  instructions['verbose'] = verbose
57
- required_keys = %w(name environment role servers path repository)
57
+ required_keys = %w[name environment role servers path repository]
58
58
 
59
59
  required_keys.each do |key|
60
60
  next if instructions.key? key
@@ -37,7 +37,7 @@ module Foreplay
37
37
  def roles_all
38
38
  return @roles_all if @roles_all
39
39
 
40
- @roles_all = YAML.load(File.read(config_file))
40
+ @roles_all = YAML.safe_load(File.read(config_file))
41
41
 
42
42
  # This environment
43
43
  unless @roles_all.key? environment
@@ -21,9 +21,10 @@ module Foreplay
21
21
  @current_service ||= port_details['current_service']
22
22
  end
23
23
 
24
- def former_port
25
- @former_port ||= port_details['former_port']
26
- end
24
+ # Not apparently used
25
+ #- def former_port
26
+ #- @former_port ||= port_details['former_port']
27
+ #- end
27
28
 
28
29
  def former_service
29
30
  @former_service ||= port_details['former_service']
@@ -81,10 +81,12 @@ module Foreplay
81
81
  keyfile = instructions['keyfile']
82
82
  keyfile.sub! '~', ENV['HOME'] || '/' unless keyfile.blank? # Remote shell won't expand this for us
83
83
 
84
- terminate(
85
- 'No authentication methods supplied. '\
86
- 'You must supply a private key, key file or password in the configuration file'
87
- ) if keyfile.blank?
84
+ if keyfile.blank?
85
+ terminate(
86
+ 'No authentication methods supplied. '\
87
+ 'You must supply a private key, key file or password in the configuration file'
88
+ )
89
+ end
88
90
 
89
91
  # Get the key from the key file
90
92
  log "Using private key from #{keyfile}"
@@ -32,7 +32,7 @@ module Foreplay
32
32
  def all_secrets
33
33
  return @all_secrets if @all_secrets
34
34
 
35
- @all_secrets = url ? YAML.load(raw_secrets) : {}
35
+ @all_secrets = url ? YAML.safe_load(raw_secrets) : {}
36
36
  rescue Psych::SyntaxError => e
37
37
  log "Exception caught when loading secrets from this location: #{url}"
38
38
  log "#{e.class}: #{e.message}".red
@@ -73,7 +73,7 @@ module Foreplay
73
73
  def steps
74
74
  concurrency = foreman.key?('concurrency') ? " -m #{foreman['concurrency']}" : ''
75
75
 
76
- @steps ||= YAML.load(
76
+ @steps ||= YAML.safe_load(
77
77
  ERB.new(
78
78
  File.read(
79
79
  "#{File.dirname(__FILE__)}/steps.yml"
@@ -42,7 +42,7 @@ module Foreplay
42
42
  end
43
43
 
44
44
  def instructions_hash
45
- header? ? { header => instructions[key] } : instructions[key]
45
+ header? ? { header => instructions[key] } : instructions[key]
46
46
  end
47
47
 
48
48
  def instructions_yaml
@@ -10,12 +10,12 @@ module Foreplay
10
10
  class_option :password
11
11
  class_option :keyfile
12
12
  class_option :private_key, aliases: '-k'
13
- class_option :port, aliases: '-p', default: 50_000
13
+ class_option :port, aliases: '-p', default: '50000'
14
14
  class_option :path, aliases: '-f'
15
15
  class_option :servers, aliases: '-s', type: :array
16
16
  class_option :db_adapter, aliases: '-a', default: 'postgresql'
17
17
  class_option :db_encoding, aliases: '-e', default: 'utf8'
18
- class_option :db_pool, default: 5
18
+ class_option :db_pool, default: '5'
19
19
  class_option :db_name, aliases: '-d'
20
20
  class_option :db_host, aliases: '-h'
21
21
  class_option :db_user
@@ -1,3 +1,3 @@
1
1
  module Foreplay
2
- VERSION = '0.17.0'.freeze
2
+ VERSION = '0.17.1'.freeze
3
3
  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.17.0
4
+ version: 0.17.1
5
5
  platform: ruby
6
6
  authors:
7
- - Xenapto
7
+ - Dominic Sayers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-26 00:00:00.000000000 Z
11
+ date: 2017-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foreman
@@ -56,38 +56,42 @@ dependencies:
56
56
  requirements:
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: '3.2'
60
- - - "<"
59
+ version: 3.2.22
60
+ - - "<="
61
61
  - !ruby/object:Gem::Version
62
- version: '5.0'
62
+ version: '5'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: '3.2'
70
- - - "<"
69
+ version: 3.2.22
70
+ - - "<="
71
71
  - !ruby/object:Gem::Version
72
- version: '5.0'
72
+ version: '5'
73
73
  description: Deploying Rails projects to Ubuntu using Foreman
74
74
  email:
75
- - developers@xenapto.com
75
+ - dominic@sayers.cc
76
76
  executables:
77
+ - console
77
78
  - foreplay
78
79
  extensions: []
79
80
  extra_rdoc_files: []
80
81
  files:
82
+ - ".codeclimate.yml"
81
83
  - ".gitignore"
82
84
  - ".hound.yml"
83
85
  - ".rspec"
84
86
  - ".rubocop.yml"
87
+ - ".travis.yml"
85
88
  - Gemfile
86
89
  - Gemfile.local.example
87
90
  - Guardfile
88
91
  - LICENSE.txt
89
92
  - README.md
90
93
  - Rakefile
94
+ - bin/console
91
95
  - bin/foreplay
92
96
  - circle.yml
93
97
  - features/check.feature
@@ -114,7 +118,7 @@ files:
114
118
  - lib/foreplay/setup.rb
115
119
  - lib/foreplay/setup/foreplay.template.yml
116
120
  - lib/foreplay/version.rb
117
- homepage: https://github.com/Xenapto/foreplay
121
+ homepage: https://github.com/dominicsayers/foreplay
118
122
  licenses:
119
123
  - MIT
120
124
  metadata: {}
@@ -134,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
138
  version: '0'
135
139
  requirements: []
136
140
  rubyforge_project:
137
- rubygems_version: 2.6.7
141
+ rubygems_version: 2.6.11
138
142
  signing_key:
139
143
  specification_version: 4
140
144
  summary: 'Example: foreplay deploy production'