redis-kit 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.travis.yml +17 -0
- data/CHANGELOG.md +18 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +55 -0
- data/Guardfile +6 -0
- data/Makefile +26 -0
- data/README.md +122 -0
- data/Rakefile +10 -0
- data/lib/redis-kit/railtie.rb +16 -0
- data/lib/redis-kit/resque.rb +31 -0
- data/lib/redis-kit/version.rb +3 -0
- data/lib/redis-kit.rb +92 -0
- data/redis-kit.gemspec +28 -0
- data/test/railsapi/.gitignore +15 -0
- data/test/railsapi/Gemfile.rails_3_2 +14 -0
- data/test/railsapi/Gemfile.rails_3_2.lock +139 -0
- data/test/railsapi/Gemfile.rails_head +14 -0
- data/test/railsapi/Gemfile.rails_head.lock +143 -0
- data/test/railsapi/README.rdoc +261 -0
- data/test/railsapi/Rakefile +7 -0
- data/test/railsapi/app/controllers/application_controller.rb +2 -0
- data/test/railsapi/app/controllers/redis_controller.rb +5 -0
- data/test/railsapi/app/mailers/.gitkeep +0 -0
- data/test/railsapi/app/models/.gitkeep +0 -0
- data/test/railsapi/config/application.rb +46 -0
- data/test/railsapi/config/boot.rb +6 -0
- data/test/railsapi/config/environment.rb +5 -0
- data/test/railsapi/config/environments/development.rb +23 -0
- data/test/railsapi/config/environments/production.rb +44 -0
- data/test/railsapi/config/environments/test.rb +29 -0
- data/test/railsapi/config/initializers/wrap_parameters.rb +13 -0
- data/test/railsapi/config/locales/en.yml +5 -0
- data/test/railsapi/config/redis.mock.yml +2 -0
- data/test/railsapi/config/redis.yml +4 -0
- data/test/railsapi/config/redis_bad_syntax.yml +2 -0
- data/test/railsapi/config/routes.rb +60 -0
- data/test/railsapi/config.ru +4 -0
- data/test/railsapi/doc/README_FOR_APP +2 -0
- data/test/railsapi/lib/assets/.gitkeep +0 -0
- data/test/railsapi/lib/tasks/.gitkeep +0 -0
- data/test/railsapi/log/.gitkeep +0 -0
- data/test/railsapi/public/404.html +26 -0
- data/test/railsapi/public/422.html +26 -0
- data/test/railsapi/public/500.html +25 -0
- data/test/railsapi/public/favicon.ico +0 -0
- data/test/railsapi/public/index.html +241 -0
- data/test/railsapi/public/robots.txt +5 -0
- data/test/railsapi/script/rails +6 -0
- data/test/railsapi/test/fixtures/.gitkeep +0 -0
- data/test/railsapi/test/functional/.gitkeep +0 -0
- data/test/railsapi/test/functional/redis_controller_test.rb +9 -0
- data/test/railsapi/test/integration/.gitkeep +0 -0
- data/test/railsapi/test/test_helper.rb +63 -0
- data/test/railsapi/test/unit/.gitkeep +0 -0
- data/test/railsapi/test/unit/redis-kit_test.rb +108 -0
- data/test/redis-kit_test.rb +72 -0
- data/test/support/redis.blank.yml +0 -0
- data/test/support/redis.good.yml +7 -0
- data/test/support/redis.invalid.yml +1 -0
- data/test/test_helper.rb +33 -0
- metadata +266 -0
@@ -0,0 +1,143 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git://github.com/rails/rails.git
|
3
|
+
revision: b359c5db9f0e7dfb2cbf34362a9b310cf5aadd3a
|
4
|
+
specs:
|
5
|
+
actionmailer (4.0.0.beta1)
|
6
|
+
actionpack (= 4.0.0.beta1)
|
7
|
+
mail (~> 2.5.3)
|
8
|
+
actionpack (4.0.0.beta1)
|
9
|
+
activesupport (= 4.0.0.beta1)
|
10
|
+
builder (~> 3.1.0)
|
11
|
+
erubis (~> 2.7.0)
|
12
|
+
rack (~> 1.5.2)
|
13
|
+
rack-test (~> 0.6.2)
|
14
|
+
activemodel (4.0.0.beta1)
|
15
|
+
activesupport (= 4.0.0.beta1)
|
16
|
+
builder (~> 3.1.0)
|
17
|
+
activerecord (4.0.0.beta1)
|
18
|
+
activemodel (= 4.0.0.beta1)
|
19
|
+
activerecord-deprecated_finders (~> 0.0.3)
|
20
|
+
activesupport (= 4.0.0.beta1)
|
21
|
+
arel (~> 4.0.0.beta1)
|
22
|
+
activesupport (4.0.0.beta1)
|
23
|
+
i18n (~> 0.6, >= 0.6.4)
|
24
|
+
minitest (~> 4.2)
|
25
|
+
multi_json (~> 1.3)
|
26
|
+
thread_safe (~> 0.1)
|
27
|
+
tzinfo (~> 0.3.33)
|
28
|
+
rails (4.0.0.beta1)
|
29
|
+
actionmailer (= 4.0.0.beta1)
|
30
|
+
actionpack (= 4.0.0.beta1)
|
31
|
+
activerecord (= 4.0.0.beta1)
|
32
|
+
activesupport (= 4.0.0.beta1)
|
33
|
+
bundler (>= 1.3.0, < 2.0)
|
34
|
+
railties (= 4.0.0.beta1)
|
35
|
+
sprockets-rails (~> 2.0.0.rc3)
|
36
|
+
railties (4.0.0.beta1)
|
37
|
+
actionpack (= 4.0.0.beta1)
|
38
|
+
activesupport (= 4.0.0.beta1)
|
39
|
+
rake (>= 0.8.7)
|
40
|
+
rdoc (~> 3.4)
|
41
|
+
thor (>= 0.17.0, < 2.0)
|
42
|
+
|
43
|
+
PATH
|
44
|
+
remote: ../../
|
45
|
+
specs:
|
46
|
+
redis-kit (0.0.1)
|
47
|
+
hiredis (~> 0.4.0)
|
48
|
+
mock_redis (~> 0.6.0)
|
49
|
+
redis (~> 3.0.0)
|
50
|
+
|
51
|
+
GEM
|
52
|
+
remote: https://rubygems.org/
|
53
|
+
specs:
|
54
|
+
activerecord-deprecated_finders (0.0.3)
|
55
|
+
arel (4.0.0.beta1)
|
56
|
+
atomic (1.0.1)
|
57
|
+
atomic (1.0.1-java)
|
58
|
+
builder (3.1.4)
|
59
|
+
coderay (1.0.9)
|
60
|
+
erubis (2.7.0)
|
61
|
+
hike (1.2.1)
|
62
|
+
hiredis (0.4.5)
|
63
|
+
hiredis (0.4.5-java)
|
64
|
+
i18n (0.6.4)
|
65
|
+
json (1.7.7)
|
66
|
+
json (1.7.7-java)
|
67
|
+
mail (2.5.3)
|
68
|
+
i18n (>= 0.4.0)
|
69
|
+
mime-types (~> 1.16)
|
70
|
+
treetop (~> 1.4.8)
|
71
|
+
method_source (0.8.1)
|
72
|
+
mime-types (1.21)
|
73
|
+
minitest (4.6.2)
|
74
|
+
mock_redis (0.6.4)
|
75
|
+
multi_json (1.6.1)
|
76
|
+
polyglot (0.3.3)
|
77
|
+
pry (0.9.12)
|
78
|
+
coderay (~> 1.0.5)
|
79
|
+
method_source (~> 0.8)
|
80
|
+
slop (~> 3.4)
|
81
|
+
pry (0.9.12-java)
|
82
|
+
coderay (~> 1.0.5)
|
83
|
+
method_source (~> 0.8)
|
84
|
+
slop (~> 3.4)
|
85
|
+
spoon (~> 0.0)
|
86
|
+
rack (1.5.2)
|
87
|
+
rack-protection (1.4.0)
|
88
|
+
rack
|
89
|
+
rack-test (0.6.2)
|
90
|
+
rack (>= 1.0)
|
91
|
+
rails-api (0.0.3)
|
92
|
+
actionpack (>= 3.2.6)
|
93
|
+
railties (>= 3.2.6)
|
94
|
+
tzinfo (~> 0.3.31)
|
95
|
+
rake (0.9.6)
|
96
|
+
rdoc (3.12.2)
|
97
|
+
json (~> 1.4)
|
98
|
+
redis (3.0.3)
|
99
|
+
redis-namespace (1.2.1)
|
100
|
+
redis (~> 3.0.0)
|
101
|
+
resque (1.23.0)
|
102
|
+
multi_json (~> 1.0)
|
103
|
+
redis-namespace (~> 1.0)
|
104
|
+
sinatra (>= 0.9.2)
|
105
|
+
vegas (~> 0.1.2)
|
106
|
+
sinatra (1.3.5)
|
107
|
+
rack (~> 1.4)
|
108
|
+
rack-protection (~> 1.3)
|
109
|
+
tilt (~> 1.3, >= 1.3.3)
|
110
|
+
slop (3.4.3)
|
111
|
+
spoon (0.0.1)
|
112
|
+
sprockets (2.9.0)
|
113
|
+
hike (~> 1.2)
|
114
|
+
multi_json (~> 1.0)
|
115
|
+
rack (~> 1.0)
|
116
|
+
tilt (~> 1.1, != 1.3.0)
|
117
|
+
sprockets-rails (2.0.0.rc3)
|
118
|
+
actionpack (>= 3.0)
|
119
|
+
activesupport (>= 3.0)
|
120
|
+
sprockets (~> 2.8)
|
121
|
+
thor (0.17.0)
|
122
|
+
thread_safe (0.1.0)
|
123
|
+
atomic
|
124
|
+
tilt (1.3.4)
|
125
|
+
treetop (1.4.12)
|
126
|
+
polyglot
|
127
|
+
polyglot (>= 0.3.1)
|
128
|
+
tzinfo (0.3.36)
|
129
|
+
vegas (0.1.11)
|
130
|
+
rack (>= 1.0.0)
|
131
|
+
|
132
|
+
PLATFORMS
|
133
|
+
java
|
134
|
+
ruby
|
135
|
+
|
136
|
+
DEPENDENCIES
|
137
|
+
minitest
|
138
|
+
pry
|
139
|
+
rails!
|
140
|
+
rails-api (~> 0.0.3)
|
141
|
+
rake (~> 0.9.0)
|
142
|
+
redis-kit!
|
143
|
+
resque (~> 1.23.0)
|
@@ -0,0 +1,261 @@
|
|
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.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.org/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
|
+
| |-- assets
|
160
|
+
| |-- images
|
161
|
+
| |-- javascripts
|
162
|
+
| `-- stylesheets
|
163
|
+
| |-- controllers
|
164
|
+
| |-- helpers
|
165
|
+
| |-- mailers
|
166
|
+
| |-- models
|
167
|
+
| `-- views
|
168
|
+
| `-- layouts
|
169
|
+
|-- config
|
170
|
+
| |-- environments
|
171
|
+
| |-- initializers
|
172
|
+
| `-- locales
|
173
|
+
|-- db
|
174
|
+
|-- doc
|
175
|
+
|-- lib
|
176
|
+
| `-- tasks
|
177
|
+
|-- log
|
178
|
+
|-- public
|
179
|
+
|-- script
|
180
|
+
|-- test
|
181
|
+
| |-- fixtures
|
182
|
+
| |-- functional
|
183
|
+
| |-- integration
|
184
|
+
| |-- performance
|
185
|
+
| `-- unit
|
186
|
+
|-- tmp
|
187
|
+
| |-- cache
|
188
|
+
| |-- pids
|
189
|
+
| |-- sessions
|
190
|
+
| `-- sockets
|
191
|
+
`-- vendor
|
192
|
+
|-- assets
|
193
|
+
`-- stylesheets
|
194
|
+
`-- plugins
|
195
|
+
|
196
|
+
app
|
197
|
+
Holds all the code that's specific to this particular application.
|
198
|
+
|
199
|
+
app/assets
|
200
|
+
Contains subdirectories for images, stylesheets, and JavaScript files.
|
201
|
+
|
202
|
+
app/controllers
|
203
|
+
Holds controllers that should be named like weblogs_controller.rb for
|
204
|
+
automated URL mapping. All controllers should descend from
|
205
|
+
ApplicationController which itself descends from ActionController::Base.
|
206
|
+
|
207
|
+
app/models
|
208
|
+
Holds models that should be named like post.rb. Models descend from
|
209
|
+
ActiveRecord::Base by default.
|
210
|
+
|
211
|
+
app/views
|
212
|
+
Holds the template files for the view that should be named like
|
213
|
+
weblogs/index.html.erb for the WeblogsController#index action. All views use
|
214
|
+
eRuby syntax by default.
|
215
|
+
|
216
|
+
app/views/layouts
|
217
|
+
Holds the template files for layouts to be used with views. This models the
|
218
|
+
common header/footer method of wrapping views. In your views, define a layout
|
219
|
+
using the <tt>layout :default</tt> and create a file named default.html.erb.
|
220
|
+
Inside default.html.erb, call <% yield %> to render the view using this
|
221
|
+
layout.
|
222
|
+
|
223
|
+
app/helpers
|
224
|
+
Holds view helpers that should be named like weblogs_helper.rb. These are
|
225
|
+
generated for you automatically when using generators for controllers.
|
226
|
+
Helpers can be used to wrap functionality for your views into methods.
|
227
|
+
|
228
|
+
config
|
229
|
+
Configuration files for the Rails environment, the routing map, the database,
|
230
|
+
and other dependencies.
|
231
|
+
|
232
|
+
db
|
233
|
+
Contains the database schema in schema.rb. db/migrate contains all the
|
234
|
+
sequence of Migrations for your schema.
|
235
|
+
|
236
|
+
doc
|
237
|
+
This directory is where your application documentation will be stored when
|
238
|
+
generated using <tt>rake doc:app</tt>
|
239
|
+
|
240
|
+
lib
|
241
|
+
Application specific libraries. Basically, any kind of custom code that
|
242
|
+
doesn't belong under controllers, models, or helpers. This directory is in
|
243
|
+
the load path.
|
244
|
+
|
245
|
+
public
|
246
|
+
The directory available for the web server. Also contains the dispatchers and the
|
247
|
+
default HTML files. This should be set as the DOCUMENT_ROOT of your web
|
248
|
+
server.
|
249
|
+
|
250
|
+
script
|
251
|
+
Helper scripts for automation and generation.
|
252
|
+
|
253
|
+
test
|
254
|
+
Unit and functional tests along with fixtures. When using the rails generate
|
255
|
+
command, template test files will be generated for you and placed in this
|
256
|
+
directory.
|
257
|
+
|
258
|
+
vendor
|
259
|
+
External libraries that the application depends on. Also includes the plugins
|
260
|
+
subdirectory. If the app has frozen rails, those gems also go here, under
|
261
|
+
vendor/rails/. This directory is in the load path.
|
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
|
+
|
5
|
+
require File.expand_path('../config/application', __FILE__)
|
6
|
+
|
7
|
+
Railsapi::Application.load_tasks
|
File without changes
|
File without changes
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require "action_controller/railtie"
|
4
|
+
require "action_mailer/railtie"
|
5
|
+
require "rails/test_unit/railtie"
|
6
|
+
|
7
|
+
if defined?(Bundler)
|
8
|
+
Bundler.require(:default, Rails.env)
|
9
|
+
end
|
10
|
+
|
11
|
+
module Railsapi
|
12
|
+
class Application < Rails::Application
|
13
|
+
# Settings in config/environments/* take precedence over those specified here.
|
14
|
+
# Application configuration should go into files in config/initializers
|
15
|
+
# -- all .rb files in that directory are automatically loaded.
|
16
|
+
|
17
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
18
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
19
|
+
|
20
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
21
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
22
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
23
|
+
|
24
|
+
# Activate observers that should always be running.
|
25
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
26
|
+
|
27
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
28
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
29
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
30
|
+
|
31
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
32
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
33
|
+
# config.i18n.default_locale = :de
|
34
|
+
|
35
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
36
|
+
config.encoding = "utf-8"
|
37
|
+
|
38
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
39
|
+
config.filter_parameters += [:password]
|
40
|
+
|
41
|
+
# Enable escaping HTML in JSON.
|
42
|
+
config.active_support.escape_html_entities_in_json = true
|
43
|
+
|
44
|
+
config.secret_key_base = "x"
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Railsapi::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Show full error reports and disable caching
|
10
|
+
config.consider_all_requests_local = true
|
11
|
+
config.action_controller.perform_caching = false
|
12
|
+
|
13
|
+
# Don't care if the mailer can't send
|
14
|
+
config.action_mailer.raise_delivery_errors = false
|
15
|
+
|
16
|
+
# Print deprecation notices to the Rails logger
|
17
|
+
config.active_support.deprecation = :log
|
18
|
+
|
19
|
+
# Only use best-standards-support built into browsers
|
20
|
+
config.action_dispatch.best_standards_support = :builtin
|
21
|
+
|
22
|
+
config.eager_load = false
|
23
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
Railsapi::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# Code is not reloaded between requests
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Full error reports are disabled and caching is turned on
|
8
|
+
config.consider_all_requests_local = false
|
9
|
+
config.action_controller.perform_caching = true
|
10
|
+
|
11
|
+
# Specifies the header that your server uses for sending files
|
12
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
13
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
14
|
+
|
15
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
16
|
+
# config.force_ssl = true
|
17
|
+
|
18
|
+
# See everything in the log (default is :info)
|
19
|
+
# config.log_level = :debug
|
20
|
+
|
21
|
+
# Prepend all log lines with the following tags
|
22
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
23
|
+
|
24
|
+
# Use a different logger for distributed setups
|
25
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
26
|
+
|
27
|
+
# Use a different cache store in production
|
28
|
+
# config.cache_store = :mem_cache_store
|
29
|
+
|
30
|
+
# Disable delivery errors, bad email addresses will be ignored
|
31
|
+
# config.action_mailer.raise_delivery_errors = false
|
32
|
+
|
33
|
+
# Enable threaded mode
|
34
|
+
# config.threadsafe!
|
35
|
+
|
36
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
37
|
+
# the I18n.default_locale when a translation can not be found)
|
38
|
+
config.i18n.fallbacks = true
|
39
|
+
|
40
|
+
# Send deprecation notices to registered listeners
|
41
|
+
config.active_support.deprecation = :notify
|
42
|
+
|
43
|
+
config.eager_load = true
|
44
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Railsapi::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Show full error reports and disable caching
|
11
|
+
config.consider_all_requests_local = true
|
12
|
+
config.action_controller.perform_caching = false
|
13
|
+
|
14
|
+
# Raise exceptions instead of rendering exception templates
|
15
|
+
config.action_dispatch.show_exceptions = false
|
16
|
+
|
17
|
+
# Disable request forgery protection in test environment
|
18
|
+
config.action_controller.allow_forgery_protection = false
|
19
|
+
|
20
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
21
|
+
# The :test delivery method accumulates sent emails in the
|
22
|
+
# ActionMailer::Base.deliveries array.
|
23
|
+
config.action_mailer.delivery_method = :test
|
24
|
+
|
25
|
+
# Print deprecation notices to the stderr
|
26
|
+
config.active_support.deprecation = :stderr
|
27
|
+
|
28
|
+
config.eager_load = true
|
29
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
#
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper
|
4
|
+
|
5
|
+
# Enable parameter wrapping for JSON.
|
6
|
+
# ActiveSupport.on_load(:action_controller) do
|
7
|
+
# wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
8
|
+
# end
|
9
|
+
|
10
|
+
# To enable root element in JSON for ActiveRecord objects.
|
11
|
+
# ActiveSupport.on_load(:active_record) do
|
12
|
+
# self.include_root_in_json = true
|
13
|
+
# end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
Railsapi::Application.routes.draw do
|
2
|
+
get "redis/ping"
|
3
|
+
|
4
|
+
# The priority is based upon order of creation:
|
5
|
+
# first created -> highest priority.
|
6
|
+
|
7
|
+
# Sample of regular route:
|
8
|
+
# match 'products/:id' => 'catalog#view'
|
9
|
+
# Keep in mind you can assign values other than :controller and :action
|
10
|
+
|
11
|
+
# Sample of named route:
|
12
|
+
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
13
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
14
|
+
|
15
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
16
|
+
# resources :products
|
17
|
+
|
18
|
+
# Sample resource route with options:
|
19
|
+
# resources :products do
|
20
|
+
# member do
|
21
|
+
# get 'short'
|
22
|
+
# post 'toggle'
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
# collection do
|
26
|
+
# get 'sold'
|
27
|
+
# end
|
28
|
+
# end
|
29
|
+
|
30
|
+
# Sample resource route with sub-resources:
|
31
|
+
# resources :products do
|
32
|
+
# resources :comments, :sales
|
33
|
+
# resource :seller
|
34
|
+
# end
|
35
|
+
|
36
|
+
# Sample resource route with more complex sub-resources
|
37
|
+
# resources :products do
|
38
|
+
# resources :comments
|
39
|
+
# resources :sales do
|
40
|
+
# get 'recent', :on => :collection
|
41
|
+
# end
|
42
|
+
# end
|
43
|
+
|
44
|
+
# Sample resource route within a namespace:
|
45
|
+
# namespace :admin do
|
46
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
47
|
+
# # (app/controllers/admin/products_controller.rb)
|
48
|
+
# resources :products
|
49
|
+
# end
|
50
|
+
|
51
|
+
# You can have the root of your site routed with "root"
|
52
|
+
# just remember to delete public/index.html.
|
53
|
+
# root :to => 'welcome#index'
|
54
|
+
|
55
|
+
# See how all your routes lay out with "rake routes"
|
56
|
+
|
57
|
+
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
58
|
+
# Note: This route will make all actions in every controller accessible via GET requests.
|
59
|
+
# match ':controller(/:action(/:id))(.:format)'
|
60
|
+
end
|