shiprails 0.1.4 → 0.1.5
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/lib/shiprails/port.rb +32 -24
- data/lib/shiprails/ship/exec.rb +10 -0
- data/lib/shiprails/ship/install/shiprails.yml.erb +4 -0
- data/lib/shiprails/ship.rb +33 -4
- data/lib/shiprails/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f6d4d236056ae63cc0c45a01ffc84f1eb579046
|
4
|
+
data.tar.gz: 142517c6bdcec225dae78167de982fd257979ec3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d63e1ae14db4b0e055082b48da424f1c365f77acc20acf72f1b82dbc4587534fec163c2fab5918905722c9585b5db46c214d9be6c2d0bd9f06bf24c66e3cd6c4
|
7
|
+
data.tar.gz: 78e7470fb2b5f4c98e41affeda518ad11438aa521f2788832b259335fb1d340defd52ccdf28b14ec427fc948179265f8d2331699a4f99a08029006200b2f3c6f
|
data/lib/shiprails/port.rb
CHANGED
@@ -16,37 +16,45 @@ module Shiprails
|
|
16
16
|
say "TODO: store development config vars"
|
17
17
|
end
|
18
18
|
|
19
|
+
desc "exec", "Run interactive commands"
|
20
|
+
method_option "no-rm",
|
21
|
+
default: false,
|
22
|
+
desc: "Remove container changes after use",
|
23
|
+
type: :boolean
|
24
|
+
def exec(*command_args)
|
25
|
+
build_command_args = ["docker-compose", "run"]
|
26
|
+
build_command_args << "--rm" unless options['no-rm']
|
27
|
+
build_command_args << "app"
|
28
|
+
build_command_args += command_args
|
29
|
+
command_string = build_command_args.join(' ')
|
30
|
+
run command_string
|
31
|
+
end
|
32
|
+
|
19
33
|
desc "up", "Hoist app and services"
|
20
34
|
def up
|
21
35
|
run "docker-compose up"
|
22
36
|
end
|
23
37
|
|
24
|
-
|
25
|
-
|
26
|
-
command_string = command.join(' ')
|
27
|
-
if command_string.start_with?("exec")
|
28
|
-
run "docker-compose run --rm app bundle #{command_string}"
|
29
|
-
else
|
30
|
-
run "docker-compose run app bundle #{command_string}"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
desc "rails", "Run rails commands"
|
35
|
-
def rails(*command)
|
36
|
-
command_string = command.join(' ')
|
37
|
-
run "docker-compose run --rm app bundle exec rails #{command_string}"
|
38
|
+
def self.configuration
|
39
|
+
YAML.load(File.read(".shiprails.yml")).deep_symbolize_keys rescue {}
|
38
40
|
end
|
39
41
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
42
|
+
if commands = configuration[:exec]
|
43
|
+
commands.each do |name, command|
|
44
|
+
desc name, "port exec #{command}"
|
45
|
+
method_option "no-rm",
|
46
|
+
default: false,
|
47
|
+
desc: "Remove container changes after use",
|
48
|
+
type: :boolean
|
49
|
+
define_method name.to_sym do |*command_args|
|
50
|
+
build_command_args = ["docker-compose", "run"]
|
51
|
+
build_command_args << "--rm" unless options['no-rm']
|
52
|
+
build_command_args << "app"
|
53
|
+
build_command_args += command.split(' ') + command_args
|
54
|
+
command_string = build_command_args.join(' ')
|
55
|
+
run command_string
|
56
|
+
end
|
57
|
+
end
|
50
58
|
end
|
51
59
|
|
52
60
|
end
|
data/lib/shiprails/ship/exec.rb
CHANGED
@@ -32,6 +32,16 @@ module Shiprails
|
|
32
32
|
ecs_exec(region, cluster_name, service, command_string, ssh_private_key_path)
|
33
33
|
end
|
34
34
|
|
35
|
+
no_commands do
|
36
|
+
def run_shorthand_command(command_args=nil, opts=nil)
|
37
|
+
options = opts unless opts.nil?
|
38
|
+
cluster_name = "#{project_name}_#{environment}"
|
39
|
+
command_string = command_args.join ' '
|
40
|
+
ssh_private_key_path = private_key
|
41
|
+
ecs_exec(region, cluster_name, service, command_string, ssh_private_key_path)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
35
45
|
private
|
36
46
|
|
37
47
|
def configuration
|
data/lib/shiprails/ship.rb
CHANGED
@@ -51,11 +51,40 @@ module Shiprails
|
|
51
51
|
Scale.start
|
52
52
|
end
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
def configuration
|
57
|
-
YAML.load(File.read(".shiprails.yml")).deep_symbolize_keys
|
54
|
+
def self.configuration
|
55
|
+
YAML.load(File.read(".shiprails.yml")).deep_symbolize_keys rescue {}
|
58
56
|
end
|
59
57
|
|
58
|
+
if commands = configuration[:exec]
|
59
|
+
commands.each do |name, command|
|
60
|
+
desc name, "ship exec #{command}"
|
61
|
+
method_option "path",
|
62
|
+
aliases: ["-p"],
|
63
|
+
default: ".",
|
64
|
+
desc: "Specify a configuration path"
|
65
|
+
method_option "environment",
|
66
|
+
aliases: ["-e"],
|
67
|
+
desc: "Specify the environment"
|
68
|
+
method_option "region",
|
69
|
+
aliases: ["-r"],
|
70
|
+
default: "us-west-2",
|
71
|
+
desc: "Specify the region"
|
72
|
+
method_option "service",
|
73
|
+
aliases: ["-a"],
|
74
|
+
default: "app",
|
75
|
+
desc: "Specify the service name"
|
76
|
+
method_option "private-key",
|
77
|
+
aliases: ["-pk"],
|
78
|
+
desc: "Specify the AWS SSH private key path"
|
79
|
+
define_method name.to_sym do |*command_args|
|
80
|
+
require "shiprails/ship/exec"
|
81
|
+
built_arguments = command.split(' ') + command_args
|
82
|
+
built_options = options.map{|k,v| "--#{k} #{v}"}
|
83
|
+
script = Exec.new built_arguments, built_options
|
84
|
+
script.run_shorthand_command built_arguments, options
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
60
89
|
end
|
61
90
|
end
|
data/lib/shiprails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shiprails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zane Shannon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
187
|
version: '0'
|
188
188
|
requirements: []
|
189
189
|
rubyforge_project:
|
190
|
-
rubygems_version: 2.
|
190
|
+
rubygems_version: 2.6.11
|
191
191
|
signing_key:
|
192
192
|
specification_version: 4
|
193
193
|
summary: Shiprails helps you deploy Rails to AWS ECS.
|