ruby_yacht 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/doc/TODO.md +1 -8
  4. data/lib/ruby_yacht/dsl/app.rb +37 -10
  5. data/lib/ruby_yacht/dsl/configuration.rb +21 -21
  6. data/lib/ruby_yacht/dsl/database.rb +53 -0
  7. data/lib/ruby_yacht/dsl/dsl.rb +14 -8
  8. data/lib/ruby_yacht/dsl/hook.rb +35 -15
  9. data/lib/ruby_yacht/dsl/project.rb +23 -10
  10. data/lib/ruby_yacht/dsl/{app_type.rb → server_type.rb} +39 -29
  11. data/lib/ruby_yacht/dsl.rb +1 -1
  12. data/lib/ruby_yacht/images/app/Dockerfile.erb +9 -5
  13. data/lib/ruby_yacht/images/app-dependencies/Dockerfile.erb +2 -2
  14. data/lib/ruby_yacht/images/database/Dockerfile.erb +12 -11
  15. data/lib/ruby_yacht/images/web/Dockerfile.erb +6 -2
  16. data/lib/ruby_yacht/images/web/add_app.rb +7 -1
  17. data/lib/ruby_yacht/images/web/app_config.erb +2 -0
  18. data/lib/ruby_yacht/plugins/mysql/scripts/setup.bash +11 -0
  19. data/lib/ruby_yacht/plugins/mysql.rb +27 -0
  20. data/lib/ruby_yacht/plugins/rails/scripts/install_gems.rb +6 -1
  21. data/lib/ruby_yacht/plugins/rails/scripts/load_seeds.rb +6 -4
  22. data/lib/ruby_yacht/plugins/rails/scripts/prepare_rails_for_launch.rb +1 -0
  23. data/lib/ruby_yacht/plugins/rails/scripts/update_rails_config.rb +1 -5
  24. data/lib/ruby_yacht/plugins/rails.rb +12 -4
  25. data/lib/ruby_yacht/plugins.rb +2 -1
  26. data/lib/ruby_yacht/runner/build_images.rb +32 -26
  27. data/lib/ruby_yacht/runner/checkout.rb +5 -4
  28. data/lib/ruby_yacht/runner/run_containers.rb +7 -6
  29. data/lib/ruby_yacht/runner/services.rb +2 -2
  30. data/lib/ruby_yacht/runner/shell.rb +5 -4
  31. data/lib/ruby_yacht/runner/update_hosts.rb +2 -1
  32. data/ruby_yacht.gemspec +1 -1
  33. data/spec/dsl/app_spec.rb +96 -10
  34. data/spec/dsl/configuration_spec.rb +53 -55
  35. data/spec/dsl/database_spec.rb +70 -12
  36. data/spec/dsl/hook_spec.rb +36 -19
  37. data/spec/dsl/project_spec.rb +26 -18
  38. data/spec/dsl/{app_type_spec.rb → server_type_spec.rb} +52 -28
  39. data/spec/fixtures/app-dependencies-dockerfile-rails +3 -0
  40. data/spec/fixtures/database-dockerfile +1 -8
  41. data/spec/fixtures/database-dockerfile-mysql +30 -0
  42. data/spec/fixtures/database-dockerfile-rails +1 -5
  43. data/spec/fixtures/database-dockerfile-with-seed-hooks +1 -8
  44. data/spec/fixtures/mars-before-startup-with-custom-file-copy +6 -0
  45. data/spec/fixtures/mars-dockerfile +0 -4
  46. data/spec/fixtures/mars-dockerfile-rails +2 -2
  47. data/spec/fixtures/mars-dockerfile-with-after-checkout-hooks +0 -4
  48. data/spec/fixtures/mars-dockerfile-with-before-startup-hooks +0 -4
  49. data/spec/fixtures/mars-dockerfile-with-custom-file-copy +23 -0
  50. data/spec/fixtures/mars-dockerfile-with-local-database +27 -0
  51. data/spec/fixtures/mars-dockerfile-with-remote-database +27 -0
  52. data/spec/fixtures/web-dockerfile-with-eponymous-app +20 -0
  53. data/spec/plugins/mysql_spec.rb +64 -0
  54. data/spec/plugins/rails_spec.rb +103 -43
  55. data/spec/runner/build_images_spec.rb +142 -11
  56. data/spec/runner/checkout_spec.rb +4 -4
  57. data/spec/runner/run_containers_spec.rb +21 -2
  58. data/spec/runner/runner_spec.rb +1 -1
  59. data/spec/runner/services_spec.rb +7 -2
  60. data/spec/runner/shell_spec.rb +3 -3
  61. data/spec/runner/update_hosts_spec.rb +26 -0
  62. data/spec/support/test_project.rb +16 -20
  63. metadata +20 -5
  64. data/lib/ruby_yacht/images/database/setup.bash +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60a4d2f558965415e5cd128391116e187b05c165
