Sha256: 3875399979f3ce711d8e503f215b00bc52a831c0b8da1f306156a5602ed3b519

Contents?: true

Size: 1.71 KB

Versions: 3

Compression:

Stored size: 1.71 KB

Contents

module Fullstack
  class InstallGenerator < Rails::Generators::Base
    source_root File.expand_path('../templates', __FILE__)

    
    # These options are for levels above to completely customize stubs generated by fullstack    
    class_option :host, :default => "remotehost"
    class_option :user, :default => "ror"
    class_option :title, :default => "title"
    class_option :slogan, :default => "slogan"

    # Copy fullstack templates
    def fullstack_templates
      directory "config", Rails.root.join("config")
      empty_directory Rails.root.join("lib/support")
    end
    
    def install_devise
      generate "devise:install"
      gsub_file('config/initializers/devise.rb', "\"please-change-me-at-config-initializers-devise@example.com\"", "Settings.app.email")
      generate "remoting:install --host='#{host}' --user='#{user}'"
    end
        
    def gitignore
      append_to_file '.gitignore' do
<<-eos
.DS_Store
/public/uploads
/public/attachments
/public/assets
*.tmproj
tmtags

eos
      end
    end
  
    def action_mailer
      inject_into_file("config/environments/production.rb",  :after => "Application.configure do\n") do
<<-eos

  config.action_mailer.default_url_options = { :host => Settings.app.host }
  config.action_mailer.delivery_method = :sendmail
  config.action_mailer.raise_delivery_errors = false

eos
      end
    end
    
    protected
      
    def host
      options[:host]
    end
    
    def user
       options[:user]
    end
    
    def app
      Rails.application.class.to_s.split("::").first.underscore      
    end
    
    def email
      "info@#{host}"
    end
    
    def title
      options[:title]      
    end
    
    def slogan
      options[:slogan]
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fullstack-0.1.22 lib/generators/fullstack/install_generator.rb
fullstack-0.1.21 lib/generators/fullstack/install_generator.rb
fullstack-0.1.20 lib/generators/fullstack/install_generator.rb