wheels 0.0.3
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/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.rdoc +17 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/app/controllers/application_controller.rb +17 -0
- data/app/controllers/blogs_controller.rb +17 -0
- data/app/controllers/galleries_controller.rb +60 -0
- data/app/controllers/images_controller.rb +30 -0
- data/app/controllers/profiles_controller.rb +16 -0
- data/app/controllers/users_controller.rb +4 -0
- data/app/models/ability.rb +23 -0
- data/app/models/blog.rb +8 -0
- data/app/models/gallery.rb +5 -0
- data/app/models/image.rb +8 -0
- data/app/models/profile.rb +11 -0
- data/app/models/role.rb +8 -0
- data/app/models/user.rb +43 -0
- data/app/views/blogs/_form.html.haml +28 -0
- data/app/views/blogs/edit.html.haml +8 -0
- data/app/views/blogs/index.html.haml +19 -0
- data/app/views/blogs/index.xml.builder +27 -0
- data/app/views/blogs/new.html.haml +6 -0
- data/app/views/blogs/show.html.haml +10 -0
- data/app/views/galleries/_form.html.haml +29 -0
- data/app/views/galleries/_show.html.haml +21 -0
- data/app/views/galleries/edit.html.haml +7 -0
- data/app/views/galleries/index.html.haml +15 -0
- data/app/views/galleries/new.html.haml +5 -0
- data/app/views/galleries/show.html.haml +4 -0
- data/app/views/images/_form.html.haml +10 -0
- data/app/views/images/create.js.haml +3 -0
- data/app/views/images/destroy.js.haml +3 -0
- data/app/views/images/edit.html.haml +7 -0
- data/app/views/images/edit.js.haml +3 -0
- data/app/views/images/index.html.haml +17 -0
- data/app/views/images/index.js.haml +3 -0
- data/app/views/images/new.html.haml +5 -0
- data/app/views/images/new.js.haml +3 -0
- data/app/views/images/show.html.haml +5 -0
- data/app/views/images/show.js.haml +3 -0
- data/app/views/images/update.js.haml +3 -0
- data/app/views/layouts/image_dialog.html.haml +18 -0
- data/app/views/profiles/_form.html.haml +26 -0
- data/app/views/profiles/edit.html.haml +7 -0
- data/app/views/profiles/index.html.haml +25 -0
- data/app/views/profiles/new.html.haml +5 -0
- data/app/views/profiles/show.html.haml +21 -0
- data/app/views/users/index.html.haml +19 -0
- data/config/amazon_s3.yml +15 -0
- data/db/migrate/add_fields_to_users.rb +28 -0
- data/db/migrate/create_blogs.rb +16 -0
- data/db/migrate/create_galleries.rb +15 -0
- data/db/migrate/create_images.rb +17 -0
- data/db/migrate/create_profiles.rb +24 -0
- data/db/migrate/create_roles.rb +16 -0
- data/init.rb +2 -0
- data/lib/generators/wheels/LICENCE +20 -0
- data/lib/generators/wheels/USAGE +8 -0
- data/lib/generators/wheels/core_extensions.rb +56 -0
- data/lib/generators/wheels/install_generator.rb +25 -0
- data/lib/generators/wheels/recipes/cancan.rb +6 -0
- data/lib/generators/wheels/recipes/cucumber.rb +39 -0
- data/lib/generators/wheels/recipes/default.rb +18 -0
- data/lib/generators/wheels/recipes/design.rb +16 -0
- data/lib/generators/wheels/recipes/devise.rb +8 -0
- data/lib/generators/wheels/recipes/factory_girl.rb +5 -0
- data/lib/generators/wheels/recipes/haml.rb +8 -0
- data/lib/generators/wheels/recipes/jquery.rb +6 -0
- data/lib/generators/wheels/recipes/mongoid.rb +7 -0
- data/lib/generators/wheels/recipes/postgresql.rb +11 -0
- data/lib/generators/wheels/recipes/remarkable.rb +9 -0
- data/lib/generators/wheels/recipes/rspec.rb +23 -0
- data/lib/generators/wheels/recipes/wheels.rb +34 -0
- data/lib/generators/wheels/snippets/cucumber/database_config +3 -0
- data/lib/generators/wheels/templater.rb +29 -0
- data/lib/generators/wheels/templates/cancan/ability.rb +13 -0
- data/lib/generators/wheels/templates/database/postgresql.yml +19 -0
- data/lib/generators/wheels/templates/git/gitignore +8 -0
- data/lib/generators/wheels/templates/haml/app/views/layouts/application.html.haml +9 -0
- data/lib/generators/wheels/templates/mongoid/features/step_definitions/mongoid_steps.rb +4 -0
- data/lib/generators/wheels/templates/mongoid/features/support/hooks.rb +3 -0
- data/lib/generators/wheels/wheels_generator.rb +69 -0
- data/lib/wheels/routes.rb +25 -0
- data/lib/wheels.rb +2 -0
- data/public/404.html +26 -0
- data/public/422.html +26 -0
- data/public/500.html +26 -0
- data/public/favicon.ico +0 -0
- data/public/images/dreamy/Thumbs.db +0 -0
- data/public/images/dreamy/bg-ad-top.png +0 -0
- data/public/images/dreamy/bg-body.png +0 -0
- data/public/images/dreamy/bg-feed.gif +0 -0
- data/public/images/dreamy/bg-footer.jpg +0 -0
- data/public/images/dreamy/bg-header.jpg +0 -0
- data/public/images/dreamy/bg-menu-hover.png +0 -0
- data/public/images/dreamy/bg-menu.png +0 -0
- data/public/images/dreamy/bg-sidebar-bottom.gif +0 -0
- data/public/images/dreamy/button-feed.png +0 -0
- data/public/images/dreamy/icon-comment.png +0 -0
- data/public/images/growl/error.png +0 -0
- data/public/images/growl/growl_bottom.png +0 -0
- data/public/images/growl/growl_repeat.png +0 -0
- data/public/images/growl/growl_top.png +0 -0
- data/public/images/growl/info.png +0 -0
- data/public/images/menu/item-pointer-mover.gif +0 -0
- data/public/images/menu/item-pointer.gif +0 -0
- data/public/images/menu/lava.gif +0 -0
- data/public/images/menu/lava.png +0 -0
- data/public/images/menu/main-bg.png +0 -0
- data/public/images/menu/main-delimiter.png +0 -0
- data/public/javascripts/jquery.growl.js +143 -0
- data/public/javascripts/loadbehind.js +0 -0
- data/public/javascripts/menu.js +247 -0
- data/public/stylesheets/.gitkeep +0 -0
- data/public/stylesheets/dreamy.css +181 -0
- data/public/stylesheets/menu.css +101 -0
- data/public/stylesheets/sass/dreamy.sass +195 -0
- data/public/stylesheets/sass/menu.sass +105 -0
- data/public/stylesheets/scaffold.css +56 -0
- data/public/stylesheets/ui-lightness/images/ui-anim_basic_16x16.gif +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
- data/public/stylesheets/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
- data/public/stylesheets/ui-lightness/jquery-ui-1.8.2.custom.css +359 -0
- data/test/helper.rb +10 -0
- data/test/test_wheels.rb +7 -0
- metadata +220 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
!!! 5
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
= csrf_meta_tag
|
5
|
+
/[if lt IE 9]
|
6
|
+
= javascript_include_tag 'html5'
|
7
|
+
= javascript_include_tag :defaults
|
8
|
+
:javascript
|
9
|
+
$(function(){
|
10
|
+
$('#image_dialog').find('img').click(function(){
|
11
|
+
url = $(this).attr('src');
|
12
|
+
window.opener.CKEDITOR.tools.callFunction( #{params[:CKEditorFuncNum]}, url);
|
13
|
+
window.close();
|
14
|
+
});
|
15
|
+
});
|
16
|
+
%body
|
17
|
+
#image_dialog= yield
|
18
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
= form_for @profile, :url=>{:action=>"update"}, :html=>{:multipart=>true} do |f|
|
2
|
+
-if @profile.errors.any?
|
3
|
+
#errorExplanation
|
4
|
+
%h2= "#{pluralize(@profile.errors.count, "error")} prohibited this profile from being saved:"
|
5
|
+
%ul
|
6
|
+
- @profile.errors.full_messages.each do |msg|
|
7
|
+
%li= msg
|
8
|
+
|
9
|
+
.field
|
10
|
+
= f.label :first_name
|
11
|
+
= f.text_field :first_name
|
12
|
+
.field
|
13
|
+
= f.label :last_name
|
14
|
+
= f.text_field :last_name
|
15
|
+
.field
|
16
|
+
= f.label :alias
|
17
|
+
= f.text_field :alias
|
18
|
+
.field
|
19
|
+
= f.label :about_me
|
20
|
+
= f.text_area :about_me
|
21
|
+
.field
|
22
|
+
= f.label :image
|
23
|
+
= f.file_field :image
|
24
|
+
.actions
|
25
|
+
= f.submit 'Save'
|
26
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
%h1 Listing profiles
|
2
|
+
|
3
|
+
%table
|
4
|
+
%tr
|
5
|
+
%th First name
|
6
|
+
%th Last name
|
7
|
+
%th Alias
|
8
|
+
%th About me
|
9
|
+
%th
|
10
|
+
%th
|
11
|
+
%th
|
12
|
+
|
13
|
+
- @profiles.each do |profile|
|
14
|
+
%tr
|
15
|
+
%td= profile.first_name
|
16
|
+
%td= profile.last_name
|
17
|
+
%td= profile.alias
|
18
|
+
%td= profile.about_me
|
19
|
+
%td= link_to 'Show', profile
|
20
|
+
%td= link_to 'Edit', edit_profile_path(profile)
|
21
|
+
%td= link_to 'Destroy', profile, :confirm => 'Are you sure?', :method => :delete
|
22
|
+
|
23
|
+
%br
|
24
|
+
|
25
|
+
= link_to 'New profile', new_profile_path
|
@@ -0,0 +1,21 @@
|
|
1
|
+
- if @profile.image_file_name
|
2
|
+
= image_tag @profile.image.url(:thumb)
|
3
|
+
- else
|
4
|
+
- if can? :edit, @profile
|
5
|
+
- link_to 'Upload a photo', user_profile_path(@user)
|
6
|
+
%p
|
7
|
+
%b First name:
|
8
|
+
= @profile.first_name
|
9
|
+
%p
|
10
|
+
%b Last name:
|
11
|
+
= @profile.last_name
|
12
|
+
%p
|
13
|
+
%b Alias:
|
14
|
+
= @profile.alias
|
15
|
+
%p
|
16
|
+
%b About me:
|
17
|
+
= @profile.about_me
|
18
|
+
|
19
|
+
- if current_user.try(:id) == @user.id
|
20
|
+
= link_to 'Edit', edit_user_profile_path(@user)
|
21
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
%h1 Users
|
2
|
+
%ul
|
3
|
+
- for user in @users
|
4
|
+
%li
|
5
|
+
%table.no_border
|
6
|
+
%tr
|
7
|
+
%td= link_to user.login, user_profile_path(user)
|
8
|
+
%td= "#{user.first_name} #{user.last_name}"
|
9
|
+
%td!= image_tag user.image.url(:thumb)
|
10
|
+
- if can? :manage, User
|
11
|
+
%td!= link_to 'Edit', edit_user_path(user)
|
12
|
+
%td!= link_to 'Destroy', user, "data-confirm"=>"Really delete #{user.alias}?", :method=>"delete"
|
13
|
+
%td{:id=>user.element_id(:confirm)}
|
14
|
+
- if user.confirmed_at
|
15
|
+
Confirmed
|
16
|
+
- else
|
17
|
+
= form_for user, :remote=>true do |f|
|
18
|
+
= f.hidden_field
|
19
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
development:
|
2
|
+
bucket: <%= bucket %>
|
3
|
+
access_key_id: <%= access_key_id %>
|
4
|
+
secret_access_key: <%= secret_access_key %>
|
5
|
+
|
6
|
+
test:
|
7
|
+
bucket: <%= bucket %>
|
8
|
+
access_key_id: <%= access_key_id %>
|
9
|
+
secret_access_key: <%= secret_access_key %>
|
10
|
+
|
11
|
+
production:
|
12
|
+
bucket: <%= bucket %>
|
13
|
+
access_key_id: <%= access_key_id %>
|
14
|
+
secret_access_key: <%= secret_access_key %>
|
15
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class AddFieldsToUsers < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :users, :confirmation_token, :string
|
4
|
+
add_column :users, :confirmed_at, :datetime
|
5
|
+
add_column :users, :confirmation_sent_at, :datetime
|
6
|
+
add_column :users, :failed_attempts, :integer, :default => 0
|
7
|
+
add_column :users, :unlock_token, :string
|
8
|
+
add_column :users, :locked_at, :datetime
|
9
|
+
add_column :users, :authentication_token, :string
|
10
|
+
add_column :users, :login, :string
|
11
|
+
add_column :users, :name, :string
|
12
|
+
add_column :users, :role_id, :integer
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.down
|
16
|
+
remove_column :users, :confirmation_token
|
17
|
+
remove_column :users, :confirmed_at
|
18
|
+
remove_column :users, :confirmation_sent_at
|
19
|
+
remove_column :users, :failed_attempts
|
20
|
+
remove_column :users, :unlock_token
|
21
|
+
remove_column :users, :locked_at
|
22
|
+
remove_column :users, :authentication_token
|
23
|
+
remove_column :users, :login
|
24
|
+
remove_column :users, :name
|
25
|
+
remove_column :users, :role_id
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateImages < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :images do |t|
|
4
|
+
t.string :image_file_name
|
5
|
+
t.string :image_content_type
|
6
|
+
t.integer :image_file_size
|
7
|
+
t.datetime :image_updated_at
|
8
|
+
t.integer :gallery_id
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
drop_table :images
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class CreateProfiles < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :profiles do |t|
|
4
|
+
t.string :first_name
|
5
|
+
t.string :last_name
|
6
|
+
t.string :alias
|
7
|
+
t.string :blog_title
|
8
|
+
t.text :about_me
|
9
|
+
t.integer :user_id
|
10
|
+
t.string :image_file_name
|
11
|
+
t.string :image_content_type
|
12
|
+
t.integer :image_file_size
|
13
|
+
t.datetime :image_updated_at
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
add_index :profiles, :alias, :unique=>true
|
17
|
+
add_index :profiles, :user_id, :unique=>true
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.down
|
21
|
+
drop_table :profiles
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateRoles < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :roles do |t|
|
4
|
+
t.string :name
|
5
|
+
t.timestamps
|
6
|
+
end
|
7
|
+
Role.create(:name=>'Super')
|
8
|
+
Role.create(:name=>'Admin')
|
9
|
+
Role.create(:name=>'User')
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
drop_table :roles
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
data/init.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Kevin Faustino
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Rails
|
2
|
+
module Generators
|
3
|
+
module Actions
|
4
|
+
|
5
|
+
attr_accessor :stategies
|
6
|
+
attr_accessor :recipes
|
7
|
+
attr_reader :template_options
|
8
|
+
|
9
|
+
def initialize_templater
|
10
|
+
self.recipes = []
|
11
|
+
@stategies = []
|
12
|
+
@template_options = {}
|
13
|
+
end
|
14
|
+
|
15
|
+
def execute_stategies
|
16
|
+
stategies.each {|stategy| stategy.call }
|
17
|
+
end
|
18
|
+
|
19
|
+
def load_options
|
20
|
+
@template_options[:design] = ask("Which design framework? [none(default), compass]: ").downcase
|
21
|
+
@template_options[:design] = "none" if @template_options[:design].nil?
|
22
|
+
end
|
23
|
+
|
24
|
+
def recipe(name)
|
25
|
+
recipes << name
|
26
|
+
File.join File.dirname(__FILE__), 'recipes', "#{name}.rb"
|
27
|
+
end
|
28
|
+
|
29
|
+
# TODO: Refactor loading of files
|
30
|
+
|
31
|
+
def load_snippet(name, group)
|
32
|
+
path = File.expand_path name, snippet_path(group)
|
33
|
+
File.read path
|
34
|
+
end
|
35
|
+
|
36
|
+
def load_template(name, group, match={})
|
37
|
+
path = File.expand_path name, template_path(group)
|
38
|
+
contents = File.read path
|
39
|
+
match.each do |key, value|
|
40
|
+
contents.gsub! "\%#{key.to_s}\%", value
|
41
|
+
end
|
42
|
+
contents
|
43
|
+
end
|
44
|
+
|
45
|
+
def snippet_path(name)
|
46
|
+
File.join(File.dirname(__FILE__), 'snippets', name)
|
47
|
+
end
|
48
|
+
|
49
|
+
def template_path(name)
|
50
|
+
File.join(File.dirname(__FILE__), 'templates', name)
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class InstallGenerator < Rails::Generators::Base
|
2
|
+
source_root File.expand_path('../../../../', __FILE__)
|
3
|
+
desc "Installs files needed for App Template gem."
|
4
|
+
|
5
|
+
# argument :scope, :required => false, :default => nil,
|
6
|
+
# :desc => "The scope to copy views to"
|
7
|
+
|
8
|
+
# class_option :template_engine, :type => :string, :aliases => "-t",
|
9
|
+
# :desc => "Template engine for the views. Available options are 'erb' and 'haml'."
|
10
|
+
|
11
|
+
def rule
|
12
|
+
generate "devise:install"
|
13
|
+
["add_fields_to_users.rb",
|
14
|
+
"create_blogs.rb",
|
15
|
+
"create_galleries.rb",
|
16
|
+
"create_images.rb",
|
17
|
+
"create_profiles.rb",
|
18
|
+
"create_roles.rb"
|
19
|
+
].each {|file| migration_template File.expand(file, 'db/migrate'), "db/migrate/#{file.split('.').first}"}
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
gsub_file 'Gemfile', /(gem "rspec-rails".*:group =>) \[:development, :test\]/, '\1 [:development, :test, :cucumber]'
|
2
|
+
gsub_file 'Gemfile', /(gem "factory_girl_rails".*:group =>) :test/, '\1 [:test, :cucumber]'
|
3
|
+
|
4
|
+
append_file 'Gemfile', <<-EOF
|
5
|
+
group :cucumber do
|
6
|
+
gem 'capybara'
|
7
|
+
gem 'cucumber-rails'
|
8
|
+
gem 'spork'
|
9
|
+
gem 'launchy'
|
10
|
+
end
|
11
|
+
EOF
|
12
|
+
|
13
|
+
stategies << lambda do
|
14
|
+
generate 'cucumber:install --rspec --capybara --skip-database'
|
15
|
+
|
16
|
+
cukes_factory_girl = <<-END
|
17
|
+
|
18
|
+
require 'factory_girl'
|
19
|
+
require 'factory_girl/step_definitions'
|
20
|
+
Dir[File.expand_path(File.join(File.dirname(__FILE__),'..','..','spec','factories','*.rb'))].each {|f| require f}
|
21
|
+
|
22
|
+
END
|
23
|
+
inject_into_file "features/support/env.rb", cukes_factory_girl, :after => 'ActionController::Base.allow_rescue = false'
|
24
|
+
if recipes.include? 'mongoid'
|
25
|
+
# Mongoid truncation strategy
|
26
|
+
create_file 'features/support/hooks.rb', load_template('features/support/hooks.rb', 'mongoid')
|
27
|
+
|
28
|
+
# Compliment to factory_girl step definitions
|
29
|
+
create_file 'features/step_definitions/mongoid_steps.rb', load_template('features/step_definitions/mongoid_steps.rb', 'mongoid')
|
30
|
+
|
31
|
+
# Update mongoid.yml
|
32
|
+
mongoid_config_path = 'config/mongoid.yml'
|
33
|
+
gsub_file mongoid_config_path, /(test:)/, '\1 &test'
|
34
|
+
|
35
|
+
inject_into_file mongoid_config_path, load_snippet('database_config', 'cucumber'), :before => '# set these environment variables on your prod server'
|
36
|
+
run "cp #{mongoid_config_path} #{mongoid_config_path}.example"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Delete all unnecessary files
|
2
|
+
remove_file "README"
|
3
|
+
remove_file "public/index.html"
|
4
|
+
remove_file "public/robots.txt"
|
5
|
+
remove_file "public/images/rails.png"
|
6
|
+
|
7
|
+
create_file 'README'
|
8
|
+
create_file 'log/.gitkeep'
|
9
|
+
create_file 'tmp/.gitkeep'
|
10
|
+
|
11
|
+
gsub_file 'config/application.rb', 'require "rails/test_unit/railtie"', '# require "rails/test_unit/railtie"'
|
12
|
+
|
13
|
+
get "http://html5shiv.googlecode.com/svn/trunk/html5.js", "public/javascripts/html5.js"
|
14
|
+
|
15
|
+
git :init
|
16
|
+
|
17
|
+
append_file '.gitignore', load_template('gitignore','git')
|
18
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
if template_options[:design] == "compass"
|
2
|
+
gem 'compass'
|
3
|
+
|
4
|
+
# TODO: support more than one framework from compass
|
5
|
+
compass_sass_dir = "app/stylesheets"
|
6
|
+
compass_css_dir = "public/stylesheets/compiled"
|
7
|
+
|
8
|
+
compass_command = "compass init rails . --using blueprint/semantic --css-dir=#{compass_css_dir} --sass-dir=#{compass_sass_dir} "
|
9
|
+
|
10
|
+
stategies << lambda do
|
11
|
+
puts "Beginning Compass setup"
|
12
|
+
run compass_command
|
13
|
+
puts "Compass has been setup"
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
gem 'haml'
|
2
|
+
|
3
|
+
remove_file 'app/views/layouts/application.html.erb'
|
4
|
+
create_file 'app/views/layouts/application.html.haml', load_template('app/views/layouts/application.html.haml','haml')
|
5
|
+
|
6
|
+
initializer 'haml.rb',<<EOF
|
7
|
+
Haml::Template.options[:format] = :html5
|
8
|
+
EOF
|
@@ -0,0 +1,6 @@
|
|
1
|
+
# Initialize jQuery
|
2
|
+
get "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js", "public/javascripts/jquery.js"
|
3
|
+
get "http://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"
|
4
|
+
|
5
|
+
# Set default JavaScript files
|
6
|
+
environment "config.action_view.javascript_expansions = { :defaults => ['jquery', 'rails'] }"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
gem 'pg'
|
2
|
+
|
3
|
+
stategies << lambda do
|
4
|
+
opts = {}
|
5
|
+
opts[:database_name] = ask("What's the name of the database?")
|
6
|
+
opts[:database_username] = ask("Database username?")
|
7
|
+
opts[:database_password] = ask("Password? *** Will show in plain text on your screen")
|
8
|
+
create_file 'config/database.yml',
|
9
|
+
load_template('postgresql.yml', 'database', opts)
|
10
|
+
end
|
11
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
gem 'remarkable_activemodel', '>=4.0.0.alpha4', :group => :test
|
2
|
+
if recipes.include? 'mongoid'
|
3
|
+
gem 'remarkable_mongoid', :group => :test
|
4
|
+
|
5
|
+
stategies << lambda do
|
6
|
+
inject_into_file 'spec/spec_helper.rb', "\nrequire 'remarkable/active_model'\nrequire 'remarkable/mongoid'", :after => "require 'rspec/rails'"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
gem 'rspec-rails', '>= 2.0.0.beta.19', :group => [:development, :test]
|
2
|
+
|
3
|
+
stategies << lambda do
|
4
|
+
generate 'rspec:install'
|
5
|
+
|
6
|
+
spec_helper_path = 'spec/spec_helper.rb'
|
7
|
+
|
8
|
+
gsub_file spec_helper_path, 'config.fixture_path = "#{::Rails.root}/spec/fixtures"', ''
|
9
|
+
gsub_file spec_helper_path, /(config.use_transactional_fixtures = true)/, '# \1'
|
10
|
+
|
11
|
+
if recipes.include? 'mongoid'
|
12
|
+
mongoid_rspec_truncation = <<-MONGOID
|
13
|
+
|
14
|
+
config.before :each do
|
15
|
+
Mongoid.master.collections.select {|c| c.name !~ /system/ }.each(&:drop)
|
16
|
+
end
|
17
|
+
|
18
|
+
MONGOID
|
19
|
+
|
20
|
+
inject_into_file spec_helper_path, mongoid_rspec_truncation, :after => "# config.use_transactional_fixtures = true\n"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
gem 'rails3-generators'
|
2
|
+
gem 'RedCloth'
|
3
|
+
gem 'acts-as-taggable-on'
|
4
|
+
gem 'da_huangs_ruby_extensions'
|
5
|
+
gem 'casey_jones'
|
6
|
+
gem 'inherited_resources', '1.1.2'
|
7
|
+
gem 'has_scope'
|
8
|
+
|
9
|
+
stategies << lambda do
|
10
|
+
migration_template 'db/migrate/add_fields_to_users.rb', 'db/migrate/add_fields_to_users'
|
11
|
+
migration_template 'db/migrate/create_blogs.rb', 'db/migrate/create_blogs'
|
12
|
+
migration_template 'db/migrate/create_galleries.rb', 'db/migrate/create_galleries'
|
13
|
+
migration_template 'db/migrate/create_images.rb', 'db/migrate/create_images'
|
14
|
+
migration_template 'db/migrate/create_profiles.rb', 'db/migrate/create_profiles'
|
15
|
+
migration_template 'db/migrate/create_roles.rb', 'db/migrate/create_roles'
|
16
|
+
|
17
|
+
route "wheels_resources"
|
18
|
+
class_eval do
|
19
|
+
attr_accessor :bucket, :access_key_id, :secret_access_key
|
20
|
+
end
|
21
|
+
say ("If you have your S3 info handy, put it in now.")
|
22
|
+
for attribute in [:bucket, :access_key_id, :secret_access_key]
|
23
|
+
self.send "#{attribute}=", ask("What's the #{attribute}?")
|
24
|
+
end
|
25
|
+
|
26
|
+
template 'config/amazon_s3.yml', 'config/amazon_s3.yml'
|
27
|
+
run "git submodule add git://github.com/tylergannon/ckeditor.git public/ckeditor"
|
28
|
+
|
29
|
+
directory 'public', 'public'
|
30
|
+
directory 'app', 'app'
|
31
|
+
gem "will_paginate", :git=>"http://github.com/mislav/will_paginate.git",
|
32
|
+
:branch=>"rails3"
|
33
|
+
end
|
34
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'core_extensions.rb')
|
2
|
+
|
3
|
+
initialize_templater
|
4
|
+
|
5
|
+
required_recipes = %w(default jquery haml rspec factory_girl remarkable devise cancan)
|
6
|
+
required_recipes.each {|required_recipe| apply recipe(required_recipe)}
|
7
|
+
|
8
|
+
apply recipe(ask("Which database? (m)ongoid or (p)ostgresql")=='m' ? 'mongoid' : 'postgresql')
|
9
|
+
|
10
|
+
load_options
|
11
|
+
apply(recipe('cucumber')) if yes?("Do you want to some cukes?")
|
12
|
+
apply recipe('design')
|
13
|
+
|
14
|
+
# run 'bundle install'
|
15
|
+
|
16
|
+
execute_stategies
|
17
|
+
|
18
|
+
generators_configuration = <<-END
|
19
|
+
config.generators do |g|
|
20
|
+
g.template_engine :haml
|
21
|
+
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
|
22
|
+
end
|
23
|
+
END
|
24
|
+
|
25
|
+
environment generators_configuration
|
26
|
+
|
27
|
+
git :add => "."
|
28
|
+
git :commit => "-m 'Initial commit'"
|
29
|
+
|