ruby_yacht 0.3.0 → 0.4.0
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/Gemfile.lock +1 -1
- data/doc/TODO.md +1 -8
- data/lib/ruby_yacht/dsl/app.rb +37 -10
- data/lib/ruby_yacht/dsl/configuration.rb +21 -21
- data/lib/ruby_yacht/dsl/database.rb +53 -0
- data/lib/ruby_yacht/dsl/dsl.rb +14 -8
- data/lib/ruby_yacht/dsl/hook.rb +35 -15
- data/lib/ruby_yacht/dsl/project.rb +23 -10
- data/lib/ruby_yacht/dsl/{app_type.rb → server_type.rb} +39 -29
- data/lib/ruby_yacht/dsl.rb +1 -1
- data/lib/ruby_yacht/images/app/Dockerfile.erb +9 -5
- data/lib/ruby_yacht/images/app-dependencies/Dockerfile.erb +2 -2
- data/lib/ruby_yacht/images/database/Dockerfile.erb +12 -11
- data/lib/ruby_yacht/images/web/Dockerfile.erb +6 -2
- data/lib/ruby_yacht/images/web/add_app.rb +7 -1
- data/lib/ruby_yacht/images/web/app_config.erb +2 -0
- data/lib/ruby_yacht/plugins/mysql/scripts/setup.bash +11 -0
- data/lib/ruby_yacht/plugins/mysql.rb +27 -0
- data/lib/ruby_yacht/plugins/rails/scripts/install_gems.rb +6 -1
- data/lib/ruby_yacht/plugins/rails/scripts/load_seeds.rb +6 -4
- data/lib/ruby_yacht/plugins/rails/scripts/prepare_rails_for_launch.rb +1 -0
- data/lib/ruby_yacht/plugins/rails/scripts/update_rails_config.rb +1 -5
- data/lib/ruby_yacht/plugins/rails.rb +12 -4
- data/lib/ruby_yacht/plugins.rb +2 -1
- data/lib/ruby_yacht/runner/build_images.rb +32 -26
- data/lib/ruby_yacht/runner/checkout.rb +5 -4
- data/lib/ruby_yacht/runner/run_containers.rb +7 -6
- data/lib/ruby_yacht/runner/services.rb +2 -2
- data/lib/ruby_yacht/runner/shell.rb +5 -4
- data/lib/ruby_yacht/runner/update_hosts.rb +2 -1
- data/ruby_yacht.gemspec +1 -1
- data/spec/dsl/app_spec.rb +96 -10
- data/spec/dsl/configuration_spec.rb +53 -55
- data/spec/dsl/database_spec.rb +70 -12
- data/spec/dsl/hook_spec.rb +36 -19
- data/spec/dsl/project_spec.rb +26 -18
- data/spec/dsl/{app_type_spec.rb → server_type_spec.rb} +52 -28
- data/spec/fixtures/app-dependencies-dockerfile-rails +3 -0
- data/spec/fixtures/database-dockerfile +1 -8
- data/spec/fixtures/database-dockerfile-mysql +30 -0
- data/spec/fixtures/database-dockerfile-rails +1 -5
- data/spec/fixtures/database-dockerfile-with-seed-hooks +1 -8
- data/spec/fixtures/mars-before-startup-with-custom-file-copy +6 -0
- data/spec/fixtures/mars-dockerfile +0 -4
- data/spec/fixtures/mars-dockerfile-rails +2 -2
- data/spec/fixtures/mars-dockerfile-with-after-checkout-hooks +0 -4
- data/spec/fixtures/mars-dockerfile-with-before-startup-hooks +0 -4
- data/spec/fixtures/mars-dockerfile-with-custom-file-copy +23 -0
- data/spec/fixtures/mars-dockerfile-with-local-database +27 -0
- data/spec/fixtures/mars-dockerfile-with-remote-database +27 -0
- data/spec/fixtures/web-dockerfile-with-eponymous-app +20 -0
- data/spec/plugins/mysql_spec.rb +64 -0
- data/spec/plugins/rails_spec.rb +103 -43
- data/spec/runner/build_images_spec.rb +142 -11
- data/spec/runner/checkout_spec.rb +4 -4
- data/spec/runner/run_containers_spec.rb +21 -2
- data/spec/runner/runner_spec.rb +1 -1
- data/spec/runner/services_spec.rb +7 -2
- data/spec/runner/shell_spec.rb +3 -3
- data/spec/runner/update_hosts_spec.rb +26 -0
- data/spec/support/test_project.rb +16 -20
- metadata +20 -5
- data/lib/ruby_yacht/images/database/setup.bash +0 -15
data/spec/runner/shell_spec.rb
CHANGED
@@ -32,7 +32,7 @@ describe RubyYacht::Runner::Shell do
|
|
32
32
|
describe "parse_positional_arguments" do
|
33
33
|
it "takes the app from the command line" do
|
34
34
|
subject.parse_positional_arguments(["venus", "rails", "c"])
|
35
|
-
expect(subject.
|
35
|
+
expect(subject.app_name).to eq "venus"
|
36
36
|
end
|
37
37
|
|
38
38
|
it "takes the command from the command line" do
|
@@ -49,7 +49,7 @@ describe RubyYacht::Runner::Shell do
|
|
49
49
|
|
50
50
|
describe "run behavior" do
|
51
51
|
before do
|
52
|
-
subject.
|
52
|
+
subject.app_name = 'saturn'
|
53
53
|
subject.command = 'rails c'
|
54
54
|
RubyYacht.configure_second_test_project
|
55
55
|
allow(subject).to receive :exec
|
@@ -72,7 +72,7 @@ describe RubyYacht::Runner::Shell do
|
|
72
72
|
|
73
73
|
context "with no app" do
|
74
74
|
before do
|
75
|
-
subject.
|
75
|
+
subject.app_name = nil
|
76
76
|
end
|
77
77
|
|
78
78
|
it "logs an error" do
|
@@ -159,5 +159,31 @@ describe RubyYacht::Runner::UpdateHosts do
|
|
159
159
|
EOS
|
160
160
|
end
|
161
161
|
end
|
162
|
+
|
163
|
+
context "with an app with the same name as the project" do
|
164
|
+
before do
|
165
|
+
RubyYacht.configuration.projects.first.apps.first.name = :apollo
|
166
|
+
end
|
167
|
+
|
168
|
+
it "adds the entries to the hosts file in the tmp folder" do
|
169
|
+
subject.run
|
170
|
+
expect(File.exist?(File.join('tmp', 'hosts'))).to be_truthy
|
171
|
+
|
172
|
+
contents = File.read(File.join('tmp', 'hosts'))
|
173
|
+
expect(contents).to eq <<-EOS.gsub(/^ +/, '').strip
|
174
|
+
# Local information
|
175
|
+
127.0.0.1 localhost
|
176
|
+
|
177
|
+
# Database server
|
178
|
+
|
179
|
+
40.1.30.10 db1.test.com
|
180
|
+
|
181
|
+
# apollo docker containers
|
182
|
+
192.168.1.27 apollo.test.com
|
183
|
+
192.168.1.27 saturn.apollo.test.com
|
184
|
+
EOS
|
185
|
+
|
186
|
+
end
|
187
|
+
end
|
162
188
|
end
|
163
189
|
end
|
@@ -1,31 +1,34 @@
|
|
1
1
|
module RubyYacht
|
2
|
-
def self.
|
3
|
-
RubyYacht.configuration.clear
|
2
|
+
def self.configure_server_types
|
4
3
|
RubyYacht.configure do
|
5
|
-
|
6
|
-
|
4
|
+
server_type :generic do
|
5
|
+
container_type :app
|
6
|
+
baseline_image 'ubuntu'
|
7
|
+
end
|
8
|
+
|
9
|
+
server_type :debian do
|
10
|
+
container_type :app
|
11
|
+
baseline_image 'debian'
|
12
|
+
end
|
7
13
|
end
|
8
14
|
|
9
15
|
RubyYacht.configure do
|
10
16
|
during :startup do
|
11
|
-
|
17
|
+
server_type :generic
|
12
18
|
command '/var/docker/start_app.bash'
|
13
19
|
end
|
14
20
|
end
|
15
|
-
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.configure_test_project
|
24
|
+
RubyYacht.configuration.clear
|
25
|
+
self.configure_server_types
|
16
26
|
RubyYacht.configure do
|
17
27
|
project :apollo do
|
18
28
|
system_prefix :apollo
|
19
29
|
domain "apollo.test.com"
|
20
30
|
repository "github.com"
|
21
31
|
|
22
|
-
database do
|
23
|
-
host "db.test.com"
|
24
|
-
name "apollo"
|
25
|
-
username "apollo"
|
26
|
-
password "test"
|
27
|
-
end
|
28
|
-
|
29
32
|
generic_app :mars do
|
30
33
|
repository_name 'brownleej/mars'
|
31
34
|
end
|
@@ -44,13 +47,6 @@ module RubyYacht
|
|
44
47
|
domain "jupiter.test.com"
|
45
48
|
repository "github.com"
|
46
49
|
|
47
|
-
database do
|
48
|
-
host "db.test.com"
|
49
|
-
name "jupiter"
|
50
|
-
username "jupiter"
|
51
|
-
password "test"
|
52
|
-
end
|
53
|
-
|
54
50
|
debian_app :venus do
|
55
51
|
repository_name 'brownleej/venus'
|
56
52
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_yacht
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Brownlee
|
@@ -74,13 +74,13 @@ files:
|
|
74
74
|
- lib/ruby_yacht.rb
|
75
75
|
- lib/ruby_yacht/dsl.rb
|
76
76
|
- lib/ruby_yacht/dsl/app.rb
|
77
|
-
- lib/ruby_yacht/dsl/app_type.rb
|
78
77
|
- lib/ruby_yacht/dsl/configuration.rb
|
79
78
|
- lib/ruby_yacht/dsl/database.rb
|
80
79
|
- lib/ruby_yacht/dsl/dns_server.rb
|
81
80
|
- lib/ruby_yacht/dsl/dsl.rb
|
82
81
|
- lib/ruby_yacht/dsl/hook.rb
|
83
82
|
- lib/ruby_yacht/dsl/project.rb
|
83
|
+
- lib/ruby_yacht/dsl/server_type.rb
|
84
84
|
- lib/ruby_yacht/images/app-dependencies/Dockerfile.erb
|
85
85
|
- lib/ruby_yacht/images/app/Dockerfile.erb
|
86
86
|
- lib/ruby_yacht/images/app/before_startup.bash.erb
|
@@ -88,7 +88,6 @@ files:
|
|
88
88
|
- lib/ruby_yacht/images/app/startup.bash.erb
|
89
89
|
- lib/ruby_yacht/images/database/Dockerfile.erb
|
90
90
|
- lib/ruby_yacht/images/database/checkout.bash
|
91
|
-
- lib/ruby_yacht/images/database/setup.bash
|
92
91
|
- lib/ruby_yacht/images/web/Dockerfile.erb
|
93
92
|
- lib/ruby_yacht/images/web/add_app.rb
|
94
93
|
- lib/ruby_yacht/images/web/add_project.rb
|
@@ -96,6 +95,8 @@ files:
|
|
96
95
|
- lib/ruby_yacht/images/web/index.html.erb
|
97
96
|
- lib/ruby_yacht/images/web/index_config.erb
|
98
97
|
- lib/ruby_yacht/plugins.rb
|
98
|
+
- lib/ruby_yacht/plugins/mysql.rb
|
99
|
+
- lib/ruby_yacht/plugins/mysql/scripts/setup.bash
|
99
100
|
- lib/ruby_yacht/plugins/rails.rb
|
100
101
|
- lib/ruby_yacht/plugins/rails/scripts/install_gems.rb
|
101
102
|
- lib/ruby_yacht/plugins/rails/scripts/load_seeds.rb
|
@@ -117,17 +118,18 @@ files:
|
|
117
118
|
- spec/docker/Dockerfile
|
118
119
|
- spec/docker/build.bash
|
119
120
|
- spec/dsl/app_spec.rb
|
120
|
-
- spec/dsl/app_type_spec.rb
|
121
121
|
- spec/dsl/configuration_spec.rb
|
122
122
|
- spec/dsl/database_spec.rb
|
123
123
|
- spec/dsl/dns_server_spec.rb
|
124
124
|
- spec/dsl/dsl_spec.rb
|
125
125
|
- spec/dsl/hook_spec.rb
|
126
126
|
- spec/dsl/project_spec.rb
|
127
|
+
- spec/dsl/server_type_spec.rb
|
127
128
|
- spec/fixtures/app-dependencies-dockerfile-generic
|
128
129
|
- spec/fixtures/app-dependencies-dockerfile-generic-with-library-install
|
129
130
|
- spec/fixtures/app-dependencies-dockerfile-rails
|
130
131
|
- spec/fixtures/database-dockerfile
|
132
|
+
- spec/fixtures/database-dockerfile-mysql
|
131
133
|
- spec/fixtures/database-dockerfile-rails
|
132
134
|
- spec/fixtures/database-dockerfile-with-seed-hooks
|
133
135
|
- spec/fixtures/deploy-dockerfile
|
@@ -136,15 +138,21 @@ files:
|
|
136
138
|
- spec/fixtures/mars-before-startup
|
137
139
|
- spec/fixtures/mars-before-startup-rails
|
138
140
|
- spec/fixtures/mars-before-startup-with-before-startup-hooks
|
141
|
+
- spec/fixtures/mars-before-startup-with-custom-file-copy
|
139
142
|
- spec/fixtures/mars-dockerfile
|
140
143
|
- spec/fixtures/mars-dockerfile-rails
|
141
144
|
- spec/fixtures/mars-dockerfile-with-after-checkout-hooks
|
142
145
|
- spec/fixtures/mars-dockerfile-with-before-startup-hooks
|
146
|
+
- spec/fixtures/mars-dockerfile-with-custom-file-copy
|
147
|
+
- spec/fixtures/mars-dockerfile-with-local-database
|
148
|
+
- spec/fixtures/mars-dockerfile-with-remote-database
|
143
149
|
- spec/fixtures/mars-startup
|
144
150
|
- spec/fixtures/mars-startup-rails
|
145
151
|
- spec/fixtures/multi-project-web-dockerfile
|
146
152
|
- spec/fixtures/web-dockerfile
|
153
|
+
- spec/fixtures/web-dockerfile-with-eponymous-app
|
147
154
|
- spec/fixtures/web-dockerfile-with-primary-app
|
155
|
+
- spec/plugins/mysql_spec.rb
|
148
156
|
- spec/plugins/rails_spec.rb
|
149
157
|
- spec/runner/build_images_spec.rb
|
150
158
|
- spec/runner/build_spec.rb
|
@@ -188,17 +196,18 @@ test_files:
|
|
188
196
|
- spec/docker/Dockerfile
|
189
197
|
- spec/docker/build.bash
|
190
198
|
- spec/dsl/app_spec.rb
|
191
|
-
- spec/dsl/app_type_spec.rb
|
192
199
|
- spec/dsl/configuration_spec.rb
|
193
200
|
- spec/dsl/database_spec.rb
|
194
201
|
- spec/dsl/dns_server_spec.rb
|
195
202
|
- spec/dsl/dsl_spec.rb
|
196
203
|
- spec/dsl/hook_spec.rb
|
197
204
|
- spec/dsl/project_spec.rb
|
205
|
+
- spec/dsl/server_type_spec.rb
|
198
206
|
- spec/fixtures/app-dependencies-dockerfile-generic
|
199
207
|
- spec/fixtures/app-dependencies-dockerfile-generic-with-library-install
|
200
208
|
- spec/fixtures/app-dependencies-dockerfile-rails
|
201
209
|
- spec/fixtures/database-dockerfile
|
210
|
+
- spec/fixtures/database-dockerfile-mysql
|
202
211
|
- spec/fixtures/database-dockerfile-rails
|
203
212
|
- spec/fixtures/database-dockerfile-with-seed-hooks
|
204
213
|
- spec/fixtures/deploy-dockerfile
|
@@ -207,15 +216,21 @@ test_files:
|
|
207
216
|
- spec/fixtures/mars-before-startup
|
208
217
|
- spec/fixtures/mars-before-startup-rails
|
209
218
|
- spec/fixtures/mars-before-startup-with-before-startup-hooks
|
219
|
+
- spec/fixtures/mars-before-startup-with-custom-file-copy
|
210
220
|
- spec/fixtures/mars-dockerfile
|
211
221
|
- spec/fixtures/mars-dockerfile-rails
|
212
222
|
- spec/fixtures/mars-dockerfile-with-after-checkout-hooks
|
213
223
|
- spec/fixtures/mars-dockerfile-with-before-startup-hooks
|
224
|
+
- spec/fixtures/mars-dockerfile-with-custom-file-copy
|
225
|
+
- spec/fixtures/mars-dockerfile-with-local-database
|
226
|
+
- spec/fixtures/mars-dockerfile-with-remote-database
|
214
227
|
- spec/fixtures/mars-startup
|
215
228
|
- spec/fixtures/mars-startup-rails
|
216
229
|
- spec/fixtures/multi-project-web-dockerfile
|
217
230
|
- spec/fixtures/web-dockerfile
|
231
|
+
- spec/fixtures/web-dockerfile-with-eponymous-app
|
218
232
|
- spec/fixtures/web-dockerfile-with-primary-app
|
233
|
+
- spec/plugins/mysql_spec.rb
|
219
234
|
- spec/plugins/rails_spec.rb
|
220
235
|
- spec/runner/build_images_spec.rb
|
221
236
|
- spec/runner/build_spec.rb
|
@@ -1,15 +0,0 @@
|
|
1
|
-
#! /bin/bash
|
2
|
-
|
3
|
-
DATABASE_NAME=$1
|
4
|
-
DATABASE_USER=$2
|
5
|
-
DATABASE_PASSWORD=$3
|
6
|
-
|
7
|
-
service mysql start;
|
8
|
-
COMMAND="CREATE USER '$DATABASE_USER'@'localhost' IDENTIFIED BY '$DATABASE_PASSWORD';";
|
9
|
-
COMMAND="$COMMAND CREATE USER '$DATABASE_USER'@'%' IDENTIFIED BY '$DATABASE_PASSWORD';";
|
10
|
-
|
11
|
-
COMMAND="$COMMAND GRANT ALL ON $DATABASE_NAME.* to '$DATABASE_USER'@'localhost';";
|
12
|
-
COMMAND="$COMMAND GRANT ALL ON $DATABASE_NAME.* to '$DATABASE_USER'@'%';";
|
13
|
-
COMMAND="$COMMAND CREATE DATABASE $DATABASE_NAME;";
|
14
|
-
|
15
|
-
mysql -uroot -e "$COMMAND";
|