Sha256: 9f93299624e0e79a49712746a989dd7313c2da13e9e2e48c50da4651627d8964

Contents?: true

Size: 1.78 KB

Versions: 5

Compression:

Stored size: 1.78 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 english_localizations
      generate "fullstack:locale en"
    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.19 lib/generators/fullstack/install_generator.rb
fullstack-0.1.18 lib/generators/fullstack/install_generator.rb
fullstack-0.1.17 lib/generators/fullstack/install_generator.rb
fullstack-0.1.16 lib/generators/fullstack/install_generator.rb
fullstack-0.1.15 lib/generators/fullstack/install_generator.rb