foreplay 0.17.0 → 0.17.1
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 +4 -4
- data/.codeclimate.yml +17 -0
- data/.rubocop.yml +34 -13
- data/.travis.yml +15 -0
- data/Gemfile +6 -6
- data/Gemfile.local.example +1 -1
- data/README.md +9 -6
- data/Rakefile +16 -16
- data/bin/console +2 -0
- data/foreplay.gemspec +6 -6
- data/lib/foreplay.rb +2 -2
- data/lib/foreplay/cli.rb +2 -2
- data/lib/foreplay/engine.rb +2 -2
- data/lib/foreplay/engine/defaults.rb +1 -1
- data/lib/foreplay/engine/port.rb +4 -3
- data/lib/foreplay/engine/remote.rb +6 -4
- data/lib/foreplay/engine/secrets/location.rb +1 -1
- data/lib/foreplay/engine/server.rb +1 -1
- data/lib/foreplay/engine/step.rb +1 -1
- data/lib/foreplay/setup.rb +2 -2
- data/lib/foreplay/version.rb +1 -1
- metadata +16 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2549644d6810e287084e17740a653682877e6243
|
|
4
|
+
data.tar.gz: 15a78061f9c39aefa585063eb6c389cc58af37d5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
- '
|
|
5
|
-
|
|
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
|
+
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
|
|
18
|
+
eval(File.read(local_gemfile)) # rubocop:disable Security/Eval
|
|
19
19
|
end
|
data/Gemfile.local.example
CHANGED
|
@@ -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
|
-
|
|
2
|
-
|
|
3
|
-
](https://rubygems.org/gems/foreplay)
|
|
4
|
+
[](https://rubygems.org/gems/foreplay)
|
|
5
|
+
[](https://travis-ci.org/dominicsayers/foreplay)
|
|
6
|
+
[](https://codeclimate.com/github/dominicsayers/foreplay)
|
|
7
|
+
[](https://codeclimate.com/github/dominicsayers/foreplay/coverage)
|
|
8
|
+
[](https://gemnasium.com/github.com/dominicsayers/foreplay)
|
|
9
|
+
[](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
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 = ['
|
|
9
|
-
s.email = ['
|
|
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/
|
|
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 =~
|
|
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
|
|
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', '
|
|
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
|
|
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,
|
|
44
|
-
method_option :db_host,
|
|
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
|
data/lib/foreplay/engine.rb
CHANGED
|
@@ -20,7 +20,7 @@ module Foreplay
|
|
|
20
20
|
@roles_all = nil
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
[
|
|
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
|
|
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
|
data/lib/foreplay/engine/port.rb
CHANGED
|
@@ -21,9 +21,10 @@ module Foreplay
|
|
|
21
21
|
@current_service ||= port_details['current_service']
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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.
|
|
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
|
data/lib/foreplay/engine/step.rb
CHANGED
data/lib/foreplay/setup.rb
CHANGED
|
@@ -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:
|
|
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
|
data/lib/foreplay/version.rb
CHANGED
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.
|
|
4
|
+
version: 0.17.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- Dominic Sayers
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
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:
|
|
60
|
-
- - "
|
|
59
|
+
version: 3.2.22
|
|
60
|
+
- - "<="
|
|
61
61
|
- !ruby/object:Gem::Version
|
|
62
|
-
version: '5
|
|
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:
|
|
70
|
-
- - "
|
|
69
|
+
version: 3.2.22
|
|
70
|
+
- - "<="
|
|
71
71
|
- !ruby/object:Gem::Version
|
|
72
|
-
version: '5
|
|
72
|
+
version: '5'
|
|
73
73
|
description: Deploying Rails projects to Ubuntu using Foreman
|
|
74
74
|
email:
|
|
75
|
-
-
|
|
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/
|
|
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.
|
|
141
|
+
rubygems_version: 2.6.11
|
|
138
142
|
signing_key:
|
|
139
143
|
specification_version: 4
|
|
140
144
|
summary: 'Example: foreplay deploy production'
|