devise_oauth2_providable 0.3.8 → 1.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +33 -2
- data/README.md +23 -11
- data/Rakefile +8 -1
- data/app/controllers/devise/oauth2_providable/authorizations_controller.rb +59 -0
- data/app/controllers/{oauth2 → devise/oauth2_providable}/tokens_controller.rb +1 -1
- data/app/models/{access_token.rb → devise/oauth2_providable/access_token.rb} +1 -1
- data/app/models/{authorization_code.rb → devise/oauth2_providable/authorization_code.rb} +1 -1
- data/app/models/{client.rb → devise/oauth2_providable/client.rb} +2 -1
- data/app/models/{refresh_token.rb → devise/oauth2_providable/refresh_token.rb} +1 -1
- data/app/views/{oauth2 → devise/oauth2_providable}/authorizations/_form.html.erb +1 -1
- data/app/views/{oauth2 → devise/oauth2_providable}/authorizations/error.html.erb +0 -0
- data/app/views/devise/oauth2_providable/authorizations/new.html.erb +4 -0
- data/config/routes.rb +6 -6
- data/db/migrate/20111014160714_create_devise_oauth2_providable_schema.rb +55 -0
- data/devise_oauth2_providable.gemspec +7 -4
- data/lib/{devise_oauth2_providable → devise/oauth2_providable}/engine.rb +2 -1
- data/lib/{devise_oauth2_providable → devise/oauth2_providable}/models/oauth2_authorization_code_grantable.rb +0 -0
- data/lib/{devise_oauth2_providable → devise/oauth2_providable}/models/oauth2_password_grantable.rb +0 -0
- data/lib/devise/oauth2_providable/models/oauth2_providable.rb +13 -0
- data/lib/{devise_oauth2_providable → devise/oauth2_providable}/models/oauth2_refresh_token_grantable.rb +0 -0
- data/lib/{devise_oauth2_providable → devise/oauth2_providable}/strategies/oauth2_authorization_code_grant_type_strategy.rb +2 -2
- data/lib/{devise_oauth2_providable → devise/oauth2_providable}/strategies/oauth2_grant_type_strategy.rb +2 -2
- data/lib/{devise_oauth2_providable → devise/oauth2_providable}/strategies/oauth2_password_grant_type_strategy.rb +1 -1
- data/lib/{devise_oauth2_providable/strategy.rb → devise/oauth2_providable/strategies/oauth2_providable_strategy.rb} +1 -1
- data/lib/{devise_oauth2_providable → devise/oauth2_providable}/strategies/oauth2_refresh_token_grant_type_strategy.rb +1 -1
- data/lib/{devise_oauth2_providable → devise/oauth2_providable}/version.rb +1 -1
- data/lib/devise_oauth2_providable.rb +16 -14
- data/script/rails +6 -0
- data/spec/{rails_app/spec/controllers → controllers}/protected_controller_spec.rb +3 -3
- data/spec/{rails_app → dummy}/Rakefile +2 -2
- data/spec/dummy/app/assets/javascripts/application.js +7 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/{rails_app → dummy}/app/controllers/application_controller.rb +0 -0
- data/spec/{rails_app → dummy}/app/controllers/protected_controller.rb +0 -0
- data/spec/{rails_app → dummy}/app/helpers/application_helper.rb +0 -0
- data/spec/{rails_app/lib/tasks → dummy/app/mailers}/.gitkeep +0 -0
- data/spec/{rails_app/public/javascripts → dummy/app/models}/.gitkeep +0 -0
- data/spec/{rails_app → dummy}/app/models/user.rb +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/{rails_app → dummy}/config/application.rb +10 -7
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/{rails_app → dummy}/config/database.yml +3 -0
- data/spec/{rails_app → dummy}/config/environment.rb +1 -1
- data/spec/{rails_app → dummy}/config/environments/development.rb +8 -4
- data/spec/{rails_app → dummy}/config/environments/production.rb +24 -13
- data/spec/{rails_app → dummy}/config/environments/test.rb +6 -2
- data/spec/{rails_app → dummy}/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/{rails_app → dummy}/config/initializers/devise.rb +29 -17
- data/spec/{rails_app → dummy}/config/initializers/inflections.rb +0 -0
- data/spec/{rails_app → dummy}/config/initializers/mime_types.rb +0 -0
- data/spec/{rails_app → dummy}/config/initializers/secret_token.rb +1 -1
- data/spec/{rails_app → dummy}/config/initializers/session_store.rb +2 -2
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/{rails_app → dummy}/config/locales/devise.en.yml +8 -0
- data/spec/{rails_app → dummy}/config/locales/en.yml +1 -1
- data/spec/dummy/config/routes.rb +7 -0
- data/spec/{rails_app → dummy}/config.ru +1 -1
- data/spec/{rails_app/db/migrate/20110511210926_create_users.rb → dummy/db/migrate/20111014142838_create_users.rb} +1 -7
- data/spec/dummy/db/migrate/20111014161437_create_devise_oauth2_providable_schema.rb +55 -0
- data/spec/dummy/db/schema.rb +78 -0
- data/spec/{rails_app/public/stylesheets → dummy/lib/assets}/.gitkeep +0 -0
- data/spec/{rails_app/vendor/plugins → dummy/log}/.gitkeep +0 -0
- data/spec/{rails_app → dummy}/public/404.html +0 -0
- data/spec/{rails_app → dummy}/public/422.html +0 -0
- data/spec/{rails_app → dummy}/public/500.html +0 -0
- data/spec/{rails_app → dummy}/public/favicon.ico +0 -0
- data/spec/{rails_app → dummy}/script/rails +0 -0
- data/spec/{rails_app/spec/integration → integration}/oauth2_authorization_token_grant_type_strategy_spec.rb +7 -7
- data/spec/{rails_app/spec/integration → integration}/oauth2_password_grant_type_strategy_spec.rb +6 -6
- data/spec/{rails_app/spec/integration → integration}/oauth2_refresh_token_grant_type_strategy_spec.rb +6 -6
- data/spec/{devise_oauth2_providable_spec.rb → lib/devise_oauth2_providable_spec.rb} +0 -0
- data/spec/{rails_app/spec/models → models}/access_token_spec.rb +7 -5
- data/spec/{rails_app/spec/models → models}/authorization_code_spec.rb +3 -3
- data/spec/{rails_app/spec/models → models}/client_spec.rb +5 -2
- data/spec/{rails_app/spec/models → models}/refresh_token_spec.rb +5 -3
- data/spec/models/user_spec.rb +6 -0
- data/spec/{rails_app/spec/routing → routing}/authorizations_routing_spec.rb +1 -1
- data/spec/{rails_app/spec/routing → routing}/tokens_routing_spec.rb +1 -1
- data/spec/spec_helper.rb +14 -20
- data/spec/support/match_json.rb +6 -0
- metadata +204 -162
- data/app/controllers/oauth2/authorizations_controller.rb +0 -55
- data/app/views/oauth2/authorizations/new.html.erb +0 -5
- data/lib/devise_oauth2_providable/model.rb +0 -13
- data/lib/devise_oauth2_providable/schema.rb +0 -61
- data/spec/rails_app/.gitignore +0 -4
- data/spec/rails_app/.rspec +0 -2
- data/spec/rails_app/Gemfile +0 -36
- data/spec/rails_app/README +0 -256
- data/spec/rails_app/app/views/layouts/application.html.erb +0 -14
- data/spec/rails_app/config/boot.rb +0 -6
- data/spec/rails_app/config/routes.rb +0 -61
- data/spec/rails_app/db/migrate/20110511210818_create_oauth2_schema.rb +0 -8
- data/spec/rails_app/db/schema.rb +0 -79
- data/spec/rails_app/db/seeds.rb +0 -7
- data/spec/rails_app/doc/README_FOR_APP +0 -2
- data/spec/rails_app/public/images/rails.png +0 -0
- data/spec/rails_app/public/index.html +0 -239
- data/spec/rails_app/public/javascripts/application.js +0 -0
- data/spec/rails_app/public/robots.txt +0 -5
- data/spec/rails_app/spec/models/user_spec.rb +0 -8
- data/spec/rails_app/spec/spec_helper.rb +0 -36
@@ -1,61 +0,0 @@
|
|
1
|
-
require 'devise/schema'
|
2
|
-
|
3
|
-
module Devise
|
4
|
-
module Oauth2Providable
|
5
|
-
module Schema
|
6
|
-
def self.up(migration)
|
7
|
-
migration.create_table :clients do |t|
|
8
|
-
t.string :name
|
9
|
-
t.string :redirect_uri
|
10
|
-
t.string :website
|
11
|
-
t.string :identifier
|
12
|
-
t.string :secret
|
13
|
-
t.timestamps
|
14
|
-
end
|
15
|
-
migration.add_index :clients, :identifier, :unique => true
|
16
|
-
|
17
|
-
migration.create_table :access_tokens do |t|
|
18
|
-
t.belongs_to :user, :client, :refresh_token
|
19
|
-
t.string :token
|
20
|
-
t.datetime :expires_at
|
21
|
-
t.timestamps
|
22
|
-
end
|
23
|
-
migration.add_index :access_tokens, :token, :unique => true
|
24
|
-
migration.add_index :access_tokens, :expires_at
|
25
|
-
migration.add_index :access_tokens, :user_id
|
26
|
-
migration.add_index :access_tokens, :client_id
|
27
|
-
|
28
|
-
migration.create_table :refresh_tokens do |t|
|
29
|
-
t.belongs_to :user, :client
|
30
|
-
t.string :token
|
31
|
-
t.datetime :expires_at
|
32
|
-
t.timestamps
|
33
|
-
end
|
34
|
-
migration.add_index :refresh_tokens, :token, :unique => true
|
35
|
-
migration.add_index :refresh_tokens, :expires_at
|
36
|
-
migration.add_index :refresh_tokens, :user_id
|
37
|
-
migration.add_index :refresh_tokens, :client_id
|
38
|
-
|
39
|
-
migration.create_table :authorization_codes do |t|
|
40
|
-
t.belongs_to :user, :client
|
41
|
-
t.string :token
|
42
|
-
t.datetime :expires_at
|
43
|
-
t.string :redirect_uri
|
44
|
-
t.timestamps
|
45
|
-
end
|
46
|
-
migration.add_index :authorization_codes, :token, :unique => true
|
47
|
-
migration.add_index :authorization_codes, :expires_at
|
48
|
-
migration.add_index :authorization_codes, :user_id
|
49
|
-
migration.add_index :authorization_codes, :client_id
|
50
|
-
end
|
51
|
-
|
52
|
-
def self.down(migration)
|
53
|
-
migration.drop_table :refresh_tokens
|
54
|
-
migration.drop_table :access_tokens
|
55
|
-
migration.drop_table :authorization_codes
|
56
|
-
migration.drop_table :clients
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
data/spec/rails_app/.gitignore
DELETED
data/spec/rails_app/.rspec
DELETED
data/spec/rails_app/Gemfile
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
source 'http://rubygems.org'
|
2
|
-
|
3
|
-
gem 'rails', '3.0.9'
|
4
|
-
gem 'rspec-rails', '2.6.0'
|
5
|
-
gem 'devise_oauth2_providable', :path => '../../'
|
6
|
-
gem 'shoulda-matchers', '1.0.0.beta2'
|
7
|
-
gem 'sqlite3', '1.3.3'
|
8
|
-
gem 'ruby-debug', '0.10.4', :platform => :ruby_18
|
9
|
-
gem 'ruby-debug19', '0.11.6', :platform => :ruby_19
|
10
|
-
|
11
|
-
# Bundle edge Rails instead:
|
12
|
-
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
13
|
-
|
14
|
-
|
15
|
-
# Use unicorn as the web server
|
16
|
-
# gem 'unicorn'
|
17
|
-
|
18
|
-
# Deploy with Capistrano
|
19
|
-
# gem 'capistrano'
|
20
|
-
|
21
|
-
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
|
22
|
-
# gem 'ruby-debug'
|
23
|
-
# gem 'ruby-debug19', :require => 'ruby-debug'
|
24
|
-
|
25
|
-
# Bundle the extra gems:
|
26
|
-
# gem 'bj'
|
27
|
-
# gem 'nokogiri'
|
28
|
-
# gem 'sqlite3-ruby', :require => 'sqlite3'
|
29
|
-
# gem 'aws-s3', :require => 'aws/s3'
|
30
|
-
|
31
|
-
# Bundle gems for the local environment. Make sure to
|
32
|
-
# put test-only gems in this group so their generators
|
33
|
-
# and rake tasks are available in development mode:
|
34
|
-
# group :development, :test do
|
35
|
-
# gem 'webrat'
|
36
|
-
# end
|
data/spec/rails_app/README
DELETED
@@ -1,256 +0,0 @@
|
|
1
|
-
== Welcome to Rails
|
2
|
-
|
3
|
-
Rails is a web-application framework that includes everything needed to create
|
4
|
-
database-backed web applications according to the Model-View-Control pattern.
|
5
|
-
|
6
|
-
This pattern splits the view (also called the presentation) into "dumb"
|
7
|
-
templates that are primarily responsible for inserting pre-built data in between
|
8
|
-
HTML tags. The model contains the "smart" domain objects (such as Account,
|
9
|
-
Product, Person, Post) that holds all the business logic and knows how to
|
10
|
-
persist themselves to a database. The controller handles the incoming requests
|
11
|
-
(such as Save New Account, Update Product, Show Post) by manipulating the model
|
12
|
-
and directing data to the view.
|
13
|
-
|
14
|
-
In Rails, the model is handled by what's called an object-relational mapping
|
15
|
-
layer entitled Active Record. This layer allows you to present the data from
|
16
|
-
database rows as objects and embellish these data objects with business logic
|
17
|
-
methods. You can read more about Active Record in
|
18
|
-
link:files/vendor/rails/activerecord/README.html.
|
19
|
-
|
20
|
-
The controller and view are handled by the Action Pack, which handles both
|
21
|
-
layers by its two parts: Action View and Action Controller. These two layers
|
22
|
-
are bundled in a single package due to their heavy interdependence. This is
|
23
|
-
unlike the relationship between the Active Record and Action Pack that is much
|
24
|
-
more separate. Each of these packages can be used independently outside of
|
25
|
-
Rails. You can read more about Action Pack in
|
26
|
-
link:files/vendor/rails/actionpack/README.html.
|
27
|
-
|
28
|
-
|
29
|
-
== Getting Started
|
30
|
-
|
31
|
-
1. At the command prompt, create a new Rails application:
|
32
|
-
<tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
|
33
|
-
|
34
|
-
2. Change directory to <tt>myapp</tt> and start the web server:
|
35
|
-
<tt>cd myapp; rails server</tt> (run with --help for options)
|
36
|
-
|
37
|
-
3. Go to http://localhost:3000/ and you'll see:
|
38
|
-
"Welcome aboard: You're riding Ruby on Rails!"
|
39
|
-
|
40
|
-
4. Follow the guidelines to start developing your application. You can find
|
41
|
-
the following resources handy:
|
42
|
-
|
43
|
-
* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
|
44
|
-
* Ruby on Rails Tutorial Book: http://www.railstutorial.org/
|
45
|
-
|
46
|
-
|
47
|
-
== Debugging Rails
|
48
|
-
|
49
|
-
Sometimes your application goes wrong. Fortunately there are a lot of tools that
|
50
|
-
will help you debug it and get it back on the rails.
|
51
|
-
|
52
|
-
First area to check is the application log files. Have "tail -f" commands
|
53
|
-
running on the server.log and development.log. Rails will automatically display
|
54
|
-
debugging and runtime information to these files. Debugging info will also be
|
55
|
-
shown in the browser on requests from 127.0.0.1.
|
56
|
-
|
57
|
-
You can also log your own messages directly into the log file from your code
|
58
|
-
using the Ruby logger class from inside your controllers. Example:
|
59
|
-
|
60
|
-
class WeblogController < ActionController::Base
|
61
|
-
def destroy
|
62
|
-
@weblog = Weblog.find(params[:id])
|
63
|
-
@weblog.destroy
|
64
|
-
logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
The result will be a message in your log file along the lines of:
|
69
|
-
|
70
|
-
Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
|
71
|
-
|
72
|
-
More information on how to use the logger is at http://www.ruby-doc.org/core/
|
73
|
-
|
74
|
-
Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
|
75
|
-
several books available online as well:
|
76
|
-
|
77
|
-
* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
|
78
|
-
* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
|
79
|
-
|
80
|
-
These two books will bring you up to speed on the Ruby language and also on
|
81
|
-
programming in general.
|
82
|
-
|
83
|
-
|
84
|
-
== Debugger
|
85
|
-
|
86
|
-
Debugger support is available through the debugger command when you start your
|
87
|
-
Mongrel or WEBrick server with --debugger. This means that you can break out of
|
88
|
-
execution at any point in the code, investigate and change the model, and then,
|
89
|
-
resume execution! You need to install ruby-debug to run the server in debugging
|
90
|
-
mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
|
91
|
-
|
92
|
-
class WeblogController < ActionController::Base
|
93
|
-
def index
|
94
|
-
@posts = Post.find(:all)
|
95
|
-
debugger
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
So the controller will accept the action, run the first line, then present you
|
100
|
-
with a IRB prompt in the server window. Here you can do things like:
|
101
|
-
|
102
|
-
>> @posts.inspect
|
103
|
-
=> "[#<Post:0x14a6be8
|
104
|
-
@attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
|
105
|
-
#<Post:0x14a6620
|
106
|
-
@attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
|
107
|
-
>> @posts.first.title = "hello from a debugger"
|
108
|
-
=> "hello from a debugger"
|
109
|
-
|
110
|
-
...and even better, you can examine how your runtime objects actually work:
|
111
|
-
|
112
|
-
>> f = @posts.first
|
113
|
-
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
|
114
|
-
>> f.
|
115
|
-
Display all 152 possibilities? (y or n)
|
116
|
-
|
117
|
-
Finally, when you're ready to resume execution, you can enter "cont".
|
118
|
-
|
119
|
-
|
120
|
-
== Console
|
121
|
-
|
122
|
-
The console is a Ruby shell, which allows you to interact with your
|
123
|
-
application's domain model. Here you'll have all parts of the application
|
124
|
-
configured, just like it is when the application is running. You can inspect
|
125
|
-
domain models, change values, and save to the database. Starting the script
|
126
|
-
without arguments will launch it in the development environment.
|
127
|
-
|
128
|
-
To start the console, run <tt>rails console</tt> from the application
|
129
|
-
directory.
|
130
|
-
|
131
|
-
Options:
|
132
|
-
|
133
|
-
* Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
|
134
|
-
made to the database.
|
135
|
-
* Passing an environment name as an argument will load the corresponding
|
136
|
-
environment. Example: <tt>rails console production</tt>.
|
137
|
-
|
138
|
-
To reload your controllers and models after launching the console run
|
139
|
-
<tt>reload!</tt>
|
140
|
-
|
141
|
-
More information about irb can be found at:
|
142
|
-
link:http://www.rubycentral.com/pickaxe/irb.html
|
143
|
-
|
144
|
-
|
145
|
-
== dbconsole
|
146
|
-
|
147
|
-
You can go to the command line of your database directly through <tt>rails
|
148
|
-
dbconsole</tt>. You would be connected to the database with the credentials
|
149
|
-
defined in database.yml. Starting the script without arguments will connect you
|
150
|
-
to the development database. Passing an argument will connect you to a different
|
151
|
-
database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
|
152
|
-
PostgreSQL and SQLite 3.
|
153
|
-
|
154
|
-
== Description of Contents
|
155
|
-
|
156
|
-
The default directory structure of a generated Ruby on Rails application:
|
157
|
-
|
158
|
-
|-- app
|
159
|
-
| |-- controllers
|
160
|
-
| |-- helpers
|
161
|
-
| |-- mailers
|
162
|
-
| |-- models
|
163
|
-
| `-- views
|
164
|
-
| `-- layouts
|
165
|
-
|-- config
|
166
|
-
| |-- environments
|
167
|
-
| |-- initializers
|
168
|
-
| `-- locales
|
169
|
-
|-- db
|
170
|
-
|-- doc
|
171
|
-
|-- lib
|
172
|
-
| `-- tasks
|
173
|
-
|-- log
|
174
|
-
|-- public
|
175
|
-
| |-- images
|
176
|
-
| |-- javascripts
|
177
|
-
| `-- stylesheets
|
178
|
-
|-- script
|
179
|
-
|-- test
|
180
|
-
| |-- fixtures
|
181
|
-
| |-- functional
|
182
|
-
| |-- integration
|
183
|
-
| |-- performance
|
184
|
-
| `-- unit
|
185
|
-
|-- tmp
|
186
|
-
| |-- cache
|
187
|
-
| |-- pids
|
188
|
-
| |-- sessions
|
189
|
-
| `-- sockets
|
190
|
-
`-- vendor
|
191
|
-
`-- plugins
|
192
|
-
|
193
|
-
app
|
194
|
-
Holds all the code that's specific to this particular application.
|
195
|
-
|
196
|
-
app/controllers
|
197
|
-
Holds controllers that should be named like weblogs_controller.rb for
|
198
|
-
automated URL mapping. All controllers should descend from
|
199
|
-
ApplicationController which itself descends from ActionController::Base.
|
200
|
-
|
201
|
-
app/models
|
202
|
-
Holds models that should be named like post.rb. Models descend from
|
203
|
-
ActiveRecord::Base by default.
|
204
|
-
|
205
|
-
app/views
|
206
|
-
Holds the template files for the view that should be named like
|
207
|
-
weblogs/index.html.erb for the WeblogsController#index action. All views use
|
208
|
-
eRuby syntax by default.
|
209
|
-
|
210
|
-
app/views/layouts
|
211
|
-
Holds the template files for layouts to be used with views. This models the
|
212
|
-
common header/footer method of wrapping views. In your views, define a layout
|
213
|
-
using the <tt>layout :default</tt> and create a file named default.html.erb.
|
214
|
-
Inside default.html.erb, call <% yield %> to render the view using this
|
215
|
-
layout.
|
216
|
-
|
217
|
-
app/helpers
|
218
|
-
Holds view helpers that should be named like weblogs_helper.rb. These are
|
219
|
-
generated for you automatically when using generators for controllers.
|
220
|
-
Helpers can be used to wrap functionality for your views into methods.
|
221
|
-
|
222
|
-
config
|
223
|
-
Configuration files for the Rails environment, the routing map, the database,
|
224
|
-
and other dependencies.
|
225
|
-
|
226
|
-
db
|
227
|
-
Contains the database schema in schema.rb. db/migrate contains all the
|
228
|
-
sequence of Migrations for your schema.
|
229
|
-
|
230
|
-
doc
|
231
|
-
This directory is where your application documentation will be stored when
|
232
|
-
generated using <tt>rake doc:app</tt>
|
233
|
-
|
234
|
-
lib
|
235
|
-
Application specific libraries. Basically, any kind of custom code that
|
236
|
-
doesn't belong under controllers, models, or helpers. This directory is in
|
237
|
-
the load path.
|
238
|
-
|
239
|
-
public
|
240
|
-
The directory available for the web server. Contains subdirectories for
|
241
|
-
images, stylesheets, and javascripts. Also contains the dispatchers and the
|
242
|
-
default HTML files. This should be set as the DOCUMENT_ROOT of your web
|
243
|
-
server.
|
244
|
-
|
245
|
-
script
|
246
|
-
Helper scripts for automation and generation.
|
247
|
-
|
248
|
-
test
|
249
|
-
Unit and functional tests along with fixtures. When using the rails generate
|
250
|
-
command, template test files will be generated for you and placed in this
|
251
|
-
directory.
|
252
|
-
|
253
|
-
vendor
|
254
|
-
External libraries that the application depends on. Also includes the plugins
|
255
|
-
subdirectory. If the app has frozen rails, those gems also go here, under
|
256
|
-
vendor/rails/. This directory is in the load path.
|
@@ -1,61 +0,0 @@
|
|
1
|
-
RailsApp::Application.routes.draw do
|
2
|
-
devise_for :users
|
3
|
-
resources :protected
|
4
|
-
|
5
|
-
# The priority is based upon order of creation:
|
6
|
-
# first created -> highest priority.
|
7
|
-
|
8
|
-
# Sample of regular route:
|
9
|
-
# match 'products/:id' => 'catalog#view'
|
10
|
-
# Keep in mind you can assign values other than :controller and :action
|
11
|
-
|
12
|
-
# Sample of named route:
|
13
|
-
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
14
|
-
# This route can be invoked with purchase_url(:id => product.id)
|
15
|
-
|
16
|
-
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
17
|
-
# resources :products
|
18
|
-
|
19
|
-
# Sample resource route with options:
|
20
|
-
# resources :products do
|
21
|
-
# member do
|
22
|
-
# get 'short'
|
23
|
-
# post 'toggle'
|
24
|
-
# end
|
25
|
-
#
|
26
|
-
# collection do
|
27
|
-
# get 'sold'
|
28
|
-
# end
|
29
|
-
# end
|
30
|
-
|
31
|
-
# Sample resource route with sub-resources:
|
32
|
-
# resources :products do
|
33
|
-
# resources :comments, :sales
|
34
|
-
# resource :seller
|
35
|
-
# end
|
36
|
-
|
37
|
-
# Sample resource route with more complex sub-resources
|
38
|
-
# resources :products do
|
39
|
-
# resources :comments
|
40
|
-
# resources :sales do
|
41
|
-
# get 'recent', :on => :collection
|
42
|
-
# end
|
43
|
-
# end
|
44
|
-
|
45
|
-
# Sample resource route within a namespace:
|
46
|
-
# namespace :admin do
|
47
|
-
# # Directs /admin/products/* to Admin::ProductsController
|
48
|
-
# # (app/controllers/admin/products_controller.rb)
|
49
|
-
# resources :products
|
50
|
-
# end
|
51
|
-
|
52
|
-
# You can have the root of your site routed with "root"
|
53
|
-
# just remember to delete public/index.html.
|
54
|
-
# root :to => "welcome#index"
|
55
|
-
|
56
|
-
# See how all your routes lay out with "rake routes"
|
57
|
-
|
58
|
-
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
59
|
-
# Note: This route will make all actions in every controller accessible via GET requests.
|
60
|
-
# match ':controller(/:action(/:id(.:format)))'
|
61
|
-
end
|
data/spec/rails_app/db/schema.rb
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
# This file is auto-generated from the current state of the database. Instead
|
2
|
-
# of editing this file, please use the migrations feature of Active Record to
|
3
|
-
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
-
#
|
5
|
-
# Note that this schema.rb definition is the authoritative source for your
|
6
|
-
# database schema. If you need to create the application database on another
|
7
|
-
# system, you should be using db:schema:load, not running all the migrations
|
8
|
-
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
9
|
-
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
10
|
-
#
|
11
|
-
# It's strongly recommended to check this file into your version control system.
|
12
|
-
|
13
|
-
ActiveRecord::Schema.define(:version => 20110511210926) do
|
14
|
-
|
15
|
-
create_table "access_tokens", :force => true do |t|
|
16
|
-
t.integer "user_id"
|
17
|
-
t.integer "client_id"
|
18
|
-
t.integer "refresh_token_id"
|
19
|
-
t.string "token"
|
20
|
-
t.datetime "expires_at"
|
21
|
-
t.datetime "created_at"
|
22
|
-
t.datetime "updated_at"
|
23
|
-
end
|
24
|
-
|
25
|
-
add_index "access_tokens", ["client_id"], :name => "index_access_tokens_on_client_id"
|
26
|
-
add_index "access_tokens", ["expires_at"], :name => "index_access_tokens_on_expires_at"
|
27
|
-
add_index "access_tokens", ["token"], :name => "index_access_tokens_on_token", :unique => true
|
28
|
-
add_index "access_tokens", ["user_id"], :name => "index_access_tokens_on_user_id"
|
29
|
-
|
30
|
-
create_table "authorization_codes", :force => true do |t|
|
31
|
-
t.integer "user_id"
|
32
|
-
t.integer "client_id"
|
33
|
-
t.string "token"
|
34
|
-
t.datetime "expires_at"
|
35
|
-
t.string "redirect_uri"
|
36
|
-
t.datetime "created_at"
|
37
|
-
t.datetime "updated_at"
|
38
|
-
end
|
39
|
-
|
40
|
-
add_index "authorization_codes", ["client_id"], :name => "index_authorization_codes_on_client_id"
|
41
|
-
add_index "authorization_codes", ["expires_at"], :name => "index_authorization_codes_on_expires_at"
|
42
|
-
add_index "authorization_codes", ["token"], :name => "index_authorization_codes_on_token", :unique => true
|
43
|
-
add_index "authorization_codes", ["user_id"], :name => "index_authorization_codes_on_user_id"
|
44
|
-
|
45
|
-
create_table "clients", :force => true do |t|
|
46
|
-
t.string "name"
|
47
|
-
t.string "redirect_uri"
|
48
|
-
t.string "website"
|
49
|
-
t.string "identifier"
|
50
|
-
t.string "secret"
|
51
|
-
t.datetime "created_at"
|
52
|
-
t.datetime "updated_at"
|
53
|
-
end
|
54
|
-
|
55
|
-
add_index "clients", ["identifier"], :name => "index_clients_on_identifier", :unique => true
|
56
|
-
|
57
|
-
create_table "refresh_tokens", :force => true do |t|
|
58
|
-
t.integer "user_id"
|
59
|
-
t.integer "client_id"
|
60
|
-
t.string "token"
|
61
|
-
t.datetime "expires_at"
|
62
|
-
t.datetime "created_at"
|
63
|
-
t.datetime "updated_at"
|
64
|
-
end
|
65
|
-
|
66
|
-
add_index "refresh_tokens", ["client_id"], :name => "index_refresh_tokens_on_client_id"
|
67
|
-
add_index "refresh_tokens", ["expires_at"], :name => "index_refresh_tokens_on_expires_at"
|
68
|
-
add_index "refresh_tokens", ["token"], :name => "index_refresh_tokens_on_token", :unique => true
|
69
|
-
add_index "refresh_tokens", ["user_id"], :name => "index_refresh_tokens_on_user_id"
|
70
|
-
|
71
|
-
create_table "users", :force => true do |t|
|
72
|
-
t.string "email"
|
73
|
-
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
74
|
-
t.string "name"
|
75
|
-
t.datetime "created_at"
|
76
|
-
t.datetime "updated_at"
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
data/spec/rails_app/db/seeds.rb
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
-
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
-
#
|
4
|
-
# Examples:
|
5
|
-
#
|
6
|
-
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
7
|
-
# Mayor.create(:name => 'Daley', :city => cities.first)
|
Binary file
|