apipierails3 0.0.1

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.
Files changed (171) hide show
  1. checksums.yaml +17 -0
  2. data/.gitignore +14 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +27 -0
  5. data/APACHE-LICENSE-2.0 +202 -0
  6. data/CHANGELOG.md +469 -0
  7. data/Gemfile +1 -0
  8. data/Gemfile.rails32 +6 -0
  9. data/Gemfile.rails41 +6 -0
  10. data/Gemfile.rails42 +11 -0
  11. data/Gemfile.rails50 +6 -0
  12. data/Gemfile.rails51 +7 -0
  13. data/MIT-LICENSE +20 -0
  14. data/NOTICE +4 -0
  15. data/PROPOSAL_FOR_RESPONSE_DESCRIPTIONS.md +244 -0
  16. data/README.rst +1874 -0
  17. data/Rakefile +13 -0
  18. data/apipierails3.gemspec +27 -0
  19. data/app/controllers/apipie/apipies_controller.rb +199 -0
  20. data/app/helpers/apipie_helper.rb +10 -0
  21. data/app/public/apipie/javascripts/apipie.js +6 -0
  22. data/app/public/apipie/javascripts/bundled/bootstrap-collapse.js +138 -0
  23. data/app/public/apipie/javascripts/bundled/bootstrap.js +1726 -0
  24. data/app/public/apipie/javascripts/bundled/jquery.js +5 -0
  25. data/app/public/apipie/javascripts/bundled/prettify.js +28 -0
  26. data/app/public/apipie/stylesheets/application.css +7 -0
  27. data/app/public/apipie/stylesheets/bundled/bootstrap-responsive.min.css +12 -0
  28. data/app/public/apipie/stylesheets/bundled/bootstrap.min.css +689 -0
  29. data/app/public/apipie/stylesheets/bundled/prettify.css +30 -0
  30. data/app/views/apipie/apipies/_disqus.html.erb +13 -0
  31. data/app/views/apipie/apipies/_errors.html.erb +23 -0
  32. data/app/views/apipie/apipies/_headers.html.erb +26 -0
  33. data/app/views/apipie/apipies/_languages.erb +6 -0
  34. data/app/views/apipie/apipies/_metadata.erb +1 -0
  35. data/app/views/apipie/apipies/_method_detail.erb +61 -0
  36. data/app/views/apipie/apipies/_params.html.erb +42 -0
  37. data/app/views/apipie/apipies/_params_plain.html.erb +20 -0
  38. data/app/views/apipie/apipies/apipie_404.html.erb +17 -0
  39. data/app/views/apipie/apipies/apipie_checksum.json.erb +1 -0
  40. data/app/views/apipie/apipies/getting_started.html.erb +6 -0
  41. data/app/views/apipie/apipies/index.html.erb +56 -0
  42. data/app/views/apipie/apipies/method.html.erb +41 -0
  43. data/app/views/apipie/apipies/plain.html.erb +77 -0
  44. data/app/views/apipie/apipies/resource.html.erb +80 -0
  45. data/app/views/apipie/apipies/static.html.erb +103 -0
  46. data/app/views/layouts/apipie/apipie.html.erb +27 -0
  47. data/config/locales/de.yml +28 -0
  48. data/config/locales/en.yml +32 -0
  49. data/config/locales/es.yml +28 -0
  50. data/config/locales/fr.yml +31 -0
  51. data/config/locales/it.yml +31 -0
  52. data/config/locales/ja.yml +31 -0
  53. data/config/locales/pl.yml +28 -0
  54. data/config/locales/pt-BR.yml +28 -0
  55. data/config/locales/ru.yml +28 -0
  56. data/config/locales/tr.yml +28 -0
  57. data/config/locales/zh-CN.yml +28 -0
  58. data/config/locales/zh-TW.yml +28 -0
  59. data/images/screenshot-1.png +0 -0
  60. data/images/screenshot-2.png +0 -0
  61. data/lib/apipie/apipie_module.rb +83 -0
  62. data/lib/apipie/application.rb +462 -0
  63. data/lib/apipie/configuration.rb +186 -0
  64. data/lib/apipie/dsl_definition.rb +607 -0
  65. data/lib/apipie/error_description.rb +44 -0
  66. data/lib/apipie/errors.rb +86 -0
  67. data/lib/apipie/extractor.rb +177 -0
  68. data/lib/apipie/extractor/collector.rb +117 -0
  69. data/lib/apipie/extractor/recorder.rb +166 -0
  70. data/lib/apipie/extractor/writer.rb +454 -0
  71. data/lib/apipie/helpers.rb +73 -0
  72. data/lib/apipie/markup.rb +48 -0
  73. data/lib/apipie/method_description.rb +273 -0
  74. data/lib/apipie/middleware/checksum_in_headers.rb +35 -0
  75. data/lib/apipie/param_description.rb +280 -0
  76. data/lib/apipie/railtie.rb +9 -0
  77. data/lib/apipie/resource_description.rb +124 -0
  78. data/lib/apipie/response_description.rb +131 -0
  79. data/lib/apipie/response_description_adapter.rb +200 -0
  80. data/lib/apipie/routes_formatter.rb +33 -0
  81. data/lib/apipie/routing.rb +16 -0
  82. data/lib/apipie/rspec/response_validation_helper.rb +192 -0
  83. data/lib/apipie/see_description.rb +39 -0
  84. data/lib/apipie/static_dispatcher.rb +69 -0
  85. data/lib/apipie/swagger_generator.rb +707 -0
  86. data/lib/apipie/tag_list_description.rb +11 -0
  87. data/lib/apipie/validator.rb +526 -0
  88. data/lib/apipie/version.rb +3 -0
  89. data/lib/apipierails3.rb +25 -0
  90. data/lib/generators/apipie/install/README +6 -0
  91. data/lib/generators/apipie/install/install_generator.rb +25 -0
  92. data/lib/generators/apipie/install/templates/initializer.rb.erb +7 -0
  93. data/lib/generators/apipie/views_generator.rb +11 -0
  94. data/lib/tasks/apipie.rake +345 -0
  95. data/rel-eng/packages/.readme +3 -0
  96. data/rel-eng/packages/rubygem-apipie-rails +1 -0
  97. data/rel-eng/tito.props +5 -0
  98. data/spec/controllers/api/v1/architectures_controller_spec.rb +29 -0
  99. data/spec/controllers/api/v2/architectures_controller_spec.rb +12 -0
  100. data/spec/controllers/api/v2/nested/resources_controller_spec.rb +11 -0
  101. data/spec/controllers/apipies_controller_spec.rb +273 -0
  102. data/spec/controllers/concerns_controller_spec.rb +42 -0
  103. data/spec/controllers/extended_controller_spec.rb +11 -0
  104. data/spec/controllers/users_controller_spec.rb +740 -0
  105. data/spec/dummy/Rakefile +7 -0
  106. data/spec/dummy/app/controllers/api/base_controller.rb +4 -0
  107. data/spec/dummy/app/controllers/api/v1/architectures_controller.rb +43 -0
  108. data/spec/dummy/app/controllers/api/v1/base_controller.rb +11 -0
  109. data/spec/dummy/app/controllers/api/v2/architectures_controller.rb +30 -0
  110. data/spec/dummy/app/controllers/api/v2/base_controller.rb +11 -0
  111. data/spec/dummy/app/controllers/api/v2/nested/architectures_controller.rb +32 -0
  112. data/spec/dummy/app/controllers/api/v2/nested/resources_controller.rb +33 -0
  113. data/spec/dummy/app/controllers/application_controller.rb +18 -0
  114. data/spec/dummy/app/controllers/concerns/extending_concern.rb +11 -0
  115. data/spec/dummy/app/controllers/concerns/sample_controller.rb +41 -0
  116. data/spec/dummy/app/controllers/concerns_controller.rb +8 -0
  117. data/spec/dummy/app/controllers/extended_controller.rb +14 -0
  118. data/spec/dummy/app/controllers/files_controller.rb +5 -0
  119. data/spec/dummy/app/controllers/overridden_concerns_controller.rb +31 -0
  120. data/spec/dummy/app/controllers/pets_controller.rb +408 -0
  121. data/spec/dummy/app/controllers/pets_using_auto_views_controller.rb +73 -0
  122. data/spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb +95 -0
  123. data/spec/dummy/app/controllers/tagged_cats_controller.rb +32 -0
  124. data/spec/dummy/app/controllers/tagged_dogs_controller.rb +15 -0
  125. data/spec/dummy/app/controllers/twitter_example_controller.rb +307 -0
  126. data/spec/dummy/app/controllers/users_controller.rb +297 -0
  127. data/spec/dummy/app/views/layouts/application.html.erb +21 -0
  128. data/spec/dummy/config.ru +4 -0
  129. data/spec/dummy/config/application.rb +49 -0
  130. data/spec/dummy/config/boot.rb +10 -0
  131. data/spec/dummy/config/database.yml +21 -0
  132. data/spec/dummy/config/environment.rb +8 -0
  133. data/spec/dummy/config/environments/development.rb +28 -0
  134. data/spec/dummy/config/environments/production.rb +52 -0
  135. data/spec/dummy/config/environments/test.rb +38 -0
  136. data/spec/dummy/config/initializers/apipie.rb +110 -0
  137. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  138. data/spec/dummy/config/initializers/inflections.rb +10 -0
  139. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  140. data/spec/dummy/config/initializers/secret_token.rb +8 -0
  141. data/spec/dummy/config/initializers/session_store.rb +8 -0
  142. data/spec/dummy/config/locales/en.yml +5 -0
  143. data/spec/dummy/config/routes.rb +51 -0
  144. data/spec/dummy/db/.gitkeep +0 -0
  145. data/spec/dummy/doc/apipie_examples.json +1 -0
  146. data/spec/dummy/doc/users/desc_from_file.md +1 -0
  147. data/spec/dummy/public/404.html +26 -0
  148. data/spec/dummy/public/422.html +26 -0
  149. data/spec/dummy/public/500.html +26 -0
  150. data/spec/dummy/public/favicon.ico +0 -0
  151. data/spec/dummy/public/stylesheets/.gitkeep +0 -0
  152. data/spec/dummy/script/rails +6 -0
  153. data/spec/lib/application_spec.rb +49 -0
  154. data/spec/lib/extractor/extractor_spec.rb +9 -0
  155. data/spec/lib/extractor/middleware_spec.rb +44 -0
  156. data/spec/lib/extractor/writer_spec.rb +110 -0
  157. data/spec/lib/file_handler_spec.rb +18 -0
  158. data/spec/lib/method_description_spec.rb +98 -0
  159. data/spec/lib/param_description_spec.rb +345 -0
  160. data/spec/lib/param_group_spec.rb +60 -0
  161. data/spec/lib/rake_spec.rb +71 -0
  162. data/spec/lib/resource_description_spec.rb +48 -0
  163. data/spec/lib/swagger/openapi_2_0_schema.json +1607 -0
  164. data/spec/lib/swagger/rake_swagger_spec.rb +139 -0
  165. data/spec/lib/swagger/response_validation_spec.rb +104 -0
  166. data/spec/lib/swagger/swagger_dsl_spec.rb +658 -0
  167. data/spec/lib/validator_spec.rb +113 -0
  168. data/spec/lib/validators/array_validator_spec.rb +85 -0
  169. data/spec/spec_helper.rb +109 -0
  170. data/spec/support/rake.rb +21 -0
  171. metadata +415 -0
