######################################################### # 2012 Marco Mastrodonato(c) # This is a Rails 3.1+ template to use with activeleonardo gem # https://rubygems.org/gems/Activeleonardo # # USAGE: rails new yourappname -m active_template.rb # # ------------------------------------------------------- # ######################################################### puts '*' * 40 puts "* Processing template..." puts '*' * 40 use_git = yes?("Do you use git ?") if use_git git :init file ".gitignore", <<-EOS.gsub(/^ /, '') # See http://help.github.com/ignore-files/ for more about ignoring files. # # If you find yourself ignoring temporary files generated by your text editor # or operating system, you probably want to add a global ignore instead: # git config --global core.excludesfile ~/.gitignore_global # Ignore bundler config /.bundle # Ignore the default SQLite database. /db/*.sqlite3 # Ignore all logfiles and tempfiles. /log/*.log /tmp /nbproject /.idea lib/tasks/files/* /*.cmd /*.dat EOS end gem "activeadmin" gem "meta_search" gem "active_leonardo" gem 'state_machine' if yes?("Do you have to handle states ?") authorization = yes?("Authorization ?") gem 'cancan' if authorization authentication = yes?("Authentication ?") #home = yes?("Generate controller home ? (raccomanded)") home = true if yes?("Bundle install ?") dir = ask(" Insert folder name to install locally: [blank=default gems path]") run "bundle install #{"--path=#{dir}" unless dir.empty?}" end generate "active_admin:install #{authentication ? "User" : "--skip-users"}" if authorization generate "cancan:ability" generate "migration", "AddRolesMaskToUsers", "roles_mask:integer" end generate "leolay", "active", #specify theme (authorization ? "" : "--skip-authorization"), (authentication ? "" : "--skip-authentication"), if home generate "controller", "home", "index" route "root :to => 'home#index'" end File.unlink "public/index.html" rake "db:create:all" rake "db:migrate" rake "db:seed" #rake "gems:unpack" if yes?("Unpack to vendor/gems ?") git :add => ".", :commit => "-m 'initial commit'" if use_git puts "ENJOY!"