spree_flat_in_range 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. data/LICENSE +26 -0
  2. data/README.md +39 -0
  3. data/app/models/spree/calculator/flat_in_range.rb +21 -0
  4. data/config/locales/en.yml +5 -0
  5. data/lib/spree_flat_in_range.rb +21 -0
  6. data/spec/dummy/Rakefile +7 -0
  7. data/spec/dummy/app/assets/javascripts/admin/all.js +10 -0
  8. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  9. data/spec/dummy/app/assets/javascripts/store/all.js +10 -0
  10. data/spec/dummy/app/assets/stylesheets/admin/all.css +11 -0
  11. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  12. data/spec/dummy/app/assets/stylesheets/store/all.css +11 -0
  13. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  14. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  15. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  16. data/spec/dummy/config.ru +4 -0
  17. data/spec/dummy/config/application.rb +60 -0
  18. data/spec/dummy/config/boot.rb +6 -0
  19. data/spec/dummy/config/database.yml +18 -0
  20. data/spec/dummy/config/environment.rb +7 -0
  21. data/spec/dummy/config/environments/development.rb +30 -0
  22. data/spec/dummy/config/environments/production.rb +60 -0
  23. data/spec/dummy/config/environments/test.rb +39 -0
  24. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  25. data/spec/dummy/config/initializers/inflections.rb +10 -0
  26. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  27. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  28. data/spec/dummy/config/initializers/session_store.rb +8 -0
  29. data/spec/dummy/config/initializers/spree.rb +12 -0
  30. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  31. data/spec/dummy/config/locales/en.yml +5 -0
  32. data/spec/dummy/config/routes.rb +3 -0
  33. data/spec/dummy/config/spree.yml +2 -0
  34. data/spec/dummy/db/dummy_test +0 -0
  35. data/spec/dummy/db/migrate/20120218160357_spree_zero_nine_zero.rb +389 -0
  36. data/spec/dummy/db/migrate/20120218160358_create_indexes_for_inventory_units.rb +6 -0
  37. data/spec/dummy/db/migrate/20120218160359_add_count_on_hand_to_variants_and_products.rb +49 -0
  38. data/spec/dummy/db/migrate/20120218160360_change_taxons_to_nested_set.rb +46 -0
  39. data/spec/dummy/db/migrate/20120218160361_move_to_configurable_gateways.rb +54 -0
  40. data/spec/dummy/db/migrate/20120218160362_product_groups_and_scopes.rb +18 -0
  41. data/spec/dummy/db/migrate/20120218160363_add_open_id_authentication_tables.rb +15 -0
  42. data/spec/dummy/db/migrate/20120218160364_add_openid_field_to_users.rb +24 -0
  43. data/spec/dummy/db/migrate/20120218160365_change_preference_value_type.rb +10 -0
  44. data/spec/dummy/db/migrate/20120218160366_create_billing_integrations.rb +12 -0
  45. data/spec/dummy/db/migrate/20120218160367_charge_refactoring.rb +39 -0
  46. data/spec/dummy/db/migrate/20120218160368_add_some_indexes.rb +11 -0
  47. data/spec/dummy/db/migrate/20120218160369_checkout_state_machine.rb +5 -0
  48. data/spec/dummy/db/migrate/20120218160370_state_for_shipments.rb +5 -0
  49. data/spec/dummy/db/migrate/20120218160371_make_state_events_polymorphic.rb +12 -0
  50. data/spec/dummy/db/migrate/20120218160372_ship_address_id_for_checkouts.rb +5 -0
  51. data/spec/dummy/db/migrate/20120218160373_shipping_method_id_for_checkouts.rb +5 -0
  52. data/spec/dummy/db/migrate/20120218160374_creditcard_last_four_digits.rb +14 -0
  53. data/spec/dummy/db/migrate/20120218160375_populate_legacy_shipment_state.rb +15 -0
  54. data/spec/dummy/db/migrate/20120218160376_add_cost_price.rb +5 -0
  55. data/spec/dummy/db/migrate/20120218160377_shipment_id_for_inventory_units.rb +25 -0
  56. data/spec/dummy/db/migrate/20120218160378_cim_fields_for_creditcards.rb +6 -0
  57. data/spec/dummy/db/migrate/20120218160379_create_return_authorizations.rb +12 -0
  58. data/spec/dummy/db/migrate/20120218160380_add_return_authorization_to_inventory_units.rb +5 -0
  59. data/spec/dummy/db/migrate/20120218160381_create_trackers.rb +10 -0
  60. data/spec/dummy/db/migrate/20120218160382_creditcard_id_for_creditcard_txns.rb +5 -0
  61. data/spec/dummy/db/migrate/20120218160383_original_creditcard_txn_id_for_creditcard_txns.rb +5 -0
  62. data/spec/dummy/db/migrate/20120218160384_add_test_mode_to_billing_integration.rb +6 -0
  63. data/spec/dummy/db/migrate/20120218160385_create_products_product_groups.rb +8 -0
  64. data/spec/dummy/db/migrate/20120218160386_create_payment_methods.rb +16 -0
  65. data/spec/dummy/db/migrate/20120218160387_polymorphic_payments.rb +42 -0
  66. data/spec/dummy/db/migrate/20120218160388_change_payments_payment_method_to_belongs_to.rb +11 -0
  67. data/spec/dummy/db/migrate/20120218160389_assign_creditcard_txns_to_payment.rb +23 -0
  68. data/spec/dummy/db/migrate/20120218160390_sti_for_transactions.rb +15 -0
  69. data/spec/dummy/db/migrate/20120218160391_drop_billing_integrations.rb +16 -0
  70. data/spec/dummy/db/migrate/20120218160392_deleted_at_for_payment_methods.rb +14 -0
  71. data/spec/dummy/db/migrate/20120218160393_add_adjustments_index.rb +6 -0
  72. data/spec/dummy/db/migrate/20120218160394_fix_by_popularity.rb +9 -0
  73. data/spec/dummy/db/migrate/20120218160395_add_alt_text_to_images.rb +5 -0
  74. data/spec/dummy/db/migrate/20120218160396_fix_existing_coupon_credits.rb +13 -0
  75. data/spec/dummy/db/migrate/20120218160397_add_display_to_payment_methods.rb +5 -0
  76. data/spec/dummy/db/migrate/20120218160398_add_addresses_checkouts_indexes.rb +8 -0
  77. data/spec/dummy/db/migrate/20120218160399_add_icon_to_taxons.rb +17 -0
  78. data/spec/dummy/db/migrate/20120218160400_add_description_to_taxons.rb +11 -0
  79. data/spec/dummy/db/migrate/20120218160401_index_for_shipments_number.rb +5 -0
  80. data/spec/dummy/db/migrate/20120218160402_add_index_on_users_persistence_token.rb +5 -0
  81. data/spec/dummy/db/migrate/20120218160403_add_default_to_tax_categories.rb +5 -0
  82. data/spec/dummy/db/migrate/20120218160404_add_display_to_shipping_methods.rb +5 -0
  83. data/spec/dummy/db/migrate/20120218160405_rename_payment_method_display.rb +5 -0
  84. data/spec/dummy/db/migrate/20120218160406_rename_preferences_field.rb +5 -0
  85. data/spec/dummy/db/migrate/20120218160407_add_guest_flag.rb +5 -0
  86. data/spec/dummy/db/migrate/20120218160408_drop_order_token.rb +9 -0
  87. data/spec/dummy/db/migrate/20120218160409_payments_state_and_assigned_to_order_only.rb +14 -0
  88. data/spec/dummy/db/migrate/20120218160410_create_address_keys_for_order.rb +6 -0
  89. data/spec/dummy/db/migrate/20120218160411_payment_total_for_orders.rb +5 -0
  90. data/spec/dummy/db/migrate/20120218160412_shipping_method_id_for_orders.rb +5 -0
  91. data/spec/dummy/db/migrate/20120218160413_add_shipment_and_payment_state.rb +6 -0
  92. data/spec/dummy/db/migrate/20120218160414_refactor_adjustments.rb +29 -0
  93. data/spec/dummy/db/migrate/20120218160415_response_code_and_avs_response_for_payments.rb +6 -0
  94. data/spec/dummy/db/migrate/20120218160416_change_guest_flag_to_anonymous.rb +5 -0
  95. data/spec/dummy/db/migrate/20120218160417_email_for_orders.rb +5 -0
  96. data/spec/dummy/db/migrate/20120218160418_create_mail_methods.rb +10 -0
  97. data/spec/dummy/db/migrate/20120218160419_rename_frozen_to_locked.rb +5 -0
  98. data/spec/dummy/db/migrate/20120218160420_move_special_instructions_to_orders.rb +10 -0
  99. data/spec/dummy/db/migrate/20120218160421_create_log_entries.rb +11 -0
  100. data/spec/dummy/db/migrate/20120218160422_migrate_transactions_to_payment_state.rb +98 -0
  101. data/spec/dummy/db/migrate/20120218160423_delete_in_progress_orders.rb +19 -0
  102. data/spec/dummy/db/migrate/20120218160424_migrate_checkout_to_orders.rb +23 -0
  103. data/spec/dummy/db/migrate/20120218160425_remove_shipped_state.rb +12 -0
  104. data/spec/dummy/db/migrate/20120218160426_prevent_nil_payment_total.rb +8 -0
  105. data/spec/dummy/db/migrate/20120218160427_prevent_nil_email.rb +9 -0
  106. data/spec/dummy/db/migrate/20120218160428_generate_anonymous_users.rb +20 -0
  107. data/spec/dummy/db/migrate/20120218160429_update_order_state.rb +12 -0
  108. data/spec/dummy/db/migrate/20120218160430_cleanup_legacy_tables.rb +11 -0
  109. data/spec/dummy/db/migrate/20120218160431_remove_number_and_cvv_from_credicard.rb +11 -0
  110. data/spec/dummy/db/migrate/20120218160432_drop_anonymous_field_for_user.rb +9 -0
  111. data/spec/dummy/db/migrate/20120218160433_renamed_rma_cancelled_state.rb +9 -0
  112. data/spec/dummy/db/migrate/20120218160434_fix_problematic_index_names.rb +13 -0
  113. data/spec/dummy/db/migrate/20120218160435_add_position_to_variants.rb +5 -0
  114. data/spec/dummy/db/migrate/20120218160436_add_next_state_to_state_events.rb +5 -0
  115. data/spec/dummy/db/migrate/20120218160437_add_position_to_option_types.rb +5 -0
  116. data/spec/dummy/db/migrate/20120218160438_remove_trailing_slashes_in_taxon_permalinks.rb +19 -0
  117. data/spec/dummy/db/migrate/20120218160439_create_activators.rb +14 -0
  118. data/spec/dummy/db/migrate/20120218160440_eligible_for_adjustments.rb +5 -0
  119. data/spec/dummy/db/migrate/20120218160441_namespace_top_level_models.rb +52 -0
  120. data/spec/dummy/db/migrate/20120218160442_migrate_namespaced_polymorphic_models.rb +52 -0
  121. data/spec/dummy/db/migrate/20120218160443_make_adjustments_polymorphic.rb +9 -0
  122. data/spec/dummy/db/migrate/20120218160444_add_company_to_addresses.rb +5 -0
  123. data/spec/dummy/db/migrate/20120218160445_add_inc_tax_to_tax_rates.rb +5 -0
  124. data/spec/dummy/db/migrate/20120218160446_rename_inc_price_attribute.rb +5 -0
  125. data/spec/dummy/db/migrate/20120218160447_add_default_tax_zone.rb +5 -0
  126. data/spec/dummy/db/migrate/20120218160448_associate_shipping_methods_and_shipping_categories.rb +7 -0
  127. data/spec/dummy/db/migrate/20120218160449_add_match_rules_to_shipping_methods.rb +7 -0
  128. data/spec/dummy/db/migrate/20120218160450_new_preferences.rb +48 -0
  129. data/spec/dummy/db/migrate/20120218160451_add_deleted_at_to_tax_category.rb +5 -0
  130. data/spec/dummy/db/schema.rb +553 -0
  131. data/spec/dummy/db/seeds.rb +11 -0
  132. data/spec/dummy/log/test.log +1136 -0
  133. data/spec/dummy/public/404.html +26 -0
  134. data/spec/dummy/public/422.html +26 -0
  135. data/spec/dummy/public/500.html +26 -0
  136. data/spec/dummy/public/favicon.ico +0 -0
  137. data/spec/dummy/script/rails +6 -0
  138. data/spec/dummy/spec/dummy/script/rails +6 -0
  139. data/spec/flat_in_range_spec.rb +56 -0
  140. data/spec/spec_helper.rb +32 -0
  141. metadata +428 -0
