vitals 0.0.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (240) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -0
  3. data/.travis.yml +15 -0
  4. data/Gemfile +4 -0
  5. data/Gemfile.lock +157 -0
  6. data/Guardfile +11 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +135 -9
  9. data/Rakefile +17 -31
  10. data/bin/console +14 -0
  11. data/bin/setup +8 -0
  12. data/integration/multiverse/grape-on-rack/.gitignore +7 -0
  13. data/integration/multiverse/grape-on-rack/.rspec +2 -0
  14. data/integration/multiverse/grape-on-rack/.rubocop.yml +2 -0
  15. data/integration/multiverse/grape-on-rack/.rubocop_todo.yml +50 -0
  16. data/integration/multiverse/grape-on-rack/.travis.yml +12 -0
  17. data/integration/multiverse/grape-on-rack/Gemfile +28 -0
  18. data/integration/multiverse/grape-on-rack/Gemfile.lock +187 -0
  19. data/integration/multiverse/grape-on-rack/Guardfile +8 -0
  20. data/integration/multiverse/grape-on-rack/LICENSE +21 -0
  21. data/integration/multiverse/grape-on-rack/README.md +88 -0
  22. data/integration/multiverse/grape-on-rack/Rakefile +27 -0
  23. data/integration/multiverse/grape-on-rack/api/content_type.rb +18 -0
  24. data/integration/multiverse/grape-on-rack/api/entities.rb +28 -0
  25. data/integration/multiverse/grape-on-rack/api/get_json.rb +24 -0
  26. data/integration/multiverse/grape-on-rack/api/header_versioning.rb +9 -0
  27. data/integration/multiverse/grape-on-rack/api/path_versioning.rb +9 -0
  28. data/integration/multiverse/grape-on-rack/api/ping.rb +8 -0
  29. data/integration/multiverse/grape-on-rack/api/post_json.rb +11 -0
  30. data/integration/multiverse/grape-on-rack/api/post_put.rb +24 -0
  31. data/integration/multiverse/grape-on-rack/api/rescue_from.rb +11 -0
  32. data/integration/multiverse/grape-on-rack/api/upload_file.rb +22 -0
  33. data/integration/multiverse/grape-on-rack/api/wrap_response.rb +14 -0
  34. data/integration/multiverse/grape-on-rack/api/wrap_response_decorator.rb +15 -0
  35. data/integration/multiverse/grape-on-rack/app/acme_app.rb +49 -0
  36. data/integration/multiverse/grape-on-rack/app/api.rb +18 -0
  37. data/integration/multiverse/grape-on-rack/config/application.rb +23 -0
  38. data/integration/multiverse/grape-on-rack/config/boot.rb +2 -0
  39. data/integration/multiverse/grape-on-rack/config/environment.rb +3 -0
  40. data/integration/multiverse/grape-on-rack/config/newrelic.yml +255 -0
  41. data/integration/multiverse/grape-on-rack/config.ru +11 -0
  42. data/integration/multiverse/grape-on-rack/public/errors/404.html +15 -0
  43. data/integration/multiverse/grape-on-rack/public/errors/500.html +15 -0
  44. data/integration/multiverse/grape-on-rack/public/images/index.html +1 -0
  45. data/integration/multiverse/grape-on-rack/public/images/rack-logo.png +0 -0
  46. data/integration/multiverse/grape-on-rack/public/index.html +23 -0
  47. data/integration/multiverse/grape-on-rack/public/scripts/jquery-1.7.1.min.js +4 -0
  48. data/integration/multiverse/grape-on-rack/public/scripts/ring.js +17 -0
  49. data/integration/multiverse/grape-on-rack/spec/api/post_put_spec.rb +21 -0
  50. data/integration/multiverse/grape-on-rack/spec/fixtures/grape_logo.png +0 -0
  51. data/integration/multiverse/grape-on-rack/spec/spec_helper.rb +24 -0
  52. data/integration/multiverse/grape-on-rails/.gitignore +16 -0
  53. data/integration/multiverse/grape-on-rails/.rspec +2 -0
  54. data/integration/multiverse/grape-on-rails/.rubocop.yml +6 -0
  55. data/integration/multiverse/grape-on-rails/.rubocop_todo.yml +33 -0
  56. data/integration/multiverse/grape-on-rails/.travis.yml +17 -0
  57. data/integration/multiverse/grape-on-rails/Gemfile +22 -0
  58. data/integration/multiverse/grape-on-rails/Gemfile.lock +238 -0
  59. data/integration/multiverse/grape-on-rails/README.md +29 -0
  60. data/integration/multiverse/grape-on-rails/Rakefile +16 -0
  61. data/integration/multiverse/grape-on-rails/app/api/acme/ping.rb +8 -0
  62. data/integration/multiverse/grape-on-rails/app/api/acme/post.rb +10 -0
  63. data/integration/multiverse/grape-on-rails/app/api/acme/protected.rb +13 -0
  64. data/integration/multiverse/grape-on-rails/app/api/acme/raise.rb +8 -0
  65. data/integration/multiverse/grape-on-rails/app/api/api.rb +8 -0
  66. data/integration/multiverse/grape-on-rails/app/assets/images/rails.png +0 -0
  67. data/integration/multiverse/grape-on-rails/app/assets/javascripts/application.js +15 -0
  68. data/integration/multiverse/grape-on-rails/app/assets/javascripts/welcome.js.coffee +3 -0
  69. data/integration/multiverse/grape-on-rails/app/assets/stylesheets/application.css +13 -0
  70. data/integration/multiverse/grape-on-rails/app/assets/stylesheets/welcome.css.scss +3 -0
  71. data/{test/dummy → integration/multiverse/grape-on-rails}/app/controllers/application_controller.rb +0 -0
  72. data/integration/multiverse/grape-on-rails/app/controllers/welcome_controller.rb +4 -0
  73. data/{test/dummy → integration/multiverse/grape-on-rails}/app/helpers/application_helper.rb +0 -0
  74. data/integration/multiverse/grape-on-rails/app/helpers/welcome_helper.rb +2 -0
  75. data/{test/dummy/db/development.sqlite3 → integration/multiverse/grape-on-rails/app/mailers/.gitkeep} +0 -0
  76. data/{test/dummy/db/test.sqlite3 → integration/multiverse/grape-on-rails/app/models/.gitkeep} +0 -0
  77. data/{test/dummy → integration/multiverse/grape-on-rails}/app/views/layouts/application.html.erb +2 -2
  78. data/integration/multiverse/grape-on-rails/app/views/welcome/index.html.erb +6 -0
  79. data/integration/multiverse/grape-on-rails/bin/bundle +3 -0
  80. data/integration/multiverse/grape-on-rails/bin/rails +4 -0
  81. data/integration/multiverse/grape-on-rails/bin/rake +4 -0
  82. data/{test/dummy → integration/multiverse/grape-on-rails}/config/application.rb +26 -6
  83. data/integration/multiverse/grape-on-rails/config/boot.rb +6 -0
  84. data/integration/multiverse/grape-on-rails/config/database.travis.yml +4 -0
  85. data/integration/multiverse/grape-on-rails/config/database.yml +16 -0
  86. data/{test/dummy → integration/multiverse/grape-on-rails}/config/environment.rb +1 -1
  87. data/{test/dummy → integration/multiverse/grape-on-rails}/config/environments/development.rb +4 -5
  88. data/{test/dummy → integration/multiverse/grape-on-rails}/config/environments/production.rb +9 -4
  89. data/{test/dummy → integration/multiverse/grape-on-rails}/config/environments/test.rb +9 -18
  90. data/{test/dummy → integration/multiverse/grape-on-rails}/config/initializers/backtrace_silencers.rb +0 -0
  91. data/{test/dummy → integration/multiverse/grape-on-rails}/config/initializers/inflections.rb +5 -0
  92. data/{test/dummy → integration/multiverse/grape-on-rails}/config/initializers/mime_types.rb +0 -0
  93. data/integration/multiverse/grape-on-rails/config/initializers/reload_api.rb +13 -0
  94. data/integration/multiverse/grape-on-rails/config/initializers/secret_token.rb +1 -0
  95. data/{test/dummy → integration/multiverse/grape-on-rails}/config/initializers/session_store.rb +2 -2
  96. data/integration/multiverse/grape-on-rails/config/initializers/vitals.rb +8 -0
  97. data/{test/dummy → integration/multiverse/grape-on-rails}/config/initializers/wrap_parameters.rb +0 -0
  98. data/{test/dummy → integration/multiverse/grape-on-rails}/config/locales/en.yml +0 -0
  99. data/integration/multiverse/grape-on-rails/config/routes.rb +5 -0
  100. data/integration/multiverse/grape-on-rails/config.ru +4 -0
  101. data/integration/multiverse/grape-on-rails/db/schema.rb +16 -0
  102. data/integration/multiverse/grape-on-rails/db/seeds.rb +7 -0
  103. data/integration/multiverse/grape-on-rails/doc/README_FOR_APP +2 -0
  104. data/{test/dummy/log/test.log → integration/multiverse/grape-on-rails/lib/assets/.gitkeep} +0 -0
  105. data/{test/dummy/public/favicon.ico → integration/multiverse/grape-on-rails/lib/tasks/.gitkeep} +0 -0
  106. data/integration/multiverse/grape-on-rails/log/.gitkeep +0 -0
  107. data/{test/dummy → integration/multiverse/grape-on-rails}/public/404.html +0 -0
  108. data/{test/dummy → integration/multiverse/grape-on-rails}/public/422.html +0 -0
  109. data/{test/dummy → integration/multiverse/grape-on-rails}/public/500.html +0 -1
  110. data/integration/multiverse/grape-on-rails/public/favicon.ico +0 -0
  111. data/integration/multiverse/grape-on-rails/public/robots.txt +5 -0
  112. data/{test/dummy → integration/multiverse/grape-on-rails}/script/rails +2 -2
  113. data/integration/multiverse/grape-on-rails/spec/api/ping_spec.rb +15 -0
  114. data/integration/multiverse/grape-on-rails/spec/spec_helper.rb +15 -0
  115. data/integration/multiverse/rails42_app/.gitignore +18 -0
  116. data/integration/multiverse/rails42_app/Gemfile +49 -0
  117. data/integration/multiverse/rails42_app/Gemfile.lock +167 -0
  118. data/integration/multiverse/rails42_app/README.rdoc +28 -0
  119. data/{test/dummy → integration/multiverse/rails42_app}/Rakefile +1 -2
  120. data/integration/multiverse/rails42_app/app/assets/images/.keep +0 -0
  121. data/integration/multiverse/rails42_app/app/assets/javascripts/application.js +16 -0
  122. data/integration/multiverse/rails42_app/app/assets/javascripts/posts.coffee +3 -0
  123. data/integration/multiverse/rails42_app/app/assets/stylesheets/application.css +15 -0
  124. data/integration/multiverse/rails42_app/app/assets/stylesheets/posts.scss +3 -0
  125. data/integration/multiverse/rails42_app/app/assets/stylesheets/scaffolds.scss +73 -0
  126. data/integration/multiverse/rails42_app/app/controllers/application_controller.rb +5 -0
  127. data/integration/multiverse/rails42_app/app/controllers/concerns/.keep +0 -0
  128. data/integration/multiverse/rails42_app/app/controllers/posts_controller.rb +75 -0
  129. data/integration/multiverse/rails42_app/app/helpers/application_helper.rb +2 -0
  130. data/integration/multiverse/rails42_app/app/helpers/posts_helper.rb +2 -0
  131. data/integration/multiverse/rails42_app/app/jobs/foobar_cleanup_job.rb +7 -0
  132. data/integration/multiverse/rails42_app/app/mailers/.keep +0 -0
  133. data/integration/multiverse/rails42_app/app/models/.keep +0 -0
  134. data/integration/multiverse/rails42_app/app/models/concerns/.keep +0 -0
  135. data/integration/multiverse/rails42_app/app/models/post.rb +2 -0
  136. data/integration/multiverse/rails42_app/app/views/layouts/application.html.erb +14 -0
  137. data/integration/multiverse/rails42_app/app/views/posts/_form.html.erb +21 -0
  138. data/integration/multiverse/rails42_app/app/views/posts/edit.html.erb +6 -0
  139. data/integration/multiverse/rails42_app/app/views/posts/index.html.erb +27 -0
  140. data/integration/multiverse/rails42_app/app/views/posts/index.json.jbuilder +4 -0
  141. data/integration/multiverse/rails42_app/app/views/posts/new.html.erb +5 -0
  142. data/integration/multiverse/rails42_app/app/views/posts/show.html.erb +9 -0
  143. data/integration/multiverse/rails42_app/app/views/posts/show.json.jbuilder +1 -0
  144. data/integration/multiverse/rails42_app/bin/bundle +3 -0
  145. data/integration/multiverse/rails42_app/bin/rails +9 -0
  146. data/integration/multiverse/rails42_app/bin/rake +9 -0
  147. data/integration/multiverse/rails42_app/bin/setup +29 -0
  148. data/integration/multiverse/rails42_app/bin/spring +15 -0
  149. data/integration/multiverse/rails42_app/config/application.rb +26 -0
  150. data/integration/multiverse/rails42_app/config/boot.rb +3 -0
  151. data/{test/dummy → integration/multiverse/rails42_app}/config/database.yml +8 -8
  152. data/integration/multiverse/rails42_app/config/environment.rb +5 -0
  153. data/integration/multiverse/rails42_app/config/environments/development.rb +41 -0
  154. data/integration/multiverse/rails42_app/config/environments/production.rb +79 -0
  155. data/integration/multiverse/rails42_app/config/environments/test.rb +42 -0
  156. data/integration/multiverse/rails42_app/config/initializers/assets.rb +11 -0
  157. data/integration/multiverse/rails42_app/config/initializers/backtrace_silencers.rb +7 -0
  158. data/integration/multiverse/rails42_app/config/initializers/cookies_serializer.rb +3 -0
  159. data/integration/multiverse/rails42_app/config/initializers/filter_parameter_logging.rb +4 -0
  160. data/integration/multiverse/rails42_app/config/initializers/inflections.rb +16 -0
  161. data/integration/multiverse/rails42_app/config/initializers/mime_types.rb +4 -0
  162. data/integration/multiverse/rails42_app/config/initializers/session_store.rb +3 -0
  163. data/integration/multiverse/rails42_app/config/initializers/vitals.rb +12 -0
  164. data/integration/multiverse/rails42_app/config/initializers/wrap_parameters.rb +14 -0
  165. data/integration/multiverse/rails42_app/config/locales/en.yml +23 -0
  166. data/integration/multiverse/rails42_app/config/routes.rb +57 -0
  167. data/integration/multiverse/rails42_app/config/secrets.yml +22 -0
  168. data/integration/multiverse/rails42_app/config.ru +4 -0
  169. data/integration/multiverse/rails42_app/db/migrate/20160321140358_create_posts.rb +9 -0
  170. data/integration/multiverse/rails42_app/db/schema.rb +22 -0
  171. data/integration/multiverse/rails42_app/db/seeds.rb +7 -0
  172. data/integration/multiverse/rails42_app/lib/assets/.keep +0 -0
  173. data/integration/multiverse/rails42_app/lib/tasks/.keep +0 -0
  174. data/integration/multiverse/rails42_app/log/.keep +0 -0
  175. data/integration/multiverse/rails42_app/public/404.html +67 -0
  176. data/integration/multiverse/rails42_app/public/422.html +67 -0
  177. data/integration/multiverse/rails42_app/public/500.html +66 -0
  178. data/integration/multiverse/rails42_app/public/favicon.ico +0 -0
  179. data/integration/multiverse/rails42_app/public/robots.txt +5 -0
  180. data/integration/multiverse/rails42_app/test/controllers/.keep +0 -0
  181. data/integration/multiverse/rails42_app/test/controllers/posts_controller_test.rb +49 -0
  182. data/integration/multiverse/rails42_app/test/fixtures/.keep +0 -0
  183. data/integration/multiverse/rails42_app/test/fixtures/posts.yml +7 -0
  184. data/integration/multiverse/rails42_app/test/helpers/.keep +0 -0
  185. data/integration/multiverse/rails42_app/test/integration/.keep +0 -0
  186. data/integration/multiverse/rails42_app/test/integration/vitals_flow_test.rb +78 -0
  187. data/integration/multiverse/rails42_app/test/jobs/foobar_cleanup_job_test.rb +7 -0
  188. data/integration/multiverse/rails42_app/test/mailers/.keep +0 -0
  189. data/integration/multiverse/rails42_app/test/models/.keep +0 -0
  190. data/{test/dummy/test/unit/task_test.rb → integration/multiverse/rails42_app/test/models/post_test.rb} +1 -1
  191. data/integration/multiverse/rails42_app/test/test_helper.rb +11 -0
  192. data/integration/multiverse_helper.rb +16 -0
  193. data/integration/multiverse_spec.rb +40 -0
  194. data/lib/vitals/configuration.rb +35 -0
  195. data/lib/vitals/formats/host_last_format.rb +26 -0
  196. data/lib/vitals/formats/production_format.rb +21 -0
  197. data/lib/vitals/integrations/notifications/action_controller.rb +26 -0
  198. data/lib/vitals/integrations/notifications/active_job.rb +18 -0
  199. data/lib/vitals/integrations/notifications/base.rb +20 -0
  200. data/lib/vitals/integrations/notifications/grape.rb +30 -0
  201. data/lib/vitals/integrations/rack/requests.rb +23 -0
  202. data/lib/vitals/reporters/base_reporter.rb +9 -0
  203. data/lib/vitals/reporters/console_reporter.rb +23 -0
  204. data/lib/vitals/reporters/inmem_reporter.rb +31 -0
  205. data/lib/vitals/reporters/multi_reporter.rb +24 -0
  206. data/lib/vitals/reporters/statsd_reporter.rb +27 -0
  207. data/lib/vitals/utils.rb +15 -0
  208. data/lib/vitals/version.rb +1 -1
  209. data/lib/vitals.rb +46 -23
  210. data/vitals.gemspec +48 -0
  211. metadata +404 -147
  212. data/MIT-LICENSE +0 -20
  213. data/lib/generators/vitals/templates/vitals_initializer.rb +0 -7
  214. data/lib/generators/vitals/vitals_generator.rb +0 -12
  215. data/lib/tasks/vitals_tasks.rake +0 -4
  216. data/lib/vitals/reporter.rb +0 -23
  217. data/test/dummy/app/assets/javascripts/application.js +0 -9
  218. data/test/dummy/app/assets/javascripts/tasks.js +0 -2
  219. data/test/dummy/app/assets/stylesheets/application.css +0 -7
  220. data/test/dummy/app/assets/stylesheets/scaffold.css +0 -56
  221. data/test/dummy/app/assets/stylesheets/tasks.css +0 -4
  222. data/test/dummy/app/controllers/tasks_controller.rb +0 -83
  223. data/test/dummy/app/helpers/tasks_helper.rb +0 -2
  224. data/test/dummy/app/models/task.rb +0 -2
  225. data/test/dummy/app/views/tasks/_form.html.erb +0 -21
  226. data/test/dummy/app/views/tasks/edit.html.erb +0 -6
  227. data/test/dummy/app/views/tasks/index.html.erb +0 -23
  228. data/test/dummy/app/views/tasks/new.html.erb +0 -5
  229. data/test/dummy/app/views/tasks/show.html.erb +0 -10
  230. data/test/dummy/config/boot.rb +0 -10
  231. data/test/dummy/config/initializers/secret_token.rb +0 -7
  232. data/test/dummy/config/routes.rb +0 -60
  233. data/test/dummy/config.ru +0 -4
  234. data/test/dummy/db/migrate/20110917182114_create_tasks.rb +0 -9
  235. data/test/dummy/log/development.log +0 -55
  236. data/test/dummy/test/fixtures/tasks.yml +0 -7
  237. data/test/dummy/test/functional/tasks_controller_test.rb +0 -49
  238. data/test/dummy/test/unit/helpers/tasks_helper_test.rb +0 -4
  239. data/test/test_helper.rb +0 -10
  240. data/test/vitals_test.rb +0 -7
