Sha256: e1b2cf3641fdd6d12df327ead6a91d40039856f3d6fae4ac2f1208751f6ea5eb

Contents?: true

Size: 1.88 KB

Versions: 5

Compression:

Stored size: 1.88 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
    
    def avoid_assets_included_twice_in_development
      gsub_file("config/environments/development.rb", "config.assets.debug = true", "config.assets.debug = false")
    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

5 entries across 5 versions & 1 rubygems

Version Path
fullstack-0.1.27 lib/generators/fullstack/install_generator.rb
fullstack-0.1.26 lib/generators/fullstack/install_generator.rb
fullstack-0.1.25 lib/generators/fullstack/install_generator.rb
fullstack-0.1.24 lib/generators/fullstack/install_generator.rb
fullstack-0.1.23 lib/generators/fullstack/install_generator.rb