data/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2012 [name of plugin creator]
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+ * Neither the name Spree nor the names of its contributors may be used to
13
+ endorse or promote products derived from this software without specific
14
+ prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,39 @@
1
+ SpreeFlatInRange
2
+ ================
3
+
4
+ A [Spree calculator](http://guides.spreecommerce.com/adjustments.html)
5
+ to calculate fixed adjustments based on ranges.
6
+
7
+ For example, **free shipping above $100, and $4.39 for all orders under $100**, would mean a range *from 0 to
8
+ $99.99*, that *has a fixed shipping rate of $4.39*.
9
+
10
+
11
+ Usage
12
+ =====
13
+
14
+ Add to your gemfile in a Spree application:
15
+
16
+ `` gem 'spree_flat_in_range', '~> 0.1.x' ``
17
+
18
+ Then visit shipping or tax to use the calculation.
19
+
20
+
21
+ TODO
22
+ =======
23
+
24
+ * Introduce Percent based on range; to allow things like **$10 to $30 gives you 10% discount, above $30
25
+ gives you 15%**.
26
+ * Introduce "infinate" as possible upper boundry; so admins can provide
27
+ cases like **above $100** easier; now they have to simple give a really
28
+ large number.
29
+
30
+ Testing
31
+ -------
32
+
33
+ Be sure to bundle your dependencies and then create a dummy test app for the specs to run against.
34
+
35
+ $ bundle
36
+ $ bundle exec rake test app
37
+ $ bundle exec rspec spec
38
+
39
+ Copyright (c) 2012 [Bèr Kessels], released under the New BSD License
@@ -0,0 +1,21 @@
1
+ module Spree
2
+ class Calculator::FlatInRange < Calculator
3
+ preference :lower_boundry, :decimal, :default => 0.0
4
+ preference :upper_boundry, :decimal, :default => 50.0
5
+ preference :amount, :decimal, :default => 5.0
6
+
7
+ def self.description
8
+ I18n.t(:flat_in_range)
9
+ end
10
+
11
+ def compute(object)
12
+ sum = 0
13
+ item_total = object.line_items.map(&:amount).sum
14
+ if (item_total >= self.preferred_lower_boundry && item_total <= self.preferred_upper_boundry)
15
+ return self.preferred_amount
16
+ else
17
+ return 0.0
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ flat_in_range: "Flat in a range"
@@ -0,0 +1,21 @@
1
+ # require 'spree_core'
2
+
3
+ module SpreeFlatInRange
4
+ class Engine < Rails::Engine
5
+ engine_name 'spree_flat_in_range'
6
+
7
+ # use rspec for tests
8
+ config.generators do |g|
9
+ g.test_framework :rspec
10
+ end
11
+
12
+ def self.activate
13
+ end
14
+
15
+ config.to_prepare &method(:activate).to_proc
16
+
17
+ initializer "spree.register.calculators" do |app|
18
+ app.config.spree.calculators.shipping_methods << Spree::Calculator::FlatInRange
19
+ end
20
+ end
21
+ end
@@ -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,10 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+
8
+ //= require admin/spree_flat_in_range
9
+
10
+ //= require_tree .
@@ -0,0 +1,9 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+ //= require jquery
8
+ //= require jquery_ujs
9
+ //= require_tree .
@@ -0,0 +1,10 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+
8
+ //= require store/spree_flat_in_range
9
+
10
+ //= require_tree .
@@ -0,0 +1,11 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *
6
+
7
+ *= require admin/spree_flat_in_range
8
+
9
+ *= require_self
10
+ *= require_tree .
11
+ */
@@ -0,0 +1,7 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *= require_self
6
+ *= require_tree .
7
+ */
@@ -0,0 +1,11 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *
6
+
7
+ *= require store/spree_flat_in_range
8
+
9
+ *= require_self
10
+ *= require_tree .
11
+ */
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </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,60 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require(*Rails.groups)
6
+
7
+ require 'spree_flat_in_range'
8
+
9
+ module Dummy
10
+ class Application < Rails::Application
11
+
12
+ config.to_prepare do
13
+ # Load application's model / class decorators
14
+ Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
15
+ Rails.configuration.cache_classes ? require(c) : load(c)
16
+ end
17
+
18
+ # Load application's view overrides
19
+ Dir.glob(File.join(File.dirname(__FILE__), "../app/overrides/*.rb")) do |c|
20
+ Rails.configuration.cache_classes ? require(c) : load(c)
21
+ end
22
+ end
23
+
24
+ # Settings in config/environments/* take precedence over those specified here.
25
+ # Application configuration should go into files in config/initializers
26
+ # -- all .rb files in that directory are automatically loaded.
27
+
28
+ # Custom directories with classes and modules you want to be autoloadable.
29
+ # config.autoload_paths += %W(#{config.root}/extras)
30
+
31
+ # Only load the plugins named here, in the order given (default is alphabetical).
32
+ # :all can be used as a placeholder for all plugins not explicitly named.
33
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
34
+
35
+ # Activate observers that should always be running.
36
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
37
+
38
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
39
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
40
+ # config.time_zone = 'Central Time (US & Canada)'
41
+
42
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
43
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
44
+ # config.i18n.default_locale = :de
45
+
46
+ # Configure the default encoding used in templates for Ruby 1.9.
47
+ config.encoding = "utf-8"
48
+
49
+ # Configure sensitive parameters which will be filtered from the log file.
50
+ config.filter_parameters += [:password]
51
+
52
+ # Enable the asset pipeline
53
+ config.assets.enabled = true
54
+
55
+ # Version of your assets, change this if you want to expire all your assets
56
+ config.assets.version = '1.0'
57
+ end
58
+ end
59
+
60
+
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+ gemfile = File.expand_path("../../../../Gemfile", __FILE__)
3
+
4
+ ENV['BUNDLE_GEMFILE'] = gemfile
5
+ require 'bundler'
6
+ Bundler.setup
@@ -0,0 +1,18 @@
1
+ login: &login
2
+
3
+ adapter: sqlite3
4
+ pool: 5
5
+ timeout: 5000
6
+
7
+
8
+ development:
9
+ <<: *login
10
+ database: db/dummy_dev
11
+
12
+ test:
13
+ <<: *login
14
+ database: db/dummy_test
15
+
16
+ production:
17
+ <<: *login
18
+ database: db/dummy_prod
@@ -0,0 +1,7 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
6
+
7
+ ActiveRecord::Base.include_root_in_json = true
@@ -0,0 +1,30 @@
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
+ # Do not compress assets
26
+ config.assets.compress = false
27
+
28
+ # Expands the lines which load the assets
29
+ config.assets.debug = true
30
+ end
@@ -0,0 +1,60 @@
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
+ # Compress JavaScripts and CSS
15
+ config.assets.compress = true
16
+
17
+ # Don't fallback to assets pipeline if a precompiled asset is missed
18
+ config.assets.compile = false
19
+
20
+ # Generate digests for assets URLs
21
+ config.assets.digest = true
22
+
23
+ # Defaults to Rails.root.join("public/assets")
24
+ # config.assets.manifest = YOUR_PATH
25
+
26
+ # Specifies the header that your server uses for sending files
27
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29
+
30
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
+ # config.force_ssl = true
32
+
33
+ # See everything in the log (default is :info)
34
+ # config.log_level = :debug
35
+
36
+ # Use a different logger for distributed setups
37
+ # config.logger = SyslogLogger.new
38
+
39
+ # Use a different cache store in production
40
+ # config.cache_store = :mem_cache_store
41
+
42
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
43
+ # config.action_controller.asset_host = "http://assets.example.com"
44
+
45
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
46
+ # config.assets.precompile += %w( search.js )
47
+
48
+ # Disable delivery errors, bad email addresses will be ignored
49
+ # config.action_mailer.raise_delivery_errors = false
50
+
51
+ # Enable threaded mode
52
+ # config.threadsafe!
53
+
54
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
55
+ # the I18n.default_locale when a translation can not be found)
56
+ config.i18n.fallbacks = true
57
+
58
+ # Send deprecation notices to registered listeners
59
+ config.active_support.deprecation = :notify
60
+ end
@@ -0,0 +1,39 @@
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
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
33
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
34
+ # like if you have constraints or database-specific column types
35
+ # config.active_record.schema_format = :sql
36
+
37
+ # Print deprecation notices to the stderr
38
+ config.active_support.deprecation = :stderr
39
+ end