lib/cybele/app_builder.rb in cybele-0.4.1 vs lib/cybele/app_builder.rb in cybele-0.5.0
- old
+ new
@@ -95,40 +95,54 @@
copy_file 'app/assets/stylesheets/application.css.sass', 'app/assets/stylesheets/application.css.sass'
end
# Interval: Configure smtp
def configure_smtp
- copy_file 'config/initializers/mail.rb', 'config/initializers/mail.rb'
- prepend_file 'config/environments/production.rb',
- "require Rails.root.join('config/initializers/mail')\n"
-
config = <<-RUBY
-
-
- # Mail Settings
- config.action_mailer.delivery_method = :smtp
- config.action_mailer.smtp_settings = MAIL_SETTING
+config.action_mailer.delivery_method = :smtp
+ config.action_mailer.smtp_settings = {
+ :address => 'smtp.mandrillapp.com',
+ :port => 587,
+ :enable_starttls_auto => true,
+ :user_name => 'email@email.com', #TODO change this with original
+ :password => 'password', #TODO change this with original
+ :authentication => 'plain'
+ }
RUBY
- inject_into_file 'config/environments/production.rb', config,
- :after => 'config.action_mailer.raise_delivery_errors = false'
+ configure_environment 'production', config
end
# Interval: Configure action mailer
def configure_action_mailer
action_mailer_host 'development', "#{app_name}.dev"
- action_mailer_host 'test', 'www.example.com'
+ action_mailer_host 'test', "#{app_name}.com"
action_mailer_host 'production', "#{app_name}.com"
+
end
# Interval: Setup letter opener
def setup_letter_opener
config = 'config.action_mailer.delivery_method = :letter_opener'
configure_environment 'development', config
end
+ # Interval: Setup simple form
+ def generate_simple_form
+ generate 'simple_form:install --bootstrap'
+ end
+
+ # Internal: Generate exception notification
+ #
+ # This command generates an initialize file (config/initializers/exception_notification.rb)
+ # where you can customize your configurations.
+ # https://github.com/smartinez87/exception_notification#rails
+ def generate_exception_notification
+ generate 'exception_notification:install'
+ end
+
# Internal: Leftovers
def leftovers
end
private
@@ -138,24 +152,25 @@
# rail_env - rails env like development, text, production
# host - domain.dev, domain.com or example.com
#
# Returns nothing
def action_mailer_host(rails_env, host)
- config = "config.action_mailer.default_url_options = { host: '#{host}' }"
+
+ config = <<-RUBY
+ # Mail Setting
+ config.action_mailer.default_url_options = { :host => '#{host}' }
+ RUBY
+
configure_environment(rails_env, config)
end
# Internal: Set configure environment
#
# rail_env - rails env like development, text, production
# config - config string which will add to rails_env file
#
# Return nothing
def configure_environment(rails_env, config)
- inject_into_file(
- "config/environments/#{rails_env}.rb",
- "\n\n #{config}",
- before: "\nend"
- )
+ inject_into_file("config/environments/#{rails_env}.rb", "\n\n #{config}", before: "\nend")
end
end
end