horsee 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -5
- data/bin/horsee +0 -0
- data/bootstrap/default/templates/bootstrap.rb +0 -3
- data/bootstrap/default/templates/cancan.rb +2 -5
- data/bootstrap/default/templates/devise.rb +9 -13
- data/bootstrap/default/templates/gemfile.rb +5 -6
- data/bootstrap/default/templates/rails_clean.rb +3 -3
- data/horsee.gemspec +7 -4
- data/lib/horsee/cli.rb +1 -2
- data/lib/horsee/version.rb +1 -1
- metadata +9 -11
- data/README.rdoc +0 -27
- data/bootstrap/default/templates/haml_generator.rb +0 -7
data/.gitignore
CHANGED
data/bin/horsee
CHANGED
File without changes
|
@@ -6,9 +6,6 @@ apply File.expand_path("../git.rb", __FILE__)
|
|
6
6
|
#Apply gemfile
|
7
7
|
apply File.expand_path("../gemfile.rb", __FILE__)
|
8
8
|
|
9
|
-
#Apply HAML generator
|
10
|
-
apply File.expand_path("../haml_generator.rb", __FILE__)
|
11
|
-
|
12
9
|
#Apply Devise
|
13
10
|
apply File.expand_path("../devise.rb", __FILE__)
|
14
11
|
|
@@ -3,7 +3,7 @@ say "Building authorization"
|
|
3
3
|
#----------------------------------------------------
|
4
4
|
# Run all migrations and setup
|
5
5
|
#----------------------------------------------------
|
6
|
-
run 'rails generate model Role name:string
|
6
|
+
run 'rails generate model Role name:string'
|
7
7
|
run 'rails generate migration UsersHaveAndBelongToManyRoles'
|
8
8
|
|
9
9
|
|
@@ -52,9 +52,6 @@ inject_into_file 'app/models/role.rb', :after => "class Role < ActiveRecord::Bas
|
|
52
52
|
<<-RUBY
|
53
53
|
has_and_belongs_to_many :users
|
54
54
|
|
55
|
-
def self.sanitize role
|
56
|
-
role.to_s.humanize.split(' ').each{ |word| word.capitalize! }.join(' ')
|
57
|
-
end
|
58
55
|
RUBY
|
59
56
|
end
|
60
57
|
|
@@ -63,7 +60,7 @@ inject_into_file 'app/models/user.rb', :before => " def destroy\n" do
|
|
63
60
|
has_and_belongs_to_many :roles
|
64
61
|
|
65
62
|
def role?(role)
|
66
|
-
return !!self.roles.find_by_name(
|
63
|
+
return !!self.roles.find_by_name(role.to_s.camelize)
|
67
64
|
end
|
68
65
|
|
69
66
|
RUBY
|
@@ -6,22 +6,19 @@ say "Building authentication"
|
|
6
6
|
run 'rails generate devise:install --quiet'
|
7
7
|
run 'rails generate devise:views'
|
8
8
|
run 'rails generate devise User'
|
9
|
-
run 'rails generate migration AddUsernameToUsers username:
|
9
|
+
run 'rails generate migration AddUsernameToUsers username:index'
|
10
10
|
run 'rails generate migration AddDeletedAtToUsers deleted_at:datetime'
|
11
11
|
|
12
12
|
#----------------------------------------------------
|
13
13
|
# Modify migration files
|
14
14
|
#----------------------------------------------------
|
15
15
|
devise_migration = Dir['db/migrate/*_devise_create_users.rb'].first
|
16
|
-
gsub_file devise_migration, /# t.
|
16
|
+
gsub_file devise_migration, /# t.string :confirmation_token/, 't.string :confirmation_token'
|
17
|
+
gsub_file devise_migration, /# t.datetime :confirmed_at/, 't.datetime :confirmed_at'
|
18
|
+
gsub_file devise_migration, /# t.datetime :confirmation_sent_at/, 't.datetime :confirmation_sent_at'
|
19
|
+
gsub_file devise_migration, /# t.string :unconfirmed_email/, 't.string :unconfirmed_email'
|
17
20
|
gsub_file devise_migration, /# add_index :users, :confirmation_token, :unique => true/, 'add_index :users, :confirmation_token, :unique => true'
|
18
21
|
|
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
22
|
|
26
23
|
#----------------------------------------------------
|
27
24
|
# Update Seeds file
|
@@ -45,8 +42,10 @@ create_file 'app/models/user.rb' do
|
|
45
42
|
<<-RUBY
|
46
43
|
class User < ActiveRecord::Base
|
47
44
|
# Include default devise modules. Others available are:
|
48
|
-
# :token_authenticatable, :encryptable, :lockable, :timeoutable
|
49
|
-
devise :database_authenticatable, :registerable,
|
45
|
+
# :token_authenticatable, :encryptable, :lockable, :timeoutable and :omniauthable
|
46
|
+
devise :database_authenticatable, :registerable,
|
47
|
+
:recoverable, :rememberable, :trackable, :validatable, :confirmable
|
48
|
+
|
50
49
|
default_scope :conditions => { :deleted_at => nil }
|
51
50
|
|
52
51
|
# validations for model
|
@@ -127,9 +126,6 @@ config.i18n.fallbacks = true
|
|
127
126
|
RUBY
|
128
127
|
end
|
129
128
|
|
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
129
|
|
134
130
|
|
135
131
|
#----------------------------------------------------
|
@@ -1,15 +1,14 @@
|
|
1
1
|
gem 'haml'
|
2
2
|
gem 'haml-rails'
|
3
3
|
|
4
|
-
gem 'devise'
|
5
|
-
gem 'cancan'
|
4
|
+
gem 'devise', '~> 2.0.0'
|
5
|
+
gem 'cancan', '~> 1.6.7'
|
6
6
|
|
7
7
|
gem 'friendly_id'
|
8
8
|
gem 'paperclip'
|
9
|
+
gem 'bootstrap-sass'
|
9
10
|
|
10
|
-
gem '
|
11
|
-
gem '
|
12
|
-
|
13
|
-
gem 'capistrano'
|
11
|
+
gsub_file 'Gemfile', /# gem 'therubyracer'/, "gem 'therubyracer'"
|
12
|
+
gsub_file 'Gemfile', /# gem 'capistrano'/, "gem 'capistrano'"
|
14
13
|
|
15
14
|
run 'bundle install'
|
data/horsee.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.authors = ["Akash Kamboj"]
|
10
10
|
s.email = ["akash@filvo.com"]
|
11
11
|
s.homepage = "http://github.com/akashkamboj/horsee"
|
12
|
-
s.summary =
|
13
|
-
s.description =
|
12
|
+
s.summary = %q{Horsee makes the Rails application creation faster}
|
13
|
+
s.description = %q{Create a Rails app with authentication, authorization using Devise and CanCan}
|
14
14
|
|
15
15
|
s.rubyforge_project = "horsee"
|
16
16
|
|
@@ -19,5 +19,8 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
|
22
|
-
|
23
|
-
|
22
|
+
# specify any dependencies here; for example:
|
23
|
+
# s.add_development_dependency "rspec"
|
24
|
+
# s.add_runtime_dependency "rest-client"
|
25
|
+
s.add_dependency 'rails', '>= 3.2.1'
|
26
|
+
end
|
data/lib/horsee/cli.rb
CHANGED
data/lib/horsee/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: horsee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.4
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Akash Kamboj
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-02-16 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rails
|
@@ -25,15 +25,15 @@ dependencies:
|
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
hash:
|
28
|
+
hash: 13
|
29
29
|
segments:
|
30
30
|
- 3
|
31
|
+
- 2
|
31
32
|
- 1
|
32
|
-
|
33
|
-
version: 3.1.3
|
33
|
+
version: 3.2.1
|
34
34
|
type: :runtime
|
35
35
|
version_requirements: *id001
|
36
|
-
description:
|
36
|
+
description: Create a Rails app with authentication, authorization using Devise and CanCan
|
37
37
|
email:
|
38
38
|
- akash@filvo.com
|
39
39
|
executables:
|
@@ -45,7 +45,6 @@ extra_rdoc_files: []
|
|
45
45
|
files:
|
46
46
|
- .gitignore
|
47
47
|
- Gemfile
|
48
|
-
- README.rdoc
|
49
48
|
- Rakefile
|
50
49
|
- bin/horsee
|
51
50
|
- bootstrap/default/default.rb
|
@@ -54,7 +53,6 @@ files:
|
|
54
53
|
- bootstrap/default/templates/devise.rb
|
55
54
|
- bootstrap/default/templates/gemfile.rb
|
56
55
|
- bootstrap/default/templates/git.rb
|
57
|
-
- bootstrap/default/templates/haml_generator.rb
|
58
56
|
- bootstrap/default/templates/home_controller.rb
|
59
57
|
- bootstrap/default/templates/initializers.rb
|
60
58
|
- bootstrap/default/templates/layout.rb
|
@@ -93,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
91
|
requirements: []
|
94
92
|
|
95
93
|
rubyforge_project: horsee
|
96
|
-
rubygems_version: 1.8.
|
94
|
+
rubygems_version: 1.8.15
|
97
95
|
signing_key:
|
98
96
|
specification_version: 3
|
99
97
|
summary: Horsee makes the Rails application creation faster
|
data/README.rdoc
DELETED
@@ -1,27 +0,0 @@
|
|
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
|
-
|