thredded_create_app 0.1.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.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +185 -0
  4. data/exe/thredded_create_app +8 -0
  5. data/lib/thredded_create_app.rb +5 -0
  6. data/lib/thredded_create_app/cli.rb +182 -0
  7. data/lib/thredded_create_app/command_error.rb +14 -0
  8. data/lib/thredded_create_app/generator.rb +91 -0
  9. data/lib/thredded_create_app/logging.rb +36 -0
  10. data/lib/thredded_create_app/tasks/add_devise.rb +63 -0
  11. data/lib/thredded_create_app/tasks/add_display_name_to_users.rb +126 -0
  12. data/lib/thredded_create_app/tasks/add_display_name_to_users/add_display_name_to_users.rb +12 -0
  13. data/lib/thredded_create_app/tasks/add_simple_form.rb +20 -0
  14. data/lib/thredded_create_app/tasks/add_thredded.rb +79 -0
  15. data/lib/thredded_create_app/tasks/add_thredded/_myapp-thredded.scss +18 -0
  16. data/lib/thredded_create_app/tasks/add_thredded/add_admin_to_users.rb +10 -0
  17. data/lib/thredded_create_app/tasks/add_thredded/myapp_thredded.js +1 -0
  18. data/lib/thredded_create_app/tasks/add_thredded/spec/features/thredded_spec.rb +9 -0
  19. data/lib/thredded_create_app/tasks/add_thredded/thredded.en.yml +8 -0
  20. data/lib/thredded_create_app/tasks/add_thredded/thredded_initializer_controller.rb +9 -0
  21. data/lib/thredded_create_app/tasks/base.rb +101 -0
  22. data/lib/thredded_create_app/tasks/create_rails_app.rb +36 -0
  23. data/lib/thredded_create_app/tasks/docker.rb +22 -0
  24. data/lib/thredded_create_app/tasks/docker/Dockerfile.erb +22 -0
  25. data/lib/thredded_create_app/tasks/docker/docker-compose.yml.erb +22 -0
  26. data/lib/thredded_create_app/tasks/docker/wait-for-tcp +30 -0
  27. data/lib/thredded_create_app/tasks/production_configs.rb +21 -0
  28. data/lib/thredded_create_app/tasks/production_configs/Procfile +1 -0
  29. data/lib/thredded_create_app/tasks/production_configs/puma.production.rb +18 -0
  30. data/lib/thredded_create_app/tasks/setup_app_skeleton.rb +160 -0
  31. data/lib/thredded_create_app/tasks/setup_app_skeleton/_flash-messages.scss +19 -0
  32. data/lib/thredded_create_app/tasks/setup_app_skeleton/_flash_messages.html.erb +7 -0
  33. data/lib/thredded_create_app/tasks/setup_app_skeleton/_header.html.erb +13 -0
  34. data/lib/thredded_create_app/tasks/setup_app_skeleton/_variables.scss.erb +6 -0
  35. data/lib/thredded_create_app/tasks/setup_app_skeleton/application.body.html.erb +7 -0
  36. data/lib/thredded_create_app/tasks/setup_app_skeleton/application.scss +83 -0
  37. data/lib/thredded_create_app/tasks/setup_app_skeleton/application_helper_methods.rb +17 -0
  38. data/lib/thredded_create_app/tasks/setup_app_skeleton/en.yml.erb +7 -0
  39. data/lib/thredded_create_app/tasks/setup_app_skeleton/home_show.html.erb.erb +47 -0
  40. data/lib/thredded_create_app/tasks/setup_app_skeleton/seeds.rb.erb +52 -0
  41. data/lib/thredded_create_app/tasks/setup_app_skeleton/spec/controllers/users_controller_spec.rb +21 -0
  42. data/lib/thredded_create_app/tasks/setup_app_skeleton/spec/features/homepage_spec.rb +9 -0
  43. data/lib/thredded_create_app/tasks/setup_app_skeleton/users_show.html.erb +26 -0
  44. data/lib/thredded_create_app/tasks/setup_database.rb +42 -0
  45. data/lib/thredded_create_app/tasks/setup_database/create_postgresql_user.sh +25 -0
  46. data/lib/thredded_create_app/tasks/setup_database/database.yml.erb +36 -0
  47. data/lib/thredded_create_app/version.rb +4 -0
  48. metadata +175 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e789f57ed0bc72c875265424613423e3e5555f42
