gem 'sprockets-rails', '~> 3.2', require: 'sprockets/railtie'
gem 'stoplight', '~> 2.2.0'
gem 'strong_migrations', '~> 0.6'
-gem 'tty-command', '~> 0.9', require: false
gem 'tty-prompt', '~> 0.21', require: false
gem 'twitter-text', '~> 1.14'
gem 'tzinfo-data', '~> 1.2020'
# frozen_string_literal: true
-require 'tty-command'
require 'tty-prompt'
namespace :mastodon do
prompt.say 'This configuration will be written to .env.production'
if prompt.yes?('Save configuration?')
- cmd = TTY::Command.new(printer: :quiet)
-
env_contents = env.each_pair.map do |key, value|
if value.is_a?(String) && value =~ /[\s\#\\"]/
if value =~ /[']/
prompt.say 'Running `RAILS_ENV=production rails db:setup` ...'
prompt.say "\n\n"
- if cmd.run!(env.merge({ RAILS_ENV: 'production', SAFETY_ASSURED: 1 }), :rails, 'db:setup').failure?
+ if !system(env.transform_values(&:to_s).merge({ 'RAILS_ENV' => 'production', 'SAFETY_ASSURED' => '1' }), 'rails db:setup')
prompt.error 'That failed! Perhaps your configuration is not right'
else
prompt.ok 'Done!'
prompt.say 'Running `RAILS_ENV=production rails assets:precompile` ...'
prompt.say "\n\n"
- if cmd.run!(env.merge({ RAILS_ENV: 'production' }), :rails, 'assets:precompile').failure?
+ if !system(env.transform_values(&:to_s).merge({ 'RAILS_ENV' => 'production' }), 'rails assets:precompile')
prompt.error 'That failed! Maybe you need swap space?'
else
prompt.say 'Done!'