jumpstart 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.bundle/config +2 -0
- data/.document +5 -0
- data/.gitignore +28 -0
- data/Gemfile +8 -0
- data/LICENSE +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +54 -0
- data/VERSION +1 -0
- data/bin/jumpstart +5 -0
- data/config/jumpstart_setup.yml +2 -0
- data/jumpstart.gemspec +222 -0
- data/jumpstart_templates/i0n_rails_3/.gitignore +11 -0
- data/jumpstart_templates/i0n_rails_3/_._Gemfile +5 -0
- data/jumpstart_templates/i0n_rails_3/app/views/home/index.haml +4 -0
- data/jumpstart_templates/i0n_rails_3/app/views/layouts/application.haml +32 -0
- data/jumpstart_templates/i0n_rails_3/config/_2._routes.rb +1 -0
- data/jumpstart_templates/i0n_rails_3/config/_L._database.yml +1 -0
- data/jumpstart_templates/i0n_rails_3/config/deploy.rb +62 -0
- data/jumpstart_templates/i0n_rails_3/config/environments/_18._development.rb +5 -0
- data/jumpstart_templates/i0n_rails_3/config/environments/_27._test.rb +1 -0
- data/jumpstart_templates/i0n_rails_3/config/environments/_41._production.rb +3 -0
- data/jumpstart_templates/i0n_rails_3/config/initializers/setup_mail.rb +14 -0
- data/jumpstart_templates/i0n_rails_3/jumpstart_config/i0n_rails_3.yml +40 -0
- data/jumpstart_templates/i0n_rails_3/jumpstart_config/nginx.local.conf +11 -0
- data/jumpstart_templates/i0n_rails_3/jumpstart_config/nginx.remote.conf +37 -0
- data/jumpstart_templates/i0n_rails_3/lib/development_mail_interceptor.rb +8 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/authlogic.rb +11 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/authlogic/session/session_generator.rb +18 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/authlogic/session/templates/session.rb +2 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper.rb +80 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/migration/migration_generator.rb +26 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/migration/templates/migration.rb +21 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/model/model_generator.rb +29 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/model/templates/migration.rb +17 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/model/templates/model.rb +10 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/observer/observer_generator.rb +15 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/observer/templates/observer.rb +5 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/factory_girl.rb +11 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/factory_girl/model/model_generator.rb +14 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/factory_girl/model/templates/fixtures.rb +7 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb.rb +9 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/USAGE +8 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/controller/controller_generator.rb +24 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/controller/templates/view.html.erb +0 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/scaffold_generator.rb +27 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/templates/_form.html.erb +12 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/templates/edit.html.erb +6 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/templates/index.html.erb +27 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/templates/layout.html.erb +16 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/templates/new.html.erb +5 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/templates/show.html.erb +10 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml.rb +9 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/USAGE +8 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/controller/controller_generator.rb +24 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/controller/templates/view.html.haml +0 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/scaffold/scaffold_generator.rb +23 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/scaffold/templates/_form.haml.erb +9 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/scaffold/templates/edit.haml.erb +7 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/scaffold/templates/index.haml.erb +23 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/scaffold/templates/layout.haml.erb +9 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/scaffold/templates/new.haml.erb +5 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/scaffold/templates/show.haml.erb +9 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml.rb +9 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/controller/controller_generator.rb +24 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/controller/templates/view.html.haml +0 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/scaffold/scaffold_generator.rb +26 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/scaffold/templates/_form.haml.erb +9 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/scaffold/templates/edit.haml.erb +7 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/scaffold/templates/index.haml.erb +23 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/scaffold/templates/layout.haml.erb +9 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/scaffold/templates/new.haml.erb +5 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/scaffold/templates/show.haml.erb +9 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/machinist.rb +11 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/machinist/model/model_generator.rb +19 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/machinist/model/templates/blueprint.rb +5 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/machinist/model/templates/machinist_initializer.rb +19 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/mongomapper.rb +80 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/mongomapper/model/model_generator.rb +29 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/mongomapper/model/templates/model.rb +24 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/mongomapper/observer/observer_generator.rb +15 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/shoulda.rb +11 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/shoulda/controller/controller_generator.rb +16 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/shoulda/controller/templates/controller.rb +84 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/shoulda/model/model_generator.rb +16 -0
- data/jumpstart_templates/i0n_rails_3/lib/generators/shoulda/model/templates/model.rb +7 -0
- data/jumpstart_templates/i0n_rails_3/lib/tasks/populate.rake +91 -0
- data/jumpstart_templates/i0n_rails_3/public/javascripts/init.js +6 -0
- data/jumpstart_templates/i0n_rails_3/public/javascripts/jquery-1.4.2.min.js +154 -0
- data/jumpstart_templates/i0n_rails_3/public/javascripts/jquery-ui-1.8.custom.min.js +404 -0
- data/jumpstart_templates/i0n_rails_3/public/javascripts/rails.js +126 -0
- data/jumpstart_templates/i0n_rails_3/public/stylesheets/sass/_setup.sass +86 -0
- data/jumpstart_templates/i0n_rails_3/public/stylesheets/sass/global.sass +58 -0
- data/jumpstart_templates/i0n_rails_3/public/stylesheets/sass/handheld.sass +7 -0
- data/jumpstart_templates/i0n_rails_3/public/stylesheets/sass/ie.sass +40 -0
- data/jumpstart_templates/i0n_rails_3/public/stylesheets/sass/print.sass +57 -0
- data/jumpstart_templates/i0n_rails_3/public/stylesheets/sass/screen.sass +170 -0
- data/lib/jumpstart.rb +71 -0
- data/lib/jumpstart/base.rb +547 -0
- data/lib/jumpstart/doc/JumpStart.html +139 -0
- data/lib/jumpstart/doc/JumpStart/Base.html +1566 -0
- data/lib/jumpstart/doc/base_rb.html +52 -0
- data/lib/jumpstart/doc/created.rid +2 -0
- data/lib/jumpstart/doc/index.html +101 -0
- data/lib/jumpstart/doc/rdoc.css +706 -0
- data/lib/jumpstart/filetools.rb +270 -0
- data/source_templates/template_config.yml +77 -0
- data/test/fake_nginx_path/local_nginx_1.conf +81 -0
- data/test/fake_nginx_path/remote_nginx_1.conf +54 -0
- data/test/helper.rb +31 -0
- data/test/jumpstart/test_base.rb +422 -0
- data/test/jumpstart/test_filetools.rb +350 -0
- data/test/test_jumpstart.rb +9 -0
- data/test/test_jumpstart_templates/test_base/_._test_file.txt +0 -0
- data/test/test_jumpstart_templates/test_base/_._test_file_.txt +0 -0
- data/test/test_jumpstart_templates/test_base/_1._test_file1.txt +0 -0
- data/test/test_jumpstart_templates/test_base/_1._test_file1_.txt +0 -0
- data/test/test_jumpstart_templates/test_base/_10._test_file2.txt +0 -0
- data/test/test_jumpstart_templates/test_base/_99999._test_file3.txt +0 -0
- data/test/test_jumpstart_templates/test_base/_a._test_file4.txt +0 -0
- data/test/test_jumpstart_templates/test_base/test_file +0 -0
- data/test/test_jumpstart_templates/test_base/test_file5.txt +0 -0
- data/test/test_jumpstart_templates/test_base/test_file_.6txt +0 -0
- data/test/test_jumpstart_templates/test_fileutils/append_after_line_test.txt +6 -0
- data/test/test_jumpstart_templates/test_fileutils/append_to_end_of_file_source.txt +1 -0
- data/test/test_jumpstart_templates/test_fileutils/append_to_end_of_file_test.txt +5 -0
- data/test/test_jumpstart_templates/test_fileutils/check_source_type +5 -0
- data/test/test_jumpstart_templates/test_fileutils/check_source_type.txt +10 -0
- data/test/test_jumpstart_templates/test_fileutils/config_capistrano_source.rb +62 -0
- data/test/test_jumpstart_templates/test_fileutils/config_capistrano_test.rb +62 -0
- data/test/test_jumpstart_templates/test_fileutils/config_nginx_source.txt +1 -0
- data/test/test_jumpstart_templates/test_fileutils/config_nginx_test.txt +82 -0
- data/test/test_jumpstart_templates/test_fileutils/hosts_test +11 -0
- data/test/test_jumpstart_templates/test_fileutils/insert_text_at_line_number_source.txt +1 -0
- data/test/test_jumpstart_templates/test_fileutils/insert_text_at_line_number_test.txt +4 -0
- data/test/test_jumpstart_templates/test_fileutils/remove_files_test_2.txt +0 -0
- data/test/test_jumpstart_templates/test_fileutils/remove_files_test_3.txt +0 -0
- data/test/test_jumpstart_templates/test_fileutils/remove_lines_test.txt +10 -0
- data/test/test_jumpstart_templates/test_fileutils/replace_strings_test.rb +62 -0
- data/test/test_jumpstart_templates/test_template_1/_._test_append_file_with_extension.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/_._test_append_file_without_extension +1 -0
- data/test/test_jumpstart_templates/test_template_1/_20._test_line_file_without_extension +1 -0
- data/test/test_jumpstart_templates/test_template_1/_5._test_line_file_with_extension.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/_L._test_append_to_end_of_file_remove_last_line_1.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/_l._test_append_to_end_of_file_remove_last_line_2.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/folder with spaces/_._test_append_file_with_extension.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/folder with spaces/_._test_append_file_without_extension +1 -0
- data/test/test_jumpstart_templates/test_template_1/folder with spaces/_5._test_line_file_with_extension.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/folder with spaces/_50._test_line_file_without_extension +1 -0
- data/test/test_jumpstart_templates/test_template_1/folder with spaces/test_whole_file_with_extension.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/folder with spaces/test_whole_file_without_extension +1 -0
- data/test/test_jumpstart_templates/test_template_1/jumpstart_config/test_template_1.yml +31 -0
- data/test/test_jumpstart_templates/test_template_1/normal_folder_name/_._test_append_file_with_extension.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/normal_folder_name/_._test_append_file_without_extension +1 -0
- data/test/test_jumpstart_templates/test_template_1/normal_folder_name/_5._test_line_file_with_extension.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/normal_folder_name/_50._test_line_file_without_extension +1 -0
- data/test/test_jumpstart_templates/test_template_1/normal_folder_name/test_whole_file_with_extension.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/normal_folder_name/test_whole_file_without_extension +1 -0
- data/test/test_jumpstart_templates/test_template_1/test_append_to_end_of_file_remove_last_line_1.txt +10 -0
- data/test/test_jumpstart_templates/test_template_1/test_append_to_end_of_file_remove_last_line_2.txt +10 -0
- data/test/test_jumpstart_templates/test_template_1/test_remove_files/file_with_extension.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/test_remove_files/file_without_extension +1 -0
- data/test/test_jumpstart_templates/test_template_1/test_replace_strings/replace_strings_1.rb +62 -0
- data/test/test_jumpstart_templates/test_template_1/test_replace_strings/replace_strings_2.txt +23 -0
- data/test/test_jumpstart_templates/test_template_1/test_whole_file_with_extension.txt +1 -0
- data/test/test_jumpstart_templates/test_template_1/test_whole_file_without_extension +1 -0
- data/test/test_jumpstart_templates/test_template_2/jumpstart_config/test_template_2.yml +8 -0
- data/test/test_jumpstart_templates/test_template_3/jumpstart_config/test_template_3.yml +22 -0
- metadata +254 -0
@@ -0,0 +1 @@
|
|
1
|
+
root :to => 'home#index'
|
@@ -0,0 +1 @@
|
|
1
|
+
socket: /var/run/mysqld/mysqld.sock
|
@@ -0,0 +1,62 @@
|
|
1
|
+
set :application, 'PROJECT_NAME'
|
2
|
+
set :domain, 'REMOTE_SERVER'
|
3
|
+
set :user, 'i0n'
|
4
|
+
|
5
|
+
set :repository, "#{user}@#{domain}:/home/#{user}/git/#{application}.git"
|
6
|
+
|
7
|
+
role :app, domain # This may be the same as the `Web` server
|
8
|
+
role :web, domain # Your HTTP server, Apache/etc
|
9
|
+
role :db, domain , :primary => true # This is where Rails migrations will run
|
10
|
+
|
11
|
+
set :scm_verbose, true
|
12
|
+
|
13
|
+
set :scm, :git
|
14
|
+
set :scm_username, user
|
15
|
+
set :runner, user
|
16
|
+
set :use_sudo, false
|
17
|
+
set :branch, "master"
|
18
|
+
set :deploy_via, :checkout
|
19
|
+
set :git_shallow_clone, 1
|
20
|
+
set :deploy_to, "/home/#{user}/sites/#{application}"
|
21
|
+
default_run_options[:pty] = true
|
22
|
+
|
23
|
+
namespace :deploy do
|
24
|
+
#task which causes Passenger to initiate a restart
|
25
|
+
task :restart do
|
26
|
+
run "mkdir -p #{release_path}/tmp && touch #{release_path}/tmp/restart.txt"
|
27
|
+
end
|
28
|
+
|
29
|
+
namespace :db do
|
30
|
+
|
31
|
+
desc "Create database for the production environment using the servers rake db:setup task.\n Loads the schema, and initializes with the seed data"
|
32
|
+
task :setup do
|
33
|
+
run "cd #{current_path}; rake db:setup RAILS_ENV=production"
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "Populates the production database using lib/tasks/populate which I will use as my own internal convention for this process"
|
37
|
+
task :populate do
|
38
|
+
run "cd #{current_path}; rake db:populate RAILS_ENV=production"
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "Task to set up the remote Nginx server for app deployment"
|
44
|
+
task :nginx do
|
45
|
+
run "#{sudo} nginx_auto_config /usr/local/bin/nginx.remote.conf /opt/nginx/conf/nginx.conf PROJECT_NAME"
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "Create bare remote git repo then add remote origin to local git repo and push to remote"
|
49
|
+
task :git do
|
50
|
+
run "cd /home/#{user}/git; mkdir #{application}.git; cd #{application}.git; git init --bare"
|
51
|
+
`git remote add origin ssh://#{user}@#{domain}/~/git/#{application}.git`
|
52
|
+
`git push origin master`
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
# Reminder of default actions for cap deploy:
|
58
|
+
# deploy:update_code
|
59
|
+
# deploy:symlink
|
60
|
+
# deploy:restart
|
61
|
+
|
62
|
+
# eg: after 'deploy:symlink', 'deploy:restart'
|
@@ -0,0 +1,5 @@
|
|
1
|
+
config.action_mailer.default_url_options = {:host => "PROJECT_NAME.local"}
|
2
|
+
|
3
|
+
# Remember that sending email through local postfix/sendmail will not work when trying to deliver directly to a googlemail address.
|
4
|
+
# Use an alternative address that forwards to googlemail
|
5
|
+
config.action_mailer.delivery_method = :sendmail
|
@@ -0,0 +1 @@
|
|
1
|
+
config.action_mailer.default_url_options = { :host => "PROJECT_NAME.local" }
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Settings for using gmail in development
|
2
|
+
|
3
|
+
# ActionMailer::Base.smtp_settings = {
|
4
|
+
# :address => "smtp.gmail.com",
|
5
|
+
# :port => 587,
|
6
|
+
# :domain => 'gmail.com',
|
7
|
+
# :user_name => 'user_name_goes_here',
|
8
|
+
# :password => 'password_goes_here',
|
9
|
+
# :authentication => 'plain',
|
10
|
+
# :enable_starttls_auto => true
|
11
|
+
# }
|
12
|
+
|
13
|
+
# Sets up an interceptor in lib/development_mail_interceptor.rb that redirects all mail to a specific address in development
|
14
|
+
ActionMailer::Base.register_interceptor(DevelopmentMailInterceptor) if Rails.env.development?
|
@@ -0,0 +1,40 @@
|
|
1
|
+
---
|
2
|
+
|
3
|
+
:install_path: /Users/i0n/Sites
|
4
|
+
|
5
|
+
:install_command: rails
|
6
|
+
:install_command_args: -d mysql -J -T
|
7
|
+
|
8
|
+
:run_after_install_command:
|
9
|
+
- rails g controller home
|
10
|
+
|
11
|
+
:remove_files:
|
12
|
+
- /app/views/layouts/application.html.erb
|
13
|
+
- /public/index.html
|
14
|
+
- /public/favicon.ico
|
15
|
+
- /public/images/rails.png
|
16
|
+
|
17
|
+
:run_after_jumpstart:
|
18
|
+
- rake db:create
|
19
|
+
- capify .
|
20
|
+
- git init
|
21
|
+
- git add .
|
22
|
+
- git commit -q -v -a -m "Initial commit"
|
23
|
+
|
24
|
+
:replace_strings:
|
25
|
+
- :target_path: /config/deploy.rb
|
26
|
+
:symbols:
|
27
|
+
:project_name: name_of_my_app
|
28
|
+
:remote_server: thoughtplant
|
29
|
+
- :target_path: /config/environments/development.rb
|
30
|
+
:symbols:
|
31
|
+
:project_name: name_of_my_app
|
32
|
+
- :target_path: /config/environments/test.rb
|
33
|
+
:symbols:
|
34
|
+
:project_name: name_of_my_app
|
35
|
+
- :target_path: /config/environments/production.rb
|
36
|
+
:symbols:
|
37
|
+
:project_name: name_of_my_app
|
38
|
+
|
39
|
+
:local_nginx_conf: /usr/local/nginx/conf/nginx.conf
|
40
|
+
:remote_nginx_conf: /opt/nginx/conf/nginx.conf
|
@@ -0,0 +1,37 @@
|
|
1
|
+
server {
|
2
|
+
listen 80;
|
3
|
+
server_name #{app_name}.com;
|
4
|
+
rails_env production;
|
5
|
+
gzip on;
|
6
|
+
gzip_proxied any;
|
7
|
+
gzip_vary on;
|
8
|
+
gzip_disable 'MSIE [1-6]\.';
|
9
|
+
gzip_http_version 1.1;
|
10
|
+
gzip_min_length 10;
|
11
|
+
gzip_comp_level 9;
|
12
|
+
gzip_types text/plain application/xhtml+xml text/css application/x-javascript text/xml application/xml;
|
13
|
+
location / {
|
14
|
+
root /home/i0n/sites/#{app_name}/current/public/;
|
15
|
+
passenger_enabled on;
|
16
|
+
if ($request_filename ~ '.+\.(jpg|jpeg|gif|css|png|js|ico|html)$') { access_log off; expires 30d; }
|
17
|
+
}
|
18
|
+
}
|
19
|
+
server {
|
20
|
+
listen 80;
|
21
|
+
server_name www.#{app_name}.com;
|
22
|
+
rewrite ^ http://#{app_name}.com$request_uri?;
|
23
|
+
rails_env production;
|
24
|
+
gzip on;
|
25
|
+
gzip_proxied any;
|
26
|
+
gzip_vary on;
|
27
|
+
gzip_disable 'MSIE [1-6]\.';
|
28
|
+
gzip_http_version 1.1;
|
29
|
+
gzip_min_length 10;
|
30
|
+
gzip_comp_level 9;
|
31
|
+
gzip_types text/plain application/xhtml+xml text/css application/x-javascript text/xml application/xml;
|
32
|
+
location / {
|
33
|
+
root /home/i0n/sites/#{app_name}/current/public/;
|
34
|
+
passenger_enabled on;
|
35
|
+
if ($request_filename ~ '.+\.(jpg|jpeg|gif|css|png|js|ico|html)$') { access_log off; expires 30d; }
|
36
|
+
}
|
37
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'rails/generators/named_base'
|
2
|
+
|
3
|
+
module Authlogic
|
4
|
+
module Generators
|
5
|
+
class Base < Rails::Generators::NamedBase
|
6
|
+
def self.source_root
|
7
|
+
@_authlogic_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'authlogic', generator_name, 'templates'))
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'generators/authlogic'
|
2
|
+
|
3
|
+
module Authlogic
|
4
|
+
module Generators
|
5
|
+
class SessionGenerator < Base
|
6
|
+
desc "Builds an Authlogic session model"
|
7
|
+
|
8
|
+
check_class_collision
|
9
|
+
|
10
|
+
def create_session_file
|
11
|
+
template 'session.rb', File.join('app', 'models', class_path, "#{file_name}.rb")
|
12
|
+
end
|
13
|
+
|
14
|
+
hook_for :test_framework
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'rails/generators/named_base'
|
2
|
+
require 'rails/generators/migration'
|
3
|
+
require 'rails/generators/active_model'
|
4
|
+
|
5
|
+
module Datamapper
|
6
|
+
module Generators
|
7
|
+
class Base < Rails::Generators::NamedBase #:nodoc:
|
8
|
+
include Rails::Generators::Migration
|
9
|
+
|
10
|
+
def self.source_root
|
11
|
+
@_datamapper_source_root ||= File.expand_path(File.join(File.dirname(__FILE__),
|
12
|
+
'datamapper', generator_name, 'templates'))
|
13
|
+
end
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
# Datamapper does not care if migrations have the same name as long as
|
18
|
+
# they have different ids.
|
19
|
+
#
|
20
|
+
def migration_exists?(dirname, file_name) #:nodoc:
|
21
|
+
false
|
22
|
+
end
|
23
|
+
|
24
|
+
# Implement the required interface for Rails::Generators::Migration.
|
25
|
+
#
|
26
|
+
def next_migration_number(dirname) #:nodoc:
|
27
|
+
if options[:id]
|
28
|
+
"%.3d" % options[:id]
|
29
|
+
else
|
30
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class ActiveModel < Rails::Generators::ActiveModel #:nodoc:
|
36
|
+
def self.all(klass)
|
37
|
+
"#{klass}.all"
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.find(klass, params=nil)
|
41
|
+
"#{klass}.get(#{params})"
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.build(klass, params=nil)
|
45
|
+
if params
|
46
|
+
"#{klass}.new(#{params})"
|
47
|
+
else
|
48
|
+
"#{klass}.new"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def save
|
53
|
+
"#{name}.save"
|
54
|
+
end
|
55
|
+
|
56
|
+
def update_attributes(params=nil)
|
57
|
+
"#{name}.update(#{params})"
|
58
|
+
end
|
59
|
+
|
60
|
+
def errors
|
61
|
+
"#{name}.errors"
|
62
|
+
end
|
63
|
+
|
64
|
+
def destroy
|
65
|
+
"#{name}.destroy"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
module Rails
|
72
|
+
module Generators
|
73
|
+
class GeneratedAttribute #:nodoc:
|
74
|
+
def type_class
|
75
|
+
return 'DateTime' if type.to_s == 'datetime'
|
76
|
+
return type.to_s.camelcase
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/migration/migration_generator.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'generators/datamapper'
|
2
|
+
|
3
|
+
module Datamapper
|
4
|
+
module Generators
|
5
|
+
class MigrationGenerator < Base
|
6
|
+
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
|
7
|
+
class_option :id, :type => :numeric, :desc => "The id to be used in this migration"
|
8
|
+
|
9
|
+
def create_migration_file
|
10
|
+
set_local_assigns!
|
11
|
+
migration_template "migration.rb", "db/migrate/#{file_name}.rb"
|
12
|
+
end
|
13
|
+
|
14
|
+
protected
|
15
|
+
attr_reader :migration_action
|
16
|
+
|
17
|
+
def set_local_assigns!
|
18
|
+
if file_name =~ /^(add|remove|drop)_.*_(?:to|from)_(.*)/
|
19
|
+
@migration_action = $1 == 'add' ? 'add' : 'drop'
|
20
|
+
@table_name = $2.pluralize
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/migration/templates/migration.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
migration <%= migration_number.to_i %>, :<%= migration_file_name %> do
|
2
|
+
up do
|
3
|
+
<% unless attributes.empty? -%>
|
4
|
+
modify_table :<%= table_name %> do
|
5
|
+
<% attributes.each do |attribute| -%>
|
6
|
+
<%= migration_action %>_column :<%= attribute.name %><% if migration_action == 'add' %>, :<%= attribute.type_class %><% end -%>
|
7
|
+
<% end -%>
|
8
|
+
end
|
9
|
+
<% end -%>
|
10
|
+
end
|
11
|
+
|
12
|
+
down do
|
13
|
+
<% unless attributes.empty? -%>
|
14
|
+
modify_table :<%= table_name %> do
|
15
|
+
<% attributes.reverse.each do |attribute| -%>
|
16
|
+
<%= migration_action == 'add' ? 'drop' : 'add' %>_column :<%= attribute.name %><% if migration_action == 'drop' %>, :<%= attribute.type_class %><% end -%>
|
17
|
+
<% end -%>
|
18
|
+
end
|
19
|
+
<% end -%>
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'generators/datamapper'
|
2
|
+
|
3
|
+
module Datamapper
|
4
|
+
module Generators
|
5
|
+
class ModelGenerator < Base
|
6
|
+
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
|
7
|
+
class_option :id, :type => :numeric, :desc => "The id to be used in the migration"
|
8
|
+
|
9
|
+
check_class_collision
|
10
|
+
|
11
|
+
class_option :migration, :type => :boolean
|
12
|
+
class_option :timestamps, :type => :boolean
|
13
|
+
class_option :parent, :type => :string, :desc => "The parent class for the generated model"
|
14
|
+
|
15
|
+
def create_migration_file
|
16
|
+
if options[:migration] && options[:parent].nil?
|
17
|
+
file_name = "create_#{file_path.gsub(/\//, '_').pluralize}"
|
18
|
+
migration_template "migration.rb", "db/migrate/#{file_name}.rb"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def create_model_file
|
23
|
+
template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
|
24
|
+
end
|
25
|
+
|
26
|
+
hook_for :test_framework
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
migration <%= migration_number.to_i %>, :<%= migration_file_name %> do
|
2
|
+
up do
|
3
|
+
create_table :<%= table_name %> do
|
4
|
+
<% attributes.each do |attribute| -%>
|
5
|
+
column :<%= attribute.name -%>, <%= attribute.type_class %>
|
6
|
+
<% end -%>
|
7
|
+
<% if options[:timestamps] %>
|
8
|
+
column :created_at, DateTime
|
9
|
+
column :updated_at, DateTime
|
10
|
+
<% end -%>
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
down do
|
15
|
+
drop_table :<%= table_name %>
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class <%= class_name %><%= "< #{options[:parent].classify}" if options[:parent] %>
|
2
|
+
<% unless options[:parent] -%>
|
3
|
+
include DataMapper::Resource
|
4
|
+
|
5
|
+
property :id, Serial
|
6
|
+
<% end -%>
|
7
|
+
<% attributes.each do |attribute| -%>
|
8
|
+
property :<%= attribute.name %>, <%= attribute.type_class %>
|
9
|
+
<% end -%>
|
10
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'generators/datamapper'
|
2
|
+
|
3
|
+
module Datamapper
|
4
|
+
module Generators
|
5
|
+
class ObserverGenerator < Base
|
6
|
+
check_class_collision :suffix => "Observer"
|
7
|
+
|
8
|
+
def create_observer_file
|
9
|
+
template 'observer.rb', File.join('app/models', class_path, "#{file_name}_observer.rb")
|
10
|
+
end
|
11
|
+
|
12
|
+
hook_for :test_framework
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|