contour 1.2.0.pre8 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +417 -0
- data/README.md +255 -0
- data/contour.gemspec +1 -1
- data/lib/contour/version.rb +1 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +238 -0
- metadata +7 -7
- data/CHANGELOG.rdoc +0 -415
- data/README.rdoc +0 -195
data/README.rdoc
DELETED
@@ -1,195 +0,0 @@
|
|
1
|
-
= Contour {<img src="https://secure.travis-ci.org/remomueller/contour.png"/>}[http://travis-ci.org/remomueller/contour] {<img src="https://gemnasium.com/remomueller/contour.png" alt="Dependency Status" />}[https://gemnasium.com/remomueller/contour] {<img src="https://codeclimate.com/github/remomueller/contour.png" />}[https://codeclimate.com/github/remomueller/contour]
|
2
|
-
|
3
|
-
Basic Rails framework files and assets for layout and authentication
|
4
|
-
|
5
|
-
== Installation
|
6
|
-
|
7
|
-
Contour can be installed from rubygems.org using
|
8
|
-
|
9
|
-
gem install contour
|
10
|
-
|
11
|
-
Or update your <tt>Gemfile</tt> to include
|
12
|
-
|
13
|
-
gem 'contour'
|
14
|
-
|
15
|
-
== Getting started
|
16
|
-
|
17
|
-
Make sure you have Rails 3.2.11
|
18
|
-
|
19
|
-
rails -v
|
20
|
-
|
21
|
-
rails new blank_rails_project
|
22
|
-
|
23
|
-
cd blank_rails_project
|
24
|
-
|
25
|
-
Modify <tt>Gemfile</tt> and add
|
26
|
-
|
27
|
-
gem 'contour', '~> 1.2.0'
|
28
|
-
|
29
|
-
Run Bundle install
|
30
|
-
|
31
|
-
bundle install
|
32
|
-
|
33
|
-
Install contour files
|
34
|
-
|
35
|
-
rails generate contour:install
|
36
|
-
|
37
|
-
Add the authentication model
|
38
|
-
|
39
|
-
rails generate model Authentication user_id:integer provider:string uid:string
|
40
|
-
|
41
|
-
Migrate your database
|
42
|
-
|
43
|
-
bundle exec rake db:create
|
44
|
-
|
45
|
-
bundle exec rake db:migrate
|
46
|
-
|
47
|
-
Create a sample controller
|
48
|
-
|
49
|
-
rails generate controller welcome index --skip-stylesheets
|
50
|
-
|
51
|
-
Remove the <tt>public/index.html</tt>
|
52
|
-
|
53
|
-
rm public/index.html
|
54
|
-
|
55
|
-
Add the following line to your <tt>app/controllers/application_controller.rb</tt>
|
56
|
-
|
57
|
-
layout "contour/layouts/application"
|
58
|
-
|
59
|
-
Edit your <tt>app/assets/javascripts/application.js</tt> manifest to use Contour JavaScript (Replace jquery and jquery_ujs)
|
60
|
-
|
61
|
-
//= require contour
|
62
|
-
|
63
|
-
Edit your <tt>app/assets/stylesheets/application.css</tt> manifest to use Contour CSS (after self, before tree)
|
64
|
-
|
65
|
-
*= require contour
|
66
|
-
|
67
|
-
Make sure the devise line in <tt>config/routes.rb</tt> looks as follows
|
68
|
-
|
69
|
-
devise_for :users, controllers: { registrations: 'contour/registrations', sessions: 'contour/sessions', passwords: 'contour/passwords', confirmations: 'contour/confirmations', unlocks: 'contour/unlocks' }, path_names: { sign_up: 'register', sign_in: 'login' }
|
70
|
-
|
71
|
-
<b>If there is a line that just says <tt>devise_for :users</tt> or a duplicate, <i>REMOVE IT!</i></b>
|
72
|
-
|
73
|
-
Create a root in your <tt>config/routes.rb</tt>
|
74
|
-
|
75
|
-
root to: 'welcome#index'
|
76
|
-
|
77
|
-
Add the following to the top of your <tt>app/controllers/welcome_controller.rb</tt>
|
78
|
-
|
79
|
-
before_filter :authenticate_user!
|
80
|
-
|
81
|
-
Add the following to your <tt>app/models/user.rb</tt>
|
82
|
-
|
83
|
-
# Model Relationships
|
84
|
-
has_many :authentications
|
85
|
-
|
86
|
-
def apply_omniauth(omniauth)
|
87
|
-
unless omniauth['info'].blank?
|
88
|
-
self.email = omniauth['info']['email'] if email.blank?
|
89
|
-
end
|
90
|
-
self.password = Devise.friendly_token[0,20] if self.password.blank?
|
91
|
-
authentications.build( provider: omniauth['provider'], uid: omniauth['uid'] )
|
92
|
-
end
|
93
|
-
|
94
|
-
def password_required?
|
95
|
-
(authentications.empty? || !password.blank?) && super
|
96
|
-
end
|
97
|
-
|
98
|
-
Add the following to your <tt>app/models/authentication.rb</tt>
|
99
|
-
|
100
|
-
belongs_to :user
|
101
|
-
|
102
|
-
def provider_name
|
103
|
-
OmniAuth.config.camelizations[provider.to_s.downcase] || provider.to_s.titleize
|
104
|
-
end
|
105
|
-
|
106
|
-
Edit <tt>config/initializers/devise.rb</tt> to use <tt>:get</tt> for devise <tt>sign_out_via</tt>
|
107
|
-
|
108
|
-
# The default HTTP method used to sign out a resource. Default is :delete.
|
109
|
-
config.sign_out_via = :get
|
110
|
-
|
111
|
-
Start your server and navigate to http://localhost:3000/users/login
|
112
|
-
|
113
|
-
rails s
|
114
|
-
|
115
|
-
You can then sign in using your {Google Account}[http://localhost:3000/auth/google_apps?domain=gmail.com] or by registering for an account at http://localhost:3000/users/register
|
116
|
-
|
117
|
-
== Overwrite Default Rails Scaffolding (optional)
|
118
|
-
|
119
|
-
Add {Kaminari}[https://github.com/amatsuda/kaminari] gem to your <tt>Gemfile</tt>
|
120
|
-
|
121
|
-
gem 'kaminari', '~> 0.14.1'
|
122
|
-
|
123
|
-
Update your gems
|
124
|
-
|
125
|
-
bundle update
|
126
|
-
|
127
|
-
Create a new model using the Rails scaffold
|
128
|
-
|
129
|
-
rails g scaffold Item name:string description:text user_id:integer bought_date:date --no-stylesheets
|
130
|
-
|
131
|
-
Add a current <tt>scope</tt> and <tt>belongs_to</tt> relationship to <tt>app/models/item.rb</tt>
|
132
|
-
|
133
|
-
scope :current, conditions: { }
|
134
|
-
|
135
|
-
belongs_to :user
|
136
|
-
|
137
|
-
Add a current <tt>scope</tt> and <tt>has_many</tt> relationship to <tt>app/models/user.rb</tt> along with name placeholder
|
138
|
-
|
139
|
-
scope :current, conditions: { }
|
140
|
-
|
141
|
-
has_many :items
|
142
|
-
|
143
|
-
def name
|
144
|
-
"User ##{self.id}"
|
145
|
-
end
|
146
|
-
|
147
|
-
Add a user resource to your <tt>config/routes.rb</tt> file
|
148
|
-
|
149
|
-
resources :users
|
150
|
-
|
151
|
-
NOTE: Adding the User controller is not shown, but could be created using <tt>rails g controller Users index show edit update destroy --no-stylesheets</tt>. Remember that the <tt>new</tt> and <tt>create</tt> actions are already defined and should be left commented out.
|
152
|
-
|
153
|
-
Migrate your database
|
154
|
-
|
155
|
-
bundle exec rake db:migrate
|
156
|
-
|
157
|
-
Update with the Contour scaffold
|
158
|
-
|
159
|
-
rails g contour:scaffold Item
|
160
|
-
|
161
|
-
When prompted to overwrite the existing files, type <tt>a</tt> for ALL.
|
162
|
-
|
163
|
-
NOTE: This will overwrite all the files generated by the rails scaffold command!
|
164
|
-
|
165
|
-
Go to http://localhost:3000/items to see the changes! Note, that the <tt>user_id</tt> selection now defaults to a drop down box!
|
166
|
-
|
167
|
-
== Inspiration and Attribution
|
168
|
-
|
169
|
-
Contour is designed to rapidly prototype Rails applications with nice default styling and a solid authentication system. The Contour code base has been influenced by existing Rails Engines architectures that are listed below. Please check them out if you are interested in seeing how Contour is put together!
|
170
|
-
|
171
|
-
=== Devise
|
172
|
-
|
173
|
-
{Devise}[https://github.com/plataformatec/devise] is the highly configurable authentication gem that Contour utilizes.
|
174
|
-
|
175
|
-
Contour has adopted Devise's installation and configuration approach <tt>rails generate devise:install</tt> and <tt>config/intializers/devise.rb</tt>.
|
176
|
-
|
177
|
-
=== Twitter Bootstrap Rails
|
178
|
-
|
179
|
-
While Contour doesn't have an external dependency on the {Twitter Bootstrap Rails}[https://github.com/seyhunak/twitter-bootstrap-rails] gem, Contour does adopt the templating approach, <tt>rails generate contour:scaffold ModelName</tt>, used to overwrite the default scaffolding provided by Rails.
|
180
|
-
|
181
|
-
For those interested in having better control on modifying the Twitter Bootstrap Less file and CSS, I highly recommend taking a look at Twitter Bootstrap Rails!
|
182
|
-
|
183
|
-
== Contributing to Contour
|
184
|
-
|
185
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
186
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
187
|
-
* Fork the project
|
188
|
-
* Start a feature/bugfix branch
|
189
|
-
* Commit and push until you are happy with your contribution
|
190
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
191
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
192
|
-
|
193
|
-
== Copyright {<img style="border-width:0" src="http://i.creativecommons.org/l/by-nc-sa/3.0/80x15.png"/>}[http://creativecommons.org/licenses/by-nc-sa/3.0/]
|
194
|
-
|
195
|
-
Copyright (c) 2013 Remo Mueller. See {LICENSE}[https://github.com/remomueller/contour/blob/master/LICENSE] for further details.
|