4
- data.tar.gz: fa574d48c920037379ecf355ce1e07a31a5795ff
3
+ metadata.gz: 84782d5ec6a5667641c4e5ac79af922256a343b9
4
+ data.tar.gz: fac43df97940c4e8bcb21b1173b3e8f5c67a9c7a
5
5
  SHA512:
6
- metadata.gz: 3a534420ae3d0eb73b31ae1f60c930d64bd217cca3717a04e50ac526d291952d024ebb3b604dd97cb5418fda3bc7fd2078220668dc01ca8651919db02d61ea15
7
- data.tar.gz: 03bba6e531b6b21bb96250593f06bad135d796bf88bfe21358e92ade3ca194470b2b463a22d00ac5270e53890e9624febffba66d7638842654dac9a12fcce5a0
6
+ metadata.gz: 09cffa04290fe6a276ca9cf586ddb6ec5ea78df49dc7889a2100c91b3e58ffbd252532352e27900f53cdc191d3d1fd40243e581d0cf949df19f739232d84cd76
7
+ data.tar.gz: 84c1952058526225483a7a284352f59b47a4d4d9bd788f9cecc8fcdec60eac7bd689b11090e99164faf625cef9722eeca43d7a5d0aaf9ed3e317632359608bc4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby_yacht (0.2.0)
4
+ ruby_yacht (0.4.0.pre1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/doc/TODO.md CHANGED
@@ -8,17 +8,10 @@ for open tickets.
8
8
  approach
9
9
  * Look into issues with running shell command that has its own command-line
10
10
  flags.
11
- * Add formal documentation on configuration DSL.
12
11
 
13
12
  # Plugins
14
13
 
15
- * Add documentation on plugin API
16
-
17
- # More Command Line Options
18
-
19
- * Getting status of containers
20
- * Starting / stopping individual containers
21
- * Clearing backups of the hosts file
14
+ * Better support for rails apps with no database
22
15
 
23
16
  # More customization
24
17
 
@@ -14,11 +14,14 @@ module RubyYacht
14
14
  # when building it.
15
15
  #
16
16
  # For instance, this would be `rails` for a Rails app.
17
- attr_accessor :app_type
17
+ attr_accessor :server_type
18
18
 
19
19
  # The port that the app listens on.
20
20
  attr_accessor :port
21
21
 
22
+ # The name of the database that this app uses as its data store.
23
+ attr_accessor :database_name
24
+
22
25
  # This method gets the name of the image / container that this app will run
23
26
  # in.
24
27
  #
@@ -26,7 +29,23 @@ module RubyYacht
26
29
  #
27
30
  # * *project: RubyYacht::Project* The project the app is running in.
28
31
  def container_name(project)
29
- return "#{project.system_prefix}-#{self.name}"
32
+ if project.system_prefix == self.name
33
+ return "#{project.system_prefix}"
34
+ else
35
+ return "#{project.system_prefix}-#{self.name}"
36
+ end
37
+ end
38
+
39
+ # This method gets the database that the app connects to.
40
+ #
41
+ # ### Parameters
42
+ #
43
+ # * *project: RubyYacht::Project* The project the app is running in.
44
+ #
45
+ # ### Returns
46
+ # RubyYacht::Database
47
+ def database(project)
48
+ project.databases.find { |database| database.name == database_name }
30
49
  end
31
50
 
32
51
  # This class provide's the DSL for configuring an app.
@@ -43,9 +62,9 @@ module RubyYacht
43
62
  # ### Parameters
44
63
  #
45
64
  # * *name: String* The name of the app.
46
- def initialize(name, app_type = nil)
65
+ def initialize(name, server_type = nil)
47
66
  @name = name.to_sym
48
- @app_type = app_type
67
+ @server_type = server_type
49
68
  load_custom_attributes
50
69
  end
51
70
 
@@ -57,9 +76,15 @@ module RubyYacht
57
76
  add_attribute :repository_name
58
77
 
59
78
  ##
60
- # :method: app_type
61
- # You can call `app_type :foo` to set the app's `app_type`.
62
- add_attribute :app_type
79
+ # :method: database_name
80
+ # You can call `database 'foo'` to tell the app to use the database server
81
+ # named `foo`.
82
+ add_attribute :database_name, nil, false
83
+
84
+ ##
85
+ # :method: server_type
86
+ # You can call `server_type :foo` to set the app's `server_type`.
87
+ add_attribute :server_type
63
88
 
64
89
  ##
65
90
  # :method: port
@@ -73,11 +98,13 @@ module RubyYacht
73
98
  #
74
99
  # If they haven't, this will raise an exception.
75
100
  #
76
- # It also checks that the app type has been defined in the configuration.
101
+ # It also checks that the server type has been defined in the
102
+ # configuration.
77
103
  def check_required_attributes
78
104
  super
79
- unless RubyYacht.configuration.find_app_type(@app_type)
80
- raise "App has invalid app type `#{@app_type}`"
105
+ server_type = RubyYacht.configuration.find_server_type(@server_type)
106
+ unless server_type && server_type.container_type == :app
107
+ raise "App has invalid server type `#{@server_type}`"
81
108
  end
82
109
  end
83
110
  end
@@ -1,6 +1,6 @@
1
1
  require_relative 'project'
2
2
  require_relative 'hook'
3
- require_relative 'app_type'
3
+ require_relative 'server_type'
4
4
 
5
5
  module RubyYacht
6
6
  # This class stores the configuration for the system.
@@ -16,7 +16,7 @@ module RubyYacht
16
16
  def clear
17
17
  @projects = []
18
18
  @hooks = []
19
- @app_types = []
19
+ @server_types = []
20
20
  end
21
21
 
22
22
  # The projects that are part of this system.
@@ -29,7 +29,7 @@ module RubyYacht
29
29
 
30
30
  # The app types that we can support.
31
31
  # Each entry is a Symbol.
32
- attr_accessor :app_types
32
+ attr_accessor :server_types
33
33
 
34
34
  # This method pulls up the hooks that we have defined.
35
35
  #
@@ -52,17 +52,17 @@ module RubyYacht
52
52
  end
53
53
  end
54
54
 
55
- # This method finds an app type by name.
55
+ # This method finds an server type by name.
56
56
  #
57
57
  # ### Parameters
58
58
  #
59
- # * **name: Symbol** The name of the app type to return.
59
+ # * **name: Symbol** The name of the server type to return.
60
60
  #
61
61
  # ### Returns
62
62
  #
63
- # The RubyYacht::AppType with that name.
64
- def find_app_type(name)
65
- self.app_types.find { |type| type.name == name }
63
+ # The RubyYacht::ServerType with that name.
64
+ def find_server_type(name)
65
+ self.server_types.find { |type| type.name == name }
66
66
  end
67
67
 
68
68
  # This method provides a DSL for top-level configuration.
@@ -96,20 +96,20 @@ module RubyYacht
96
96
  add_object_list :hook, RubyYacht::Hook::DSL
97
97
 
98
98
  ##
99
- # :method: app_type
99
+ # :method: server_type
100
100
  #
101
- # This method adds an app type to the configuration.
101
+ # This method adds a server type to the configuration.
102
102
  #
103
103
  # This takes type's name as its argument. It also takes a block which you
104
104
  # can use to configure the type, using
105
- # RubyYacht::AppType::DSL.
106
- add_object_list :app_type, RubyYacht::AppType::DSL
105
+ # RubyYacht::ServerType::DSL.
106
+ add_object_list :server_type, RubyYacht::ServerType::DSL
107
107
 
108
108
  # The path for files and other resources from configuration hooks.
109
109
  attr_accessor :hook_folder
110
110
 
111
111
  # The app type for hooks that we are defining in the current block.
112
- attr_accessor :hook_app_type
112
+ attr_accessor :hook_server_type
113
113
 
114
114
  # This method sets default attributes for a group of hooks.
115
115
  #
@@ -121,7 +121,7 @@ module RubyYacht
121
121
  # * **folder: String** The full path to the script folder.
122
122
  # * **block** A block for adding the hooks.
123
123
  def add_hooks(options = {}, &block)
124
- keys = [:folder, :app_type]
124
+ keys = [:folder, :server_type]
125
125
  old_options = {}
126
126
  keys.each do |key|
127
127
  old_options[key] = self.send("hook_#{key}")
@@ -174,16 +174,16 @@ module RubyYacht
174
174
  add_hook :during, event_type, &block
175
175
  end
176
176
 
177
- creates_object Configuration, %w(projects hooks app_types)
177
+ creates_object Configuration, %w(projects hooks server_types)
178
178
 
179
179
  private
180
180
 
181
181
  def add_hook(event_time, event_type, &block)
182
182
  folder = hook_folder
183
- type = hook_app_type
183
+ type = hook_server_type
184
184
  hook event_time, event_type do
185
185
  script_folder folder
186
- app_type type
186
+ server_type type
187
187
  instance_eval(&block)
188
188
  end
189
189
  end
@@ -203,11 +203,11 @@ module RubyYacht
203
203
  self.configuration.send("#{field}=", self.configuration.send(field) + new_configuration.send(field))
204
204
  end
205
205
 
206
- new_configuration.app_types.each do |type|
207
- if self.configuration.app_types.any? { |existing| existing.name == type.name }
208
- raise "App type already registered: #{type.name}"
206
+ new_configuration.server_types.each do |type|
207
+ if self.configuration.server_types.any? { |existing| existing.name == type.name }
208
+ raise "Server type already registered: #{type.name}"
209
209
  end
210
- self.configuration.app_types << type
210
+ self.configuration.server_types << type
211
211
  end
212
212
  end
213
213
 
@@ -9,17 +9,31 @@ module RubyYacht
9
9
  # The name of the database
10
10
  attr_accessor :name
11
11
 
12
+ # The type of database server we're using.
13
+ attr_accessor :server_type
14
+
12
15
  # The username we use to connect to the database
13
16
  attr_accessor :username
14
17
 
15
18
  # The password we use to connect to the database
16
19
  attr_accessor :password
20
+
21
+ # The database-specific part of the container name for this database.
22
+ attr_accessor :container_label
17
23
 
18
24
  # Whether the database is running on the same machine as the app servers.
19
25
  def local?
20
26
  host == 'localhost'
21
27
  end
22
28
 
29
+ # This method gets the name of the container and image for this database.
30
+ #
31
+ # This will be the project's prefix followed by the database's container
32
+ # label.
33
+ def container_name(project)
34
+ "#{project.system_prefix}-#{container_label}"
35
+ end
36
+
23
37
  # This class provides a DSL for configuring a database.
24
38
  #
25
39
  # You can access this DSL by calling `database` within `RubyYacht::Project::DSL`.
@@ -28,6 +42,18 @@ module RubyYacht
28
42
  include RubyYacht::DSL::Base
29
43
  extend RubyYacht::DSL::Base::ClassMethods
30
44
 
45
+ # This initializer starts the DSL for the database.
46
+ #
47
+ # ### Parameters
48
+ #
49
+ # * **name: String** The name of the database.
50
+ # * **server_type: Symbol** The type of database server this is.
51
+ def initialize(name, server_type = nil)
52
+ @name = name
53
+ @server_type = server_type
54
+ load_custom_attributes
55
+ end
56
+
31
57
  ##
32
58
  # :method: host
33
59
  # You can call `host 'db.test.com'` to set the database's host.
@@ -39,6 +65,12 @@ module RubyYacht
39
65
  # named `my_database`.
40
66
  add_attribute :name
41
67
 
68
+ #
69
+ # :method: server_type
70
+ # You can call `server_type` :sqlite` to tell the apps to use the database
71
+ # server type sqlite.
72
+ add_attribute :server_type
73
+
42
74
  ##
43
75
  # :method: username
44
76
  # You can call `username 'db-user'` to tell the apps to connect to the
@@ -51,7 +83,28 @@ module RubyYacht
51
83
  # password `testpass`.
52
84
  add_attribute :password
53
85
 
86
+ ##
87
+ # :method: container_label
88
+ # You can call `container_label 'mysql'` to give this database a container
89
+ # name that is {project}-mysql.
90
+ add_attribute :container_label, :database
91
+
54
92
  creates_object Database
93
+
94
+ # This method checks that all of the required attributes have been set on
95
+ # the object.
96
+ #
97
+ # If they haven't, this will raise an exception.
98
+ #
99
+ # It also checks that the server type has been defined in the
100
+ # configuration.
101
+ def check_required_attributes
102
+ super
103
+ server_type = RubyYacht.configuration.find_server_type(@server_type)
104
+ unless server_type && server_type.container_type == :database
105
+ raise "Database has invalid server type `#{@server_type}`"
106
+ end
107
+ end
55
108
  end
56
109
  end
57
110
  end
@@ -188,6 +188,14 @@ module RubyYacht
188
188
  @copied_attributes = attributes
189
189
  @created_type = type
190
190
  end
191
+
192
+ # This method gets the attribute that server types can use to specify
193
+ # custom attributes for this DSL type.
194
+ #
195
+ # The default is `server_attributes`.
196
+ def custom_attribute_method
197
+ :server_attributes
198
+ end
191
199
  end
192
200
 
193
201
  # This initializer creates a new DSL instance.
@@ -207,14 +215,12 @@ module RubyYacht
207
215
  end
208
216
 
209
217
  if self.class.created_type
210
- dsl_type = self.class.created_type.name.split('::').last.downcase
211
- RubyYacht.configuration.app_types.each do |app_type|
212
- next if @app_type && app_type.name != @app_type
213
- method_name = "#{dsl_type}_attributes"
214
- if app_type.respond_to?("#{dsl_type}_attributes")
215
- attributes = app_type.send(method_name)
218
+ RubyYacht.configuration.server_types.each do |server_type|
219
+ next if @server_type && server_type.name != @server_type
220
+ if server_type.respond_to?(self.class.custom_attribute_method)
221
+ attributes = server_type.send(self.class.custom_attribute_method)
216
222
  attributes.each do |attribute|
217
- attribute = attribute.merge(name: "#{app_type.name}_#{attribute[:name]}")
223
+ attribute = attribute.merge(name: "#{server_type.name}_#{attribute[:name]}")
218
224
  load_custom_attribute(attribute)
219
225
  end
220
226
  end
@@ -263,7 +269,7 @@ module RubyYacht
263
269
  defaults.each do |name, value|
264
270
  copy =
265
271
  case value
266
- when TrueClass, FalseClass, Fixnum
272
+ when TrueClass, FalseClass, Fixnum, Symbol
267
273
  value
268
274
  else
269
275
  value.dup
@@ -16,19 +16,19 @@ module RubyYacht
16
16
  # The type of event that this hook is attached to.
17
17
  attr_accessor :event_type
18
18
 
19
- # The type of app that this hook applies to.
20
- attr_accessor :app_type
19
+ # The type of server that this hook applies to.
20
+ attr_accessor :server_type
21
21
 
22
- # The path to the script that contains the code for this hook.
23
- attr_accessor :script_path
22
+ # The path to the file that we should copy into the image for this hook.
23
+ attr_accessor :copied_file_path
24
24
 
25
25
  # The command that we should run for this hook.
26
26
  attr_accessor :command
27
27
 
28
28
  # The name of the file containing the code for this hook.
29
- def script_name
30
- return '' unless script_path
31
- File.basename(script_path)
29
+ def copied_file_name
30
+ return '' unless copied_file_path
31
+ File.basename(copied_file_path)
32
32
  end
33
33
 
34
34
  # This class provides a DSL for configuring hooks.
@@ -46,16 +46,15 @@ module RubyYacht
46
46
  def initialize(event_time, event_type)
47
47
  @event_time = event_time
48
48
  @event_type = event_type
49
- @script_path = nil
50
49
  load_custom_attributes
51
50
  end
52
51
 
53
52
  ##
54
- # :method: app_type
53
+ # :method: server_type
55
54
  #
56
- # You can call `app_type :rails` to signify that this hook applies to
55
+ # You can call `server_type :rails` to signify that this hook applies to
57
56
  # rails apps.
58
- add_attribute :app_type
57
+ add_attribute :server_type
59
58
 
60
59
  ##
61
60
  # :method: command
@@ -64,6 +63,22 @@ module RubyYacht
64
63
  # command `whoami`. You can also set the command through `run_script`, if
65
64
  # the hook runs a script file included with the plugin.
66
65
  add_attribute :command
66
+
67
+ ##
68
+ # :method: copy_file
69
+ #
70
+ # You can call `copy_file 'foo.txt'` to signify that this hook should
71
+ # copy a file called `foo.txt` from the hook's script folder to
72
+ # `/var/docker`.
73
+ #
74
+ # You can pair this with a command if you want to move it from that
75
+ # location in /var/docker into a custom location inside your code folder.
76
+ #
77
+ # The file copying happens at the time the image has built.
78
+ #
79
+ # When setting this attribute, you must provide another command using the
80
+ # `command` method.
81
+ add_attribute :copy_file, nil, false
67
82
 
68
83
  ##
69
84
  # :method: script_folder
@@ -82,7 +97,7 @@ module RubyYacht
82
97
  #
83
98
  # * **name: String** The filename of the script.
84
99
  def run_script(name)
85
- @script_path = File.join(@script_folder || '.', name)
100
+ @copy_file = name
86
101
  @command = "/var/docker/#{name}"
87
102
  end
88
103
 
@@ -94,12 +109,17 @@ module RubyYacht
94
109
  # This will also check that the app type is valid.
95
110
  def check_required_attributes
96
111
  super
97
- unless RubyYacht.configuration.find_app_type(@app_type)
98
- raise "Hook has invalid app type `#{@app_type}`"
112
+ unless RubyYacht.configuration.find_server_type(@server_type)
113
+ raise "Hook has invalid app type `#{@server_type}`"
99
114
  end
100
115
  end
116
+
117
+ def create_object
118
+ @copied_file_path = File.join(@script_folder || '.', @copy_file) if @copy_file
119
+ super
120
+ end
101
121
 
102
- creates_object RubyYacht::Hook, %w(event_time event_type script_path app_type command)
122
+ creates_object RubyYacht::Hook, %w(event_time event_type copied_file_path server_type command)
103
123
  end
104
124
  end
105
125
  end
@@ -27,13 +27,14 @@ module RubyYacht
27
27
  # keeping it entirely inside the container.
28
28
  attr_accessor :check_out_locally
29
29
 
30
- # The configuration for the database. This is a RubyYacht::Database.
31
- attr_accessor :database
30
+ # The configuration for the databases. Each entry is a RubyYacht::Database.
31
+ attr_accessor :databases
32
32
 
33
33
  # The configuration for the apps. Each entry is a RubyYacht::App.
34
34
  attr_accessor :apps
35
35
 
36
- # The configuration for the DNS for the apps. This is a RubyYacht::DnsServer.
36
+ # The configuration for the DNS for the apps. This is a
37
+ # RubyYacht::DnsServer.
37
38
  attr_accessor :dns_server
38
39
 
39
40
  # The name of the primary app for the project.
@@ -108,12 +109,10 @@ module RubyYacht
108
109
  ##
109
110
  # :method: database
110
111
  #
111
- # You can call `database` to configure the database for the project.
112
+ # You can call `database` to configure a database for the project.
112
113
  # This takes a block for configuring the database, which allows you to
113
114
  # call methods in RubyYacht::Database::DSL
114
- #
115
- # You must call this in your project config.
116
- add_object :database, RubyYacht::Database::DSL
115
+ add_object_list :database, RubyYacht::Database::DSL
117
116
 
118
117
  ##
119
118
  # :method: dns_server
@@ -133,12 +132,26 @@ module RubyYacht
133
132
  # For the app type with the name `foo`, this will create a `foo_app`
134
133
  # method on the DSL that builds an app with the type `foo`.
135
134
  def load_app_initializers
136
- RubyYacht.configuration.app_types.each do |app_type|
137
- define_singleton_method "#{app_type.name}_app" do |name, &block|
138
- app name, app_type.name, &block
135
+ RubyYacht.configuration.server_types.each do |server_type|
136
+ method_name = "#{server_type.name}_#{server_type.container_type}"
137
+ define_singleton_method method_name do |name, &block|
138
+ self.public_send(
139
+ server_type.container_type,
140
+ name,
141
+ server_type.name,
142
+ &block
143
+ )
139
144
  end
140
145
  end
141
146
  end
147
+
148
+ # This method gets the attribute that server types can use to specify
149
+ # custom attributes for this DSL type.
150
+ #
151
+ # This DSL uses `project_attributes`.
152
+ def self.custom_attribute_method
153
+ :project_attributes
154
+ end
142
155
  end
143
156
  end
144
157
  end