templates/somatics.rb in somatics3-generators-0.0.9 vs templates/somatics.rb in somatics3-generators-0.0.10
- old
+ new
@@ -1,151 +1,106 @@
# somatics.rb
#
# repo_entered = ask 'Type your repository for the project (SVN), followed by [ENTER]:'
+app_name = ARGV[0]
+
+puts " Somatics going to bootstrap your new #{app_name.humanize} App..."
+puts " Any problems? See https://github.com/inspiresynergy/somatics3-generator"
+
+
+#----------------------------------------------------------------------------
+# Set up git
+#----------------------------------------------------------------------------
+puts " setting up source control with 'git'..."
+# specific to Mac OS X
+append_file '.gitignore' do
+ '.DS_Store'
+end
+git :init
+git :add => '.'
+git :commit => "-m 'Initial commit of unmodified new Rails app'"
+
+#----------------------------------------------------------------------------
+# Add Somatics Required Gems and plugins
+#----------------------------------------------------------------------------
+
gem 'will_paginate', :version => "~> 3.0.pre2"
-gem 'prawn', :version => '0.6.3'
gem 'somatics3-generators', :group => :development
gem 'json'
+gem 'meta_search'
+gem 'paper_trail'
+gem 'tiny_mce'
+gem 'devise'
-plugin 'action_mailer_optional_tls',
- :git => 'git://github.com/collectiveidea/action_mailer_optional_tls.git'
+puts " installing gems (takes a few minutes!)..."
+run 'bundle install'
+
plugin 'faster_csv',
:git => 'git://github.com/circle/fastercsv.git'
-plugin 'prawnto',
- :git => 'git://github.com/thorny-sun/prawnto.git'
-plugin 'redmine_filter',
- :git => 'git://github.com/inspiresynergy/redmine_filter.git'
-plugin 'restful_authentication',
- :git => 'git://github.com/Satish/restful-authentication.git'
- # :git => 'git://github.com/technoweenie/restful-authentication.git'
-# plugin 'somatics_generator',
-# :git => 'git://github.com/inspiresynergy/somatics_generator.git'
-# theme_support break my rails 2.3.5
-# http://inspiresynergy.lighthouseapp.com/projects/53315-somatics/tickets/14-theme_support-break-my-rails-235
- # plugin 'theme_support',
- # :git => 'git://github.com/aussiegeek/theme_support.git'
-plugin 'tinymce_hammer',
- :git => 'git://github.com/trevorrowe/tinymce_hammer.git'
+plugin 'somatics_filter',
+ :git => 'git://github.com/inspiresynergy/somatics_filter.git'
plugin 'to_xls',
:git => 'git://github.com/arydjmal/to_xls.git'
plugin 'dynamic_form',
:git => 'git://github.com/rails/dynamic_form.git'
+plugin 'calendar_date_select',
+ :git => 'git://github.com/timcharper/calendar_date_select.git'
-rakefile "setup_svn.rake" do
- <<-TASK
-desc "Configure Subversion for Rails"
-task :setup_svn do
- system "svn info"
- if $? != 0
- puts 'Please Import your project to svn before executing this task'
- exit(0)
- end
-
- system "svn commit -m 'initial commit'"
-
- puts "Add .gems"
- system "svn add .gems"
- system "svn commit -m 'add .gems'"
-
- puts "Add .gitignore"
- system "echo '.svn' > .gitignore"
- system "svn add .gitignore"
- system "svn commit -m 'add .gitignore'"
-
- puts "Ignoring .git"
- system "svn propset svn:ignore '.git' ."
-
- puts "Removing /log"
- system "svn remove log/*"
- system "svn commit -m 'removing all log files from subversion'"
- system 'svn propset svn:ignore "*.log" log/'
- system "svn update log/"
- system "svn commit -m 'Ignoring all files in /log/ ending in .log'"
+#----------------------------------------------------------------------------
+# Tweak config/application.rb
+#----------------------------------------------------------------------------
+environment 'config.autoload_paths += %W(#{config.root}/lib)'
- puts "Ignoring /db"
- system 'svn propset svn:ignore "*.db" db/'
- system "svn update db/"
- system "svn commit -m 'Ignoring all files in /db/ ending in .db'"
+#----------------------------------------------------------------------------
+# Remove the usual cruft
+#----------------------------------------------------------------------------
+puts " removing unneeded files..."
+run 'rm public/index.html'
+run 'rm public/favicon.ico'
+run 'rm public/images/rails.png'
+run 'rm README'
+run 'touch README'
- puts "Renaming database.yml database.example"
- system "svn move config/database.yml config/database.example"
- system "svn commit -m 'Moving database.yml to database.example to provide a template for anyone who checks out the code'"
- system 'svn propset svn:ignore "database.yml" config/'
- system "svn update config/"
- system "svn commit -m 'Ignoring database.yml'"
+puts " banning spiders from your site by changing robots.txt..."
+gsub_file 'public/robots.txt', /# User-Agent/, 'User-Agent'
+gsub_file 'public/robots.txt', /# Disallow/, 'Disallow'
- puts "Ignoring /tmp"
- system 'svn propset svn:ignore "*" tmp/'
- system "svn update tmp/"
- system "svn commit -m 'Ignoring all files in /tmp/'"
+#----------------------------------------------------------------------------
+# Generate Required Assets
+#----------------------------------------------------------------------------
- puts "Ignoring /doc"
- system 'svn propset svn:ignore "*" doc/'
- system "svn update doc/"
- system "svn commit -m 'Ignoring all files in /doc/'"
-end
- TASK
-end
-
generate "somatics:install"
-# generate "tinymce_installation"
-
-environment 'config.autoload_paths += %W(#{config.root}/lib)'
-generate "somatics:authenticated user"
-generate "somatics:authenticated_controller admin/user --model=User"
-
+generate "devise:install"
+generate 'paper_trail'
+generate "somatics:authenticated user --namespace=admin"
generate "somatics:settings"
+#----------------------------------------------------------------------------
+# Create and Migrate the Database
+#----------------------------------------------------------------------------
+
+puts " create and migrate the database"
rake "db:create"
rake "db:migrate"
+rake "db:seed"
-if yes?(%(Create Default Admin User (username:admin, password:somatics)?))
+#----------------------------------------------------------------------------
+# Create a default user
+#----------------------------------------------------------------------------
+
+if yes?(%(Create Default Admin User (email:admin@somatics.com, password:somatics)?))
rake "somatics:create_user"
else
- puts "You can run rake somatics:create_user to create default user"
+ puts " You can run rake somatics:create_user to create default user"
end
-# Delete unnecessary files
-run "rm README"
-# run "rm public/index.html"
+#----------------------------------------------------------------------------
+# Finish up
+#----------------------------------------------------------------------------
-app_name = ARGV[0]
-
-# Commit all work so far to the local repository
-git :init
+puts " checking everything into git..."
git :add => '.'
-git :commit => "-a -m 'Initial commit'"
+git :commit => "-m 'modified Rails app to use Somatics'"
-rakefile "heroku.rake" do
- <<-TASK
-namespace :heroku do
- desc "Configure Heroku"
- task :setup do
- system "heroku create #{app_name}"
- system "git add ."
- system "git commit -a -m 'Initial Commit'"
- # system "heroku addons:add cron:daily"
- system "heroku addons:add deployhooks:email \
- recipient=heroku@inspiresynergy.com \
- subject='[#{app_name}] Deployed' \
- body='{{user}} deployed #{app_name} successfully'"
- system "heroku addons:add piggyback_ssl"
- system "heroku addons:add newrelic:bronze"
- end
-
- desc "Deploy to Heroku"
- task :deploy do
- system "git add ."
- system "git commit -a -m 'Heroku Release'"
- system "git push heroku master"
- end
-
- desc "Deploy and Migrate to Heroku"
- task :deploy_migrate => :deploy do
- system "heroku rake db:migrate"
- end
-
-end
- TASK
-end
+puts " Done setting up your Rails app with Somatics."