4
+ data.tar.gz: 4be5310ad208c0b2811e165759be33c79603baee
5
+ SHA512:
6
+ metadata.gz: 786d97598b36481726f233146c2394a6dd819cb5e408322a4dc40b1dbd34bba68d3263b3599d4d0d28dff150f908fc7629bb7f7f6c89a767c93992d25e78b6f1
7
+ data.tar.gz: e72055793bcf3eddc38e1937be2cd20fd0c45d7756065ea410ce7dc4262812a36d30b9640a534cdb22c7747ebe0723d7d76d15e6d32300436547964a57a92ce0
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Gleb Mazovetskiy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,185 @@
1
+ # ThreddedCreateApp [![Build Status](https://travis-ci.org/thredded/thredded_create_app.svg?branch=master)](https://travis-ci.org/thredded/thredded_create_app) [![Test Coverage](https://codeclimate.com/github/thredded/thredded_create_app/badges/coverage.svg)](https://codeclimate.com/github/thredded/thredded_create_app/coverage)
2
+
3
+ Generates a Rails app with the [Thredded](https://github.com/thredded/thredded) forums engine installed.
4
+
5
+ This generator will create a new Rails app with the following configuration:
6
+
7
+ * Database: PostgreSQL.
8
+ * Auth: Devise.
9
+
10
+ See below for more information on the generated app.
11
+
12
+ Example screenshots of the generated app:
13
+
14
+ <table>
15
+ <tr>
16
+ <td><img alt="Home" src="https://cloud.githubusercontent.com/assets/216339/19858280/23072dd8-9f3e-11e6-8d71-e977a4a67f0f.png"></td>
17
+ <td><img alt="Sign Up" src="https://cloud.githubusercontent.com/assets/216339/19858282/231bb06e-9f3e-11e6-8e51-a293523b7034.png"></td>
18
+ </tr>
19
+ <tr>
20
+ <td><img alt="Messageboard" src="https://cloud.githubusercontent.com/assets/216339/19858469/c592413c-9f3e-11e6-827d-b530f3ee2850.png"></td>
21
+ <td><img alt="Topic" src="https://cloud.githubusercontent.com/assets/216339/19858284/232107e4-9f3e-11e6-8c5f-8a8f927f2922.png"></td>
22
+ </tr>
23
+ </table>
24
+
25
+ ## Pre-requisites
26
+
27
+ 1. Git.
28
+ 2. PostgreSQL.
29
+ 3. Ruby 2.3+.
30
+
31
+ ## Usage
32
+
33
+ Install the gem and create your app:
34
+
35
+ ```bash
36
+ gem install thredded_create_app
37
+ thredded_create_app myapp
38
+ ```
39
+
40
+ Run `thredded_create_app --help` for more information about the available
41
+ options.
42
+
43
+ ### RVM
44
+
45
+ If you're using [RVM](https://rvm.io/), you probably want to create a
46
+ gemset before creating your app:
47
+
48
+ ```bash
49
+ RUBY_VERSION=2.3.1 APP=myapp
50
+ rvm use --create "${RUBY_VERSION}@${APP}"
51
+ gem install thredded_create_app
52
+ thredded_create_app "$APP"
53
+ ```
54
+
55
+ Then, generate the `.ruby-version` and `.ruby-gemset` files so that the gemset
56
+ is used automatically whenever you `cd` into the project directory:
57
+
58
+ ```bash
59
+ cd "$APP"
60
+ rvm use --ruby-version "${RUBY_VERSION}@${APP}"
61
+ printf '.ruby-version\n.ruby-gemset\n' >> .git/info/exclude
62
+ ```
63
+
64
+ ### App generation
65
+
66
+ The app generator will do the steps below for you.
67
+
68
+ First, the rubygems package is updated and the latest versions of
69
+ [Rails] and [Bundler] are installed.
70
+
71
+ Then, a Rails app is generated for use with the PostgreSQL database.
72
+
73
+ Then, a [git] repository is initialized in the app directory. From here onwards,
74
+ the app generator will commit the changes at each step.
75
+
76
+ [RSpec] is used as the testing framework, and some basic acceptance tests
77
+ using [capybara] are added.
78
+
79
+ [Devise] is used as the authentication framework. Its default views are
80
+ customized to add a user name field (`display_name`) to the registration form.
81
+ The [simple_form] gem is used for the customized Devise views by default.
82
+
83
+ A basic responsive app layout with top bar navigation is added.
84
+ A user profile page that displays some basic information about the user and
85
+ their recent forum posts is also added.
86
+
87
+ The app comes with basic styles (~10KiB gzipped, including Thredded styles)
88
+ that are written using [Sass].
89
+
90
+ The app's JavaScript code is loaded asynchronously in production mode via the
91
+ [`async`] attribute on the script tag. In development, the individual script
92
+ files are not concatenated. With `async` they would load out-of-order, so
93
+ [`defer`] is used instead.
94
+
95
+ **NB:** While loading scripts via `async` provides the best possible speed,
96
+ a lot of JavaScript libraries do not support it.
97
+ **If** you plan on adding JavaScript code, you might want to
98
+ **remove the `async` attribute** from the `javascript_include_tag` in
99
+ `app/views/layouts/application.html.erb`.
100
+
101
+ A [Dockerfile] and [docker-compose.yml] is generated for development.
102
+ This is so that other engineers can spin up a development environment with
103
+ a single command.
104
+
105
+ A production configuration file for the [puma] Ruby web server is created.
106
+ A `Procfile` process description file that can be used by that can be used by
107
+ the [Heroku] hosting platform or the [foreman] app runner is also be created.
108
+
109
+ Lastly, the `$APP` database user is created and given rights to the app's
110
+ development and test databases. Then, the database is created, the migrations
111
+ are run, and the database is seeded with an admin user and a messageboard.
112
+
113
+ Finally, the tests are run, and the development web server is started at
114
+ <http://localhost:3000>.
115
+
116
+ [`async`]: https://developer.mozilla.org/en/docs/Web/HTML/Element/script
117
+ [`defer`]: https://developer.mozilla.org/en/docs/Web/HTML/Element/script
118
+ [Bundler]: http://bundler.io/
119
+ [capybara]: https://github.com/jnicklas/capybara
120
+ [Devise]: https://github.com/plataformatec/devise
121
+ [docker-compose.yml]: https://docs.docker.com/compose/
122
+ [Dockerfile]: https://docs.docker.com/engine/reference/builder/
123
+ [foreman]: https://ddollar.github.io/foreman/
124
+ [git]: https://git-scm.com/
125
+ [Heroku]: https://www.heroku.com/
126
+ [puma]: https://github.com/puma/puma
127
+ [Rails]: http://rubyonrails.org/
128
+ [RSpec]: http://rspec.info/
129
+ [Sass]: http://sass-lang.com/
130
+ [simple_form]: https://github.com/plataformatec/simple_form
131
+
132
+ ### Next steps
133
+
134
+ To learn about customizing the forums, see the [Thredded Readme].
135
+
136
+ To learn about customizing the authentication system, e.g. to require email
137
+ confirmation or to add an OAuth login, see the [Devise Readme].
138
+
139
+ To change the homepage, edit the view file at `app/views/home/show.html.erb`.
140
+
141
+ To change the app's styles, see the files in `app/assets/stylesheets`.
142
+ The app is generated with a randomly selected primary theme color that you may
143
+ want to change. You can find it in `app/assets/stylesheets/_variables.scss`.
144
+
145
+ You can contact the Thredded team via the [Thredded chat room].
146
+ Once you've deployed your app, please let us know that you are using Thredded
147
+ by tweeting [@thredded]!
148
+
149
+ [@thredded]: https://twitter.com/thredded
150
+ [Devise Readme]: https://github.com/plataformatec/devise/blob/master/README.md
151
+ [Thredded chat room]: https://gitter.im/thredded/thredded
152
+ [Thredded Readme]: https://github.com/thredded/thredded/blob/master/README.md
153
+
154
+ ## Development
155
+
156
+ The instructions below are for developing and contributing to
157
+ the Thredded app generator itself, not for using it.
158
+
159
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
160
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
161
+
162
+ To generate an app with `thredded_create_app` at `tmp/myapp`, run:
163
+
164
+ ```sh
165
+ bundle exec bin/create-tmp-myapp
166
+ ```
167
+
168
+ This command will clean up the previously generated app before creating a new one.
169
+
170
+ To install this gem onto your local machine, run `bundle exec rake install`.
171
+ To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`,
172
+ which will create a git tag for the version, push git commits and tags, and push the `.gem` file to
173
+ [rubygems.org](https://rubygems.org).
174
+
175
+ ## Contributing
176
+
177
+ Bug reports and pull requests are welcome on GitHub at https://github.com/thredded/thredded_create_app.
178
+ This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the
179
+ [Contributor Covenant](http://contributor-covenant.org) code of conduct.
180
+
181
+
182
+ ## License
183
+
184
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
185
+
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ if ENV['THREDDED_CREATE_APP_BIN_SIMPLECOV_COVERAGE']
4
+ require_relative '../spec/simplecov_bin_helper'
5
+ end
6
+
7
+ require 'thredded_create_app/cli'
8
+ ThreddedCreateApp::CLI.start(ARGV)
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+ require 'thredded_create_app/version'
3
+
4
+ module ThreddedCreateApp
5
+ end
@@ -0,0 +1,182 @@
1
+ # frozen_string_literal: true
2
+ require 'thredded_create_app/command_error'
3
+ require 'thredded_create_app/generator'
4
+ require 'thredded_create_app/logging'
5
+
6
+ require 'highline'
7
+ module ThreddedCreateApp
8
+ class CLI
9
+ include ThreddedCreateApp::Logging
10
+
11
+ DEFAULTS = {
12
+ auto_confirm: false,
13
+ verbose: false,
14
+ install_gem_bundler_rails: true,
15
+ start_server: true,
16
+ simple_form: true
17
+ }.freeze
18
+
19
+ def self.start(argv)
20
+ new(argv).start
21
+ end
22
+
23
+ def initialize(argv)
24
+ @argv = argv
25
+ end
26
+
27
+ def start
28
+ auto_output_coloring do
29
+ begin
30
+ run
31
+ rescue OptionParser::ParseError, ArgvError => e
32
+ error e.message, 64
33
+ rescue ThreddedCreateApp::CommandError => e
34
+ begin
35
+ error e.message, 78
36
+ ensure
37
+ log_verbose e.backtrace * "\n"
38
+ end
39
+ rescue Errno::EPIPE
40
+ exit 1
41
+ end
42
+ end
43
+ rescue ExecutionError => e
44
+ exit e.exit_code
45
+ end
46
+
47
+ private
48
+
49
+ def run # rubocop:disable Metrics/AbcSize
50
+ options = optparse
51
+ generator = ThreddedCreateApp::Generator.new(options)
52
+ log_info 'Will do the following:'
53
+ log_info generator.summary
54
+ exit unless options[:auto_confirm] || agree?
55
+ generator.generate
56
+ log_stderr Term::ANSIColor.bold Term::ANSIColor.bright_green <<~TEXT
57
+ All done! 🌟
58
+ TEXT
59
+ generator.run_tests!
60
+ start_app_server!(options[:app_path]) if options[:start_server]
61
+ end
62
+
63
+ def start_app_server!(app_path)
64
+ log_info 'Changing directory and starting the app server'
65
+ command = "cd #{Shellwords.escape(app_path)} && " \
66
+ 'bundle exec rails s'
67
+ log_command command
68
+ if defined?(Bundler)
69
+ Bundler.with_clean_env { exec command }
70
+ else
71
+ exec command
72
+ end
73
+ end
74
+
75
+ # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
76
+ def optparse
77
+ argv = @argv.dup
78
+ argv << '--help' if argv.empty?
79
+ options = DEFAULTS.dup
80
+ positional_args = OptionParser.new(
81
+ "Usage: #{program_name} #{Term::ANSIColor.bold 'APP_PATH'}", 37
82
+ ) do |op|
83
+ flags = Flags.new(op, options)
84
+
85
+ flags.bool :auto_confirm, '-y', 'Auto-confirm all prompts'
86
+ op.on '-v', '--version', 'Print the version' do
87
+ puts ThreddedCreateApp::VERSION
88
+ exit
89
+ end
90
+ flags.bool :verbose, '--verbose', 'Verbose output' do
91
+ @verbose = true
92
+ end
93
+ flags.bool :simple_form, '--[no-]simple-form', 'Use simple_form'
94
+ flags.bool :install_gem_bundler_rails,
95
+ '--[no-]install-gem-bundler-rails',
96
+ 'Run `gem update --system and `gem install bundler rails`'
97
+ flags.bool :start_server, '--[no-]start-server', 'Start the app server'
98
+
99
+ op.on '-h', '--help', 'Show this message' do
100
+ STDERR.puts op
101
+ exit
102
+ end
103
+ op.separator Term::ANSIColor.bright_blue <<-TEXT
104
+
105
+ For more information, see the readme at:
106
+ #{File.expand_path('../../README.md', File.dirname(__FILE__))}
107
+ https://github.com/thredded/thredded_create_app
108
+ TEXT
109
+ end.parse!(argv)
110
+ if positional_args.length != 1
111
+ raise ArgvError, 'Expected 1 positional argument, ' \
112
+ "got #{positional_args.length}."
113
+ end
114
+ options.update(app_path: argv[0])
115
+ options
116
+ end
117
+ # rubocop:enable Metrics/AbcSize,Metrics/MethodLength,Metrics/BlockLength
118
+
119
+ class Flags
120
+ def initialize(op, options)
121
+ @op = op
122
+ @options = options
123
+ end
124
+
125
+ # rubocop:disable Style/OptionalArguments
126
+ def bool(as, short = nil, long, desc)
127
+ flag_args = [short, long].compact
128
+ if long.start_with?('--[no-]')
129
+ desc += " (default: #{DEFAULTS[as]})" if DEFAULTS[as]
130
+ @op.on(*flag_args, desc) do |v|
131
+ @options[as] = v
132
+ yield v if block_given?
133
+ end
134
+ else
135
+ @op.on(*flag_args, desc) do
136
+ @options[as] = !long.start_with?('--no-')
137
+ yield @options[as] if block_given?
138
+ end
139
+ end
140
+ end
141
+ # rubocop:enable Style/OptionalArguments
142
+ end
143
+
144
+ def error(message, exit_code)
145
+ log_error message
146
+ raise ExecutionError.new(message, exit_code)
147
+ end
148
+
149
+ def auto_output_coloring(coloring = STDOUT.isatty)
150
+ coloring_was = Term::ANSIColor.coloring?
151
+ Term::ANSIColor.coloring = coloring
152
+ HighLine.use_color = coloring
153
+ yield
154
+ ensure
155
+ HighLine.use_color = coloring_was
156
+ Term::ANSIColor.coloring = coloring_was
157
+ end
158
+
159
+ def agree?
160
+ ::HighLine.new.agree(
161
+ Term::ANSIColor.bold(Term::ANSIColor.bright_yellow('Proceed? [y/n]')),
162
+ true
163
+ )
164
+ end
165
+
166
+ def verbose?
167
+ @verbose
168
+ end
169
+
170
+ class ArgvError < StandardError
171
+ end
172
+
173
+ class ExecutionError < RuntimeError
174
+ attr_reader :exit_code
175
+
176
+ def initialize(message, exit_code)
177
+ super(message)
178
+ @exit_code = exit_code
179
+ end
180
+ end
181
+ end
182
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+ module ThreddedCreateApp
3
+ # When this type of error is caught:
4
+ # 1. show error message of the backtrace
5
+ # 2. exit with non-zero exit code
6
+ class CommandError < StandardError
7
+ # rubocop:disable Style/OptionalArguments
8
+ def initialize(error = nil, message)
9
+ super(message)
10
+ set_backtrace error.backtrace if error
11
+ end
12
+ # rubocop:enable Style/OptionalArguments
13
+ end
14
+ end
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+ require 'fileutils'
3
+ require 'shellwords'
4
+ require 'thredded_create_app/tasks/base'
5
+ require 'thredded_create_app/tasks/create_rails_app'
6
+ require 'thredded_create_app/tasks/add_simple_form'
7
+ require 'thredded_create_app/tasks/add_devise'
8
+ require 'thredded_create_app/tasks/add_thredded'
9
+ require 'thredded_create_app/tasks/add_display_name_to_users'
10
+ require 'thredded_create_app/tasks/setup_database'
11
+ require 'thredded_create_app/tasks/setup_app_skeleton'
12
+ require 'thredded_create_app/tasks/production_configs'
13
+ require 'thredded_create_app/tasks/docker'
14
+ module ThreddedCreateApp
15
+ class Generator < Tasks::Base
16
+ def initialize(**options)
17
+ super
18
+ @options = options
19
+ end
20
+
21
+ def summary
22
+ tasks.map { |t| "* #{t.summary}" }.join("\n")
23
+ end
24
+
25
+ def generate
26
+ log_verbose "Started: #{inspect}"
27
+ FileUtils.mkdir_p(app_path)
28
+ in_app_env do
29
+ run 'git init .'
30
+ @tasks.each(&:before_bundle)
31
+ bundle
32
+ @tasks.each(&:after_bundle)
33
+ end
34
+ end
35
+
36
+ def run_tests!
37
+ log_info 'Running tests'
38
+ in_app_env do
39
+ run 'bundle exec rspec -fd'
40
+ end
41
+ end
42
+
43
+ private
44
+
45
+ def in_app_env
46
+ if defined?(Bundler)
47
+ Bundler.with_clean_env do
48
+ Dir.chdir app_path do
49
+ yield
50
+ end
51
+ end
52
+ else
53
+ Dir.chdir app_path do
54
+ yield
55
+ end
56
+ end
57
+ end
58
+
59
+ def tasks
60
+ @tasks ||= [
61
+ Tasks::CreateRailsApp,
62
+ (Tasks::AddSimpleForm if @options[:simple_form]),
63
+ Tasks::AddDevise,
64
+ Tasks::AddThredded,
65
+ Tasks::AddDisplayNameToUsers,
66
+ Tasks::SetupAppSkeleton,
67
+ Tasks::ProductionConfigs,
68
+ Tasks::Docker,
69
+ Tasks::SetupDatabase
70
+ ].compact.map { |task_class| task_class.new(@options) }
71
+ end
72
+
73
+ def gems
74
+ tasks.flat_map(&:gems)
75
+ end
76
+
77
+ # @final
78
+ def bundle
79
+ File.open('Gemfile', 'a') do |f|
80
+ log_info 'Writing gems to Gemfile'
81
+ gems.each do |(name, version, groups)|
82
+ f.puts ["gem '#{name}'",
83
+ (version if version),
84
+ ("groups: %i(#{groups * ' '})" if groups)].compact.join(', ')
85
+ end
86
+ end
87
+ run "bundle install#{' --quiet' unless verbose?}"
88
+ git_commit "Add gems: #{gems.map { |(name, *)| name } * ', '}"
89
+ end
90
+ end
91
+ end