@@ -0,0 +1,24 @@
1
+ require 'rubygems'
2
+
3
+ ENV['RACK_ENV'] ||= 'test'
4
+
5
+ require 'rack/test'
6
+
7
+ require File.expand_path('../../config/environment', __FILE__)
8
+
9
+ RSpec.configure do |config|
10
+ config.color = true
11
+ config.formatter = :documentation
12
+
13
+ config.mock_with :rspec
14
+ config.expect_with :rspec
15
+ config.raise_errors_for_deprecations!
16
+ end
17
+
18
+ require 'capybara/rspec'
19
+ Capybara.configure do |config|
20
+ config.app = Acme::App.new
21
+ config.server_port = 9293
22
+ end
23
+
24
+ require File.expand_path( '../../../multiverse_helper', File.dirname(__FILE__))
@@ -0,0 +1,16 @@
1
+ # See http://help.github.com/ignore-files/ for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile ~/.gitignore_global
6
+
7
+ # Ignore bundler config
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+
13
+ # Ignore all logfiles and tempfiles.
14
+ /log/*.log
15
+ /tmp
16
+ vendor/
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format=progress
@@ -0,0 +1,6 @@
1
+ AllCops:
2
+ Exclude:
3
+ - vendor/**/*
4
+ - bin/**/*
5
+
6
+ inherit_from: .rubocop_todo.yml
@@ -0,0 +1,33 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2015-08-06 12:27:03 -0400 using RuboCop version 0.33.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 30
10
+ # Configuration parameters: AllowURI, URISchemes.
11
+ Metrics/LineLength:
12
+ Max: 129
13
+
14
+ # Offense count: 10
15
+ Style/Documentation:
16
+ Exclude:
17
+ - 'app/api/acme/ping.rb'
18
+ - 'app/api/acme/post.rb'
19
+ - 'app/api/acme/protected.rb'
20
+ - 'app/api/acme/raise.rb'
21
+ - 'app/api/api.rb'
22
+ - 'app/controllers/application_controller.rb'
23
+ - 'app/controllers/welcome_controller.rb'
24
+ - 'app/helpers/application_helper.rb'
25
+ - 'app/helpers/welcome_helper.rb'
26
+ - 'config/application.rb'
27
+
28
+ # Offense count: 1
29
+ # Cop supports --auto-correct.
30
+ # Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
31
+ Style/RegexpLiteral:
32
+ Exclude:
33
+ - 'spec/spec_helper.rb'
@@ -0,0 +1,17 @@
1
+ sudo: false
2
+
3
+ language: ruby
4
+
5
+ cache: bundler
6
+
7
+ rvm:
8
+ - 2.2.4
9
+
10
+ before_install:
11
+ - "export DISPLAY=:99.0"
12
+ - "sh -e /etc/init.d/xvfb start"
13
+
14
+ before_script:
15
+ - "cp config/database.travis.yml config/database.yml"
16
+ - "RAILS_ENV=test bundle exec rake db:create"
17
+
@@ -0,0 +1,22 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails'
4
+ gem 'sass'
5
+ gem 'sqlite3'
6
+ gem 'sass-rails'
7
+ gem 'coffee-rails'
8
+ gem 'jquery-rails'
9
+ gem 'grape'
10
+ gem 'uglifier'
11
+ gem 'zip-zip'
12
+
13
+ group :development, :test do
14
+ gem 'rspec'
15
+ gem 'rspec-rails'
16
+ gem 'capybara'
17
+ gem 'selenium-webdriver'
18
+ gem 'rubocop'
19
+ gem 'nokogiri'
20
+ end
21
+
22
+ gem 'vitals', path: '../../../'
@@ -0,0 +1,238 @@
1
+ PATH
2
+ remote: ../../../
3
+ specs:
4
+ vitals (0.3.0)
5
+ statsd-ruby (~> 1.3.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionmailer (4.2.5.1)
11
+ actionpack (= 4.2.5.1)
12
+ actionview (= 4.2.5.1)
13
+ activejob (= 4.2.5.1)
14
+ mail (~> 2.5, >= 2.5.4)
15
+ rails-dom-testing (~> 1.0, >= 1.0.5)
16
+ actionpack (4.2.5.1)
17
+ actionview (= 4.2.5.1)
18
+ activesupport (= 4.2.5.1)
19
+ rack (~> 1.6)
20
+ rack-test (~> 0.6.2)
21
+ rails-dom-testing (~> 1.0, >= 1.0.5)
22
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
23
+ actionview (4.2.5.1)
24
+ activesupport (= 4.2.5.1)
25
+ builder (~> 3.1)
26
+ erubis (~> 2.7.0)
27
+ rails-dom-testing (~> 1.0, >= 1.0.5)
28
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
+ activejob (4.2.5.1)
30
+ activesupport (= 4.2.5.1)
31
+ globalid (>= 0.3.0)
32
+ activemodel (4.2.5.1)
33
+ activesupport (= 4.2.5.1)
34
+ builder (~> 3.1)
35
+ activerecord (4.2.5.1)
36
+ activemodel (= 4.2.5.1)
37
+ activesupport (= 4.2.5.1)
38
+ arel (~> 6.0)
39
+ activesupport (4.2.5.1)
40
+ i18n (~> 0.7)
41
+ json (~> 1.7, >= 1.7.7)
42
+ minitest (~> 5.1)
43
+ thread_safe (~> 0.3, >= 0.3.4)
44
+ tzinfo (~> 1.1)
45
+ addressable (2.4.0)
46
+ arel (6.0.3)
47
+ ast (2.2.0)
48
+ axiom-types (0.1.1)
49
+ descendants_tracker (~> 0.0.4)
50
+ ice_nine (~> 0.11.0)
51
+ thread_safe (~> 0.3, >= 0.3.1)
52
+ builder (3.2.2)
53
+ capybara (2.6.2)
54
+ addressable
55
+ mime-types (>= 1.16)
56
+ nokogiri (>= 1.3.3)
57
+ rack (>= 1.0.0)
58
+ rack-test (>= 0.5.4)
59
+ xpath (~> 2.0)
60
+ childprocess (0.5.9)
61
+ ffi (~> 1.0, >= 1.0.11)
62
+ coercible (1.0.0)
63
+ descendants_tracker (~> 0.0.1)
64
+ coffee-rails (4.1.1)
65
+ coffee-script (>= 2.2.0)
66
+ railties (>= 4.0.0, < 5.1.x)
67
+ coffee-script (2.4.1)
68
+ coffee-script-source
69
+ execjs
70
+ coffee-script-source (1.10.0)
71
+ concurrent-ruby (1.0.0)
72
+ descendants_tracker (0.0.4)
73
+ thread_safe (~> 0.3, >= 0.3.1)
74
+ diff-lcs (1.2.5)
75
+ equalizer (0.0.11)
76
+ erubis (2.7.0)
77
+ execjs (2.6.0)
78
+ ffi (1.9.10)
79
+ globalid (0.3.6)
80
+ activesupport (>= 4.1.0)
81
+ grape (0.14.0)
82
+ activesupport
83
+ builder
84
+ hashie (>= 2.1.0)
85
+ multi_json (>= 1.3.2)
86
+ multi_xml (>= 0.5.2)
87
+ rack (>= 1.3.0)
88
+ rack-accept
89
+ rack-mount
90
+ virtus (>= 1.0.0)
91
+ hashie (3.4.3)
92
+ i18n (0.7.0)
93
+ ice_nine (0.11.2)
94
+ jquery-rails (4.1.0)
95
+ rails-dom-testing (~> 1.0)
96
+ railties (>= 4.2.0)
97
+ thor (>= 0.14, < 2.0)
98
+ json (1.8.3)
99
+ loofah (2.0.3)
100
+ nokogiri (>= 1.5.9)
101
+ mail (2.6.3)
102
+ mime-types (>= 1.16, < 3)
103
+ mime-types (2.99)
104
+ mini_portile2 (2.0.0)
105
+ minitest (5.8.4)
106
+ multi_json (1.11.2)
107
+ multi_xml (0.5.5)
108
+ nokogiri (1.6.7.2)
109
+ mini_portile2 (~> 2.0.0.rc2)
110
+ parser (2.3.0.2)
111
+ ast (~> 2.2)
112
+ powerpack (0.1.1)
113
+ rack (1.6.4)
114
+ rack-accept (0.4.5)
115
+ rack (>= 0.4)
116
+ rack-mount (0.8.3)
117
+ rack (>= 1.0.0)
118
+ rack-test (0.6.3)
119
+ rack (>= 1.0)
120
+ rails (4.2.5.1)
121
+ actionmailer (= 4.2.5.1)
122
+ actionpack (= 4.2.5.1)
123
+ actionview (= 4.2.5.1)
124
+ activejob (= 4.2.5.1)
125
+ activemodel (= 4.2.5.1)
126
+ activerecord (= 4.2.5.1)
127
+ activesupport (= 4.2.5.1)
128
+ bundler (>= 1.3.0, < 2.0)
129
+ railties (= 4.2.5.1)
130
+ sprockets-rails
131
+ rails-deprecated_sanitizer (1.0.3)
132
+ activesupport (>= 4.2.0.alpha)
133
+ rails-dom-testing (1.0.7)
134
+ activesupport (>= 4.2.0.beta, < 5.0)
135
+ nokogiri (~> 1.6.0)
136
+ rails-deprecated_sanitizer (>= 1.0.1)
137
+ rails-html-sanitizer (1.0.3)
138
+ loofah (~> 2.0)
139
+ railties (4.2.5.1)
140
+ actionpack (= 4.2.5.1)
141
+ activesupport (= 4.2.5.1)
142
+ rake (>= 0.8.7)
143
+ thor (>= 0.18.1, < 2.0)
144
+ rainbow (2.1.0)
145
+ rake (10.5.0)
146
+ rspec (3.4.0)
147
+ rspec-core (~> 3.4.0)
148
+ rspec-expectations (~> 3.4.0)
149
+ rspec-mocks (~> 3.4.0)
150
+ rspec-core (3.4.2)
151
+ rspec-support (~> 3.4.0)
152
+ rspec-expectations (3.4.0)
153
+ diff-lcs (>= 1.2.0, < 2.0)
154
+ rspec-support (~> 3.4.0)
155
+ rspec-mocks (3.4.1)
156
+ diff-lcs (>= 1.2.0, < 2.0)
157
+ rspec-support (~> 3.4.0)
158
+ rspec-rails (3.4.2)
159
+ actionpack (>= 3.0, < 4.3)
160
+ activesupport (>= 3.0, < 4.3)
161
+ railties (>= 3.0, < 4.3)
162
+ rspec-core (~> 3.4.0)
163
+ rspec-expectations (~> 3.4.0)
164
+ rspec-mocks (~> 3.4.0)
165
+ rspec-support (~> 3.4.0)
166
+ rspec-support (3.4.1)
167
+ rubocop (0.37.0)
168
+ parser (>= 2.3.0.2, < 3.0)
169
+ powerpack (~> 0.1)
170
+ rainbow (>= 1.99.1, < 3.0)
171
+ ruby-progressbar (~> 1.7)
172
+ unicode-display_width (~> 0.3)
173
+ ruby-progressbar (1.7.5)
174
+ rubyzip (1.1.7)
175
+ sass (3.4.21)
176
+ sass-rails (5.0.4)
177
+ railties (>= 4.0.0, < 5.0)
178
+ sass (~> 3.1)
179
+ sprockets (>= 2.8, < 4.0)
180
+ sprockets-rails (>= 2.0, < 4.0)
181
+ tilt (>= 1.1, < 3)
182
+ selenium-webdriver (2.50.0)
183
+ childprocess (~> 0.5)
184
+ multi_json (~> 1.0)
185
+ rubyzip (~> 1.0)
186
+ websocket (~> 1.0)
187
+ sprockets (3.5.2)
188
+ concurrent-ruby (~> 1.0)
189
+ rack (> 1, < 3)
190
+ sprockets-rails (3.0.1)
191
+ actionpack (>= 4.0)
192
+ activesupport (>= 4.0)
193
+ sprockets (>= 3.0.0)
194
+ sqlite3 (1.3.11)
195
+ statsd-ruby (1.3.0)
196
+ thor (0.19.1)
197
+ thread_safe (0.3.5)
198
+ tilt (2.0.2)
199
+ tzinfo (1.2.2)
200
+ thread_safe (~> 0.1)
201
+ uglifier (2.7.2)
202
+ execjs (>= 0.3.0)
203
+ json (>= 1.8.0)
204
+ unicode-display_width (0.3.1)
205
+ virtus (1.0.5)
206
+ axiom-types (~> 0.1)
207
+ coercible (~> 1.0)
208
+ descendants_tracker (~> 0.0, >= 0.0.3)
209
+ equalizer (~> 0.0, >= 0.0.9)
210
+ websocket (1.2.2)
211
+ xpath (2.0.0)
212
+ nokogiri (~> 1.3)
213
+ zip-zip (0.3)
214
+ rubyzip (>= 1.0.0)
215
+
216
+ PLATFORMS
217
+ ruby
218
+
219
+ DEPENDENCIES
220
+ capybara
221
+ coffee-rails
222
+ grape
223
+ jquery-rails
224
+ nokogiri
225
+ rails
226
+ rspec
227
+ rspec-rails
228
+ rubocop
229
+ sass
230
+ sass-rails
231
+ selenium-webdriver
232
+ sqlite3
233
+ uglifier
234
+ vitals!
235
+ zip-zip
236
+
237
+ BUNDLED WITH
238
+ 1.11.2
@@ -0,0 +1,29 @@
1
+ Grape on Rails
2
+ ==============
3
+
4
+ [![Build Status](https://travis-ci.org/ruby-grape/grape-on-rails.svg?branch=master)](https://travis-ci.org/ruby-grape/grape-on-rails)
5
+ [![Dependency Status](https://gemnasium.com/ruby-grape/grape-on-rails.svg)](https://gemnasium.com/ruby-grape/grape-on-rails)
6
+ [![Code Climate](https://codeclimate.com/github/ruby-grape/grape-on-rails.svg)](https://codeclimate.com/github/ruby-grape/grape-on-rails)
7
+
8
+ A [Grape](http://github.com/ruby-grape/grape) API mounted on Rails.
9
+
10
+ * [ping](app/api/acme/ping.rb): a hello world `GET` API
11
+ * [post](app/api/acme/post.rb): post JSON data
12
+ * [raise](app/api/acme/raise.rb): raise an error, Rails handling exceptions
13
+ * [protected](app/api/acme/protected.rb): API protected with rudimentary Basic Authentication
14
+
15
+ See
16
+ ---
17
+
18
+ An instance of this app is running on [grape-on-rails.herokuapp.com](http://grape-on-rails.herokuapp.com).
19
+
20
+ Run
21
+ ---
22
+
23
+ ```
24
+ bundle install
25
+ rails s
26
+ ```
27
+
28
+ Try http://localhost:3000/api/ping or http://localhost:3000/api/protected/ping with _username_ and _password_.
29
+
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env rake
2
+
3
+ require File.expand_path('../config/application', __FILE__)
4
+
5
+ GrapeOnRails::Application.load_tasks
6
+
7
+ if Rails.env.test? || Rails.env.development?
8
+ require 'rspec/core/rake_task'
9
+
10
+ Rake::Task[:default].prerequisites.clear
11
+
12
+ require 'rubocop/rake_task'
13
+ RuboCop::RakeTask.new(:rubocop)
14
+
15
+ task default: [:rubocop, :spec]
16
+ end
@@ -0,0 +1,8 @@
1
+ module Acme
2
+ class Ping < Grape::API
3
+ desc 'Returns pong.'
4
+ get :ping do
5
+ { ping: params[:pong] || 'pong' }
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ module Acme
2
+ class Post < Grape::API
3
+ desc 'Creates a spline that can be reticulated.'
4
+ resource :spline do
5
+ post do
6
+ { reticulated: params[:reticulated] }
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,13 @@
1
+ module Acme
2
+ class Protected < Grape::API
3
+ namespace :protected do
4
+ http_basic do |username, password|
5
+ username == 'username' && password == 'password'
6
+ end
7
+ desc 'Returns pong if username=username and password=password.'
8
+ get :ping do
9
+ { ping: 'pong' }
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,8 @@
1
+ module Acme
2
+ class Raise < Grape::API
3
+ desc 'Raises an exception.'
4
+ get :raise do
5
+ raise 'Unexpected error.'
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ class API < Grape::API
2
+ prefix 'api'
3
+ format :json
4
+ mount Acme::Ping
5
+ mount Acme::Raise
6
+ mount Acme::Protected
7
+ mount Acme::Post
8
+ end
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://coffeescript.org/
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the welcome controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,4 @@
1
+ class WelcomeController < ApplicationController
2
+ def index
3
+ end
4
+ end
@@ -0,0 +1,2 @@
1
+ module WelcomeHelper
2
+ end
@@ -1,8 +1,8 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <title>Dummy</title>
5
- <%= stylesheet_link_tag "application" %>
4
+ <title>GrapeOnRails</title>
5
+ <%= stylesheet_link_tag "application", :media => "all" %>
6
6
  <%= javascript_include_tag "application" %>
7
7
  <%= csrf_meta_tags %>
8
8
  </head>
@@ -0,0 +1,6 @@
1
+ <h1>Grape Mounted on Rails 4</h1>
2
+ <ul>
3
+ <li><a href='/api/ping'>Ping</a></li>
4
+ <li><a href='/api/protected/ping'>Ping w/ Basic Auth</a> (username: <em>username</em>, password: <em>password</em>)</li>
5
+ </ul>
6
+ <a href="https://github.com/ruby-grape/grape-on-rails">Fork me on Github</a>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -1,11 +1,20 @@
1
1
  require File.expand_path('../boot', __FILE__)
2
2
 
3
- require 'rails/all'
3
+ # Pick the frameworks you want:
4
+ require 'active_record/railtie'
5
+ require 'action_controller/railtie'
6
+ require 'action_mailer/railtie'
7
+ require 'sprockets/railtie'
8
+ # require "rails/test_unit/railtie"
4
9
 
5
- Bundler.require
6
- require "vitals"
10
+ if defined?(Bundler)
11
+ # If you precompile assets before deploying to production, use this line
12
+ Bundler.require(*Rails.groups(assets: %w(development test)))
13
+ # If you want your assets lazily compiled in production, use this line
14
+ # Bundler.require(:default, :assets, Rails.env)
15
+ end
7
16
 
8
- module Dummy
17
+ module GrapeOnRails
9
18
  class Application < Rails::Application
10
19
  # Settings in config/environments/* take precedence over those specified here.
11
20
  # Application configuration should go into files in config/initializers
@@ -14,6 +23,10 @@ module Dummy
14
23
  # Custom directories with classes and modules you want to be autoloadable.
15
24
  # config.autoload_paths += %W(#{config.root}/extras)
16
25
 
26
+ # Auto-load API and its subdirectories
27
+ config.paths.add 'app/api', glob: '**/*.rb'
28
+ config.autoload_paths += Dir["#{Rails.root}/app/api/*"]
29
+
17
30
  # Only load the plugins named here, in the order given (default is alphabetical).
18
31
  # :all can be used as a placeholder for all plugins not explicitly named.
19
32
  # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
@@ -30,11 +43,19 @@ module Dummy
30
43
  # config.i18n.default_locale = :de
31
44
 
32
45
  # Configure the default encoding used in templates for Ruby 1.9.
33
- config.encoding = "utf-8"
46
+ config.encoding = 'utf-8'
34
47
 
35
48
  # Configure sensitive parameters which will be filtered from the log file.
36
49
  config.filter_parameters += [:password]
37
50
 
51
+ # Enable escaping HTML in JSON.
52
+ config.active_support.escape_html_entities_in_json = true
53
+
54
+ # Use SQL instead of Active Record's schema dumper when creating the database.
55
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
56
+ # like if you have constraints or database-specific column types
57
+ # config.active_record.schema_format = :sql
58
+
38
59
  # Enable the asset pipeline
39
60
  config.assets.enabled = true
40
61
 
@@ -42,4 +63,3 @@ module Dummy
42
63
  config.assets.version = '1.0'
43
64
  end
44
65
  end
45
-
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
+
6
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,4 @@
1
+ test:
2
+ adapter: postgresql
3
+ database: grape_on_rails_test
4
+ username: postgres
@@ -0,0 +1,16 @@
1
+ default: &default
2
+ adapter: sqlite3
3
+ pool: 5
4
+ timeout: 5000
5
+
6
+ development:
7
+ <<: *default
8
+ database: db/development.sqlite3
9
+
10
+ # Warning: The database defined as "test" will be erased and
11
+ # re-generated from your development database when you run "rake".
12
+ # Do not set this db to the same as development or production.
13
+ test:
14
+ <<: *default
15
+ database: db/test.sqlite3
16
+
@@ -2,4 +2,4 @@
2
2
  require File.expand_path('../application', __FILE__)
3
3
 
4
4
  # Initialize the rails application
5
- Dummy::Application.initialize!
5
+ GrapeOnRails::Application.initialize!