roro 0.3.17 → 0.3.18
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/.circleci/config.yml +11 -10
- data/.gitignore +3 -2
- data/Guardfile +8 -10
- data/README.md +2 -1
- data/lib/roro.rb +1 -0
- data/lib/roro/cli.rb +13 -7
- data/lib/roro/cli/generate/story.rb +18 -0
- data/lib/roro/cli/greenfield/rails.rb +2 -24
- data/lib/roro/cli/rollon.rb +135 -8
- data/lib/roro/cli/rollon/rails/base/base.rb +4 -0
- data/lib/roro/cli/{base → rollon/rails/base}/insert_gems.rb +2 -10
- data/lib/roro/cli/{base → rollon/rails/base}/insertions.rb +8 -0
- data/lib/roro/cli/rollon/rails/database.rb +4 -8
- data/lib/roro/cli/rollon/rails/database/with_mysql.rb +2 -2
- data/lib/roro/cli/rollon/rails/database/with_postgresql.rb +3 -4
- data/lib/roro/cli/rollon/ruby_gem/with_ci_cd.rb +7 -7
- data/lib/roro/configurator.rb +15 -0
- data/lib/roro/configurator/eligibility.rb +137 -0
- data/lib/roro/configurator/okonomi.rb +28 -0
- data/lib/roro/configurator/omakase.rb +170 -0
- data/lib/roro/stories/greenfield.yml +1 -0
- data/lib/roro/stories/greenfield/rails.yml +9 -0
- data/lib/roro/stories/rollon.yml +42 -0
- data/lib/roro/stories/rollon/rails.yml +76 -0
- data/lib/roro/stories/rollon/rails/ci_cd.yml +1 -0
- data/lib/roro/stories/rollon/rails/ci_cd/circleci.yml +2 -0
- data/lib/roro/stories/rollon/rails/database.yml +9 -0
- data/lib/roro/stories/rollon/rails/database/mysql.yml +17 -0
- data/lib/roro/stories/rollon/rails/database/postgresql.yml +15 -0
- data/lib/roro/stories/rollon/rails/kubernetes.yml +1 -0
- data/lib/roro/stories/rollon/rails/kubernetes/postgresql.yml +10 -0
- data/lib/roro/stories/rollon/rails/kubernetes/postgresql/default.yml +1 -0
- data/lib/roro/stories/rollon/rails/kubernetes/postgresql/edge.yml +1 -0
- data/lib/roro/stories/rollon/ruby_gem.yml +5 -0
- data/lib/roro/{cli/templates/rails → templates/base}/.circleci/_aliases.yml +0 -0
- data/lib/roro/templates/base/.circleci/_commands.yml +31 -0
- data/lib/roro/templates/base/.circleci/_defaults.yml +5 -0
- data/lib/roro/templates/base/.circleci/_executors.yml +11 -0
- data/lib/roro/templates/base/.circleci/_major_only.yml +4 -0
- data/lib/roro/templates/base/.circleci/_version.yml +1 -0
- data/lib/roro/{cli/templates → templates}/base/.circleci/_workflow.yml +0 -0
- data/lib/roro/{cli/templates → templates}/base/.circleci/config.job-example.yml +5 -5
- data/lib/roro/{cli/templates → templates}/base/.circleci/jobs/_build.yml +0 -0
- data/lib/roro/{cli/templates → templates}/base/.circleci/jobs/_release.yml +0 -0
- data/lib/roro/{cli/templates → templates}/base/.circleci/workflows/_build_release.yml +0 -0
- data/lib/roro/{cli/templates → templates}/base/.dockerignore +0 -0
- data/lib/roro/{cli/templates → templates}/base/dotenv +0 -0
- data/lib/roro/{cli/templates → templates}/base/jumpstart/.keep +0 -0
- data/lib/roro/{cli/templates → templates}/base/jumpstart/Dockerfile.tt +0 -0
- data/lib/roro/{cli/templates → templates}/base/jumpstart/docker-compose.yml +0 -0
- data/lib/roro/{cli/templates → templates}/base/jumpstart/docker-entrypoint.sh +0 -0
- data/lib/roro/{cli/templates → templates}/base/livereload/hosts.example +0 -0
- data/lib/roro/{cli/templates → templates}/base/roro/.keep +0 -0
- data/lib/roro/{cli/templates → templates}/base/roro/roro/.keep +0 -0
- data/lib/roro/{cli/templates → templates}/base/roro/roro/containers/.keep +0 -0
- data/lib/roro/{cli/templates → templates}/base/roro/roro/containers/app/.keep +0 -0
- data/lib/roro/{cli/templates → templates}/base/roro/roro/containers/frontend/.keep +0 -0
- data/lib/roro/{cli/templates → templates}/base/roro/roro/docker-entrypoint.sh.tt +0 -0
- data/lib/roro/{cli/templates → templates}/rails/.circleci/.keep +0 -0
- data/lib/roro/{cli/templates → templates}/rails/.circleci/config.yml.tt +4 -6
- data/lib/roro/{cli/templates → templates}/rails/.circleci/jobs/_build.yml +4 -6
- data/lib/roro/templates/rails/.circleci/jobs/_push.yml +11 -0
- data/lib/roro/templates/rails/.circleci/jobs/_test.yml +12 -0
- data/lib/roro/{cli/templates → templates}/rails/.circleci/setup-gem-credentials.sh +0 -0
- data/lib/roro/templates/rails/.circleci/workflows/_build_test_push.yml +12 -0
- data/lib/roro/{cli/templates → templates}/rails/.keep +0 -0
- data/lib/roro/templates/rails/Dockerfile.greenfield.tt +51 -0
- data/lib/roro/{cli/templates → templates}/rails/config/database.mysql.yml +0 -0
- data/lib/roro/{cli/templates → templates}/rails/config/database.pg.yml +2 -3
- data/lib/roro/{cli/templates/stories → templates/rails/database}/with_mysql/_service.yml +0 -0
- data/lib/roro/{cli/templates → templates}/rails/database/with_postgresql/.keep +0 -0
- data/lib/roro/{cli/templates/stories → templates/rails/database}/with_postgresql/_service.yml +0 -0
- data/lib/roro/{cli/templates → templates}/rails/docker-compose.yml.tt +3 -3
- data/lib/roro/{cli/templates → templates}/rails/dotenv/.keep +0 -0
- data/lib/roro/templates/rails/dotenv/database.mysql.env.tt +6 -0
- data/lib/roro/templates/rails/dotenv/database.pg.env.tt +4 -0
- data/lib/roro/{cli/templates → templates}/rails/dotenv/web.env.tt +0 -0
- data/lib/roro/templates/rails/kube.rake.tt +114 -0
- data/lib/roro/{cli/templates → templates}/rails/roro/.keep +0 -0
- data/lib/roro/{cli/templates → templates}/rails/roro/containers/.keep +0 -0
- data/lib/roro/{cli/templates → templates}/rails/roro/containers/app/.keep +0 -0
- data/lib/roro/templates/rails/roro/containers/app/Dockerfile.tt +34 -0
- data/lib/roro/{cli/templates → templates}/rails/roro/containers/frontend/.keep +0 -0
- data/lib/roro/{cli/templates/rails/roro/docker-entrypoint.sh.tt → templates/rails/roro/docker-entrypoint.sh} +0 -0
- data/lib/roro/{cli/templates/rails/roro/roro → templates/rails/roro/kube}/.keep +0 -0
- data/lib/roro/{cli/templates/rails/roro/roro/containers/.keep → templates/rails/roro/kube/certificate.yml.tt} +0 -0
- data/lib/roro/{cli/templates/rails/roro/roro/containers/app/.keep → templates/rails/roro/kube/cluster-issuer.yml.tt} +0 -0
- data/lib/roro/templates/rails/roro/kube/deployment.yml.tt +50 -0
- data/lib/roro/templates/rails/roro/kube/deployments/postgres_deploy.yaml +47 -0
- data/lib/roro/templates/rails/roro/kube/deployments/rails_deploy.yaml +62 -0
- data/lib/roro/templates/rails/roro/kube/deployments/redis_deploy.yaml +23 -0
- data/lib/roro/templates/rails/roro/kube/deployments/sidekiq_deploy.yaml +56 -0
- data/lib/roro/{cli/templates/rails/roro/roro/containers/frontend/.keep → templates/rails/roro/kube/ingress.yml.tt} +0 -0
- data/lib/roro/templates/rails/roro/kube/ingresses/ingress.yaml +13 -0
- data/lib/roro/{cli/templates/ruby_gem/.circleci/.keep → templates/rails/roro/kube/job-migrate.yml.tt} +0 -0
- data/lib/roro/templates/rails/roro/kube/jobs/setup.yaml +42 -0
- data/lib/roro/templates/rails/roro/kube/secret-digital-ocean.yml.tt +4 -0
- data/lib/roro/templates/rails/roro/kube/service.yml.tt +10 -0
- data/lib/roro/templates/rails/roro/kube/services/postgres_svc.yaml +13 -0
- data/lib/roro/templates/rails/roro/kube/services/rails_svc.yaml +13 -0
- data/lib/roro/templates/rails/roro/kube/services/redis_svc.yaml +13 -0
- data/lib/roro/templates/rails/roro/kube/volumes/postgres_volumes.yaml +25 -0
- data/lib/roro/{cli/templates/ruby_gem/roro/containers → templates/ruby_gem/.circleci}/.keep +0 -0
- data/lib/roro/{cli/templates → templates}/ruby_gem/.circleci/config.yml.tt +4 -4
- data/lib/roro/templates/ruby_gem/.circleci/jobs/_test.yml +4 -0
- data/lib/roro/{cli/templates → templates}/ruby_gem/.circleci/setup-gem-credentials.sh +0 -0
- data/lib/roro/{cli/templates → templates}/ruby_gem/docker-compose.yml +0 -0
- data/lib/roro/{cli/templates/ruby_gem/roro/keys → templates/ruby_gem/roro/containers}/.keep +0 -0
- data/lib/roro/{cli/templates → templates}/ruby_gem/roro/containers/ruby_image/Dockerfile.tt +1 -1
- data/lib/roro/templates/ruby_gem/roro/containers/ruby_image/ci.env.tt +1 -0
- data/lib/roro/{cli/templates/stories → templates/ruby_gem/roro/keys}/.keep +0 -0
- data/lib/roro/version.rb +1 -1
- metadata +101 -80
- data/lib/roro/cli/base/base.rb +0 -8
- data/lib/roro/cli/base/base_files.rb +0 -24
- data/lib/roro/cli/base/check_dependencies.rb +0 -97
- data/lib/roro/cli/base/continuous_integration.rb +0 -13
- data/lib/roro/cli/base/utilities.rb +0 -38
- data/lib/roro/cli/configuration.rb +0 -69
- data/lib/roro/cli/generate/config.rb +0 -11
- data/lib/roro/cli/generate/config/rails.rb +0 -17
- data/lib/roro/cli/rollon/rails.rb +0 -47
- data/lib/roro/cli/rollon/stories/stories.rb +0 -3
- data/lib/roro/cli/roro_configurator.yml +0 -157
- data/lib/roro/cli/templates/base/.circleci/_defaults.yml +0 -17
- data/lib/roro/cli/templates/base/.roro_config.yml +0 -15
- data/lib/roro/cli/templates/rails/.circleci/jobs/_push.yml +0 -23
- data/lib/roro/cli/templates/rails/.circleci/jobs/_test.yml +0 -13
- data/lib/roro/cli/templates/rails/.circleci/workflows/_build_test_push.yml +0 -9
- data/lib/roro/cli/templates/rails/Dockerfile.greenfield.tt +0 -47
- data/lib/roro/cli/templates/rails/database/with_mysql/_service.yml +0 -10
- data/lib/roro/cli/templates/rails/database/with_postgresql/_service.yml +0 -7
- data/lib/roro/cli/templates/rails/dotenv/database.mysql.env.tt +0 -3
- data/lib/roro/cli/templates/rails/dotenv/database.pg.env.tt +0 -4
- data/lib/roro/cli/templates/rails/roro/containers/app/Dockerfile.tt +0 -88
- data/lib/roro/cli/templates/rails/roro/roro/docker-entrypoint.sh.tt +0 -8
- data/lib/roro/cli/templates/ruby_gem/roro/containers/ruby_image/ci.env.tt +0 -1
- data/lib/roro/cli/templates/stories/ruby_gem/with_ci_cd/_build.yml +0 -11
- data/lib/roro/cli/templates/stories/with_postgresql/.keep +0 -0
- data/lib/tasks/deploy.rake +0 -126
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 28419719167db581fa026244d2628fa4c86c9d3b
|
|
4
|
+
data.tar.gz: b46403289b09d42a550ac9dff3a4edcc717f2c63
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b2075ccae46a264f2d64bf2d2c09fb678bf95a44d534b0263dcb2a9e5cbf6345663d683bea3219ec728512e65eca391e1715a7334d304d4e46411a3e75f6ec1
|
|
7
|
+
data.tar.gz: 5ef3392e89e8e72af5e190a79f45ff7e107db744c0fe2a886b6e0e11bf6829c0fc723c6e298c0ad51d20a7b4882dbd84035b3b966a2eabdf5484e4c32827ae28
|
data/.circleci/config.yml
CHANGED
|
@@ -10,6 +10,11 @@ aliases:
|
|
|
10
10
|
defaults: &defaults
|
|
11
11
|
executor: machine-executor
|
|
12
12
|
working_directory: ~/project
|
|
13
|
+
|
|
14
|
+
major_only: &major_only
|
|
15
|
+
filters:
|
|
16
|
+
branches:
|
|
17
|
+
only: master, release
|
|
13
18
|
|
|
14
19
|
version: 2.1
|
|
15
20
|
|
|
@@ -74,19 +79,15 @@ workflows:
|
|
|
74
79
|
|
|
75
80
|
build-cli:
|
|
76
81
|
jobs:
|
|
77
|
-
- build
|
|
82
|
+
- build
|
|
78
83
|
- test-rollon-rails:
|
|
79
|
-
|
|
80
|
-
branches:
|
|
81
|
-
only: development
|
|
84
|
+
<<: *major_only
|
|
82
85
|
- test:
|
|
83
|
-
|
|
84
|
-
branches:
|
|
85
|
-
only: master
|
|
86
|
+
<<: *major_only
|
|
86
87
|
|
|
87
88
|
- release:
|
|
88
89
|
requires:
|
|
89
90
|
- build
|
|
90
|
-
filters:
|
|
91
|
-
branches:
|
|
92
|
-
only: release
|
|
91
|
+
filters:
|
|
92
|
+
branches:
|
|
93
|
+
only: release
|
data/.gitignore
CHANGED
data/Guardfile
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
options = {
|
|
2
|
-
all_on_start:
|
|
3
|
-
all_after_pass:
|
|
2
|
+
all_on_start: false,
|
|
3
|
+
all_after_pass: false,
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
guard :minitest, options do
|
|
7
7
|
|
|
8
8
|
watch(%r{^test/(.*)\/?(.*)_test\.rb$})
|
|
9
|
-
watch(%r{^
|
|
10
|
-
watch(%r{^test/
|
|
11
|
-
watch(%r{^lib/roro/
|
|
12
|
-
watch(%r{^lib/roro/cli/
|
|
13
|
-
watch(%r{^lib/roro/cli/
|
|
14
|
-
watch(%r{^lib/roro/cli/
|
|
15
|
-
watch(%r{^lib/roro/cli/templates/greenfield(.+)\.yml$}) { |m| "test/cli/greenfield" }
|
|
16
|
-
watch(%r{^lib/roro/cli/templates/greenfield(.+)\.tt$}) { |m| "test/cli/greenfield" }
|
|
9
|
+
watch(%r{^test/helpers/(.*)\.rb$}) { 'test' }
|
|
10
|
+
watch(%r{^test/test_helper\.rb$}) { 'test' }
|
|
11
|
+
watch(%r{^lib/roro/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
|
|
12
|
+
watch(%r{^lib/roro/cli/(.+)\.rb$}) { |m| "test/cli/#{m[1]}_test.rb" }
|
|
13
|
+
watch(%r{^lib/roro/cli/(.+)\.yml$}) { |m| "test/cli" }
|
|
14
|
+
watch(%r{^lib/roro/cli/(.+)\.tt$}) { |m| "test/cli" }
|
|
17
15
|
end
|
data/README.md
CHANGED
|
@@ -217,4 +217,5 @@ $ docker system prune -af --volumes
|
|
|
217
217
|
This gem and its associated practices are just one way of using these tools and not the canonical way. My purpose in publishing it is to get a conversation started about what conventions around these tools might look like. If you have ideas on how to make it better please put in an issue -- or fork the repo, make your changes, write your tests, and send me a pull request. It'll make me feel warm inside.
|
|
218
218
|
|
|
219
219
|
## License
|
|
220
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
220
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
221
|
+
|
data/lib/roro.rb
CHANGED
data/lib/roro/cli.rb
CHANGED
|
@@ -1,25 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
require 'roro/cli/configuration'
|
|
3
|
-
require 'roro/cli/generate/config'
|
|
1
|
+
|
|
4
2
|
require 'roro/cli/generate/exposed'
|
|
5
3
|
require 'roro/cli/generate/keys'
|
|
6
4
|
require 'roro/cli/generate/obfuscated'
|
|
5
|
+
require 'roro/cli/generate/story'
|
|
7
6
|
require 'roro/cli/greenfield/rails'
|
|
8
7
|
require 'roro/cli/rollon'
|
|
9
|
-
require 'roro/cli/rollon/rails'
|
|
8
|
+
require 'roro/cli/rollon/rails/base/base'
|
|
10
9
|
require 'roro/cli/rollon/rails/database/with_mysql'
|
|
11
10
|
require 'roro/cli/rollon/rails/database/with_postgresql'
|
|
12
11
|
|
|
13
12
|
require 'roro/cli/rollon/ruby_gem'
|
|
14
13
|
|
|
15
14
|
module Roro
|
|
16
|
-
|
|
17
15
|
class CLI < Thor
|
|
18
16
|
|
|
19
17
|
include Thor::Actions
|
|
20
18
|
|
|
21
19
|
def self.source_root
|
|
22
|
-
File.dirname(__FILE__) + '/
|
|
23
|
-
end
|
|
20
|
+
File.dirname(__FILE__) + '/templates'
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.story_root
|
|
24
|
+
File.dirname(__FILE__) + '/stories'
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.roro_environments
|
|
28
|
+
%w(development production test staging ci)
|
|
29
|
+
end
|
|
24
30
|
end
|
|
25
31
|
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Roro
|
|
2
|
+
class CLI < Thor
|
|
3
|
+
|
|
4
|
+
desc "generate::story", "Generate a config file at .roro_config.yml to use later"
|
|
5
|
+
map "generate::story" => "generate_story"
|
|
6
|
+
|
|
7
|
+
def generate_story
|
|
8
|
+
|
|
9
|
+
@config ||= Roro::Configuration.new(options)
|
|
10
|
+
# configuration = {
|
|
11
|
+
# env_vars: @config.env.keys,
|
|
12
|
+
# intentions: @config.intentions,
|
|
13
|
+
# story: @config.structure['story']
|
|
14
|
+
# }
|
|
15
|
+
# create_file ".roro_configurator.yml", @config.env.to_yaml
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -5,32 +5,10 @@ module Roro
|
|
|
5
5
|
desc "greenfield::rails", "Greenfield a new, dockerized rails app with
|
|
6
6
|
either MySQL or PostgreSQL in a separate container."
|
|
7
7
|
|
|
8
|
-
method_option :env_vars, type: :hash, default: {}, desc: "Pass a list of environment variables like so: env:var", banner: "key1:value1 key2:value2"
|
|
9
|
-
method_option :interactive, desc: "Set up your environment variables as you go."
|
|
10
|
-
method_option :force, desc: "force over-write of existing files"
|
|
11
|
-
|
|
12
8
|
map "greenfield::rails" => "greenfield_rails"
|
|
13
9
|
|
|
14
|
-
def greenfield_rails
|
|
15
|
-
|
|
16
|
-
configure_for_rollon
|
|
17
|
-
copy_greenfield_files
|
|
18
|
-
run_greenfield_commands
|
|
19
|
-
rollon_rails(*args)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
no_commands do
|
|
23
|
-
|
|
24
|
-
def copy_greenfield_files
|
|
25
|
-
@config.app['force'] = true
|
|
26
|
-
src = 'rails/Dockerfile.greenfield.tt'
|
|
27
|
-
dest = 'roro/containers/app/Dockerfile'
|
|
28
|
-
template src, dest, @config.app
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def run_greenfield_commands
|
|
32
|
-
system "DOCKER_BUILDKIT=1 docker build --file roro/containers/app/Dockerfile --output . ."
|
|
33
|
-
end
|
|
10
|
+
def greenfield_rails
|
|
11
|
+
greenfield( { story: :rails } )
|
|
34
12
|
end
|
|
35
13
|
end
|
|
36
14
|
end
|
data/lib/roro/cli/rollon.rb
CHANGED
|
@@ -1,19 +1,146 @@
|
|
|
1
1
|
module Roro
|
|
2
2
|
class CLI < Thor
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def
|
|
7
|
-
|
|
3
|
+
|
|
4
|
+
class << self
|
|
5
|
+
private
|
|
6
|
+
def shared_options!
|
|
7
|
+
method_option :omakase, default: :omakase, desc: "Use the Roro setup with some configuring. 'Omakase' translates as 'I'll leave it up to you.'", aliases: ['-d', '--default']
|
|
8
|
+
method_option :fatsutofodo, desc: 'Use the Roro setup without having to think.', aliases: ['-f', '--fast']
|
|
9
|
+
method_option :okonomi, desc: "Use Roro how you like. 'Okonomi' has the opposite meaning of omakase.", aliases: ['-i', '--interactive']
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
alias_method :orig_desc, :desc
|
|
13
|
+
|
|
14
|
+
def desc(*args)
|
|
15
|
+
orig_desc(*args)
|
|
16
|
+
shared_options!
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
rollonto = ' into Roro.'
|
|
20
|
+
desc "rollon", "Roll an existing app#{rollonto}"
|
|
21
|
+
def rollon(args={})
|
|
22
|
+
@config ||= Roro::Configuration.new(args, options)
|
|
23
|
+
greenfield_actions
|
|
24
|
+
greenfield_commands
|
|
25
|
+
manifest_actions
|
|
26
|
+
manifest_intentions
|
|
27
|
+
congratulations
|
|
28
|
+
startup_commands
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
desc "greenfield", "Greenfield a new app and roll it#{rollonto}"
|
|
32
|
+
def greenfield(args={})
|
|
33
|
+
args[:greenfield] = :greenfield
|
|
34
|
+
|
|
35
|
+
rollon(args)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
desc "greenfield::rails", "Greenfield a new Rails app and roll it#{rollonto}"
|
|
39
|
+
|
|
40
|
+
map "greenfield::rails" => "greenfield_rails"
|
|
41
|
+
|
|
42
|
+
def greenfield_rails
|
|
43
|
+
greenfield( { story: :rails } )
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
desc "rollon::rails", "Roll an existing app#{rollonto}"
|
|
47
|
+
map "rollon::rails" => "rollon_rails"
|
|
48
|
+
|
|
49
|
+
def rollon_rails(args={})
|
|
50
|
+
rollon( { story: :rails } )
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
desc "rollon::rails::kubernetes", "Adds Kubernetes for production."
|
|
54
|
+
map "rollon::rails::kubernetes" => "rollon_rails_kubernetes"
|
|
55
|
+
|
|
56
|
+
def rollon_rails_kubernetes(args={})
|
|
57
|
+
story = {
|
|
58
|
+
rails: [
|
|
59
|
+
{ database: :postgresql },
|
|
60
|
+
{ kubernetes: :postgresql },
|
|
61
|
+
{ ci_cd: :circleci}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
rollon( { story: story } )
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
desc "greenfield::rails::kubernetes", "Adds Kubernetes for production."
|
|
68
|
+
map "greenfield::rails::kubernetes" => "greenfield_rails_kubernetes"
|
|
69
|
+
|
|
70
|
+
def greenfield_rails_kubernetes(args={})
|
|
71
|
+
story = {
|
|
72
|
+
rails: [
|
|
73
|
+
{ database: :postgresql },
|
|
74
|
+
{ kubernetes: :postgresql },
|
|
75
|
+
{ ci_cd: :circleci}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
rollon( { story: story } )
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
no_commands do
|
|
82
|
+
|
|
83
|
+
def configure_for_rollon(aroptions=nil)
|
|
8
84
|
@config ||= Roro::Configuration.new(options)
|
|
9
85
|
end
|
|
86
|
+
|
|
87
|
+
def manifest_actions
|
|
88
|
+
@config.structure[:actions].each {|a| eval a }
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def manifest_intentions
|
|
92
|
+
@config.intentions.each {|k, v| eval(k.to_s) if v.eql?('y') }
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def greenfield_actions
|
|
96
|
+
return unless @config.structure[:greenfield_actions]
|
|
97
|
+
@config.structure[:greenfield_actions].each {|a| eval a }
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def greenfield_commands
|
|
101
|
+
return unless @config.structure[:greenfield_actions]
|
|
102
|
+
@config.structure[:greenfield_commands].each {|a| eval a }
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def congratulations(story=nil)
|
|
106
|
+
( @config.story[:rollon])
|
|
107
|
+
if @config.structure[:greenfield]
|
|
108
|
+
usecase = 'greenfielded a new '
|
|
109
|
+
else
|
|
110
|
+
usecase = 'rolled your existing '
|
|
111
|
+
end
|
|
112
|
+
array = ["You've successfully "]
|
|
113
|
+
array << usecase
|
|
114
|
+
congrats = array.join("")
|
|
115
|
+
puts congrats
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def startup_commands
|
|
119
|
+
congratulations( @config.story[:rollon])
|
|
120
|
+
cmd = @config.structure[:startup]
|
|
121
|
+
commands = cmd[:commands]
|
|
122
|
+
question = []
|
|
123
|
+
question << "\n\n You can start your app up with some combination of these commands:\n"
|
|
124
|
+
commands.each { |c| question << "\t#{c}"}
|
|
125
|
+
question << "\nOr if you'd like Roro to try and do it for you:"
|
|
126
|
+
question = question.join("\n")
|
|
127
|
+
if ask(question, default: 'y', limited_to: ['y', 'n']).eql?("y")
|
|
128
|
+
commands.each {|a| system(a) }
|
|
129
|
+
puts "\n\n#{cmd[:success]}\n\n"
|
|
130
|
+
end
|
|
131
|
+
end
|
|
10
132
|
|
|
11
133
|
def yaml_from_template(file)
|
|
12
|
-
File.read(
|
|
134
|
+
File.read(find_in_source_paths(file))
|
|
13
135
|
end
|
|
14
136
|
|
|
15
|
-
def
|
|
16
|
-
|
|
137
|
+
def generate_config_story
|
|
138
|
+
roro_story = {
|
|
139
|
+
story: @config.story,
|
|
140
|
+
env_vars: @config.env,
|
|
141
|
+
intentions: @config.intentions
|
|
142
|
+
}
|
|
143
|
+
create_file ".roro_story.yml", roro_story.to_yaml
|
|
17
144
|
end
|
|
18
145
|
end
|
|
19
146
|
end
|
|
@@ -10,16 +10,8 @@ module Roro
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def insert_db_gem(gem)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/gem\s['"]mysql2['"]/,
|
|
16
|
-
/gem\s['"]pg['"]/,
|
|
17
|
-
|
|
18
|
-
]
|
|
19
|
-
gem_lines.each do |line|
|
|
20
|
-
comment_lines 'Gemfile', line
|
|
21
|
-
gsub_file 'Gemfile', line, 'gem copied over by roro'
|
|
22
|
-
end
|
|
13
|
+
gems = %w(sqlite pg mysql2)
|
|
14
|
+
gems.each { |g| gsub_file('Gemfile', /.*#{g}.*/, '')}
|
|
23
15
|
insert_into_file 'Gemfile', "gem '#{gem}'\n\n", before: "group :development, :test"
|
|
24
16
|
end
|
|
25
17
|
|
|
@@ -11,8 +11,16 @@ module Roro
|
|
|
11
11
|
prepend_to_file(file, line, force: true)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
+
def copy_dockerignore
|
|
15
|
+
copy_file 'base/.dockerignore', '.dockerignore'
|
|
16
|
+
end
|
|
17
|
+
|
|
14
18
|
def gitignore_sensitive_files
|
|
15
19
|
append_to_file ".gitignore", "\nroro/**/*.env\nroro/**/*.key"
|
|
20
|
+
append_to_file ".gitignore", "\nroro/**/*.env\nroro/**/*.key"
|
|
21
|
+
append_to_file ".gitignore", "\n*kubeconfig.yaml"
|
|
22
|
+
append_to_file ".gitignore", "\n*kubeconfig.yml"
|
|
23
|
+
append_to_file ".gitignore", "\n*.roro_configurator.yml"
|
|
16
24
|
end
|
|
17
25
|
end
|
|
18
26
|
end
|
|
@@ -5,23 +5,19 @@ module Roro
|
|
|
5
5
|
no_commands do
|
|
6
6
|
|
|
7
7
|
def configure_database
|
|
8
|
-
database = @config.
|
|
9
|
-
vendor = @config.master['services']['database']['vendors']
|
|
8
|
+
database = @config.intentions[:configure_database]
|
|
10
9
|
case database
|
|
11
10
|
when 'p'
|
|
12
|
-
@config.
|
|
13
|
-
@config.app['postgresql_env_vars'] = vendor['postgresql']['env_vars']
|
|
11
|
+
@config.env[:database_vendor] = 'postgresql'
|
|
14
12
|
configure_for_pg
|
|
15
13
|
when 'm'
|
|
16
|
-
@config.
|
|
17
|
-
@config.app['mysql_env_vars'] = vendor['mysql']['env_vars']
|
|
14
|
+
@config.env[:database_vendor] = 'mysql'
|
|
18
15
|
configure_for_mysql
|
|
19
16
|
end
|
|
20
|
-
|
|
21
17
|
%w(development production test staging ci).each do |environment|
|
|
22
18
|
src = 'rails/dotenv/web.env.tt'
|
|
23
19
|
dest = "roro/containers/app/#{environment}.env"
|
|
24
|
-
template src, dest, @config.
|
|
20
|
+
template src, dest, @config.env
|
|
25
21
|
end
|
|
26
22
|
end
|
|
27
23
|
end
|
|
@@ -7,10 +7,10 @@ module Roro
|
|
|
7
7
|
def configure_for_mysql
|
|
8
8
|
insert_db_gem('mysql2')
|
|
9
9
|
copy_file 'rails/config/database.mysql.yml', 'config/database.yml', force: true
|
|
10
|
-
config = @config.
|
|
10
|
+
config = @config.env.clone
|
|
11
11
|
|
|
12
12
|
%w(development production test staging ci).each do |environment|
|
|
13
|
-
config[
|
|
13
|
+
config[:rails_env] = environment
|
|
14
14
|
|
|
15
15
|
source = 'rails/dotenv/database.mysql.env.tt'
|
|
16
16
|
target = "roro/containers/database/#{environment}.env"
|
|
@@ -5,14 +5,13 @@ module Roro
|
|
|
5
5
|
no_commands do
|
|
6
6
|
|
|
7
7
|
def configure_for_pg
|
|
8
|
-
insert_db_gem('pg')
|
|
9
8
|
copy_file 'rails/config/database.pg.yml', 'config/database.yml', force: true
|
|
10
|
-
config = @config.
|
|
9
|
+
config = @config.env.clone
|
|
11
10
|
%w(development production test staging ci).each do |environment|
|
|
12
|
-
config[
|
|
11
|
+
config[:rails_env] = environment
|
|
13
12
|
|
|
14
13
|
source = 'rails/dotenv/database.pg.env.tt'
|
|
15
|
-
target = "roro/containers/database/#{environment}.env"
|
|
14
|
+
target = "roro/containers/database/#{environment}.env"
|
|
16
15
|
template( source, target, config )
|
|
17
16
|
end
|
|
18
17
|
end
|