vodka 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 (81) hide show
  1. data/.gitignore +7 -0
  2. data/.travis.yml +14 -0
  3. data/Gemfile +4 -0
  4. data/LICENCE +13 -0
  5. data/README.md +119 -0
  6. data/lib/party.rb +9 -0
  7. data/lib/vodka/client/exceptions/exception.rb +6 -0
  8. data/lib/vodka/client/exceptions/failed_action_exception.rb +6 -0
  9. data/lib/vodka/client/exceptions/forbidden_exception.rb +11 -0
  10. data/lib/vodka/client/exceptions/not_found_exception.rb +11 -0
  11. data/lib/vodka/client/exceptions/resource_exception.rb +6 -0
  12. data/lib/vodka/client/middleware/error_aware.rb +21 -0
  13. data/lib/vodka/client/middleware/signed_request.rb +34 -0
  14. data/lib/vodka/client.rb +16 -0
  15. data/lib/vodka/configuration.rb +25 -0
  16. data/lib/vodka/her/extensions/extended_orm.rb +92 -0
  17. data/lib/vodka/her/extensions/will_paginate.rb +32 -0
  18. data/lib/vodka/server/controllers/vodka_controller.rb +32 -0
  19. data/lib/vodka/server/handlers/resource.rb +36 -0
  20. data/lib/vodka/server/handlers/response.rb +34 -0
  21. data/lib/vodka/server/handlers/scaffold.rb +63 -0
  22. data/lib/vodka/server/middleware/signed_request.rb +39 -0
  23. data/lib/vodka/server/plugins/presentable.rb +20 -0
  24. data/lib/vodka/server/railtie.rb +11 -0
  25. data/lib/vodka/server/response.rb +34 -0
  26. data/lib/vodka/server.rb +15 -0
  27. data/lib/vodka/version.rb +3 -0
  28. data/lib/vodka.rb +5 -0
  29. data/script/bundle_dummy +4 -0
  30. data/script/ci +4 -0
  31. data/script/setup_db +7 -0
  32. data/script/show_logs +22 -0
  33. data/script/spec +14 -0
  34. data/script/start_server +6 -0
  35. data/script/stop_server +6 -0
  36. data/spec/client/article.rb +4 -0
  37. data/spec/dummy/Gemfile +9 -0
  38. data/spec/dummy/Gemfile.lock +113 -0
  39. data/spec/dummy/Rakefile +7 -0
  40. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  41. data/spec/dummy/app/controllers/vodka/articles_controller.rb +8 -0
  42. data/spec/dummy/app/models/article.rb +10 -0
  43. data/spec/dummy/config/application.rb +64 -0
  44. data/spec/dummy/config/boot.rb +6 -0
  45. data/spec/dummy/config/database.yml +17 -0
  46. data/spec/dummy/config/environment.rb +5 -0
  47. data/spec/dummy/config/environments/development.rb +32 -0
  48. data/spec/dummy/config/environments/production.rb +54 -0
  49. data/spec/dummy/config/environments/test.rb +37 -0
  50. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  51. data/spec/dummy/config/initializers/inflections.rb +15 -0
  52. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  53. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  54. data/spec/dummy/config/initializers/session_store.rb +8 -0
  55. data/spec/dummy/config/initializers/vodka_setup.rb +3 -0
  56. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  57. data/spec/dummy/config/locales/en.yml +2 -0
  58. data/spec/dummy/config/locales/ru.yml +2 -0
  59. data/spec/dummy/config/routes.rb +7 -0
  60. data/spec/dummy/config/thin.yml +10 -0
  61. data/spec/dummy/config.ru +4 -0
  62. data/spec/dummy/db/migrate/20130217185353_create_articles.rb +9 -0
  63. data/spec/dummy/db/schema.rb +22 -0
  64. data/spec/dummy/db/seeds.rb +1 -0
  65. data/spec/dummy/log/.gitkeep +0 -0
  66. data/spec/dummy/script/rails +6 -0
  67. data/spec/her/extensions/extended_orm/create_spec.rb +33 -0
  68. data/spec/her/extensions/extended_orm/delete_spec.rb +23 -0
  69. data/spec/her/extensions/extended_orm/destroy_spec.rb +35 -0
  70. data/spec/her/extensions/extended_orm/first_spec.rb +11 -0
  71. data/spec/her/extensions/extended_orm/last_spec.rb +11 -0
  72. data/spec/her/extensions/extended_orm/update_attribute_spec.rb +44 -0
  73. data/spec/her/extensions/extended_orm/update_attributes_spec.rb +44 -0
  74. data/spec/her/extensions/extended_orm/where_spec.rb +39 -0
  75. data/spec/her/extensions/will_paginate/paginate_spec.rb +16 -0
  76. data/spec/middleware/error_aware_spec.rb +19 -0
  77. data/spec/middleware/response_locale_spec.rb +12 -0
  78. data/spec/middleware/signed_request_spec.rb +9 -0
  79. data/spec/spec_helper.rb +24 -0
  80. data/vodka.gemspec +21 -0
  81. metadata +190 -0
