lib/cany/recipes/rails.rb in cany-0.0.2 vs lib/cany/recipes/rails.rb in cany-0.1.0

- old
+ new

@@ -1,22 +1,39 @@ module Cany module Recipes class Rails < Recipe register_as :rails + hook :env + class DSL < Recipe::DSL + delegate :compile_assets + end + + attr_accessor :compile_assets + + def initialize(*args) + @compile_assets = true + super + end + def clean rmtree 'tmp', 'public/assets' inner.clean end + def prepare + recipe(:bundler).configure :env_vars, RAILS_ENV: 'production' + end + def build - ENV['RAILS_ENV'] = 'assets' - ruby_bin 'bundle', 'exec', 'rake', 'assets:precompile' + run_hook :env, :before ENV['RAILS_ENV'] = 'production' + ruby_bin 'bundle', 'exec', 'rake', 'assets:precompile' if compile_assets inner.build end def binary + run_hook :env, :after %w(app config.ru db Gemfile Gemfile.lock lib public Rakefile vendor).each do |item| install item, "/usr/share/#{spec.name}" if File.exists? item end Dir.foreach('config') do |entry|