Class: Cany::Recipes::Rails

Inherits:
Cany::Recipe show all
Defined in:
lib/cany/recipes/rails.rb

Instance Attribute Summary

Attributes inherited from Cany::Recipe

#inner, #spec

Instance Method Summary collapse

Methods inherited from Cany::Recipe

#exec, from_name, #initialize, #install, #install_content, #install_dir, #install_link, register_as, #rmtree, #ruby_bin

Constructor Details

This class inherits a constructor from Cany::Recipe

Instance Method Details

#binaryObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/cany/recipes/rails.rb', line 18

def binary
  %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|
    next if %w(. ..).include? entry
    install File.join('config', entry), "/etc/#{spec.name}"
  end
  install_link "/etc/#{spec.name}", "/usr/share/#{spec.name}/config"

  install_dir "/etc/#{spec.name}"
  install_dir "/var/tmp/#{spec.name}"
  install_dir "/var/log/#{spec.name}"

  install_link "/var/log/#{spec.name}", "/usr/share/#{spec.name}/log"
  install_link "/var/tmp/#{spec.name}", "/usr/share/#{spec.name}/tmp"
  inner.binary
end

#buildObject



11
12
13
14
15
16
# File 'lib/cany/recipes/rails.rb', line 11

def build
  ENV['RAILS_ENV'] = 'assets'
  ruby_bin 'bundle', 'exec', 'rake', 'assets:precompile'
  ENV['RAILS_ENV'] = 'production'
  inner.build
end

#cleanObject



6
7
8
9
# File 'lib/cany/recipes/rails.rb', line 6

def clean
  rmtree 'tmp', 'public/assets'
  inner.clean
end