ruby_yacht 0.6.1 → 0.7.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/README.md +7 -5
- data/doc/TODO.md +1 -5
- data/doc/configuration.md +51 -0
- data/doc/plugins.md +4 -0
- data/lib/ruby_yacht/dsl/configuration.rb +26 -1
- data/lib/ruby_yacht/dsl/dsl.rb +35 -3
- data/lib/ruby_yacht/dsl/hook.rb +4 -0
- data/lib/ruby_yacht/dsl/project.rb +11 -0
- data/lib/ruby_yacht/images/app/Dockerfile.erb +2 -1
- data/lib/ruby_yacht/images/app/checkout.bash +1 -1
- data/lib/ruby_yacht/images/app-dependencies/Dockerfile.erb +7 -1
- data/lib/ruby_yacht/images/database/Dockerfile.erb +3 -1
- data/lib/ruby_yacht/images/database/checkout.bash +3 -4
- data/lib/ruby_yacht/images/web/Dockerfile.erb +2 -0
- data/lib/ruby_yacht/plugins/nginx.rb +5 -0
- data/lib/ruby_yacht/plugins/rails/scripts/load_seeds.rb +10 -1
- data/lib/ruby_yacht/plugins/rails/scripts/prepare_rails_for_launch.rb +1 -1
- data/lib/ruby_yacht/plugins/rails/scripts/update_rails_config.rb +6 -4
- data/lib/ruby_yacht/plugins/rails.rb +30 -17
- data/lib/ruby_yacht/plugins.rb +1 -1
- data/lib/ruby_yacht/runner/build_images.rb +5 -7
- data/lib/ruby_yacht/runner/run_containers.rb +1 -2
- data/ruby_yacht.gemspec +2 -2
- data/spec/docker/run.bash +4 -0
- data/spec/dsl/configuration_spec.rb +29 -0
- data/spec/dsl/dsl_spec.rb +56 -0
- data/spec/dsl/hook_spec.rb +28 -5
- data/spec/dsl/project_spec.rb +46 -0
- data/spec/dsl/server_type_spec.rb +3 -0
- data/spec/fixtures/app-dependencies-dockerfile-generic +3 -1
- data/spec/fixtures/app-dependencies-dockerfile-generic-with-library-install +3 -1
- data/spec/fixtures/app-dependencies-dockerfile-rails +4 -3
- data/spec/fixtures/app-dependencies-dockerfile-rails-production +35 -0
- data/spec/fixtures/app-dependencies-dockerfile-with-https-repository +25 -0
- data/spec/fixtures/app-dependencies-dockerfile-with-no-repository +2 -0
- data/spec/fixtures/database-dockerfile +1 -1
- data/spec/fixtures/database-dockerfile-mysql +1 -1
- data/spec/fixtures/database-dockerfile-rails +2 -6
- data/spec/fixtures/database-dockerfile-rails-mysql +38 -0
- data/spec/fixtures/database-dockerfile-rails-with-no-repository +1 -3
- data/spec/fixtures/database-dockerfile-with-seed-hooks +1 -1
- data/spec/fixtures/local_config.yml +8 -0
- data/spec/fixtures/mars-dockerfile +0 -1
- data/spec/fixtures/mars-dockerfile-rails +0 -1
- data/spec/fixtures/mars-dockerfile-rails-with-no-repository +0 -1
- data/spec/fixtures/mars-dockerfile-with-after-checkout-hooks +0 -1
- data/spec/fixtures/mars-dockerfile-with-before-startup-hooks +0 -1
- data/spec/fixtures/mars-dockerfile-with-custom-file-copy +0 -1
- data/spec/fixtures/mars-dockerfile-with-local-database +0 -1
- data/spec/fixtures/mars-dockerfile-with-no-repository +0 -1
- data/spec/fixtures/mars-dockerfile-with-remote-database +0 -1
- data/spec/fixtures/mars-startup-rails +1 -1
- data/spec/fixtures/mars-startup-rails-with-no-repository +1 -1
- data/spec/fixtures/web-dockerfile-nginx +3 -0
- data/spec/integration/01_normal_config_spec.rb +352 -0
- data/spec/integration/{create_new_project_spec.rb → 02_creating_new_project_spec.rb} +2 -2
- data/spec/integration/03_no_repository_spec.rb +56 -0
- data/spec/integration/04_no_database_spec.rb +58 -0
- data/spec/integration/05_https_repository_spec.rb +52 -0
- data/spec/integration/06_production_environment_spec.rb +72 -0
- data/spec/integration/07_local_checkout_spec.rb +52 -0
- data/spec/integration/08_multiple_projects_spec.rb +46 -0
- data/spec/integration/09_titular_app_spec.rb +53 -0
- data/spec/integration/10_misc_scenarios_spec.rb +97 -0
- data/spec/integration/run.rb +18 -2
- data/spec/plugins/rails_spec.rb +73 -16
- data/spec/runner/build_images_spec.rb +17 -1
- data/spec/runner/run_containers_spec.rb +3 -3
- data/spec/support/integration_helpers.rb +18 -4
- metadata +30 -20
- data/spec/integration/build_images_spec.rb +0 -210
- data/spec/integration/build_spec.rb +0 -23
- data/spec/integration/checkout_spec.rb +0 -94
- data/spec/integration/implode_spec.rb +0 -20
- data/spec/integration/run_containers_spec.rb +0 -279
- data/spec/integration/services_spec.rb +0 -99
- data/spec/integration/shell_spec.rb +0 -31
- data/spec/integration/update_hosts_spec.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7b48a435714287ebf157e4cbacd1db8012a323a
|
4
|
+
data.tar.gz: 433d477edaaa3f78ec21235a8f0b16f56e1b8fe7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ebdfbb69595cede3d1a91633317c10b7e507b8a9e2a86215be040a7c385a187a0fd1d56e7fcbef8f988695a94ef9ae52556b9c7b321e45406217b13b6dfa44b
|
7
|
+
data.tar.gz: 5b2121af08a0a47f85f969ef1d6e4de3f4ae37be3484be94d847d9d6f1f102ecb9b1bd348c134b46ebe5a6acb7aaaecd026df64569074dbf5aeb46dcbfc06728
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -146,11 +146,13 @@ it will build the following images:
|
|
146
146
|
### run_containers
|
147
147
|
|
148
148
|
This command runs all of the containers for the images described above. Each
|
149
|
-
container will have the same name as its image. Each container
|
150
|
-
docker network called `apollo`, and will have network
|
151
|
-
the container names. For instance, the `apollo-web`
|
152
|
-
access the `apollo-mars` container under the hostname
|
153
|
-
will also be able to talk to each other using these
|
149
|
+
container will have the same name as its image. Each container for the `apollo`
|
150
|
+
project will be on a docker network called `apollo`, and will have network
|
151
|
+
aliases corresponding to the container names. For instance, the `apollo-web`
|
152
|
+
container will be able to access the `apollo-mars` container under the hostname
|
153
|
+
`apollo-mars`. The apps will also be able to talk to each other using these
|
154
|
+
network aliases. Containers for different projects will be in different
|
155
|
+
networks, and will not be able to communicate.
|
154
156
|
|
155
157
|
It will not run a container for the `app-dependencies` images. Those images are
|
156
158
|
intended to use as a baseline for the app and database images, to reduce their
|
data/doc/TODO.md
CHANGED
data/doc/configuration.md
CHANGED
@@ -47,6 +47,15 @@ You can provide the following fields.
|
|
47
47
|
<td><code>repository 'github.com'</code></td>
|
48
48
|
<td>None; this is required.</td>
|
49
49
|
</tr>
|
50
|
+
<tr>
|
51
|
+
<td>repository_protocol</td>
|
52
|
+
<td>
|
53
|
+
<p>The protocol that we use to check out the repositories.</p>
|
54
|
+
<p>This can be `ssh`, `http`, or `https`.</p>
|
55
|
+
</td>
|
56
|
+
<td><code>repository_protocol 'https'</code></td>
|
57
|
+
<td>ssh</td>
|
58
|
+
</tr>
|
50
59
|
<tr>
|
51
60
|
<td>check_out_locally</td>
|
52
61
|
<td>
|
@@ -362,6 +371,48 @@ You should only call the `dns_server` once for a given project.
|
|
362
371
|
</tr>
|
363
372
|
</table>
|
364
373
|
|
374
|
+
# Local Configuration
|
375
|
+
|
376
|
+
You may want to have some of your configuration stored in a local file, outside
|
377
|
+
of source control, to handle host-specific settings. For instance, you may have
|
378
|
+
different users using different remote databases, or you may want to set the
|
379
|
+
Rails environment differently in production than in testing. You can do this
|
380
|
+
through two steps. First, you can call `add_local_config` to load the
|
381
|
+
configuration from the YAML file:
|
382
|
+
|
383
|
+
RubyYacht.configure do
|
384
|
+
add_local_config File.join(File.dirname(__FILE__), 'config.yml')
|
385
|
+
end
|
386
|
+
|
387
|
+
This has to be done in a separate configuration block, because the loaded config
|
388
|
+
will not be available until the configuration block is over.
|
389
|
+
|
390
|
+
Inside your main configuration block, you can then call `copy_local_config` to
|
391
|
+
set the fields in the DSL based on the local config:
|
392
|
+
|
393
|
+
project :apollo do
|
394
|
+
system_prefix :apollo
|
395
|
+
|
396
|
+
copy_local_config :rails_environment, :rails_secret_key_base
|
397
|
+
end
|
398
|
+
|
399
|
+
You may also want to have some of your configuration fields grouped together to
|
400
|
+
keep the config file neater. For instance, you can have a database section of
|
401
|
+
the config YML file that is structured like this:
|
402
|
+
|
403
|
+
:database:
|
404
|
+
:apollo:
|
405
|
+
:host: db1.apollo.com
|
406
|
+
:username: apollo
|
407
|
+
:password: ;kljfadsl
|
408
|
+
:name: apollo_production
|
409
|
+
|
410
|
+
And then inside your project config, you could call:
|
411
|
+
|
412
|
+
database :apollo do
|
413
|
+
copy_local_config :host, :username, :password, :name, from: 'database.apollo'
|
414
|
+
end
|
415
|
+
|
365
416
|
# Default Plugins
|
366
417
|
|
367
418
|
By default, RubyYacht comes with three plugins, defined under the
|
data/doc/plugins.md
CHANGED
@@ -177,6 +177,10 @@ These are the event types that you can hook into:
|
|
177
177
|
<td>add_app_config</td>
|
178
178
|
<td>We are adding the configuration for a single app to a web server.</td>
|
179
179
|
</tr>
|
180
|
+
<tr>
|
181
|
+
<td>cleanup</td>
|
182
|
+
<td>This is run at the end of the build process for each image.</td>
|
183
|
+
</tr>
|
180
184
|
</table>
|
181
185
|
|
182
186
|
### Fields
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'yaml'
|
1
2
|
require_relative 'project'
|
2
3
|
require_relative 'hook'
|
3
4
|
require_relative 'server_type'
|
@@ -18,6 +19,7 @@ module RubyYacht
|
|
18
19
|
@hooks = []
|
19
20
|
@server_types = []
|
20
21
|
@avoid_docker_machine = false
|
22
|
+
@local_config = {}
|
21
23
|
end
|
22
24
|
|
23
25
|
# The projects that are part of this system.
|
@@ -38,6 +40,9 @@ module RubyYacht
|
|
38
40
|
# ignored.
|
39
41
|
attr_accessor :disable_docker_machine
|
40
42
|
|
43
|
+
# The configuration that has been loaded from a local YAML file.
|
44
|
+
attr_accessor :local_config
|
45
|
+
|
41
46
|
# This method pulls up the hooks that we have defined.
|
42
47
|
#
|
43
48
|
# ### Parameters
|
@@ -102,6 +107,7 @@ module RubyYacht
|
|
102
107
|
def initialize
|
103
108
|
self.load_custom_attributes
|
104
109
|
@hook_options = {}
|
110
|
+
@local_config = {}
|
105
111
|
end
|
106
112
|
|
107
113
|
##
|
@@ -137,6 +143,9 @@ module RubyYacht
|
|
137
143
|
# The default options for the hooks we're defining in the current block.
|
138
144
|
attr_accessor :hook_options
|
139
145
|
|
146
|
+
# The configuration that has been loaded from a local YAML file.
|
147
|
+
attr_accessor :local_config
|
148
|
+
|
140
149
|
# This method sets default attributes for a group of hooks.
|
141
150
|
#
|
142
151
|
# Any hooks that you create in the associated block will have the included
|
@@ -154,6 +163,20 @@ module RubyYacht
|
|
154
163
|
self.hook_options = old_options
|
155
164
|
end
|
156
165
|
|
166
|
+
# This method loads config from a local YAML file.
|
167
|
+
#
|
168
|
+
# The contents of the file will be stored in the global configuration's
|
169
|
+
# `local_config` field. From there, it can be loaded into another DSL
|
170
|
+
# object by calling `copy_local_config`.
|
171
|
+
#
|
172
|
+
# ### Parameters
|
173
|
+
#
|
174
|
+
# * **path: String** The full path to the config file.
|
175
|
+
def add_local_config(path)
|
176
|
+
new_config = YAML.load_file(path)
|
177
|
+
@local_config = @local_config.merge(new_config)
|
178
|
+
end
|
179
|
+
|
157
180
|
# This method adds a before hook.
|
158
181
|
#
|
159
182
|
# ### Parameters
|
@@ -193,7 +216,7 @@ module RubyYacht
|
|
193
216
|
add_hook :during, event_type, &block
|
194
217
|
end
|
195
218
|
|
196
|
-
creates_object Configuration, %w(projects hooks server_types)
|
219
|
+
creates_object Configuration, %w(projects hooks server_types local_config)
|
197
220
|
|
198
221
|
private
|
199
222
|
|
@@ -222,6 +245,8 @@ module RubyYacht
|
|
222
245
|
self.configuration.send("#{field}=", self.configuration.send(field) + new_configuration.send(field))
|
223
246
|
end
|
224
247
|
|
248
|
+
self.configuration.local_config = self.configuration.local_config.merge(new_configuration.local_config)
|
249
|
+
|
225
250
|
new_configuration.server_types.each do |type|
|
226
251
|
if self.configuration.server_types.any? { |existing| existing.name == type.name }
|
227
252
|
raise "Server type already registered: #{type.name}"
|
data/lib/ruby_yacht/dsl/dsl.rb
CHANGED
@@ -95,7 +95,7 @@ module RubyYacht
|
|
95
95
|
# * **name: Symbol** The name of the method. The name of the
|
96
96
|
# attribute will be this name, followed by an s.
|
97
97
|
def add_list(name)
|
98
|
-
add_generic_attribute name, "#{name}s", [], false do |value|
|
98
|
+
add_generic_attribute name, "#{name}s".to_sym, [], false do |value|
|
99
99
|
variable_name = "@#{name}s"
|
100
100
|
list = instance_variable_get(variable_name)
|
101
101
|
list << value
|
@@ -160,7 +160,7 @@ module RubyYacht
|
|
160
160
|
# * **type: Class** The class type that provides the DSL when they
|
161
161
|
# call this method.
|
162
162
|
def add_object_list(name, type)
|
163
|
-
add_generic_attribute name, "#{name}s", [], false do |*args, &config_block|
|
163
|
+
add_generic_attribute name, "#{name}s".to_sym, [], false do |*args, &config_block|
|
164
164
|
variable_name = "@#{name}s"
|
165
165
|
list = instance_variable_get(variable_name)
|
166
166
|
object_config = type.new(*args)
|
@@ -218,7 +218,7 @@ module RubyYacht
|
|
218
218
|
if server_type.respond_to?(self.class.custom_attribute_method)
|
219
219
|
attributes = server_type.send(self.class.custom_attribute_method)
|
220
220
|
attributes.each do |attribute|
|
221
|
-
attribute = attribute.merge(name: "#{server_type.name}_#{attribute[:name]}")
|
221
|
+
attribute = attribute.merge(name: "#{server_type.name}_#{attribute[:name]}".to_sym)
|
222
222
|
load_custom_attribute(attribute)
|
223
223
|
end
|
224
224
|
end
|
@@ -290,6 +290,38 @@ module RubyYacht
|
|
290
290
|
end
|
291
291
|
self
|
292
292
|
end
|
293
|
+
|
294
|
+
# This method copies fields from the local config to this DSL.
|
295
|
+
#
|
296
|
+
# The local config must have been loaded in a previous configuration block
|
297
|
+
# using the `add_local_config` method.
|
298
|
+
#
|
299
|
+
# The keys in the local config file should all be symbols, as should the
|
300
|
+
# `fields`. If they are not, this method may not be able to find the
|
301
|
+
# config entries.
|
302
|
+
#
|
303
|
+
# Any fields that are not present in the local config will be set to nil.
|
304
|
+
#
|
305
|
+
# ### Parameters
|
306
|
+
#
|
307
|
+
# * **fields: [Symbol]** The fields to load.
|
308
|
+
# * **from: String** A dot-separated key path to the location in
|
309
|
+
# the config file that contains the dictionary
|
310
|
+
# that we are pulling the fields from.
|
311
|
+
def copy_local_config(*fields, from:nil)
|
312
|
+
dictionary = RubyYacht.configuration.local_config
|
313
|
+
if from
|
314
|
+
from.split('.').each do |key|
|
315
|
+
dictionary = dictionary[key.to_sym]
|
316
|
+
end
|
317
|
+
end
|
318
|
+
fields.each do |field|
|
319
|
+
unless self.singleton_class.all_attributes.include?(field)
|
320
|
+
raise "Undefined field in #{self.class.name}: #{field}"
|
321
|
+
end
|
322
|
+
instance_variable_set("@#{field}", dictionary[field])
|
323
|
+
end
|
324
|
+
end
|
293
325
|
|
294
326
|
# This method checks that all of the required attributes have been set on
|
295
327
|
# the object.
|
data/lib/ruby_yacht/dsl/hook.rb
CHANGED
@@ -248,11 +248,15 @@ module RubyYacht
|
|
248
248
|
|
249
249
|
# The command that should be run in a Dockerfile for this behavior.
|
250
250
|
def dockerfile_command
|
251
|
+
value = self.value
|
252
|
+
return nil unless value
|
251
253
|
"ENV #{@name} #{value}"
|
252
254
|
end
|
253
255
|
|
254
256
|
# The command that should be run in a shell script for this behavior.
|
255
257
|
def shell_command
|
258
|
+
value = self.value
|
259
|
+
return nil unless value
|
256
260
|
"export #{@name}=\"#{value}\""
|
257
261
|
end
|
258
262
|
end
|
@@ -21,6 +21,11 @@ module RubyYacht
|
|
21
21
|
# The hostname for the repository that contains the code for the apps.
|
22
22
|
attr_accessor :repository
|
23
23
|
|
24
|
+
# The protocol that we use to check out the repository.
|
25
|
+
#
|
26
|
+
# This can be `ssh`, `http`, or `https`.
|
27
|
+
attr_accessor :repository_protocol
|
28
|
+
|
24
29
|
# Whether we should check out the code on the host machine, rather than
|
25
30
|
# keeping it entirely inside the container.
|
26
31
|
attr_accessor :check_out_locally
|
@@ -80,6 +85,12 @@ module RubyYacht
|
|
80
85
|
# You can call `repository 'github.com'` to set the project's `repository`
|
81
86
|
# to `github.com`
|
82
87
|
add_attribute :repository
|
88
|
+
|
89
|
+
##
|
90
|
+
# :method: repository_protocol
|
91
|
+
# You can call `repository_protocol :https` to tell the scripts to check
|
92
|
+
# out the repositories over HTTPS rather than SSH.
|
93
|
+
add_attribute :repository_protocol, :ssh
|
83
94
|
|
84
95
|
#
|
85
96
|
# :method: primary_app
|
@@ -10,7 +10,6 @@ ENV DATABASE_TYPE <%= database.server_type %>
|
|
10
10
|
ENV DATABASE_PORT <%= database.port %>
|
11
11
|
<% end %>
|
12
12
|
ENV APP_PORT <%= @app.port %>
|
13
|
-
ENV REPOSITORY_HOST <%= @project.repository %>
|
14
13
|
ENV SYSTEM_PREFIX <%= @project.system_prefix %>
|
15
14
|
<% if @app.repository_name %>
|
16
15
|
ENV REPOSITORY_NAME <%= @app.repository_name %>
|
@@ -37,6 +36,8 @@ WORKDIR /var/code
|
|
37
36
|
<%= include_event(@app, :build_new_app) %>
|
38
37
|
<% end %>
|
39
38
|
|
39
|
+
<%= include_event @app, :cleanup %>
|
40
|
+
|
40
41
|
EXPOSE <%= @app.port %>
|
41
42
|
|
42
43
|
CMD /var/docker/startup.bash
|
@@ -6,6 +6,12 @@
|
|
6
6
|
|
7
7
|
FROM <%= @server_type.baseline_image %>
|
8
8
|
|
9
|
+
<% repository_host = @project.repository %>
|
10
|
+
<% if @project.repository_protocol == :ssh %>
|
11
|
+
<% repository_host = 'git@' + repository_host %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
ENV REPOSITORY_HOST <%= @project.repository_protocol %>://<%= repository_host %>
|
9
15
|
<%= include_event @project.apps, :initialize_app_environment %>
|
10
16
|
|
11
17
|
RUN mkdir -p /root/.ssh
|
@@ -21,7 +27,7 @@ RUN apt-get update && apt-get upgrade -y
|
|
21
27
|
<% next unless app.server_type == @server_type.name %>
|
22
28
|
<% next unless app.repository_name %>
|
23
29
|
|
24
|
-
RUN git clone
|
30
|
+
RUN git clone $REPOSITORY_HOST/<%= app.repository_name %> /var/code/<%= app.name %>
|
25
31
|
WORKDIR /var/code/<%= app.name %>
|
26
32
|
<%= include_event app, :install_libraries %>
|
27
33
|
<% end %>
|
@@ -18,7 +18,7 @@ RUN chmod u+x /var/docker/*
|
|
18
18
|
<% @database.apps.each do |app| %>
|
19
19
|
|
20
20
|
<% next unless app.repository_name %>
|
21
|
-
RUN /var/docker/checkout.bash <%=
|
21
|
+
RUN /var/docker/checkout.bash <%= app.name %> <%= app.repository_name %>
|
22
22
|
WORKDIR /var/code/<%= app.name %>
|
23
23
|
<%= include_event @database, :load_database_seeds %>
|
24
24
|
<% end %>
|
@@ -26,6 +26,8 @@ WORKDIR /var/code/<%= app.name %>
|
|
26
26
|
RUN rm -r /var/code
|
27
27
|
WORKDIR /
|
28
28
|
|
29
|
+
<%= include_event @database, :cleanup %>
|
30
|
+
|
29
31
|
ENV DATABASE_USERNAME ''
|
30
32
|
ENV DATABASE_PASSWORD ''
|
31
33
|
ENV DATABASE_NAME ''
|
@@ -1,10 +1,9 @@
|
|
1
1
|
#! /bin/bash
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
REPOSITORY_NAME=$3
|
3
|
+
APP_NAME=$1
|
4
|
+
REPOSITORY_NAME=$2
|
6
5
|
|
7
6
|
if [ ! -d /var/code/$APP_NAME/.git ]
|
8
7
|
then
|
9
|
-
git clone
|
8
|
+
git clone $REPOSITORY_HOST/$REPOSITORY_NAME /var/code/$APP_NAME
|
10
9
|
fi
|
@@ -19,6 +19,11 @@ module RubyYacht::Plugins
|
|
19
19
|
|
20
20
|
during(:add_project_landing) { run_script :ruby, 'add_project.rb' }
|
21
21
|
during(:add_app_config) { run_script :ruby, 'add_app.rb' }
|
22
|
+
|
23
|
+
during(:cleanup) do
|
24
|
+
command 'apt-get remove -y ruby'
|
25
|
+
command 'apt-get autoremove -y'
|
26
|
+
end
|
22
27
|
end
|
23
28
|
end
|
24
29
|
end
|
@@ -12,7 +12,7 @@ config_path = "./config/database.yml"
|
|
12
12
|
username = ENV['DATABASE_USERNAME']
|
13
13
|
password = ENV['DATABASE_PASSWORD']
|
14
14
|
database = ENV['DATABASE_NAME']
|
15
|
-
rails_env = ENV['RAILS_ENV']
|
15
|
+
rails_env = ENV['RAILS_ENV'] || 'development'
|
16
16
|
|
17
17
|
database_config = {
|
18
18
|
rails_env => {
|
@@ -30,6 +30,15 @@ File.open(config_path, "w") do |file|
|
|
30
30
|
file.write(database_config.to_yaml)
|
31
31
|
end
|
32
32
|
|
33
|
+
File.open('./config/secrets.yml', 'w') do |file|
|
34
|
+
secret_key_config = {
|
35
|
+
rails_env => {
|
36
|
+
'secret_key_base' => ENV['SECRET_KEY_BASE']
|
37
|
+
}
|
38
|
+
}
|
39
|
+
file.write(secret_key_config.to_yaml)
|
40
|
+
end
|
41
|
+
|
33
42
|
system "bundle install"
|
34
43
|
tables = `mysql -uroot -e "SHOW TABLES" #{database}`
|
35
44
|
if tables == ''
|