roro 0.3.12 → 0.3.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/{lib/roro/cli/rollon/stories/rails → .circleci}/.keep +0 -0
- data/.circleci/config.yml +93 -0
- data/{lib/roro/cli/templates/ruby_gem → .circleci}/setup-gem-credentials.sh +1 -1
- data/.gitignore +5 -4
- data/Guardfile +8 -10
- data/README.md +2 -1
- data/{lib/roro/cli/templates/ruby_gem/docker-compose.yml → docker-compose.yml} +6 -2
- data/lib/roro.rb +2 -1
- data/lib/roro/cli.rb +16 -74
- data/lib/roro/cli/generate/exposed.rb +14 -0
- data/lib/roro/cli/generate/{generate_keys.rb → keys.rb} +22 -0
- data/lib/roro/cli/generate/obfuscated.rb +17 -0
- data/lib/roro/cli/generate/story.rb +18 -0
- data/lib/roro/cli/greenfield/rails.rb +14 -0
- data/lib/roro/cli/rollon.rb +126 -63
- 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 +26 -0
- data/lib/roro/cli/rollon/{stories/rails → rails}/database/with_mysql.rb +4 -4
- data/lib/roro/cli/rollon/{stories/rails → rails}/database/with_postgresql.rb +5 -6
- data/lib/roro/cli/rollon/ruby_gem.rb +1 -0
- data/lib/roro/cli/rollon/ruby_gem/with_ci_cd.rb +45 -0
- data/lib/roro/cli/rollon/stories.rb +2 -2
- 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/templates/base/.circleci/_aliases.yml +8 -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/templates/base/.circleci/_workflow.yml +2 -0
- data/lib/roro/templates/base/.circleci/config.job-example.yml +33 -0
- data/lib/roro/templates/base/.circleci/jobs/_build.yml +4 -0
- data/lib/roro/templates/base/.circleci/jobs/_release.yml +12 -0
- data/lib/roro/templates/base/.circleci/workflows/_build_release.yml +10 -0
- data/lib/roro/{cli/templates → templates}/base/.dockerignore +2 -2
- data/lib/roro/templates/base/dotenv +1 -0
- data/lib/roro/{cli/templates/base → 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/jumpstart → templates/base/roro}/.keep +0 -0
- data/lib/roro/{cli/templates → templates/base/roro}/roro/.keep +0 -0
- data/lib/roro/{cli/templates/roro/roro → templates/base/roro/roro/containers}/.keep +0 -0
- data/lib/roro/{cli/templates/roro/roro/containers → templates/base/roro/roro/containers/app}/.keep +0 -0
- data/lib/roro/{cli/templates/roro/roro/containers/app → 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/roro/roro/containers/frontend → templates/rails/.circleci}/.keep +0 -0
- data/lib/roro/templates/rails/.circleci/config.yml.tt +11 -0
- data/lib/roro/templates/rails/.circleci/jobs/_build.yml +14 -0
- 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/templates/rails/.circleci/setup-gem-credentials.sh +3 -0
- data/lib/roro/templates/rails/.circleci/workflows/_build_test_push.yml +12 -0
- data/lib/roro/{cli/templates/ruby_gem/roro/containers → templates/rails}/.keep +0 -0
- data/lib/roro/templates/rails/Dockerfile.greenfield.tt +51 -0
- data/lib/roro/{cli/templates/base → templates/rails}/config/database.mysql.yml +0 -0
- data/lib/roro/{cli/templates/base → templates/rails}/config/database.pg.yml +2 -3
- data/lib/roro/templates/rails/database/with_mysql/_service.yml +10 -0
- data/lib/roro/{cli/templates/ruby_gem/roro/keys → templates/rails/database/with_postgresql}/.keep +0 -0
- data/lib/roro/templates/rails/database/with_postgresql/_service.yml +7 -0
- data/lib/roro/{cli/templates/roro → templates/rails}/docker-compose.yml.tt +9 -10
- data/lib/roro/{cli/templates/stories → 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/templates/rails/dotenv/web.env.tt +2 -0
- data/lib/roro/templates/rails/kube.rake.tt +114 -0
- data/lib/roro/{cli/templates/stories/with_postgresql → templates/rails/roro}/.keep +0 -0
- data/lib/roro/{cli/rollon/stories/database.rb → templates/rails/roro/containers/.keep} +0 -0
- data/lib/roro/templates/rails/roro/containers/app/.keep +0 -0
- data/lib/roro/templates/rails/roro/containers/app/Dockerfile.tt +34 -0
- data/lib/roro/templates/rails/roro/containers/frontend/.keep +0 -0
- data/lib/roro/templates/rails/roro/docker-entrypoint.sh +8 -0
- data/lib/roro/templates/rails/roro/kube/.keep +0 -0
- data/lib/roro/templates/rails/roro/kube/certificate.yml.tt +0 -0
- data/lib/roro/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/templates/rails/roro/kube/ingress.yml.tt +0 -0
- data/lib/roro/templates/rails/roro/kube/ingresses/ingress.yaml +13 -0
- data/lib/roro/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/templates/ruby_gem/.circleci/.keep +0 -0
- data/lib/roro/templates/ruby_gem/.circleci/config.yml.tt +16 -0
- data/lib/roro/templates/ruby_gem/.circleci/jobs/_test.yml +4 -0
- data/lib/roro/templates/ruby_gem/.circleci/setup-gem-credentials.sh +3 -0
- data/lib/roro/templates/ruby_gem/docker-compose.yml +15 -0
- data/lib/roro/templates/ruby_gem/roro/containers/.keep +0 -0
- data/lib/roro/templates/ruby_gem/roro/containers/ruby_image/Dockerfile.tt +16 -0
- data/lib/roro/templates/ruby_gem/roro/containers/ruby_image/ci.env.tt +1 -0
- data/lib/roro/templates/ruby_gem/roro/keys/.keep +0 -0
- data/lib/roro/version.rb +1 -1
- data/roro.gemspec +10 -10
- data/roro/containers/.keep +0 -0
- data/roro/containers/ruby_image/Dockerfile +16 -0
- data/roro/containers/ruby_image/ci.env.enc +2 -0
- data/roro/keys/.keep +0 -0
- data/tmp/.keep +0 -0
- metadata +177 -157
- 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 -98
- data/lib/roro/cli/base/continuous_integration.rb +0 -13
- data/lib/roro/cli/base/utilities.rb +0 -39
- data/lib/roro/cli/cli.rb +0 -99
- data/lib/roro/cli/configuration.rb +0 -69
- data/lib/roro/cli/expose.rb +0 -14
- data/lib/roro/cli/generate/config.rb +0 -13
- data/lib/roro/cli/generate/config/rails.rb +0 -17
- data/lib/roro/cli/greenfield.rb +0 -31
- data/lib/roro/cli/obfuscate.rb +0 -19
- data/lib/roro/cli/rollon/stories/rails.rb +0 -1
- data/lib/roro/cli/rollon/stories/rails/database.rb +0 -33
- data/lib/roro/cli/rollon/stories/ruby_gem.rb +0 -77
- data/lib/roro/cli/rollon/stories/ruby_gem/with_ci_cd.rb +0 -81
- data/lib/roro/cli/rollon/stories/stories.rb +0 -3
- data/lib/roro/cli/roro_configurator.yml +0 -157
- data/lib/roro/cli/ruby_gem.rb +0 -67
- data/lib/roro/cli/templates/base/.roro_config.yml +0 -15
- data/lib/roro/cli/templates/base/Dockerfile.tt +0 -82
- data/lib/roro/cli/templates/greenfield/Dockerfile.tt +0 -43
- data/lib/roro/cli/templates/ruby_gem/.circleci/config.yml +0 -17
- data/lib/roro/cli/templates/ruby_gem/roro/ci.env.tt +0 -1
- data/lib/roro/cli/templates/ruby_gem/roro/containers/ruby_image/Dockerfile.tt +0 -16
- data/lib/roro/cli/templates/stories/with_mysql/_service.yml +0 -10
- data/lib/roro/cli/templates/stories/with_postgresql/_service.yml +0 -7
- data/lib/tasks/deploy.rake +0 -126
- data/vendor/cache/actionpack-6.0.3.2.gem +0 -0
- data/vendor/cache/actionview-6.0.3.2.gem +0 -0
- data/vendor/cache/activesupport-6.0.3.2.gem +0 -0
- data/vendor/cache/addressable-2.7.0.gem +0 -0
- data/vendor/cache/builder-3.2.4.gem +0 -0
- data/vendor/cache/byebug-11.1.3.gem +0 -0
- data/vendor/cache/coderay-1.1.3.gem +0 -0
- data/vendor/cache/concurrent-ruby-1.1.7.gem +0 -0
- data/vendor/cache/crass-1.0.6.gem +0 -0
- data/vendor/cache/em-websocket-0.5.1.gem +0 -0
- data/vendor/cache/erubi-1.9.0.gem +0 -0
- data/vendor/cache/eventmachine-1.2.7.gem +0 -0
- data/vendor/cache/ffi-1.13.1.gem +0 -0
- data/vendor/cache/formatador-0.2.5.gem +0 -0
- data/vendor/cache/gem-release-2.1.1.gem +0 -0
- data/vendor/cache/given_core-3.8.0.gem +0 -0
- data/vendor/cache/guard-2.16.2.gem +0 -0
- data/vendor/cache/guard-compat-1.2.1.gem +0 -0
- data/vendor/cache/guard-livereload-2.5.2.gem +0 -0
- data/vendor/cache/guard-minitest-2.4.6.gem +0 -0
- data/vendor/cache/handsome_fencer-crypto-0.1.6.gem +0 -0
- data/vendor/cache/handsome_fencer-test-0.1.1.gem +0 -0
- data/vendor/cache/http_parser.rb-0.6.0.gem +0 -0
- data/vendor/cache/i18n-1.8.5.gem +0 -0
- data/vendor/cache/launchy-2.5.0.gem +0 -0
- data/vendor/cache/listen-3.2.1.gem +0 -0
- data/vendor/cache/loofah-2.6.0.gem +0 -0
- data/vendor/cache/lumberjack-1.2.7.gem +0 -0
- data/vendor/cache/method_source-1.0.0.gem +0 -0
- data/vendor/cache/mini_portile2-2.4.0.gem +0 -0
- data/vendor/cache/minitest-5.14.1.gem +0 -0
- data/vendor/cache/minitest-given-3.8.0.gem +0 -0
- data/vendor/cache/minitest-matchers_vaccine-1.0.4.gem +0 -0
- data/vendor/cache/minitest-rails-6.0.1.gem +0 -0
- data/vendor/cache/mocha-1.11.2.gem +0 -0
- data/vendor/cache/multi_json-1.15.0.gem +0 -0
- data/vendor/cache/nenv-0.3.0.gem +0 -0
- data/vendor/cache/net-scp-3.0.0.gem +0 -0
- data/vendor/cache/net-ssh-6.1.0.gem +0 -0
- data/vendor/cache/nokogiri-1.10.10.gem +0 -0
- data/vendor/cache/notiffany-0.1.3.gem +0 -0
- data/vendor/cache/os-1.0.0.gem +0 -0
- data/vendor/cache/pry-0.13.1.gem +0 -0
- data/vendor/cache/public_suffix-4.0.5.gem +0 -0
- data/vendor/cache/rack-2.2.3.gem +0 -0
- data/vendor/cache/rack-livereload-0.3.17.gem +0 -0
- data/vendor/cache/rack-test-1.1.0.gem +0 -0
- data/vendor/cache/rails-dom-testing-2.0.3.gem +0 -0
- data/vendor/cache/rails-html-sanitizer-1.3.0.gem +0 -0
- data/vendor/cache/railties-6.0.3.2.gem +0 -0
- data/vendor/cache/rake-13.0.1.gem +0 -0
- data/vendor/cache/rb-fsevent-0.10.4.gem +0 -0
- data/vendor/cache/rb-inotify-0.10.1.gem +0 -0
- data/vendor/cache/shellany-0.0.1.gem +0 -0
- data/vendor/cache/shoulda-4.0.0.gem +0 -0
- data/vendor/cache/shoulda-context-2.0.0.gem +0 -0
- data/vendor/cache/shoulda-matchers-4.3.0.gem +0 -0
- data/vendor/cache/sorcerer-2.0.1.gem +0 -0
- data/vendor/cache/sshkit-1.18.2.gem +0 -0
- data/vendor/cache/thor-1.0.1.gem +0 -0
- data/vendor/cache/thread_safe-0.3.6.gem +0 -0
- data/vendor/cache/tzinfo-1.2.7.gem +0 -0
- data/vendor/cache/zeitwerk-2.4.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
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
|
File without changes
|
@@ -0,0 +1,93 @@
|
|
1
|
+
aliases:
|
2
|
+
- &workspace-location
|
3
|
+
at: /tmp/workspace
|
4
|
+
- ©-ci-dotenv |
|
5
|
+
cp -rf /tmp/workspace/roro .
|
6
|
+
- &source-ci-variables |
|
7
|
+
echo 'source roro/containers/app/ci.env' >> $BASH_ENV
|
8
|
+
source $BASH_ENV
|
9
|
+
|
10
|
+
defaults: &defaults
|
11
|
+
executor: machine-executor
|
12
|
+
working_directory: ~/project
|
13
|
+
|
14
|
+
major_only: &major_only
|
15
|
+
filters:
|
16
|
+
branches:
|
17
|
+
only: master, release
|
18
|
+
|
19
|
+
version: 2.1
|
20
|
+
|
21
|
+
executors:
|
22
|
+
machine-executor:
|
23
|
+
machine: true
|
24
|
+
ruby-executor:
|
25
|
+
docker:
|
26
|
+
- image: cimg/ruby:2.7
|
27
|
+
|
28
|
+
jobs:
|
29
|
+
|
30
|
+
build:
|
31
|
+
<<: *defaults
|
32
|
+
steps:
|
33
|
+
- checkout
|
34
|
+
|
35
|
+
test-rollon-rails:
|
36
|
+
executor: ruby-executor
|
37
|
+
steps:
|
38
|
+
- checkout
|
39
|
+
- setup_remote_docker:
|
40
|
+
version: 19.03.12
|
41
|
+
- run: |
|
42
|
+
rake install
|
43
|
+
mkdir greenfield
|
44
|
+
cd greenfield
|
45
|
+
(yes || true) | roro greenfield
|
46
|
+
- run: echo 'success'
|
47
|
+
|
48
|
+
test:
|
49
|
+
<<: *defaults
|
50
|
+
steps:
|
51
|
+
- checkout
|
52
|
+
- run: RUBY_VERSION=2.5 docker-compose build ruby_gem
|
53
|
+
- run: RUBY_VERSION=2.5 docker-compose up -d --force-recreate ruby_gem
|
54
|
+
- run: RUBY_VERSION=2.5 docker-compose run ruby_gem bundle exec rake test
|
55
|
+
- run: RUBY_VERSION=2.6 docker-compose build ruby_gem
|
56
|
+
- run: RUBY_VERSION=2.6 docker-compose up -d --force-recreate ruby_gem
|
57
|
+
- run: RUBY_VERSION=2.6 docker-compose run ruby_gem bundle exec rake test
|
58
|
+
- run: RUBY_VERSION=2.7 docker-compose build ruby_gem
|
59
|
+
- run: RUBY_VERSION=2.7 docker-compose up -d --force-recreate ruby_gem
|
60
|
+
- run: RUBY_VERSION=2.7 docker-compose run ruby_gem bundle exec rake test
|
61
|
+
|
62
|
+
release:
|
63
|
+
<<: *defaults
|
64
|
+
steps:
|
65
|
+
- checkout
|
66
|
+
- run: gem install roro
|
67
|
+
- run: roro generate::exposed ci
|
68
|
+
- run: |
|
69
|
+
echo $(cat ./roro/containers/ruby_image/ci.env) >> $BASH_ENV
|
70
|
+
source $BASH_ENV
|
71
|
+
- run: chmod +x ./.circleci/setup-gem-credentials.sh
|
72
|
+
- run: ./.circleci/setup-gem-credentials.sh
|
73
|
+
- run: chmod 0600 ~/.gem/credentials
|
74
|
+
- run: git checkout .
|
75
|
+
- run: gem release
|
76
|
+
|
77
|
+
workflows:
|
78
|
+
version: 2
|
79
|
+
|
80
|
+
build-cli:
|
81
|
+
jobs:
|
82
|
+
- build
|
83
|
+
- test-rollon-rails:
|
84
|
+
<<: *major_only
|
85
|
+
- test:
|
86
|
+
<<: *major_only
|
87
|
+
|
88
|
+
- release:
|
89
|
+
requires:
|
90
|
+
- build
|
91
|
+
filters:
|
92
|
+
branches:
|
93
|
+
only: release
|
data/.gitignore
CHANGED
@@ -13,12 +13,13 @@ roro/**/*.key
|
|
13
13
|
|
14
14
|
*.key
|
15
15
|
*.env
|
16
|
-
|
17
|
-
|
16
|
+
!/.gitignore
|
17
|
+
*.gem
|
18
18
|
tmp/*
|
19
|
-
!tmp/.
|
19
|
+
!tmp/.keep
|
20
20
|
sandbox/*
|
21
21
|
!sandbox/.keep
|
22
22
|
!sandbox/greenfield
|
23
23
|
sandbox/greenfield/*
|
24
|
-
!sandbox/greenfield/.keep
|
24
|
+
!sandbox/greenfield/.keep
|
25
|
+
TUTORIAL.md
|
data/Guardfile
CHANGED
@@ -1,17 +1,15 @@
|
|
1
|
-
# A sample Guardfile
|
2
|
-
# More info at https://github.com/guard/guard#readme
|
3
|
-
|
4
1
|
options = {
|
5
|
-
|
6
|
-
|
7
|
-
all_after_pass: true
|
2
|
+
all_on_start: false,
|
3
|
+
all_after_pass: false,
|
8
4
|
}
|
9
5
|
|
10
6
|
guard :minitest, options do
|
11
7
|
|
12
|
-
watch(%r{^test/(.*)\/?test_(.*)\.rb$})
|
13
8
|
watch(%r{^test/(.*)\/?(.*)_test\.rb$})
|
14
|
-
watch(%r{^
|
15
|
-
watch(%r{^test/
|
16
|
-
watch(%r{^
|
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,89 +1,31 @@
|
|
1
|
-
require 'roro/cli/base/base'
|
2
|
-
require 'roro/cli/greenfield'
|
3
|
-
require 'roro/cli/obfuscate'
|
4
|
-
require 'roro/cli/expose'
|
5
|
-
require 'roro/cli/generate/config/rails'
|
6
|
-
require 'roro/cli/generate/config'
|
7
|
-
require 'roro/cli/generate/generate_keys'
|
8
|
-
require 'roro/cli/configuration'
|
9
1
|
|
2
|
+
require 'roro/cli/generate/exposed'
|
3
|
+
require 'roro/cli/generate/keys'
|
4
|
+
require 'roro/cli/generate/obfuscated'
|
5
|
+
require 'roro/cli/generate/story'
|
6
|
+
require 'roro/cli/greenfield/rails'
|
10
7
|
require 'roro/cli/rollon'
|
8
|
+
require 'roro/cli/rollon/rails/base/base'
|
9
|
+
require 'roro/cli/rollon/rails/database/with_mysql'
|
10
|
+
require 'roro/cli/rollon/rails/database/with_postgresql'
|
11
|
+
|
12
|
+
require 'roro/cli/rollon/ruby_gem'
|
13
|
+
|
11
14
|
module Roro
|
12
|
-
|
13
15
|
class CLI < Thor
|
14
16
|
|
15
17
|
include Thor::Actions
|
16
18
|
|
17
19
|
def self.source_root
|
18
|
-
File.dirname(__FILE__) + '/
|
19
|
-
end
|
20
|
-
|
21
|
-
|
22
|
-
desc "rollon::rails", "Generates files for and makes changes to your app
|
23
|
-
so it can run using Docker containers."
|
24
|
-
method_option :interactive, desc: "Set up your environment variables as
|
25
|
-
you go."
|
26
|
-
map "rollon::rails" => "rollon_rails"
|
27
|
-
|
28
|
-
def rollon_rails
|
29
|
-
rollon
|
30
|
-
end
|
31
|
-
|
32
|
-
|
33
|
-
desc "greenfield::rails", "Greenfield a new, dockerized rails app with
|
34
|
-
either MySQL or PostgreSQL in a separate container."
|
35
|
-
|
36
|
-
method_option :env_vars, type: :hash, default: {}, desc: "Pass a list of environment variables like so: env:var", banner: "key1:value1 key2:value2"
|
37
|
-
method_option :interactive, desc: "Set up your environment variables as you go."
|
38
|
-
method_option :force, desc: "force over-write of existing files"
|
39
|
-
|
40
|
-
map "greenfield::rails" => "greenfield_rails"
|
41
|
-
|
42
|
-
def greenfield_rails(*args)
|
43
|
-
greenfield(*args)
|
20
|
+
File.dirname(__FILE__) + '/templates'
|
44
21
|
end
|
45
|
-
desc "generate::exposed", "Generate private .env files from
|
46
|
-
encrypted .env.enc files inside the roro directory."
|
47
|
-
map "generate::exposed" => "generate_exposed"
|
48
22
|
|
49
|
-
def
|
50
|
-
|
23
|
+
def self.story_root
|
24
|
+
File.dirname(__FILE__) + '/stories'
|
51
25
|
end
|
52
26
|
|
53
|
-
|
54
|
-
|
55
|
-
encrypted .env.enc files inside the roro directory.
|
56
|
-
Expose encrypted files"
|
57
|
-
|
58
|
-
map "generate::key" => "generate_key"
|
59
|
-
method_option :environment, type: :hash, default: {}, desc: "Pass a list of environment variables like so: env:var", banner: "development, staging"
|
60
|
-
|
61
|
-
def generate_key(*args)
|
62
|
-
generate_key_or_keys(*args)
|
63
|
-
end
|
64
|
-
|
65
|
-
desc "generate::keys", "Generate keys for each environment inside roro/keys.
|
66
|
-
If you have .env files like 'roro/containers/app/[staging_env].env' and
|
67
|
-
'roro/[circle_ci_env].env' it will generate '/roro/keys/[staging_env].key'
|
68
|
-
and '/roro/keys/[circle_ci_env].key'."
|
69
|
-
map "generate::keys" => "generate_keys"
|
70
|
-
|
71
|
-
def generate_keys(*args)
|
72
|
-
generate_key(*args)
|
73
|
-
end
|
74
|
-
|
75
|
-
desc "generate::config", "Generate a config file at .roro_config.yml"
|
76
|
-
map "generate::config" => "generate_config"
|
77
|
-
|
78
|
-
def generate_config
|
79
|
-
create_file ".roro_config.yml", @config.app.to_yaml
|
80
|
-
end
|
81
|
-
|
82
|
-
desc "generate::obfuscated", "obfuscates any files matching the pattern ./roro/**/*.env"
|
83
|
-
map "generate::obfuscated" => "generate_obfuscated"
|
84
|
-
|
85
|
-
def generate_obfuscated(*args)
|
86
|
-
obfuscate(*args)
|
27
|
+
def self.roro_environments
|
28
|
+
%w(development production test staging ci)
|
87
29
|
end
|
88
30
|
end
|
89
31
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Roro
|
2
|
+
class CLI < Thor
|
3
|
+
|
4
|
+
desc "generate::exposed", "Generate private .env files from encrypted .env.enc files inside the roro directory."
|
5
|
+
map "generate::exposed" => "generate_exposed"
|
6
|
+
|
7
|
+
def generate_exposed(*args)
|
8
|
+
environments = args.first ? [args.first] : gather_environments
|
9
|
+
environments.each do |environment|
|
10
|
+
HandsomeFencer::Crypto.expose(environment, 'roro')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -2,6 +2,28 @@ module Roro
|
|
2
2
|
|
3
3
|
class CLI < Thor
|
4
4
|
|
5
|
+
desc "generate::key", "Generate a key inside roro/keys. Takes the name of
|
6
|
+
an environment as an argument to private .env files from
|
7
|
+
encrypted .env.enc files inside the roro directory.
|
8
|
+
Expose encrypted files"
|
9
|
+
|
10
|
+
map "generate::key" => "generate_key"
|
11
|
+
method_option :environment, type: :hash, default: {}, desc: "Pass a list of environment variables like so: env:var", banner: "development, staging"
|
12
|
+
|
13
|
+
def generate_key(*args)
|
14
|
+
generate_key_or_keys(*args)
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "generate::keys", "Generate keys for each environment inside roro/keys.
|
18
|
+
If you have .env files like 'roro/containers/app/[staging_env].env' and
|
19
|
+
'roro/[circle_ci_env].env' it will generate '/roro/keys/[staging_env].key'
|
20
|
+
and '/roro/keys/[circle_ci_env].key'."
|
21
|
+
map "generate::keys" => "generate_keys"
|
22
|
+
|
23
|
+
def generate_keys(*args)
|
24
|
+
generate_key(*args)
|
25
|
+
end
|
26
|
+
|
5
27
|
no_commands do
|
6
28
|
|
7
29
|
def generate_key_or_keys(*args)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'handsome_fencer/crypto'
|
2
|
+
|
3
|
+
module Roro
|
4
|
+
|
5
|
+
class CLI < Thor
|
6
|
+
|
7
|
+
desc "generate::obfuscated", "obfuscates any files matching the pattern ./roro/**/*.env"
|
8
|
+
map "generate::obfuscated" => "generate_obfuscated"
|
9
|
+
|
10
|
+
def generate_obfuscated(*args)
|
11
|
+
environments = args.first ? [args.first] : gather_environments
|
12
|
+
environments.each do |environment|
|
13
|
+
HandsomeFencer::Crypto.obfuscate(environment, 'roro')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
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
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Roro
|
2
|
+
|
3
|
+
class CLI < Thor
|
4
|
+
|
5
|
+
desc "greenfield::rails", "Greenfield a new, dockerized rails app with
|
6
|
+
either MySQL or PostgreSQL in a separate container."
|
7
|
+
|
8
|
+
map "greenfield::rails" => "greenfield_rails"
|
9
|
+
|
10
|
+
def greenfield_rails
|
11
|
+
greenfield( { story: :rails } )
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/roro/cli/rollon.rb
CHANGED
@@ -1,84 +1,147 @@
|
|
1
|
-
require 'roro/cli/rollon/stories'
|
2
|
-
|
3
1
|
module Roro
|
4
|
-
|
5
2
|
class CLI < Thor
|
6
3
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
16
34
|
|
17
|
-
|
18
|
-
|
19
|
-
copy_roro_files
|
20
|
-
generate_config
|
21
|
-
startup_commands
|
35
|
+
rollon(args)
|
22
36
|
end
|
23
37
|
|
24
|
-
|
25
|
-
|
26
|
-
|
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)
|
27
84
|
@config ||= Roro::Configuration.new(options)
|
28
85
|
end
|
29
|
-
|
30
|
-
def
|
31
|
-
|
86
|
+
|
87
|
+
def manifest_actions
|
88
|
+
@config.structure[:actions].each {|a| eval a }
|
32
89
|
end
|
33
90
|
|
34
|
-
def
|
35
|
-
|
36
|
-
|
37
|
-
template 'base/Dockerfile.tt', 'roro/containers/app/Dockerfile', @config.app
|
38
|
-
take_thor_actions
|
39
|
-
end
|
91
|
+
def manifest_intentions
|
92
|
+
@config.intentions.each {|k, v| eval(k.to_s) if v.eql?('y') }
|
93
|
+
end
|
40
94
|
|
41
|
-
def
|
42
|
-
@config.
|
43
|
-
|
44
|
-
|
45
|
-
def startup_commands
|
46
|
-
system 'docker-compose build'
|
47
|
-
system 'docker-compose run web bundle'
|
48
|
-
system 'docker-compose run web bin/rails webpacker:install'
|
49
|
-
system 'docker-compose run web bin/rails yarn:install'
|
50
|
-
system 'docker-compose run web bin/rails db:create'
|
51
|
-
system 'docker-compose run web bin/rails db:migrate'
|
52
|
-
system 'docker-compose up'
|
53
|
-
end
|
95
|
+
def greenfield_actions
|
96
|
+
return unless @config.structure[:greenfield_actions]
|
97
|
+
@config.structure[:greenfield_actions].each {|a| eval a }
|
98
|
+
end
|
54
99
|
|
55
|
-
def
|
56
|
-
|
57
|
-
|
58
|
-
warning: "this is not an empty directory. Roro will not greenfield a new Rails app unless either a) the current directory is empty or b) you run greenfield with the --force flag",
|
59
|
-
suggestion: "$ roro greenfield --force",
|
60
|
-
conditional: "Dir.glob('*').empty?" })
|
61
|
-
confirm || true
|
100
|
+
def greenfield_commands
|
101
|
+
return unless @config.structure[:greenfield_actions]
|
102
|
+
@config.structure[:greenfield_commands].each {|a| eval a }
|
62
103
|
end
|
63
104
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
msg << delineator
|
69
|
-
msg << "It looks like #{options[:warning]}. The following bash command returns false:"
|
70
|
-
msg << "\t$ #{options[:system_query]}"
|
71
|
-
msg << "Please try these instructions:"
|
72
|
-
msg << ("\t" + options[:suggestion])
|
73
|
-
msg << delineator
|
74
|
-
conditional = options[:conditional] ? eval(options[:conditional]) : system(options[:system_query])
|
75
|
-
if conditional == false
|
76
|
-
raise(Roro::Error.new(msg.join("\n\n")))
|
105
|
+
def congratulations(story=nil)
|
106
|
+
( @config.story[:rollon])
|
107
|
+
if @config.structure[:greenfield]
|
108
|
+
usecase = 'greenfielded a new '
|
77
109
|
else
|
78
|
-
|
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"
|
79
130
|
end
|
80
131
|
end
|
81
132
|
|
133
|
+
def yaml_from_template(file)
|
134
|
+
File.read(find_in_source_paths(file))
|
135
|
+
end
|
136
|
+
|
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
|
144
|
+
end
|
82
145
|
end
|
83
146
|
end
|
84
147
|
end
|