jumpstart 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/Gemfile +2 -1
- data/VERSION +1 -1
- data/config/jumpstart_setup.yml +1 -0
- data/jumpstart.gemspec +15 -89
- data/jumpstart_templates/{i0n_rails_3/lib/generators/formtastic_erb/controller/templates/view.html.erb → .gitignore} +0 -0
- data/lib/jumpstart.rb +15 -39
- data/lib/jumpstart/base.rb +111 -111
- data/lib/jumpstart/filetools.rb +11 -7
- data/lib/jumpstart/stringtools.rb +41 -0
- data/test/helper.rb +12 -6
- data/test/jumpstart/test_base.rb +848 -106
- data/test/jumpstart/test_filetools.rb +42 -10
- data/test/jumpstart/test_stringutils.rb +67 -0
- data/test/test_jumpstart_templates/test_base/current_files_and_dirs_test_file.txt +1 -0
- data/{jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/controller/templates/view.html.haml → test/test_jumpstart_templates/test_fileutils/sort_contained_files_and_dirs_test/file_1.txt} +0 -0
- data/{jumpstart_templates/i0n_rails_3/lib/generators/haml/controller/templates/view.html.haml → test/test_jumpstart_templates/test_fileutils/sort_contained_files_and_dirs_test/file_2} +0 -0
- data/test/test_jumpstart_templates/test_fileutils/sort_contained_files_and_dirs_test/folder_1/file_3.txt +0 -0
- data/test/test_jumpstart_templates/test_fileutils/sort_contained_files_and_dirs_test/folder_1/folder_2/file_4.txt +0 -0
- data/test/test_jumpstart_templates/test_fileutils/sort_contained_files_and_dirs_test/folder_1/folder_2/folder_3/file_5.txt +0 -0
- data/test/test_jumpstart_templates/test_fileutils/sort_contained_files_and_dirs_test/folder_1/folder_2/folder_4/file_6.txt +0 -0
- data/test/test_jumpstart_templates/test_template_1/_20._test_line_file_without_extension +1 -1
- data/test/test_jumpstart_templates/test_template_2/jumpstart_config/test_template_2.yml +83 -1
- metadata +15 -89
- data/.bundle/config +0 -2
- data/jumpstart_templates/i0n_rails_3/.gitignore +0 -11
- data/jumpstart_templates/i0n_rails_3/_._Gemfile +0 -5
- data/jumpstart_templates/i0n_rails_3/app/views/home/index.haml +0 -4
- data/jumpstart_templates/i0n_rails_3/app/views/layouts/application.haml +0 -32
- data/jumpstart_templates/i0n_rails_3/config/_2._routes.rb +0 -1
- data/jumpstart_templates/i0n_rails_3/config/_L._database.yml +0 -1
- data/jumpstart_templates/i0n_rails_3/config/deploy.rb +0 -62
- data/jumpstart_templates/i0n_rails_3/config/environments/_18._development.rb +0 -5
- data/jumpstart_templates/i0n_rails_3/config/environments/_27._test.rb +0 -1
- data/jumpstart_templates/i0n_rails_3/config/environments/_41._production.rb +0 -3
- data/jumpstart_templates/i0n_rails_3/config/initializers/setup_mail.rb +0 -14
- data/jumpstart_templates/i0n_rails_3/jumpstart_config/i0n_rails_3.yml +0 -40
- data/jumpstart_templates/i0n_rails_3/jumpstart_config/nginx.local.conf +0 -11
- data/jumpstart_templates/i0n_rails_3/jumpstart_config/nginx.remote.conf +0 -37
- data/jumpstart_templates/i0n_rails_3/lib/development_mail_interceptor.rb +0 -8
- data/jumpstart_templates/i0n_rails_3/lib/generators/authlogic.rb +0 -11
- data/jumpstart_templates/i0n_rails_3/lib/generators/authlogic/session/session_generator.rb +0 -18
- data/jumpstart_templates/i0n_rails_3/lib/generators/authlogic/session/templates/session.rb +0 -2
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper.rb +0 -80
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/migration/migration_generator.rb +0 -26
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/migration/templates/migration.rb +0 -21
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/model/model_generator.rb +0 -29
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/model/templates/migration.rb +0 -17
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/model/templates/model.rb +0 -10
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/observer/observer_generator.rb +0 -15
- data/jumpstart_templates/i0n_rails_3/lib/generators/datamapper/observer/templates/observer.rb +0 -5
- data/jumpstart_templates/i0n_rails_3/lib/generators/factory_girl.rb +0 -11
- data/jumpstart_templates/i0n_rails_3/lib/generators/factory_girl/model/model_generator.rb +0 -14
- data/jumpstart_templates/i0n_rails_3/lib/generators/factory_girl/model/templates/fixtures.rb +0 -7
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb.rb +0 -9
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/USAGE +0 -8
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/controller/controller_generator.rb +0 -24
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/scaffold_generator.rb +0 -27
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/templates/_form.html.erb +0 -12
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/templates/edit.html.erb +0 -6
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/templates/index.html.erb +0 -27
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/templates/layout.html.erb +0 -16
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/templates/new.html.erb +0 -5
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_erb/scaffold/templates/show.html.erb +0 -10
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml.rb +0 -9
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/USAGE +0 -8
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/controller/controller_generator.rb +0 -24
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/scaffold/scaffold_generator.rb +0 -23
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/scaffold/templates/_form.haml.erb +0 -9
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/scaffold/templates/edit.haml.erb +0 -7
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/scaffold/templates/index.haml.erb +0 -23
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/scaffold/templates/layout.haml.erb +0 -9
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/scaffold/templates/new.haml.erb +0 -5
- data/jumpstart_templates/i0n_rails_3/lib/generators/formtastic_haml/scaffold/templates/show.haml.erb +0 -9
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml.rb +0 -9
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/controller/controller_generator.rb +0 -24
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/scaffold/scaffold_generator.rb +0 -26
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/scaffold/templates/_form.haml.erb +0 -9
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/scaffold/templates/edit.haml.erb +0 -7
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/scaffold/templates/index.haml.erb +0 -23
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/scaffold/templates/layout.haml.erb +0 -9
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/scaffold/templates/new.haml.erb +0 -5
- data/jumpstart_templates/i0n_rails_3/lib/generators/haml/scaffold/templates/show.haml.erb +0 -9
- data/jumpstart_templates/i0n_rails_3/lib/generators/machinist.rb +0 -11
- data/jumpstart_templates/i0n_rails_3/lib/generators/machinist/model/model_generator.rb +0 -19
- data/jumpstart_templates/i0n_rails_3/lib/generators/machinist/model/templates/blueprint.rb +0 -5
- data/jumpstart_templates/i0n_rails_3/lib/generators/machinist/model/templates/machinist_initializer.rb +0 -19
- data/jumpstart_templates/i0n_rails_3/lib/generators/mongomapper.rb +0 -80
- data/jumpstart_templates/i0n_rails_3/lib/generators/mongomapper/model/model_generator.rb +0 -29
- data/jumpstart_templates/i0n_rails_3/lib/generators/mongomapper/model/templates/model.rb +0 -24
- data/jumpstart_templates/i0n_rails_3/lib/generators/mongomapper/observer/observer_generator.rb +0 -15
- data/jumpstart_templates/i0n_rails_3/lib/generators/shoulda.rb +0 -11
- data/jumpstart_templates/i0n_rails_3/lib/generators/shoulda/controller/controller_generator.rb +0 -16
- data/jumpstart_templates/i0n_rails_3/lib/generators/shoulda/controller/templates/controller.rb +0 -84
- data/jumpstart_templates/i0n_rails_3/lib/generators/shoulda/model/model_generator.rb +0 -16
- data/jumpstart_templates/i0n_rails_3/lib/generators/shoulda/model/templates/model.rb +0 -7
- data/jumpstart_templates/i0n_rails_3/lib/tasks/populate.rake +0 -91
- data/jumpstart_templates/i0n_rails_3/public/javascripts/init.js +0 -6
- data/jumpstart_templates/i0n_rails_3/public/javascripts/jquery-1.4.2.min.js +0 -154
- data/jumpstart_templates/i0n_rails_3/public/javascripts/jquery-ui-1.8.custom.min.js +0 -404
- data/jumpstart_templates/i0n_rails_3/public/javascripts/rails.js +0 -126
- data/jumpstart_templates/i0n_rails_3/public/stylesheets/sass/_setup.sass +0 -86
- data/jumpstart_templates/i0n_rails_3/public/stylesheets/sass/global.sass +0 -58
- data/jumpstart_templates/i0n_rails_3/public/stylesheets/sass/handheld.sass +0 -7
- data/jumpstart_templates/i0n_rails_3/public/stylesheets/sass/ie.sass +0 -40
- data/jumpstart_templates/i0n_rails_3/public/stylesheets/sass/print.sass +0 -57
- data/jumpstart_templates/i0n_rails_3/public/stylesheets/sass/screen.sass +0 -170
data/.bundle/config
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
!!! 5
|
2
|
-
%html
|
3
|
-
%head
|
4
|
-
%meta{ :content => "text/html;charset=UTF-8", "http-equiv" => "content-type" }
|
5
|
-
%meta{:name => 'description', :content => ''}
|
6
|
-
%meta{:name => 'keywords', :content => ''}
|
7
|
-
= csrf_meta_tag
|
8
|
-
%title
|
9
|
-
#{yield :title}
|
10
|
-
= stylesheet_link_tag 'global', :media => :all
|
11
|
-
= stylesheet_link_tag 'screen', :media => :screen
|
12
|
-
= stylesheet_link_tag 'print', :media => :print
|
13
|
-
= stylesheet_link_tag 'handheld', :media => :handheld
|
14
|
-
/
|
15
|
-
[if IE 7]>
|
16
|
-
= stylesheet_link_tag 'ie', :media => 'screen, projection'
|
17
|
-
= stylesheet_link_tag 'print', :media => 'print'
|
18
|
-
<![endif]
|
19
|
-
%body
|
20
|
-
- if flash[:notice] != nil
|
21
|
-
%p{:class => "flash_notice"}
|
22
|
-
= flash[:notice]
|
23
|
-
- elsif flash[:error] != nil
|
24
|
-
%p{:class => "flash_error"}
|
25
|
-
= flash[:error]
|
26
|
-
=yield
|
27
|
-
= javascript_include_tag "jquery-1.4.2.min.js"
|
28
|
-
/ = javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"
|
29
|
-
= javascript_include_tag "jquery-ui-1.8.custom.min.js"
|
30
|
-
/ = javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js"
|
31
|
-
= javascript_include_tag 'rails'
|
32
|
-
= javascript_include_tag "init.js"
|
@@ -1 +0,0 @@
|
|
1
|
-
root :to => 'home#index'
|
@@ -1 +0,0 @@
|
|
1
|
-
socket: /var/run/mysqld/mysqld.sock
|
@@ -1,62 +0,0 @@
|
|
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'
|
@@ -1,5 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
1
|
-
config.action_mailer.default_url_options = { :host => "PROJECT_NAME.local" }
|
@@ -1,14 +0,0 @@
|
|
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?
|
@@ -1,40 +0,0 @@
|
|
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
|
@@ -1,37 +0,0 @@
|
|
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
|
-
}
|
@@ -1,11 +0,0 @@
|
|
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
|
@@ -1,18 +0,0 @@
|
|
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
|
-
|
@@ -1,80 +0,0 @@
|
|
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
DELETED
@@ -1,26 +0,0 @@
|
|
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
DELETED
@@ -1,21 +0,0 @@
|
|
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
|
@@ -1,29 +0,0 @@
|
|
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
|