@@ -0,0 +1,297 @@
1
+ class UsersController < ApplicationController
2
+
3
+ resource_description do
4
+ short 'Site members'
5
+ path '/users'
6
+ formats ['json']
7
+ param :id, Fixnum, :desc => "User ID", :required => false
8
+ param :legacy_param, Hash, :desc => 'Deprecated parameter not documented', :show => false, :required => false do
9
+ param :resource_param, Hash, :desc => 'Param description for all methods' do
10
+ param :ausername, String, :desc => "Username for login", :required => true
11
+ param :apassword, String, :desc => "Password for login", :required => true
12
+ end
13
+ end
14
+ api_version "development"
15
+ error 404, "Missing", :meta => {:some => "metadata"}
16
+ error 500, "Server crashed for some <%= reason %>"
17
+ meta :new_style => true, :author => { :name => 'John', :surname => 'Doe' }
18
+ description <<-EOS
19
+ == Long description
20
+
21
+ Example resource for rest api documentation
22
+
23
+ These can now be accessed in <tt>shared/header</tt> with:
24
+
25
+ Headline: <%= headline %>
26
+ First name: <%= person.first_name %>
27
+
28
+ If you need to find out whether a certain local variable has been assigned a value in a particular render call,
29
+ you need to use the following pattern:
30
+
31
+ <% if local_assigns.has_key? :headline %>
32
+ Headline: <%= headline %>
33
+ <% end %>
34
+
35
+ Testing using <tt>defined? headline</tt> will not work. This is an implementation restriction.
36
+
37
+ === Template caching
38
+
39
+ By default, Rails will compile each template to a method in order to render it. When you alter a template,
40
+ Rails will check the file's modification time and recompile it in development mode.
41
+ EOS
42
+ header :CommonHeader, 'Common header description', required: true
43
+ end
44
+
45
+ description <<-eos
46
+ = Action View Base
47
+
48
+ Action View templates can be written in several ways. If the template file has a <tt>.erb</tt> extension then it uses a mixture of ERb
49
+ (included in Ruby) and HTML. If the template file has a <tt>.builder</tt> extension then Jim Weirich's Builder::XmlMarkup library is used.
50
+
51
+ == ERB
52
+
53
+ You trigger ERB by using embeddings such as <% %>, <% -%>, and <%= %>. The <%= %> tag set is used when you want output. Consider the
54
+ following loop for names:
55
+
56
+ <b>Names of all the people</b>
57
+ <% @people.each do |person| %>
58
+ Name: <%= person.name %><br/>
59
+ <% end %>
60
+
61
+ The loop is setup in regular embedding tags <% %> and the name is written using the output embedding tag <%= %>. Note that this
62
+ is not just a usage suggestion. Regular output functions like print or puts won't work with ERB templates. So this would be wrong:
63
+
64
+ <%# WRONG %>
65
+ Hi, Mr. <% puts "Frodo" %>
66
+
67
+ If you absolutely must write from within a function use +concat+.
68
+
69
+ <%- and -%> suppress leading and trailing whitespace, including the trailing newline, and can be used interchangeably with <% and %>.
70
+
71
+ === Using sub templates
72
+
73
+ Using sub templates allows you to sidestep tedious replication and extract common display structures in shared templates. The
74
+ classic example is the use of a header and footer (even though the Action Pack-way would be to use Layouts):
75
+
76
+ <%= render "shared/header" %>
77
+ Something really specific and terrific
78
+ <%= render "shared/footer" %>
79
+
80
+ As you see, we use the output embeddings for the render methods. The render call itself will just return a string holding the
81
+ result of the rendering. The output embedding writes it to the current template.
82
+
83
+ But you don't have to restrict yourself to static includes. Templates can share variables amongst themselves by using instance
84
+ variables defined using the regular embedding tags. Like this:
85
+
86
+ <% @page_title = "A Wonderful Hello" %>
87
+ <%= render "shared/header" %>
88
+
89
+ Now the header can pick up on the <tt>@page_title</tt> variable and use it for outputting a title tag:
90
+
91
+ <title><%= @page_title %></title>
92
+
93
+ === Passing local variables to sub templates
94
+
95
+ You can pass local variables to sub templates by using a hash with the variable names as keys and the objects as values:
96
+
97
+ <%= render "shared/header", { :headline => "Welcome", :person => person } %>
98
+
99
+ These can now be accessed in <tt>shared/header</tt> with:
100
+
101
+ Headline: <%= headline %>
102
+ First name: <%= person.first_name %>
103
+
104
+ If you need to find out whether a certain local variable has been assigned a value in a particular render call,
105
+ you need to use the following pattern:
106
+
107
+ <% if local_assigns.has_key? :headline %>
108
+ Headline: <%= headline %>
109
+ <% end %>
110
+
111
+ Testing using <tt>defined? headline</tt> will not work. This is an implementation restriction.
112
+
113
+ === Template caching
114
+
115
+ By default, Rails will compile each template to a method in order to render it. When you alter a template,
116
+ Rails will check the file's modification time and recompile it in development mode.
117
+
118
+ == Builder
119
+
120
+ Builder templates are a more programmatic alternative to ERB. They are especially useful for generating XML content. An XmlMarkup object
121
+ named +xml+ is automatically made available to templates with a <tt>.builder</tt> extension.
122
+
123
+ Here are some basic examples:
124
+
125
+ xml.em("emphasized") # => <em>emphasized</em>
126
+ xml.em { xml.b("emph & bold") } # => <em><b>emph &amp; bold</b></em>
127
+ xml.a("A Link", "href" => "http://onestepback.org") # => <a href="http://onestepback.org">A Link</a>
128
+ xml.target("name" => "compile", "option" => "fast") # => <target option="fast" name="compile"\>
129
+ # NOTE: order of attributes is not specified.
130
+
131
+ Any method with a block will be treated as an XML markup tag with nested markup in the block. For example, the following:
132
+
133
+ xml.div do
134
+ xml.h1(@person.name)
135
+ xml.p(@person.bio)
136
+ end
137
+
138
+ would produce something like:
139
+
140
+ <div>
141
+ <h1>David Heinemeier Hansson</h1>
142
+ <p>A product of Danish Design during the Winter of '79...</p>
143
+ </div>
144
+
145
+ A full-length RSS example actually used on Basecamp:
146
+
147
+ xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do
148
+ xml.channel do
149
+ xml.title(@feed_title)
150
+ xml.link(@url)
151
+ xml.description "Basecamp: Recent items"
152
+ xml.language "en-us"
153
+ xml.ttl "40"
154
+
155
+ @recent_items.each do |item|
156
+ xml.item do
157
+ xml.title(item_title(item))
158
+ xml.description(item_description(item)) if item_description(item)
159
+ xml.pubDate(item_pubDate(item))
160
+ xml.guid(@person.firm.account.url + @recent_items.url(item))
161
+ xml.link(@person.firm.account.url + @recent_items.url(item))
162
+
163
+ xml.tag!("dc:creator", item.author_name) if item_has_creator?(item)
164
+ end
165
+ end
166
+ end
167
+ end
168
+
169
+ More builder documentation can be found at http://builder.rubyforge.org.
170
+ eos
171
+ api :GET, "/users/:id", "Show user profile"
172
+ show false
173
+ formats ['json', 'jsonp']
174
+ error 401, "Unauthorized"
175
+ error :code => 404, :description => "Not Found"
176
+ param :id, Integer, :desc => "user id", :required => true
177
+ param :session, String, :desc => "user is logged in", :required => true, :missing_message => lambda { "session_parameter_is_required" }
178
+ param :regexp_param, /^[0-9]* years/, :desc => "regexp param"
179
+ param :regexp2, /\b[A-Z0-9._%+-=]+@[A-Z0-9.-]+.[A-Z]{2,}\b/i, :desc => "email regexp"
180
+ param :array_param, ["100", "one", "two", "1", "2"], :desc => "array validator"
181
+ param :boolean_param, [true, false], :desc => "array validator with boolean"
182
+ param :proc_param, lambda { |val|
183
+ val == "param value" ? true : "The only good value is 'param value'."
184
+ }, :desc => "proc validator"
185
+ param :briefer_dsl, String, "You dont need :desc => from now"
186
+ param :meta_param, String, :desc => "A parameter with some additional metadata", :meta => [:some, :more, :info]
187
+ meta :success_message => "Some message"
188
+ param :hash_param, Hash, :desc => "Hash param" do
189
+ param :dummy_hash, Hash do
190
+ param :dummy_2, String, :required => true
191
+ end
192
+ end
193
+ def show
194
+ unless params[:session] == "secret_hash"
195
+ render :plain => "Not authorized", :status => 401
196
+ return
197
+ end
198
+
199
+ unless params[:id].to_i == 5
200
+ render :plain => "Not Found", :status => 404 and return
201
+ end
202
+
203
+ render :plain => "OK"
204
+ end
205
+
206
+ def_param_group :credentials do
207
+ param :name, String, :desc => "Username for login", :required => true
208
+ param :pass, String, :desc => "Password for login", :required => true
209
+ end
210
+
211
+ def_param_group :user do
212
+ param :user, Hash, :desc => "User info", :required => true, :action_aware => true do
213
+ param_group :credentials
214
+ param :membership, ["standard","premium"], :desc => "User membership", :allow_nil => false
215
+ end
216
+ end
217
+
218
+ api :POST, "/users", "Create user"
219
+ param_group :user
220
+ param :user, Hash do
221
+ param :permalink, String
222
+ end
223
+ param :facts, Hash, :desc => "Additional optional facts about the user", :allow_nil => true
224
+ param :age, :number, :desc => "Age is just a number", :allow_blank => true
225
+ error :unprocessable_entity, 'Unprocessable Entity'
226
+ def create
227
+ render :plain => "OK #{params.inspect}"
228
+ end
229
+
230
+ api :PUT, "/users/:id", "Update an user"
231
+ param_group :user
232
+ param :comments, Array do
233
+ param :comment, String
234
+ end
235
+ def update
236
+ render :plain => "OK #{params.inspect}"
237
+ end
238
+
239
+ api :POST, "/users/admin", "Create admin user"
240
+ param_group :user, :as => :create
241
+ def admin_create
242
+ render :plain => "OK #{params.inspect}"
243
+ end
244
+
245
+ api :GET, "/users", "List users"
246
+ error :code => 401, :desc => "Unauthorized"
247
+ error :code => 404, :desc => "Not Found"
248
+ desc "List all users."
249
+ param :oauth, nil,
250
+ :desc => "Hide this global param (eg dont need auth here)"
251
+ def index
252
+ render :plain => "List of users"
253
+ end
254
+
255
+ api :GET, '/company_users', 'Get company users'
256
+ api :GET, '/company/:id/users', 'Get users working in given company'
257
+ param :id, Integer, :desc => "Company ID"
258
+ def two_urls
259
+ render :plain => 'List of users'
260
+ end
261
+
262
+ api :GET, '/users/see_another', 'Boring method'
263
+ show false
264
+ see 'development#users#create'
265
+ see 'development#users#index', "very interesting method reference"
266
+ desc 'This method is boring, look at users#create. It is hidden from documentation.'
267
+ def see_another
268
+ render :plain => 'This is very similar to create action'
269
+ end
270
+
271
+ api :GET, '/users/by_department', 'show users from a specific department'
272
+ param :department, ["finance", "operations", "sales", "marketing", "HR"], required: false, default_value: "sales"
273
+ def get_by_department
274
+ render :plain => 'nothing to see here'
275
+ end
276
+
277
+ api :GET, '/users/desc_from_file', 'desc from file'
278
+ document 'users/desc_from_file.md'
279
+ def desc_from_file
280
+ render :plain => 'document from file action'
281
+ end
282
+
283
+ api! 'Create user'
284
+ param_group :user
285
+ param :user, Hash do
286
+ param :permalink, String
287
+ end
288
+ param :facts, Hash, :desc => "Additional optional facts about the user", :allow_nil => true
289
+ def create_route
290
+ end
291
+
292
+ api :GET, '/users/action_with_headers'
293
+ header :RequredHeaderName, 'Required header description', required: true
294
+ header :OptionalHeaderName, 'Optional header description', required: false, type: 'string'
295
+ def action_with_headers
296
+ end
297
+ end
@@ -0,0 +1,21 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy API</title>
5
+ <%= Apipie.include_stylesheets %>
6
+ </head>
7
+ <body style='background-color: #F5F6F7;'>
8
+ <div class="container">
9
+ <div class="row">
10
+ <div id='container' style='background-color: white;padding:10px;box-shadow:0px 0px 10px rgba(68,68,68,0.6);'>
11
+ <%= yield %>
12
+ <%= render 'disqus' if Apipie.configuration.use_disqus? %>
13
+ </div>
14
+ </div>
15
+ <hr>
16
+ <footer><%= yield :apipie_footer %></footer>
17
+ </div>
18
+
19
+ <%= Apipie.include_javascripts %>
20
+ </body>
21
+ </html>
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
@@ -0,0 +1,49 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require "active_model/railtie"
4
+ require "active_record/railtie"
5
+ require "action_controller/railtie"
6
+ require "action_view/railtie"
7
+ require "action_mailer/railtie"
8
+
9
+ Bundler.require
10
+ require "apipierails3"
11
+
12
+ module Dummy
13
+ class Application < Rails::Application
14
+ # Settings in config/environments/* take precedence over those specified here.
15
+ # Application configuration should go into files in config/initializers
16
+ # -- all .rb files in that directory are automatically loaded.
17
+
18
+ # Custom directories with classes and modules you want to be autoloadable.
19
+ # config.autoload_paths += %W(#{config.root}/extras)
20
+
21
+ # Only load the plugins named here, in the order given (default is alphabetical).
22
+ # :all can be used as a placeholder for all plugins not explicitly named.
23
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
24
+
25
+ # Activate observers that should always be running.
26
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
27
+
28
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
29
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
30
+ # config.time_zone = 'Central Time (US & Canada)'
31
+
32
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
33
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
34
+ # config.i18n.default_locale = :de
35
+
36
+ # JavaScript files you want as :defaults (application.js is always included).
37
+ # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
38
+
39
+ # Configure the default encoding used in templates for Ruby 1.9.
40
+ config.encoding = "utf-8"
41
+
42
+ # Configure sensitive parameters which will be filtered from the log file.
43
+ config.filter_parameters += [:password]
44
+
45
+ config.to_prepare do
46
+ ExtendedController.send(:include, Concerns::ExtendingConcern)
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ end
9
+
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,21 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
6
+ pool: 5
7
+ timeout: 5000
8
+
9
+ # Warning: The database defined as "test" will be erased and
10
+ # re-generated from your development database when you run "rake".
11
+ # Do not set this db to the same as development or production.
12
+ test:
13
+ adapter: sqlite3
14
+ database: ":memory:"
15
+ timeout: 500
16
+
17
+ production:
18
+ adapter: sqlite3
19
+ database: db/production.sqlite3
20
+ pool: 5
21
+ timeout: 5000
@@ -0,0 +1,8 @@
1
+ # uncomment this line to test rails relative url root
2
+ # ENV['RAILS_RELATIVE_URL_ROOT'] = '/relative/path'
3
+
4
+ # Load the rails application
5
+ require File.expand_path('../application', __FILE__)
6
+
7
+ # Initialize the rails application
8
+ Dummy::Application.initialize!
@@ -0,0 +1,28 @@
1
+ Dummy::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 webserver when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger
20
+ config.active_support.deprecation = :log
21
+
22
+ # Only use best-standards-support built into browsers
23
+ config.action_dispatch.best_standards_support = :builtin
24
+
25
+ # Do not eager load code on boot. (Rails 5)
26
+ config.eager_load = false
27
+ end
28
+