@@ -0,0 +1,34 @@
1
+ module Vodka
2
+ module Server
3
+ class Response
4
+ attr_accessor :code, :success, :data, :metadata, :errors
5
+
6
+ def initialize
7
+ @code = 200
8
+ @metadata = {}
9
+ @errors = {}
10
+ end
11
+
12
+ def json
13
+ metadata[:vodka_action_success] = success unless success.nil?
14
+
15
+ if data.nil?
16
+ presented_data = nil
17
+ errors_to_return = errors
18
+ elsif data.is_a?(Array)
19
+ presented_data = data.map(&:present_vodka)
20
+ errors_to_return = errors
21
+ else
22
+ presented_data = data.present_vodka
23
+ errors_to_return = presented_data.delete(:errors)
24
+ end
25
+
26
+ MultiJson.dump(
27
+ data: presented_data,
28
+ metadata: metadata,
29
+ errors: errors_to_return
30
+ )
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,15 @@
1
+ require 'vodka'
2
+ require 'vodka/server/middleware/signed_request'
3
+ require 'vodka/server/railtie'
4
+ require 'vodka/server/response'
5
+ require 'vodka/server/handlers/resource'
6
+ require 'vodka/server/handlers/response'
7
+ require 'vodka/server/handlers/scaffold'
8
+ require 'vodka/server/controllers/vodka_controller'
9
+ require 'vodka/server/plugins/presentable'
10
+
11
+ module Vodka
12
+ module Server
13
+ extend Configurable
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module Vodka
2
+ VERSION = '0.0.1'
3
+ end
data/lib/vodka.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'her'
2
+ require 'multi_json'
3
+
4
+ require 'vodka/version'
5
+ require 'vodka/configuration'
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+ dummy_path="$(pwd)/spec/dummy"
3
+ BUNDLE_GEMFILE=$dummy_path/Gemfile
4
+ cd $dummy_path && bundle install --path $dummy_path/.bundle 2>&1 > $dummy_path/log/bundler.log
data/script/ci ADDED
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+ BUNDLE_PATH=.bundle
3
+ BUNDLE_GEMFILE=Gemfile
4
+ bundle exec rspec
data/script/setup_db ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ dummy_path="$(pwd)/spec/dummy"
3
+ BUNDLE_PATH=$dummy_path/.bundle
4
+ BUNDLE_GEMFILE=$dummy_path/Gemfile
5
+ RAILS_ENV=test
6
+ cd $dummy_path && bundle exec rake db:migrate 2>&1 > $dummy_path/log/setup_db.log
7
+ cd $dummy_path && bundle exec rake db:test:prepare 2>&1 > $dummy_path/log/setup_db.log
data/script/show_logs ADDED
@@ -0,0 +1,22 @@
1
+ #!/bin/bash
2
+ dummy_path="$(pwd)/spec/dummy"
3
+
4
+ echo 'Bundler log:'
5
+ cat $dummy_path/log/bundler.log
6
+ echo ''
7
+
8
+ echo 'Setup DB log:'
9
+ cat $dummy_path/log/setup_db.log
10
+ echo ''
11
+
12
+ echo 'Thin start log:'
13
+ cat $dummy_path/log/thin_start.log
14
+ echo ''
15
+
16
+ echo 'Thin log:'
17
+ cat $dummy_path/log/thin.3000.log
18
+ echo ''
19
+
20
+ echo 'Dummy log:'
21
+ cat $dummy_path/log/test.log
22
+ echo ''
data/script/spec ADDED
@@ -0,0 +1,14 @@
1
+ #!/bin/bash
2
+
3
+ cd spec/dummy
4
+ rm -f log/*
5
+ bundle install --path .bundle 2>&1 > log/bundler.log
6
+ RAILS_ENV=test bundle exec rake db:reset 2>&1 > log/setup_db.log
7
+ RAILS_ENV=test bundle exec thin start -C config/thin.yml 2>&1 > log/thin_start.log
8
+ cd ../..
9
+ bundle exec rspec
10
+ code=$?
11
+ cd spec/dummy
12
+ RAILS_ENV=test bundle exec thin stop -C config/thin.yml 2>&1 > log/thin_stop.log
13
+ cd ../..
14
+ exit $code
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+ dummy_path="$(pwd)/spec/dummy"
3
+ BUNDLE_PATH=$dummy_path/.bundle
4
+ BUNDLE_GEMFILE=$dummy_path/Gemfile
5
+ RAILS_ENV=test
6
+ cd $dummy_path && bundle exec thin start -C $dummy_path/config/thin.yml 2>&1 > $dummy_path/log/thin_start.log
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+ dummy_path="$(pwd)/spec/dummy"
3
+ BUNDLE_PATH=$dummy_path/.bundle
4
+ BUNDLE_GEMFILE=$dummy_path/Gemfile
5
+ RAILS_ENV=test
6
+ cd $dummy_path && bundle exec thin stop -C $dummy_path/config/thin.yml 2>&1 > /dev/null
@@ -0,0 +1,4 @@
1
+ class Article
2
+ include Her::Model
3
+ custom_get :hello
4
+ end
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', '~> 3.2.12'
4
+ gem 'will_paginate', '~> 3.0.4'
5
+ gem 'sqlite3', '~> 1.3.7'
6
+ gem 'thin', '~> 1.5.0'
7
+ gem 'multi_json', '~> 1.6.1'
8
+
9
+ gem 'vodka', path: '../..', require: 'vodka/server'
@@ -0,0 +1,113 @@
1
+ PATH
2
+ remote: ../..
3
+ specs:
4
+ vodka (0.0.1)
5
+ her (~> 0.4)
6
+ multi_json (~> 1.6.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionmailer (3.2.12)
12
+ actionpack (= 3.2.12)
13
+ mail (~> 2.4.4)
14
+ actionpack (3.2.12)
15
+ activemodel (= 3.2.12)
16
+ activesupport (= 3.2.12)
17
+ builder (~> 3.0.0)
18
+ erubis (~> 2.7.0)
19
+ journey (~> 1.0.4)
20
+ rack (~> 1.4.5)
21
+ rack-cache (~> 1.2)
22
+ rack-test (~> 0.6.1)
23
+ sprockets (~> 2.2.1)
24
+ activemodel (3.2.12)
25
+ activesupport (= 3.2.12)
26
+ builder (~> 3.0.0)
27
+ activerecord (3.2.12)
28
+ activemodel (= 3.2.12)
29
+ activesupport (= 3.2.12)
30
+ arel (~> 3.0.2)
31
+ tzinfo (~> 0.3.29)
32
+ activeresource (3.2.12)
33
+ activemodel (= 3.2.12)
34
+ activesupport (= 3.2.12)
35
+ activesupport (3.2.12)
36
+ i18n (~> 0.6)
37
+ multi_json (~> 1.0)
38
+ arel (3.0.2)
39
+ builder (3.0.4)
40
+ daemons (1.1.9)
41
+ erubis (2.7.0)
42
+ eventmachine (1.0.0)
43
+ faraday (0.8.5)
44
+ multipart-post (~> 1.1)
45
+ her (0.4)
46
+ activesupport (>= 3.0.0)
47
+ faraday (~> 0.8)
48
+ multi_json (~> 1.5)
49
+ hike (1.2.1)
50
+ i18n (0.6.1)
51
+ journey (1.0.4)
52
+ json (1.7.7)
53
+ mail (2.4.4)
54
+ i18n (>= 0.4.0)
55
+ mime-types (~> 1.16)
56
+ treetop (~> 1.4.8)
57
+ mime-types (1.21)
58
+ multi_json (1.6.1)
59
+ multipart-post (1.1.5)
60
+ polyglot (0.3.3)
61
+ rack (1.4.5)
62
+ rack-cache (1.2)
63
+ rack (>= 0.4)
64
+ rack-ssl (1.3.3)
65
+ rack
66
+ rack-test (0.6.2)
67
+ rack (>= 1.0)
68
+ rails (3.2.12)
69
+ actionmailer (= 3.2.12)
70
+ actionpack (= 3.2.12)
71
+ activerecord (= 3.2.12)
72
+ activeresource (= 3.2.12)
73
+ activesupport (= 3.2.12)
74
+ bundler (~> 1.0)
75
+ railties (= 3.2.12)
76
+ railties (3.2.12)
77
+ actionpack (= 3.2.12)
78
+ activesupport (= 3.2.12)
79
+ rack-ssl (~> 1.3.2)
80
+ rake (>= 0.8.7)
81
+ rdoc (~> 3.4)
82
+ thor (>= 0.14.6, < 2.0)
83
+ rake (10.0.3)
84
+ rdoc (3.12.1)
85
+ json (~> 1.4)
86
+ sprockets (2.2.2)
87
+ hike (~> 1.2)
88
+ multi_json (~> 1.0)
89
+ rack (~> 1.0)
90
+ tilt (~> 1.1, != 1.3.0)
91
+ sqlite3 (1.3.7)
92
+ thin (1.5.0)
93
+ daemons (>= 1.0.9)
94
+ eventmachine (>= 0.12.6)
95
+ rack (>= 1.0.0)
96
+ thor (0.17.0)
97
+ tilt (1.3.3)
98
+ treetop (1.4.12)
99
+ polyglot
100
+ polyglot (>= 0.3.1)
101
+ tzinfo (0.3.35)
102
+ will_paginate (3.0.4)
103
+
104
+ PLATFORMS
105
+ ruby
106
+
107
+ DEPENDENCIES
108
+ multi_json (~> 1.6.1)
109
+ rails (~> 3.2.12)
110
+ sqlite3 (~> 1.3.7)
111
+ thin (~> 1.5.0)
112
+ vodka!
113
+ will_paginate (~> 3.0.4)
@@ -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
+ Dummy::Application.load_tasks
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,8 @@
1
+ module Vodka
2
+ class ArticlesController < VodkaController
3
+ def hello
4
+ vodka_response.metadata[:hello] = I18n.t('hello')
5
+ respond_with_collection([])
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ class Article < ActiveRecord::Base
2
+ present_with :id, :title
3
+ attr_accessible :title
4
+ validates_presence_of :title
5
+ before_destroy :ensure_article_in_not_special
6
+
7
+ def ensure_article_in_not_special
8
+ return false if title == 'special'
9
+ end
10
+ end
@@ -0,0 +1,64 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # Pick the frameworks you want:
4
+ require "active_record/railtie"
5
+ require "action_controller/railtie"
6
+ require "action_mailer/railtie"
7
+ require "active_resource/railtie"
8
+ # require "sprockets/railtie"
9
+ # require "rails/test_unit/railtie"
10
+
11
+ if defined?(Bundler)
12
+ # If you precompile assets before deploying to production, use this line
13
+ Bundler.require(*Rails.groups(:assets => %w(development test)))
14
+ # If you want your assets lazily compiled in production, use this line
15
+ # Bundler.require(:default, :assets, Rails.env)
16
+ end
17
+
18
+ module Dummy
19
+ class Application < Rails::Application
20
+ # Settings in config/environments/* take precedence over those specified here.
21
+ # Application configuration should go into files in config/initializers
22
+ # -- all .rb files in that directory are automatically loaded.
23
+
24
+ # Custom directories with classes and modules you want to be autoloadable.
25
+ # config.autoload_paths += %W(#{config.root}/extras)
26
+
27
+ # Only load the plugins named here, in the order given (default is alphabetical).
28
+ # :all can be used as a placeholder for all plugins not explicitly named.
29
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
30
+
31
+ # Activate observers that should always be running.
32
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
33
+
34
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
35
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
36
+ # config.time_zone = 'Central Time (US & Canada)'
37
+
38
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
39
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
40
+ config.i18n.default_locale = :en
41
+ config.i18n.available_locales = [:en, :ru]
42
+
43
+ # Configure the default encoding used in templates for Ruby 1.9.
44
+ config.encoding = "utf-8"
45
+
46
+ # Configure sensitive parameters which will be filtered from the log file.
47
+ config.filter_parameters += [:password]
48
+
49
+ # Enable escaping HTML in JSON.
50
+ config.active_support.escape_html_entities_in_json = true
51
+
52
+ # Use SQL instead of Active Record's schema dumper when creating the database.
53
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
54
+ # like if you have constraints or database-specific column types
55
+ # config.active_record.schema_format = :sql
56
+
57
+ # Enforce whitelist mode for mass assignment.
58
+ # This will create an empty whitelist of attributes available for mass-assignment for all models
59
+ # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
60
+ # parameters by using an attr_accessible or attr_protected declaration.
61
+ config.active_record.whitelist_attributes = true
62
+
63
+ end
64
+ end
@@ -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.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,17 @@
1
+ development:
2
+ adapter: sqlite3
3
+ database: db/test.sqlite3
4
+ pool: 5
5
+ timeout: 5000
6
+
7
+ test:
8
+ adapter: sqlite3
9
+ database: db/test.sqlite3
10
+ pool: 5
11
+ timeout: 5000
12
+
13
+ production:
14
+ adapter: sqlite3
15
+ database: db/test.sqlite3
16
+ pool: 5
17
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
@@ -0,0 +1,32 @@
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 web server 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
+ # Raise exception on mass assignment protection for Active Record models
26
+ config.active_record.mass_assignment_sanitizer = :strict
27
+
28
+ # Log the query plan for queries taking more than this (works
29
+ # with SQLite, MySQL, and PostgreSQL)
30
+ config.active_record.auto_explain_threshold_in_seconds = 0.5
31
+
32
+ end
@@ -0,0 +1,54 @@
1
+ Dummy::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
+ # Disable Rails's static asset server (Apache or nginx will already do this)
12
+ config.serve_static_assets = false
13
+
14
+
15
+ # Specifies the header that your server uses for sending files
16
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
17
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
18
+
19
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
20
+ # config.force_ssl = true
21
+
22
+ # See everything in the log (default is :info)
23
+ # config.log_level = :debug
24
+
25
+ # Prepend all log lines with the following tags
26
+ # config.log_tags = [ :subdomain, :uuid ]
27
+
28
+ # Use a different logger for distributed setups
29
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
30
+
31
+ # Use a different cache store in production
32
+ # config.cache_store = :mem_cache_store
33
+
34
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
35
+ # config.action_controller.asset_host = "http://assets.example.com"
36
+
37
+
38
+ # Disable delivery errors, bad email addresses will be ignored
39
+ # config.action_mailer.raise_delivery_errors = false
40
+
41
+ # Enable threaded mode
42
+ # config.threadsafe!
43
+
44
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
45
+ # the I18n.default_locale when a translation can not be found)
46
+ config.i18n.fallbacks = true
47
+
48
+ # Send deprecation notices to registered listeners
49
+ config.active_support.deprecation = :notify
50
+
51
+ # Log the query plan for queries taking more than this (works
52
+ # with SQLite, MySQL, and PostgreSQL)
53
+ # config.active_record.auto_explain_threshold_in_seconds = 0.5
54
+ end
@@ -0,0 +1,37 @@
1
+ Dummy::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
+ # Configure static asset server for tests with Cache-Control for performance
11
+ config.serve_static_assets = true
12
+ config.static_cache_control = "public, max-age=3600"
13
+
14
+ # Log error messages when you accidentally call methods on nil
15
+ config.whiny_nils = true
16
+
17
+ # Show full error reports and disable caching
18
+ config.consider_all_requests_local = true
19
+ config.action_controller.perform_caching = false
20
+
21
+ # Raise exceptions instead of rendering exception templates
22
+ config.action_dispatch.show_exceptions = false
23
+
24
+ # Disable request forgery protection in test environment
25
+ config.action_controller.allow_forgery_protection = false
26
+
27
+ # Tell Action Mailer not to deliver emails to the real world.
28
+ # The :test delivery method accumulates sent emails in the
29
+ # ActionMailer::Base.deliveries array.
30
+ config.action_mailer.delivery_method = :test
31
+
32
+ # Raise exception on mass assignment protection for Active Record models
33
+ config.active_record.mass_assignment_sanitizer = :strict
34
+
35
+ # Print deprecation notices to the stderr
36
+ config.active_support.deprecation = :stderr
37
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,15 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
11
+ #
12
+ # These inflection rules are supported but not enabled by default:
13
+ # ActiveSupport::Inflector.inflections do |inflect|
14
+ # inflect.acronym 'RESTful'
15
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Dummy::Application.config.secret_token = 'f7460f57e987f1f94f791e35932a7420129562621e77489b917d904f77a5b2ab0546fa249ea105345c3aaaad9cbf72b8b3a322f382c6268907cc247a4b65a9e8'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store
@@ -0,0 +1,3 @@
1
+ Vodka::Server.configure do |c|
2
+ c.secret = 'whatever'
3
+ end
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
@@ -0,0 +1,2 @@
1
+ en:
2
+ hello: 'Hello World!'
@@ -0,0 +1,2 @@
1
+ ru:
2
+ hello: 'Привет, мир!'
@@ -0,0 +1,7 @@
1
+ Dummy::Application.routes.draw do
2
+ namespace :vodka do
3
+ resources :articles do
4
+ collection{ get :hello }
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ pid: tmp/pids/thin.pid
2
+ log: log/thin.log
3
+ timeout: 30
4
+ max_conns: 1024
5
+ port: 3000
6
+ max_persistent_conns: 512
7
+ environment: test
8
+ servers: 1
9
+ address: 0.0.0.0
10
+ daemonize: true
@@ -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,9 @@
1
+ class CreateArticles < ActiveRecord::Migration
2
+ def change
3
+ create_table :articles do |t|
4
+ t.string :title
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end