horsee 0.0.4
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 +10 -0
- data/Gemfile +4 -0
- data/README.rdoc +27 -0
- data/Rakefile +1 -0
- data/bin/horsee +17 -0
- data/bootstrap/default/default.rb +39 -0
- data/bootstrap/default/templates/bootstrap.rb +31 -0
- data/bootstrap/default/templates/cancan.rb +110 -0
- data/bootstrap/default/templates/devise.rb +157 -0
- data/bootstrap/default/templates/gemfile.rb +15 -0
- data/bootstrap/default/templates/git.rb +15 -0
- data/bootstrap/default/templates/haml_generator.rb +7 -0
- data/bootstrap/default/templates/home_controller.rb +2 -0
- data/bootstrap/default/templates/initializers.rb +5 -0
- data/bootstrap/default/templates/layout.rb +63 -0
- data/bootstrap/default/templates/rails_clean.rb +11 -0
- data/bootstrap/default/templates/welcome.rb +27 -0
- data/horsee.gemspec +23 -0
- data/lib/horsee.rb +4 -0
- data/lib/horsee/cli.rb +42 -0
- data/lib/horsee/version.rb +3 -0
- metadata +101 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
== Welcome to Horsee
|
2
|
+
|
3
|
+
Horsee creates the rails application faster. It uses rails template way to do the necessary
|
4
|
+
things that are needed for most of application.
|
5
|
+
|
6
|
+
Some of the tasks it does are
|
7
|
+
|
8
|
+
* Authentication using Devise
|
9
|
+
* Authorization using CanCan
|
10
|
+
* HAML as default template engine
|
11
|
+
* Making necessary initializers and configuration
|
12
|
+
|
13
|
+
|
14
|
+
== How to Use it?
|
15
|
+
|
16
|
+
1. Install horsee gem at the command prompt
|
17
|
+
|
18
|
+
gem install horsee
|
19
|
+
|
20
|
+
2. Create new rails application using horsee
|
21
|
+
|
22
|
+
horsee new myapp
|
23
|
+
|
24
|
+
where "myapp" is the application name and path where you want the application.
|
25
|
+
|
26
|
+
|
27
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/horsee
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- mode: ruby -*-
|
3
|
+
|
4
|
+
# Requires
|
5
|
+
begin
|
6
|
+
require 'horsee'
|
7
|
+
rescue LoadError
|
8
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
|
9
|
+
require 'rubygems'
|
10
|
+
require 'horsee'
|
11
|
+
end
|
12
|
+
|
13
|
+
# Setup Constants
|
14
|
+
Horsee::GEM_ROOT = File.expand_path( File.dirname( __FILE__ ) + '/../' )
|
15
|
+
|
16
|
+
# Run
|
17
|
+
Horsee::CLI.start
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'thor/actions'
|
3
|
+
require 'thor/group'
|
4
|
+
|
5
|
+
module Horsee
|
6
|
+
module Bootstrap
|
7
|
+
|
8
|
+
class Default < Thor::Group
|
9
|
+
include Thor::Actions
|
10
|
+
|
11
|
+
source_root File.expand_path('../templates', __FILE__)
|
12
|
+
|
13
|
+
argument :app_path, :type => :string
|
14
|
+
|
15
|
+
def on_invocation
|
16
|
+
ENV['HORSEE_USER_NAME'] = git_user_name
|
17
|
+
ENV['HORSEE_USER_EMAIL'] = git_user_email
|
18
|
+
ENV['HORSEE_USER_PASSWORD'] = user_password
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def git_user_name
|
24
|
+
`git config --global github.user`.strip || "admin"
|
25
|
+
end
|
26
|
+
|
27
|
+
def git_user_email
|
28
|
+
`git config --global user.email`.strip || "me@me.com"
|
29
|
+
end
|
30
|
+
|
31
|
+
def user_password
|
32
|
+
'Passw0rd!'
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
say "Installing Horsee..."
|
2
|
+
|
3
|
+
#Apply git
|
4
|
+
apply File.expand_path("../git.rb", __FILE__)
|
5
|
+
|
6
|
+
#Apply gemfile
|
7
|
+
apply File.expand_path("../gemfile.rb", __FILE__)
|
8
|
+
|
9
|
+
#Apply HAML generator
|
10
|
+
apply File.expand_path("../haml_generator.rb", __FILE__)
|
11
|
+
|
12
|
+
#Apply Devise
|
13
|
+
apply File.expand_path("../devise.rb", __FILE__)
|
14
|
+
|
15
|
+
#Apply CanCan
|
16
|
+
apply File.expand_path("../cancan.rb", __FILE__)
|
17
|
+
|
18
|
+
#Apply Initializers
|
19
|
+
apply File.expand_path("../initializers.rb", __FILE__)
|
20
|
+
|
21
|
+
#Apply HTML5 Layout
|
22
|
+
apply File.expand_path("../layout.rb", __FILE__)
|
23
|
+
|
24
|
+
#Apply Homepage
|
25
|
+
apply File.expand_path("../home_controller.rb", __FILE__)
|
26
|
+
|
27
|
+
#Apply rails clean up
|
28
|
+
apply File.expand_path("../rails_clean.rb", __FILE__)
|
29
|
+
|
30
|
+
#Apply rails clean up
|
31
|
+
apply File.expand_path("../welcome.rb", __FILE__)
|
@@ -0,0 +1,110 @@
|
|
1
|
+
say "Building authorization"
|
2
|
+
|
3
|
+
#----------------------------------------------------
|
4
|
+
# Run all migrations and setup
|
5
|
+
#----------------------------------------------------
|
6
|
+
run 'rails generate model Role name:string --skip'
|
7
|
+
run 'rails generate migration UsersHaveAndBelongToManyRoles'
|
8
|
+
|
9
|
+
|
10
|
+
#----------------------------------------------------
|
11
|
+
# Modify migration files
|
12
|
+
#----------------------------------------------------
|
13
|
+
habtm_roles = Dir['db/migrate/*_users_have_and_belong_to_many_roles.rb'].first
|
14
|
+
inject_into_file habtm_roles, :after => "def up\n" do
|
15
|
+
<<-RUBY
|
16
|
+
create_table :roles_users, :id => false do |t|
|
17
|
+
t.references :role, :user
|
18
|
+
end
|
19
|
+
add_index :roles_users, :user_id
|
20
|
+
add_index :roles_users, :role_id
|
21
|
+
RUBY
|
22
|
+
end
|
23
|
+
|
24
|
+
inject_into_file habtm_roles, :after => "def down\n" do
|
25
|
+
<<-RUBY
|
26
|
+
drop_table :roles_users
|
27
|
+
RUBY
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
#----------------------------------------------------
|
32
|
+
# Update Seeds file
|
33
|
+
#----------------------------------------------------
|
34
|
+
append_file 'db/seeds.rb' do
|
35
|
+
<<-FILE
|
36
|
+
#
|
37
|
+
# Setup two common roles
|
38
|
+
Role.create! :name => 'Admin'
|
39
|
+
Role.create! :name => 'Member'
|
40
|
+
#
|
41
|
+
# make
|
42
|
+
adminuser = User.find_by_email('#{ENV['HORSEE_USER_EMAIL']}')
|
43
|
+
adminuser.role_ids = [1]
|
44
|
+
adminuser.save
|
45
|
+
FILE
|
46
|
+
end
|
47
|
+
|
48
|
+
#----------------------------------------------------
|
49
|
+
# Modify models file
|
50
|
+
#----------------------------------------------------
|
51
|
+
inject_into_file 'app/models/role.rb', :after => "class Role < ActiveRecord::Base\n" do
|
52
|
+
<<-RUBY
|
53
|
+
has_and_belongs_to_many :users
|
54
|
+
|
55
|
+
def self.sanitize role
|
56
|
+
role.to_s.humanize.split(' ').each{ |word| word.capitalize! }.join(' ')
|
57
|
+
end
|
58
|
+
RUBY
|
59
|
+
end
|
60
|
+
|
61
|
+
inject_into_file 'app/models/user.rb', :before => " def destroy\n" do
|
62
|
+
<<-RUBY
|
63
|
+
has_and_belongs_to_many :roles
|
64
|
+
|
65
|
+
def role?(role)
|
66
|
+
return !!self.roles.find_by_name( Role.sanitize role )
|
67
|
+
end
|
68
|
+
|
69
|
+
RUBY
|
70
|
+
end
|
71
|
+
|
72
|
+
create_file 'app/models/ability.rb' do
|
73
|
+
<<-RUBY
|
74
|
+
class Ability
|
75
|
+
include CanCan::Ability
|
76
|
+
|
77
|
+
def initialize(user)
|
78
|
+
user ||= User.new # guest user
|
79
|
+
|
80
|
+
if user.role? :admin
|
81
|
+
can :manage, :all
|
82
|
+
# elsif user.role? :writer
|
83
|
+
# can :manage, [Post, Asset]
|
84
|
+
# elsif user.role? :member
|
85
|
+
# can :read, [MemberPost, Asset]
|
86
|
+
# # manage posts, assets user owns
|
87
|
+
# can :manage, Post do |p|
|
88
|
+
# p.try(:owner) == user
|
89
|
+
# end
|
90
|
+
# can :manage, Asset do |a|
|
91
|
+
# a.try(:owner) == user
|
92
|
+
# end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
RUBY
|
97
|
+
end
|
98
|
+
|
99
|
+
#----------------------------------------------------
|
100
|
+
# Modify config files
|
101
|
+
#----------------------------------------------------
|
102
|
+
inject_into_file 'app/controllers/application_controller.rb', :before => "end\n" do
|
103
|
+
<<-RUBY
|
104
|
+
|
105
|
+
rescue_from CanCan::AccessDenied do |exception|
|
106
|
+
flash[:error] = "Access Denied"
|
107
|
+
redirect_to root_url
|
108
|
+
end
|
109
|
+
RUBY
|
110
|
+
end
|
@@ -0,0 +1,157 @@
|
|
1
|
+
say "Building authentication"
|
2
|
+
|
3
|
+
#----------------------------------------------------
|
4
|
+
# Run all migrations and setup
|
5
|
+
#----------------------------------------------------
|
6
|
+
run 'rails generate devise:install --quiet'
|
7
|
+
run 'rails generate devise:views'
|
8
|
+
run 'rails generate devise User'
|
9
|
+
run 'rails generate migration AddUsernameToUsers username:string'
|
10
|
+
run 'rails generate migration AddDeletedAtToUsers deleted_at:datetime'
|
11
|
+
|
12
|
+
#----------------------------------------------------
|
13
|
+
# Modify migration files
|
14
|
+
#----------------------------------------------------
|
15
|
+
devise_migration = Dir['db/migrate/*_devise_create_users.rb'].first
|
16
|
+
gsub_file devise_migration, /# t.confirmable/, 't.confirmable'
|
17
|
+
gsub_file devise_migration, /# add_index :users, :confirmation_token, :unique => true/, 'add_index :users, :confirmation_token, :unique => true'
|
18
|
+
|
19
|
+
username_migration = Dir['db/migrate/*_add_username_to_users.rb'].first
|
20
|
+
inject_into_file username_migration, :after => "add_column :users, :username, :string\n" do
|
21
|
+
<<-FILE
|
22
|
+
add_index :users, :username, :unique => true
|
23
|
+
FILE
|
24
|
+
end
|
25
|
+
|
26
|
+
#----------------------------------------------------
|
27
|
+
# Update Seeds file
|
28
|
+
#----------------------------------------------------
|
29
|
+
append_file 'db/seeds.rb' do
|
30
|
+
<<-FILE
|
31
|
+
#
|
32
|
+
# Setup initial user so we can get in
|
33
|
+
firstuser = User.create! :username => "#{ENV['HORSEE_USER_NAME']}", :email => "#{ENV['HORSEE_USER_EMAIL']}", :password => "#{ENV['HORSEE_USER_PASSWORD']}", :password_confirmation => "#{ENV['HORSEE_USER_PASSWORD']}"
|
34
|
+
firstuser.skip_confirmation!
|
35
|
+
firstuser.save
|
36
|
+
FILE
|
37
|
+
end
|
38
|
+
|
39
|
+
#----------------------------------------------------
|
40
|
+
# Modify models file
|
41
|
+
#----------------------------------------------------
|
42
|
+
run 'rm app/models/user.rb'
|
43
|
+
|
44
|
+
create_file 'app/models/user.rb' do
|
45
|
+
<<-RUBY
|
46
|
+
class User < ActiveRecord::Base
|
47
|
+
# Include default devise modules. Others available are:
|
48
|
+
# :token_authenticatable, :encryptable, :lockable, :timeoutable
|
49
|
+
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable
|
50
|
+
default_scope :conditions => { :deleted_at => nil }
|
51
|
+
|
52
|
+
# validations for model
|
53
|
+
validates :username, :presence => true, :uniqueness => true
|
54
|
+
|
55
|
+
# Setup accessible (or protected) attributes for your model
|
56
|
+
attr_accessor :login
|
57
|
+
attr_accessible :login, :email, :username, :password, :password_confirmation, :remember_me, :role_ids
|
58
|
+
|
59
|
+
def destroy
|
60
|
+
self.update_attribute(:deleted_at, Time.now.utc)
|
61
|
+
end
|
62
|
+
|
63
|
+
protected
|
64
|
+
|
65
|
+
def self.find_for_database_authentication(warden_conditions)
|
66
|
+
conditions = warden_conditions.dup
|
67
|
+
login = conditions.delete(:login)
|
68
|
+
where(conditions).where(["lower(username) = :value OR lower(email) = :value", { :value => login.downcase }]).first
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
RUBY
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
#----------------------------------------------------
|
77
|
+
# Modify config files
|
78
|
+
#----------------------------------------------------
|
79
|
+
devise_config_file = 'config/initializers/devise.rb'
|
80
|
+
inject_into_file devise_config_file, :before => " # config.authentication_keys" do
|
81
|
+
<<-RUBY
|
82
|
+
config.authentication_keys = [ :login ]
|
83
|
+
RUBY
|
84
|
+
end
|
85
|
+
gsub_file devise_config_file, /# config.password_length = 6..128/, 'config.password_length = 5..16'
|
86
|
+
gsub_file devise_config_file, /# config.pepper/, 'config.pepper'
|
87
|
+
gsub_file 'config/locales/devise.en.yml', /Invalid email or password/, 'Invalid login or password'
|
88
|
+
append_file 'config/locales/en.yml' do
|
89
|
+
<<-FILE
|
90
|
+
activerecord:
|
91
|
+
attributes:
|
92
|
+
user:
|
93
|
+
login: "Username or email"
|
94
|
+
FILE
|
95
|
+
end
|
96
|
+
|
97
|
+
gsub_file 'config/application.rb', /:password/, ':password, :password_confirmation'
|
98
|
+
gsub_file 'config/environments/development.rb', /# Don't care if the mailer can't send/, '### ActionMailer Config'
|
99
|
+
|
100
|
+
gsub_file 'config/environments/development.rb', /config.action_mailer.raise_delivery_errors = false/ do
|
101
|
+
<<-RUBY
|
102
|
+
config.action_mailer.default_url_options = { :host => '0.0.0.0:3000' }
|
103
|
+
# A dummy setup for development - no deliveries, but logged
|
104
|
+
config.action_mailer.delivery_method = :smtp
|
105
|
+
config.action_mailer.perform_deliveries = false
|
106
|
+
config.action_mailer.raise_delivery_errors = true
|
107
|
+
config.action_mailer.default :charset => "utf-8"
|
108
|
+
RUBY
|
109
|
+
end
|
110
|
+
|
111
|
+
inject_into_file 'config/environments/test.rb', :after => "config.action_controller.allow_forgery_protection = false\n" do
|
112
|
+
<<-RUBY
|
113
|
+
config.action_mailer.default_url_options = { :host => '0.0.0.0:3000' }
|
114
|
+
RUBY
|
115
|
+
end
|
116
|
+
|
117
|
+
gsub_file 'config/environments/production.rb', /config.i18n.fallbacks = true/ do
|
118
|
+
<<-RUBY
|
119
|
+
config.i18n.fallbacks = true
|
120
|
+
config.action_mailer.default_url_options = { :host => 'yourhost.com' }
|
121
|
+
### ActionMailer Config
|
122
|
+
# Setup for production - deliveries, no errors raised
|
123
|
+
config.action_mailer.delivery_method = :smtp
|
124
|
+
config.action_mailer.perform_deliveries = true
|
125
|
+
config.action_mailer.raise_delivery_errors = false
|
126
|
+
config.action_mailer.default :charset => "utf-8"
|
127
|
+
RUBY
|
128
|
+
end
|
129
|
+
|
130
|
+
gsub_file devise_config_file, /# config.pepper/, 'config.pepper'
|
131
|
+
gsub_file 'config/locales/devise.en.yml', /Invalid email or password/, 'Invalid login or password'
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
#----------------------------------------------------
|
136
|
+
# Modify Views Files
|
137
|
+
#----------------------------------------------------
|
138
|
+
devise_new_session_file = 'app/views/devise/sessions/new.html.erb'
|
139
|
+
gsub_file devise_new_session_file, /f.label :email/, 'f.label :login'
|
140
|
+
gsub_file devise_new_session_file, /f.email_field :email/, 'f.text_field :login'
|
141
|
+
|
142
|
+
devise_new_registration_file = 'app/views/devise/registrations/new.html.erb'
|
143
|
+
devise_edit_registration_file = 'app/views/devise/registrations/edit.html.erb'
|
144
|
+
inject_into_file devise_new_registration_file, :before => " <div><%= f.label :email %><br />" do
|
145
|
+
<<-FILE
|
146
|
+
<div><%= f.label :username %><br />
|
147
|
+
<%= f.text_field :username %></div>
|
148
|
+
|
149
|
+
FILE
|
150
|
+
end
|
151
|
+
inject_into_file devise_edit_registration_file, :before => " <div><%= f.label :email %><br />" do
|
152
|
+
<<-FILE
|
153
|
+
<div><%= f.label :username %><br />
|
154
|
+
<%= f.text_field :username %></div>
|
155
|
+
|
156
|
+
FILE
|
157
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
run 'mkdir app/views/shared'
|
2
|
+
|
3
|
+
create_file 'app/views/shared/_header.html.haml' do
|
4
|
+
<<-FILE
|
5
|
+
= render 'shared/messages'
|
6
|
+
%header
|
7
|
+
%h1= link_to '#{app_name.humanize}', root_path
|
8
|
+
%nav
|
9
|
+
%ul
|
10
|
+
%li= link_to 'Home', root_path
|
11
|
+
FILE
|
12
|
+
end
|
13
|
+
|
14
|
+
create_file 'app/views/shared/_messages.html.haml' do
|
15
|
+
<<-FILE
|
16
|
+
- if flash[:notice]
|
17
|
+
%div#messenger{:class => "flasher"}= flash[:notice]
|
18
|
+
- if flash[:error]
|
19
|
+
%div#error{:class => "flasher"}= flash[:error]
|
20
|
+
- if flash[:alert]
|
21
|
+
%div#alert{:class => "flasher"}= flash[:alert]
|
22
|
+
FILE
|
23
|
+
end
|
24
|
+
|
25
|
+
create_file 'app/views/shared/_footer.html.haml' do
|
26
|
+
<<-FILE
|
27
|
+
%footer
|
28
|
+
Copyright © 2012 #{app_name.humanize}. All rights reserved.
|
29
|
+
FILE
|
30
|
+
end
|
31
|
+
|
32
|
+
remove_file 'app/views/layouts/application.html.erb'
|
33
|
+
create_file 'app/views/layouts/application.html.haml' do
|
34
|
+
<<-FILE
|
35
|
+
!!! 5
|
36
|
+
-# paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/
|
37
|
+
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
|
38
|
+
<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
|
39
|
+
<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
|
40
|
+
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
|
41
|
+
<!--[if (gte IE 9)|!(IE)]><!-->
|
42
|
+
%html.no-js{ :lang => "en" }
|
43
|
+
<!--<![endif]-->
|
44
|
+
%head
|
45
|
+
%meta{'charset' => 'utf-8'}
|
46
|
+
%meta{'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1'}
|
47
|
+
%title<
|
48
|
+
#{app_name.humanize}
|
49
|
+
= yield(:title)
|
50
|
+
%meta{:name => 'viewport', :content => 'width=device-width initial-scale=1.0 maximum-scale=1.0'}
|
51
|
+
%link{:rel => "fluid-icon", :href => "/fluidicon.png"}
|
52
|
+
= csrf_meta_tag
|
53
|
+
= stylesheet_link_tag "application"
|
54
|
+
= javascript_include_tag "application"
|
55
|
+
= yield(:head)
|
56
|
+
%body
|
57
|
+
= render :partial => "shared/header"
|
58
|
+
#content
|
59
|
+
= yield
|
60
|
+
= render :partial => "shared/footer"
|
61
|
+
= yield(:end_scripts)
|
62
|
+
FILE
|
63
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#run 'rake db:drop'
|
2
|
+
run 'rake db:create'
|
3
|
+
run 'rake db:migrate'
|
4
|
+
run 'rake db:seed'
|
5
|
+
|
6
|
+
say <<-D
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
########################################################################
|
12
|
+
|
13
|
+
Horsee just added like 6 hours to your life.
|
14
|
+
|
15
|
+
Login to admin with the following login details
|
16
|
+
|
17
|
+
username: #{ENV['HORSEE_USER_NAME']}
|
18
|
+
password: #{ENV['HORSEE_USER_PASSWORD']}
|
19
|
+
|
20
|
+
|
21
|
+
########################################################################
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
D
|
data/horsee.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "horsee/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "horsee"
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.version = Horsee::VERSION
|
9
|
+
s.authors = ["Akash Kamboj"]
|
10
|
+
s.email = ["akash@filvo.com"]
|
11
|
+
s.homepage = "http://github.com/akashkamboj/horsee"
|
12
|
+
s.summary = "Horsee makes the Rails application creation faster"
|
13
|
+
s.description = "Horsee is a template engine used to create a Rails application with authentication, authorization using Devise and CanCan"
|
14
|
+
|
15
|
+
s.rubyforge_project = "horsee"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_dependency 'rails', '>= 3.1.3'
|
23
|
+
end
|
data/lib/horsee.rb
ADDED
data/lib/horsee/cli.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'thor/actions'
|
3
|
+
|
4
|
+
module Horsee
|
5
|
+
|
6
|
+
class CLI < Thor
|
7
|
+
|
8
|
+
# Includes
|
9
|
+
include Thor::Actions
|
10
|
+
|
11
|
+
desc "version", "Prints Horsee's version information"
|
12
|
+
def version
|
13
|
+
say "Horsee version #{Horsee::VERSION}"
|
14
|
+
end
|
15
|
+
map %w(-v --version) => :version
|
16
|
+
|
17
|
+
|
18
|
+
desc "new [app_path]", "Creates a new Rails application with Horsee"
|
19
|
+
method_option :app_path, :type => :string, :desc => 'path to rails application'
|
20
|
+
def new(app_path, template_name = "default")
|
21
|
+
|
22
|
+
# Require the template
|
23
|
+
require "#{Horsee::GEM_ROOT}/bootstrap/#{template_name}/#{template_name}.rb"
|
24
|
+
|
25
|
+
# Invoke the template
|
26
|
+
invoke "horsee:bootstrap:#{template_name}:on_invocation"
|
27
|
+
|
28
|
+
# Execute the template
|
29
|
+
exec(<<-COMMAND)
|
30
|
+
rails new #{app_path} \
|
31
|
+
--template=#{Horsee::GEM_ROOT}/bootstrap/#{template_name}/templates/bootstrap.rb \
|
32
|
+
--database=mysql \
|
33
|
+
--javascript=jquery \
|
34
|
+
--skip-test-unit \
|
35
|
+
--skip-bundle
|
36
|
+
COMMAND
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: horsee
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Akash Kamboj
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-01-26 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rails
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 5
|
29
|
+
segments:
|
30
|
+
- 3
|
31
|
+
- 1
|
32
|
+
- 3
|
33
|
+
version: 3.1.3
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
description: Horsee is a template engine used to create a Rails application with authentication, authorization using Devise and CanCan
|
37
|
+
email:
|
38
|
+
- akash@filvo.com
|
39
|
+
executables:
|
40
|
+
- horsee
|
41
|
+
extensions: []
|
42
|
+
|
43
|
+
extra_rdoc_files: []
|
44
|
+
|
45
|
+
files:
|
46
|
+
- .gitignore
|
47
|
+
- Gemfile
|
48
|
+
- README.rdoc
|
49
|
+
- Rakefile
|
50
|
+
- bin/horsee
|
51
|
+
- bootstrap/default/default.rb
|
52
|
+
- bootstrap/default/templates/bootstrap.rb
|
53
|
+
- bootstrap/default/templates/cancan.rb
|
54
|
+
- bootstrap/default/templates/devise.rb
|
55
|
+
- bootstrap/default/templates/gemfile.rb
|
56
|
+
- bootstrap/default/templates/git.rb
|
57
|
+
- bootstrap/default/templates/haml_generator.rb
|
58
|
+
- bootstrap/default/templates/home_controller.rb
|
59
|
+
- bootstrap/default/templates/initializers.rb
|
60
|
+
- bootstrap/default/templates/layout.rb
|
61
|
+
- bootstrap/default/templates/rails_clean.rb
|
62
|
+
- bootstrap/default/templates/welcome.rb
|
63
|
+
- horsee.gemspec
|
64
|
+
- lib/horsee.rb
|
65
|
+
- lib/horsee/cli.rb
|
66
|
+
- lib/horsee/version.rb
|
67
|
+
homepage: http://github.com/akashkamboj/horsee
|
68
|
+
licenses: []
|
69
|
+
|
70
|
+
post_install_message:
|
71
|
+
rdoc_options: []
|
72
|
+
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
hash: 3
|
81
|
+
segments:
|
82
|
+
- 0
|
83
|
+
version: "0"
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
hash: 3
|
90
|
+
segments:
|
91
|
+
- 0
|
92
|
+
version: "0"
|
93
|
+
requirements: []
|
94
|
+
|
95
|
+
rubyforge_project: horsee
|
96
|
+
rubygems_version: 1.8.12
|
97
|
+
signing_key:
|
98
|
+
specification_version: 3
|
99
|
+
summary: Horsee makes the Rails application creation faster
|
100
|
+
test_files: []
|
101
|
+
|