roo_on_rails 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile +3 -0
- data/Guardfile +70 -0
- data/README.md +22 -0
- data/exe/roo_on_rails +7 -1
- data/lib/roo_on_rails/checks/base.rb +93 -0
- data/lib/roo_on_rails/checks/env_specific.rb +20 -0
- data/lib/roo_on_rails/checks/environment.rb +22 -0
- data/lib/roo_on_rails/checks/git/origin.rb +27 -0
- data/lib/roo_on_rails/checks/helpers.rb +27 -0
- data/lib/roo_on_rails/checks/heroku/app_exists.rb +65 -0
- data/lib/roo_on_rails/checks/heroku/login.rb +30 -0
- data/lib/roo_on_rails/checks/heroku/preboot_enabled.rb +43 -0
- data/lib/roo_on_rails/checks/heroku/token.rb +27 -0
- data/lib/roo_on_rails/checks/heroku/toolbelt_installed.rb +23 -0
- data/lib/roo_on_rails/checks/heroku/toolbelt_working.rb +24 -0
- data/lib/roo_on_rails/checks.rb +7 -0
- data/lib/roo_on_rails/config.rb +13 -0
- data/lib/roo_on_rails/harness.rb +28 -0
- data/lib/roo_on_rails/shell.rb +21 -0
- data/lib/roo_on_rails/version.rb +1 -1
- data/lib/roo_on_rails.rb +4 -2
- data/roo_on_rails.gemspec +2 -0
- metadata +46 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b45d0f189c82243df2453d720547a7c7d7100e3b
|
4
|
+
data.tar.gz: cee0095e6548020f230d34d803c18ca98440f18c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bdb535531b139b82612d8c77ac1088de2a1e132961a35866b3aa911ab0b2b5bd27a596f5f136625d5d0e887434ae9610f9de239b766b07a4362c0e88d6833950
|
7
|
+
data.tar.gz: 3de9f215afe327094c19a120cd7ba522b987cd4d04cd847ac1cfcf3ca66ada4cbab6cff74675f0e9619d50e715435b9cdaf58c6887ac3325b258fce24be175ae
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Guardfile
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec features) \
|
6
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
7
|
+
|
8
|
+
## Note: if you are using the `directories` clause above and you are not
|
9
|
+
## watching the project directory ('.'), then you will want to move
|
10
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
11
|
+
#
|
12
|
+
# $ mkdir config
|
13
|
+
# $ mv Guardfile config/
|
14
|
+
# $ ln -s config/Guardfile .
|
15
|
+
#
|
16
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
|
+
|
18
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
19
|
+
# rspec may be run, below are examples of the most common uses.
|
20
|
+
# * bundler: 'bundle exec rspec'
|
21
|
+
# * bundler binstubs: 'bin/rspec'
|
22
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
23
|
+
# installed the spring binstubs per the docs)
|
24
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
25
|
+
# * 'just' rspec: 'rspec'
|
26
|
+
|
27
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
28
|
+
require "guard/rspec/dsl"
|
29
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
30
|
+
|
31
|
+
# Feel free to open issues for suggestions and improvements
|
32
|
+
|
33
|
+
# RSpec files
|
34
|
+
rspec = dsl.rspec
|
35
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
36
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
37
|
+
watch(rspec.spec_files)
|
38
|
+
|
39
|
+
# Ruby files
|
40
|
+
ruby = dsl.ruby
|
41
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
42
|
+
|
43
|
+
# Rails files
|
44
|
+
rails = dsl.rails(view_extensions: %w(erb haml slim))
|
45
|
+
dsl.watch_spec_files_for(rails.app_files)
|
46
|
+
dsl.watch_spec_files_for(rails.views)
|
47
|
+
|
48
|
+
watch(rails.controllers) do |m|
|
49
|
+
[
|
50
|
+
rspec.spec.call("routing/#{m[1]}_routing"),
|
51
|
+
rspec.spec.call("controllers/#{m[1]}_controller"),
|
52
|
+
rspec.spec.call("acceptance/#{m[1]}")
|
53
|
+
]
|
54
|
+
end
|
55
|
+
|
56
|
+
# Rails config changes
|
57
|
+
# watch(rails.spec_helper) { rspec.spec_dir }
|
58
|
+
# watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
59
|
+
# watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
60
|
+
|
61
|
+
# Capybara features specs
|
62
|
+
# watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
|
63
|
+
# watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
|
64
|
+
|
65
|
+
# Turnip features and steps
|
66
|
+
# watch(%r{^spec/acceptance/(.+)\.feature$})
|
67
|
+
# watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
68
|
+
# Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
69
|
+
# end
|
70
|
+
end
|
data/README.md
CHANGED
@@ -20,14 +20,36 @@ Remove the following configuration files:
|
|
20
20
|
|
21
21
|
- `newrelic.yml` or `config/newrelic.yml`
|
22
22
|
|
23
|
+
Also remove any other gem-specific configuration from your repository.
|
24
|
+
|
23
25
|
And then execute:
|
24
26
|
|
25
27
|
$ bundle
|
26
28
|
|
27
29
|
Then re-run your test suite to make sure everything is shipshape.
|
28
30
|
|
31
|
+
## Usage
|
32
|
+
|
33
|
+
Run the following from your app's top-level directory:
|
34
|
+
|
35
|
+
```
|
36
|
+
bundle exec roo_on_rails
|
37
|
+
```
|
38
|
+
|
39
|
+
This will run a series of checks of your application's setup, as descirbed
|
40
|
+
below.
|
41
|
+
|
42
|
+
|
29
43
|
## Features
|
30
44
|
|
45
|
+
### App validation
|
46
|
+
|
47
|
+
Running the `roo_on_rails` script currently checks for:
|
48
|
+
|
49
|
+
- compliant Heroku app naming;
|
50
|
+
- presence of the Heroku preboot flag.
|
51
|
+
|
52
|
+
|
31
53
|
### New Relic configuration
|
32
54
|
|
33
55
|
We enforce configuration of New Relic.
|
data/exe/roo_on_rails
CHANGED
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'roo_on_rails/checks'
|
2
|
+
require 'roo_on_rails/checks/helpers'
|
3
|
+
require 'roo_on_rails/shell'
|
4
|
+
require 'bundler'
|
5
|
+
|
6
|
+
module RooOnRails
|
7
|
+
module Checks
|
8
|
+
class Base
|
9
|
+
include Helpers
|
10
|
+
|
11
|
+
# Add `dependencies` to the list of prerequisites for this check.
|
12
|
+
# If none are specified, return the list of dependencies.
|
13
|
+
def self.requires(*dependencies)
|
14
|
+
@requires ||= Set.new
|
15
|
+
dependencies.any? ? @requires.merge(dependencies) : @requires
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
def initialize(options = {})
|
20
|
+
@options = options.dup
|
21
|
+
@fix = @options.delete(:fix) { false }
|
22
|
+
@context = @options.delete(:context) { Hashie::Mash.new }
|
23
|
+
@shell = @options.delete(:shell) { Shell.new }
|
24
|
+
end
|
25
|
+
|
26
|
+
def run
|
27
|
+
resolve dependencies
|
28
|
+
say intro
|
29
|
+
call
|
30
|
+
true
|
31
|
+
rescue Failure => e
|
32
|
+
raise if e === FinalFailure
|
33
|
+
raise unless @fix
|
34
|
+
say "\t· attempting to fix", %i[yellow]
|
35
|
+
fix
|
36
|
+
say "\t· re-checking", %i[yellow]
|
37
|
+
call
|
38
|
+
end
|
39
|
+
|
40
|
+
protected
|
41
|
+
|
42
|
+
attr_reader :shell, :context, :options
|
43
|
+
|
44
|
+
# Returns prerequisite checks. Can be overriden.
|
45
|
+
def dependencies
|
46
|
+
self.class.requires.map { |k|
|
47
|
+
k.new(fix: @fix, context: @context, shell: @shell, **@options)
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
def intro
|
52
|
+
self.class.name
|
53
|
+
end
|
54
|
+
|
55
|
+
def call
|
56
|
+
fail! "this check wasn't implemented"
|
57
|
+
end
|
58
|
+
|
59
|
+
def fix
|
60
|
+
fail! "can't fix this on my own"
|
61
|
+
end
|
62
|
+
|
63
|
+
def pass(msg)
|
64
|
+
say "\t✔ #{msg}", :green
|
65
|
+
end
|
66
|
+
|
67
|
+
def fail!(msg)
|
68
|
+
say "\t✘ #{msg}", :red
|
69
|
+
raise Failure, msg
|
70
|
+
end
|
71
|
+
|
72
|
+
def final_fail!(msg)
|
73
|
+
say "\t✘ #{msg}", :red
|
74
|
+
raise FinalFailure, msg
|
75
|
+
end
|
76
|
+
|
77
|
+
# Return a unique signature for this check
|
78
|
+
def signature
|
79
|
+
[self.class.name]
|
80
|
+
end
|
81
|
+
|
82
|
+
private
|
83
|
+
|
84
|
+
# Run each dependency, then mark them as run.
|
85
|
+
def resolve(deps)
|
86
|
+
deps.each do |dep|
|
87
|
+
context.deps ||= {}
|
88
|
+
context.deps[dep.signature.join('/')] ||= dep.run
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'roo_on_rails/checks/base'
|
2
|
+
|
3
|
+
module RooOnRails
|
4
|
+
module Checks
|
5
|
+
# Base class for checks that are applicable per-environment.
|
6
|
+
# The `env` passed to the initializer becomes part of the check signature.
|
7
|
+
class EnvSpecific < Base
|
8
|
+
attr_reader :env
|
9
|
+
|
10
|
+
def initialize(**options)
|
11
|
+
super(options)
|
12
|
+
@env = @options[:env]
|
13
|
+
end
|
14
|
+
|
15
|
+
def signature
|
16
|
+
super + [@env]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'roo_on_rails/checks/env_specific'
|
2
|
+
require 'roo_on_rails/checks/heroku/app_exists'
|
3
|
+
require 'roo_on_rails/checks/heroku/preboot_enabled'
|
4
|
+
|
5
|
+
module RooOnRails
|
6
|
+
module Checks
|
7
|
+
class Environment < EnvSpecific
|
8
|
+
requires Heroku::PrebootEnabled
|
9
|
+
|
10
|
+
def call
|
11
|
+
# nothing to do
|
12
|
+
end
|
13
|
+
|
14
|
+
protected
|
15
|
+
|
16
|
+
def intro
|
17
|
+
"Validated #{bold @env} environment"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'roo_on_rails/checks/base'
|
2
|
+
|
3
|
+
module RooOnRails
|
4
|
+
module Checks
|
5
|
+
module Git
|
6
|
+
class Origin < Base
|
7
|
+
# Output context:
|
8
|
+
# - git_org (string)
|
9
|
+
# - git_repo (string)
|
10
|
+
def intro
|
11
|
+
"Checking your Git origin remote..."
|
12
|
+
end
|
13
|
+
|
14
|
+
def call
|
15
|
+
status, url = shell.run "git config remote.origin.url"
|
16
|
+
fail! "Origin does not seem to be configured." unless status
|
17
|
+
|
18
|
+
org, repo = url.strip.sub(%r{\.git$}, '').split(%r{[:/]}).last(2)
|
19
|
+
context.git_org = org
|
20
|
+
context.git_repo = repo
|
21
|
+
pass "organisation #{bold org}, repository: #{bold repo}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'forwardable'
|
2
|
+
require 'singleton'
|
3
|
+
require 'thor'
|
4
|
+
|
5
|
+
module RooOnRails
|
6
|
+
module Checks
|
7
|
+
module Helpers
|
8
|
+
class Receiver < Thor::Group
|
9
|
+
include Singleton
|
10
|
+
include Thor::Actions
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.included(by)
|
14
|
+
by.class_eval do
|
15
|
+
extend Forwardable
|
16
|
+
delegate %i[say set_color] => :'RooOnRails::Checks::Helpers::Receiver.instance'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def bold(str)
|
21
|
+
"\e[1;4m#{str}\e[22;24m"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'roo_on_rails/checks/env_specific'
|
2
|
+
require 'roo_on_rails/checks/git/origin'
|
3
|
+
require 'roo_on_rails/checks/heroku/token'
|
4
|
+
require 'active_support/core_ext/enumerable'
|
5
|
+
|
6
|
+
module RooOnRails
|
7
|
+
module Checks
|
8
|
+
module Heroku
|
9
|
+
# Check if a corresponding app exists on Heroku (for a given environment)
|
10
|
+
#
|
11
|
+
# Input context
|
12
|
+
# - git_repo: the name of the repository
|
13
|
+
# - heroku.api_client: a connected PlatformAPI client
|
14
|
+
# - app_name_stem (optional): a name override
|
15
|
+
#
|
16
|
+
# Output context:
|
17
|
+
# - heroku.app.{env}: an app name.
|
18
|
+
class AppExists < EnvSpecific
|
19
|
+
requires Git::Origin, Heroku::Token
|
20
|
+
|
21
|
+
def intro
|
22
|
+
"Checking if #{bold env} app exist..."
|
23
|
+
end
|
24
|
+
|
25
|
+
def call
|
26
|
+
all_apps = client.app.list.map { |a| a['name'] }
|
27
|
+
matches = all_apps.select { |a| candidates.include?(a) }
|
28
|
+
|
29
|
+
if matches.empty?
|
30
|
+
fail! "no apps with matching names detected"
|
31
|
+
end
|
32
|
+
|
33
|
+
if matches.many?
|
34
|
+
final_fail! "multiple matching apps detected: #{candidates.map { |c| bold c}.join(', ')}"
|
35
|
+
end
|
36
|
+
|
37
|
+
context.heroku.app![env] = matches.first
|
38
|
+
pass "found app #{bold matches.first}"
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def name_stem
|
44
|
+
context.app_name_stem || context.git_repo.delete('.')
|
45
|
+
end
|
46
|
+
|
47
|
+
def candidates
|
48
|
+
[
|
49
|
+
['deliveroo', 'roo', nil],
|
50
|
+
[name_stem],
|
51
|
+
[env],
|
52
|
+
].tap { |a|
|
53
|
+
a.replace a.first.product(*a[1..-1])
|
54
|
+
}.map { |c|
|
55
|
+
c.compact.join('-')
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
def client
|
60
|
+
context.heroku.api_client
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'roo_on_rails/checks/base'
|
2
|
+
require 'roo_on_rails/checks/heroku/toolbelt_working'
|
3
|
+
|
4
|
+
module RooOnRails
|
5
|
+
module Checks
|
6
|
+
module Heroku
|
7
|
+
class Login < Base
|
8
|
+
requires ToolbeltWorking
|
9
|
+
|
10
|
+
def intro
|
11
|
+
"Checking if you're signed in to Heroku..."
|
12
|
+
end
|
13
|
+
|
14
|
+
def call
|
15
|
+
status, email = shell.run "heroku whoami"
|
16
|
+
if status
|
17
|
+
pass "logged in as #{bold email.strip}"
|
18
|
+
else
|
19
|
+
fail! "not logged in"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def fix
|
24
|
+
shell.run! "heroku auth:login --sso"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'roo_on_rails/checks/env_specific'
|
2
|
+
require 'roo_on_rails/checks/git/origin'
|
3
|
+
require 'roo_on_rails/checks/heroku/app_exists'
|
4
|
+
|
5
|
+
module RooOnRails
|
6
|
+
module Checks
|
7
|
+
module Heroku
|
8
|
+
# Input context
|
9
|
+
# - heroku.api_client: a connected PlatformAPI client
|
10
|
+
# - heroku.app.{env}: an existing app name.
|
11
|
+
class PrebootEnabled < EnvSpecific
|
12
|
+
requires Git::Origin, Heroku::AppExists
|
13
|
+
|
14
|
+
def intro
|
15
|
+
"Checking preboot status on #{bold app_name}"
|
16
|
+
end
|
17
|
+
|
18
|
+
def call
|
19
|
+
status = client.app_feature.info(app_name, 'preboot')
|
20
|
+
if status['enabled']
|
21
|
+
pass 'preboot enabled'
|
22
|
+
else
|
23
|
+
fail! 'preboot disabled'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def fix
|
30
|
+
client.app_feature.update(app_name, 'preboot', enabled: true)
|
31
|
+
end
|
32
|
+
|
33
|
+
def app_name
|
34
|
+
context.heroku.app[env]
|
35
|
+
end
|
36
|
+
|
37
|
+
def client
|
38
|
+
context.heroku.api_client
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'roo_on_rails/checks/base'
|
2
|
+
require 'roo_on_rails/checks/heroku/login'
|
3
|
+
require 'platform-api'
|
4
|
+
|
5
|
+
module RooOnRails
|
6
|
+
module Checks
|
7
|
+
module Heroku
|
8
|
+
# Output context:
|
9
|
+
# - heroku.api_client: a connected PlatformAPI client
|
10
|
+
class Token < Base
|
11
|
+
requires Login
|
12
|
+
|
13
|
+
def intro
|
14
|
+
"Obtaining Heroku auth token..."
|
15
|
+
end
|
16
|
+
|
17
|
+
def call
|
18
|
+
status, token = shell.run "heroku auth:token"
|
19
|
+
fail! "could not get a token" unless status
|
20
|
+
|
21
|
+
context.heroku!.api_client = PlatformAPI.connect_oauth(token.strip)
|
22
|
+
pass "connected to Heroku's API"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'roo_on_rails/checks/base'
|
2
|
+
|
3
|
+
module RooOnRails
|
4
|
+
module Checks
|
5
|
+
module Heroku
|
6
|
+
class ToolbeltInstalled < Base
|
7
|
+
def intro
|
8
|
+
"Checking if the Heroku Toolbelt is installed..."
|
9
|
+
end
|
10
|
+
|
11
|
+
def call
|
12
|
+
status, path = shell.run "which heroku"
|
13
|
+
if status
|
14
|
+
pass "found #{bold path.strip} binary"
|
15
|
+
else
|
16
|
+
fail! "'heroku' binary missing"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'roo_on_rails/checks/base'
|
2
|
+
require 'roo_on_rails/checks/heroku/toolbelt_installed'
|
3
|
+
|
4
|
+
module RooOnRails
|
5
|
+
module Checks
|
6
|
+
module Heroku
|
7
|
+
class ToolbeltWorking < Base
|
8
|
+
requires ToolbeltInstalled
|
9
|
+
|
10
|
+
def intro
|
11
|
+
"Checking if the Heroku Toolbelt is working..."
|
12
|
+
end
|
13
|
+
|
14
|
+
def call
|
15
|
+
if shell.run? 'heroku status > /dev/null'
|
16
|
+
pass 'read heroku status'
|
17
|
+
else
|
18
|
+
fail! "could not run 'heroku status'"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'hashie'
|
3
|
+
require 'roo_on_rails/checks/environment'
|
4
|
+
|
5
|
+
module RooOnRails
|
6
|
+
class Harness
|
7
|
+
include Thor::Shell
|
8
|
+
|
9
|
+
def initialize(try_fix: false, context: nil)
|
10
|
+
@try_fix = try_fix
|
11
|
+
@context = context || Hashie::Mash.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def run
|
15
|
+
[
|
16
|
+
Checks::Environment.new(env: 'staging', fix: @try_fix, context: @context),
|
17
|
+
Checks::Environment.new(env: 'production', fix: @try_fix, context: @context),
|
18
|
+
].each(&:run)
|
19
|
+
self
|
20
|
+
rescue Shell::CommandFailed
|
21
|
+
say 'A command failed to run, aborting', %i[bold red]
|
22
|
+
exit 2
|
23
|
+
rescue Checks::Failure
|
24
|
+
say 'A check failed, exiting', %i[bold red]
|
25
|
+
exit 1
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
require 'roo_on_rails/checks'
|
3
|
+
|
4
|
+
module RooOnRails
|
5
|
+
class Shell
|
6
|
+
CommandFailed = Class.new(StandardError)
|
7
|
+
|
8
|
+
def run(cmd)
|
9
|
+
result = Bundler.with_clean_env { %x{#{cmd}} }
|
10
|
+
return [$?.success?, result]
|
11
|
+
end
|
12
|
+
|
13
|
+
def run!(cmd)
|
14
|
+
raise CommandFailed.new(cmd) unless run(cmd).first
|
15
|
+
end
|
16
|
+
|
17
|
+
def run?(cmd)
|
18
|
+
run(cmd).first
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/roo_on_rails/version.rb
CHANGED
data/lib/roo_on_rails.rb
CHANGED
data/roo_on_rails.gemspec
CHANGED
@@ -24,6 +24,8 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_runtime_dependency 'dotenv-rails', '~> 2.1'
|
25
25
|
spec.add_runtime_dependency 'newrelic_rpm', '~> 3.17'
|
26
26
|
spec.add_runtime_dependency 'rails', '~> 5.0'
|
27
|
+
spec.add_runtime_dependency 'platform-api', '~> 0.8'
|
28
|
+
spec.add_runtime_dependency 'hashie', '~> 3.4'
|
27
29
|
|
28
30
|
spec.add_development_dependency "bundler", "~> 1.13"
|
29
31
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roo_on_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julien Letessier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv-rails
|
@@ -52,6 +52,34 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: platform-api
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.8'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.8'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: hashie
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.4'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.4'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: bundler
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -135,6 +163,7 @@ files:
|
|
135
163
|
- ".travis.yml"
|
136
164
|
- CHANGELOG.md
|
137
165
|
- Gemfile
|
166
|
+
- Guardfile
|
138
167
|
- LICENSE.txt
|
139
168
|
- README.md
|
140
169
|
- Rakefile
|
@@ -142,8 +171,23 @@ files:
|
|
142
171
|
- bin/setup
|
143
172
|
- exe/roo_on_rails
|
144
173
|
- lib/roo_on_rails.rb
|
174
|
+
- lib/roo_on_rails/checks.rb
|
175
|
+
- lib/roo_on_rails/checks/base.rb
|
176
|
+
- lib/roo_on_rails/checks/env_specific.rb
|
177
|
+
- lib/roo_on_rails/checks/environment.rb
|
178
|
+
- lib/roo_on_rails/checks/git/origin.rb
|
179
|
+
- lib/roo_on_rails/checks/helpers.rb
|
180
|
+
- lib/roo_on_rails/checks/heroku/app_exists.rb
|
181
|
+
- lib/roo_on_rails/checks/heroku/login.rb
|
182
|
+
- lib/roo_on_rails/checks/heroku/preboot_enabled.rb
|
183
|
+
- lib/roo_on_rails/checks/heroku/token.rb
|
184
|
+
- lib/roo_on_rails/checks/heroku/toolbelt_installed.rb
|
185
|
+
- lib/roo_on_rails/checks/heroku/toolbelt_working.rb
|
186
|
+
- lib/roo_on_rails/config.rb
|
145
187
|
- lib/roo_on_rails/default.env
|
188
|
+
- lib/roo_on_rails/harness.rb
|
146
189
|
- lib/roo_on_rails/railtie.rb
|
190
|
+
- lib/roo_on_rails/shell.rb
|
147
191
|
- lib/roo_on_rails/version.rb
|
148
192
|
- roo_on_rails.gemspec
|
149
193
|
homepage: https://github.com/deliveroo/roo_on_rails
|