bit_core 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +4 -0
  4. data/Rakefile +21 -0
  5. data/app/assets/stylesheets/bit_core/application.css +15 -0
  6. data/app/controllers/bit_core/application_controller.rb +4 -0
  7. data/app/models/bit_core/content_module.rb +37 -0
  8. data/app/models/bit_core/content_provider.rb +14 -0
  9. data/app/models/bit_core/slide.rb +36 -0
  10. data/app/models/bit_core/slideshow.rb +16 -0
  11. data/app/models/bit_core/tool.rb +25 -0
  12. data/app/views/layouts/bit_core/application.html.erb +14 -0
  13. data/config/routes.rb +2 -0
  14. data/config/spring.rb +1 -0
  15. data/db/migrate/20140415210052_create_bit_core_tools.rb +28 -0
  16. data/db/migrate/20140415211458_create_bit_core_content_modules.rb +40 -0
  17. data/db/migrate/20140415213346_create_bit_core_content_providers.rb +42 -0
  18. data/db/migrate/20140417173056_create_bit_core_slideshows.rb +9 -0
  19. data/db/migrate/20140417174159_create_bit_core_slides.rb +43 -0
  20. data/lib/bit_core/engine.rb +12 -0
  21. data/lib/bit_core/version.rb +4 -0
  22. data/lib/bit_core.rb +5 -0
  23. data/lib/tasks/bit_core_tasks.rake +4 -0
  24. data/spec/dummy/README.rdoc +28 -0
  25. data/spec/dummy/Rakefile +7 -0
  26. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  27. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  28. data/spec/dummy/app/controllers/application_controller.rb +6 -0
  29. data/spec/dummy/app/views/layouts/application.html.erb +13 -0
  30. data/spec/dummy/bin/bundle +3 -0
  31. data/spec/dummy/bin/rails +8 -0
  32. data/spec/dummy/bin/rake +8 -0
  33. data/spec/dummy/bin/spring +18 -0
  34. data/spec/dummy/config/application.rb +29 -0
  35. data/spec/dummy/config/boot.rb +5 -0
  36. data/spec/dummy/config/database.yml +85 -0
  37. data/spec/dummy/config/environment.rb +5 -0
  38. data/spec/dummy/config/environments/development.rb +37 -0
  39. data/spec/dummy/config/environments/production.rb +83 -0
  40. data/spec/dummy/config/environments/test.rb +39 -0
  41. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  42. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  43. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  44. data/spec/dummy/config/initializers/inflections.rb +16 -0
  45. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  46. data/spec/dummy/config/initializers/session_store.rb +3 -0
  47. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  48. data/spec/dummy/config/locales/en.yml +23 -0
  49. data/spec/dummy/config/routes.rb +56 -0
  50. data/spec/dummy/config/secrets.yml +22 -0
  51. data/spec/dummy/config.ru +4 -0
  52. data/spec/dummy/db/schema.rb +69 -0
  53. data/spec/dummy/log/development.log +575 -0
  54. data/spec/dummy/log/test.log +1176 -0
  55. data/spec/dummy/public/404.html +67 -0
  56. data/spec/dummy/public/422.html +67 -0
  57. data/spec/dummy/public/500.html +66 -0
  58. data/spec/dummy/public/favicon.ico +0 -0
  59. data/spec/fixtures/bit_core/content_modules.yml +9 -0
  60. data/spec/fixtures/bit_core/content_providers.yml +9 -0
  61. data/spec/fixtures/bit_core/slides.yml +17 -0
  62. data/spec/fixtures/bit_core/slideshows.yml +2 -0
  63. data/spec/fixtures/bit_core/tools.yml +2 -0
  64. data/spec/models/bit_core/slide_spec.rb +38 -0
  65. data/spec/spec_helper.rb +17 -0
  66. metadata +220 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 46eb715d2ebf8df84b3bc19c1ef113babf53121d
4
+ data.tar.gz: c5a4d7697a0154726c0bbcf72f5c3a8b01298678
5
+ SHA512:
6
+ metadata.gz: 89d19c7babf025ead3e89f0bfecf6e7e671c6e4f9fbf65e9967ae058fc54df1f6a6013ca350b0aeb447d8b62cd7c6f086c77011792baa840b8c860540bc76f2a
7
+ data.tar.gz: 70096b801ceb598d0a9044d015f6b298216cb09f1c74ed3b7b067c334a5aa5fbaff00e7a0e1dde36ab7c346f2a99146cda372fc95769a37b96cfc8809943bb86
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2014 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ Run specs
2
+
3
+ bin/rake app:db:drop app:db:create app:db:migrate RAILS_ENV=test
4
+ bin/rspec
data/Rakefile ADDED
@@ -0,0 +1,21 @@
1
+ begin
2
+ require "bundler/setup"
3
+ rescue LoadError
4
+ puts "You must `gem install bundler` and `bundle install` to run rake tasks"
5
+ end
6
+
7
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
8
+
9
+ load "rails/tasks/engine.rake"
10
+
11
+ Bundler::GemHelper.install_tasks
12
+
13
+ Dir[File.join(File.dirname(__FILE__), "tasks/**/*.rake")].each {|f| load f }
14
+
15
+ require "rspec/core"
16
+ require "rspec/core/rake_task"
17
+
18
+ desc "Run all specs in spec directory (excluding plugin specs)"
19
+ RSpec::Core::RakeTask.new(:spec => "app:db:test:prepare")
20
+
21
+ task :default => :spec
@@ -0,0 +1,15 @@
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 bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,4 @@
1
+ module BitCore
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,37 @@
1
+ module BitCore
2
+ # A logical unit of content, possibly containing mixed provider types.
3
+ class ContentModule < ActiveRecord::Base
4
+ belongs_to :tool,
5
+ class_name: "BitCore::Tool",
6
+ foreign_key: :bit_core_tool_id
7
+ has_many :content_providers,
8
+ class_name: "BitCore::ContentProvider",
9
+ foreign_key: :bit_core_content_module_id,
10
+ inverse_of: :content_module,
11
+ dependent: :destroy
12
+
13
+ validates :title, :tool, :position, presence: true
14
+ validates :position,
15
+ numericality: { greater_than_or_equal_to: 1 },
16
+ uniqueness: { scope: :bit_core_tool_id }
17
+
18
+ def provider(position)
19
+ content_providers.where(position: position).first ||
20
+ ContentProviders::Null.new(self, position)
21
+ end
22
+
23
+ def provider_exists?(position)
24
+ content_providers.exists?(position: position)
25
+ end
26
+
27
+ def add_content_provider(type)
28
+ content_providers.create(type: type, position: last_position + 1)
29
+ end
30
+
31
+ private
32
+
33
+ def last_position
34
+ content_providers.order(:position).last.try(:position) || 0
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,14 @@
1
+ module BitCore
2
+ # Modeled after the presenter pattern. Ties data layer to view layer.
3
+ class ContentProvider < ActiveRecord::Base
4
+ belongs_to :content_module,
5
+ class_name: "BitCore::ContentModule",
6
+ foreign_key: :bit_core_content_module_id,
7
+ inverse_of: :content_providers
8
+
9
+ validates :type, :bit_core_content_module_id, :position, presence: true
10
+ validates :position,
11
+ numericality: { greater_than_or_equal_to: 1 },
12
+ uniqueness: { scope: :bit_core_content_module_id }
13
+ end
14
+ end
@@ -0,0 +1,36 @@
1
+ require "redcarpet"
2
+
3
+ module BitCore
4
+ # A page of "static" or presentational content (as opposed to data capture).
5
+ class Slide < ActiveRecord::Base
6
+ belongs_to :slideshow,
7
+ class_name: "BitCore::Slideshow",
8
+ foreign_key: :bit_core_slideshow_id,
9
+ inverse_of: :slides
10
+
11
+ validates :title, :body, :position, presence: true
12
+ validates :position, numericality: { greater_than_or_equal_to: 1 }
13
+ validates :position, uniqueness: { scope: :bit_core_slideshow_id }
14
+
15
+ def self.update_positions(ids)
16
+ transaction do
17
+ connection.execute "SET CONSTRAINTS bit_core_slide_position DEFERRED"
18
+ ids.each_with_index do |id, index|
19
+ where(id: id).update_all(position: index + 1)
20
+ end
21
+ end
22
+ end
23
+
24
+ def render_body
25
+ return "" if body.nil?
26
+
27
+ Redcarpet::Markdown.new(
28
+ Redcarpet::Render::HTML.new(
29
+ filter_html: true,
30
+ safe_links_only: true
31
+ ),
32
+ space_after_headers: true
33
+ ).render(body).html_safe
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,16 @@
1
+ module BitCore
2
+ # A collection of ordered Slides.
3
+ class Slideshow < ActiveRecord::Base
4
+ has_many :slides,
5
+ -> { order "position" },
6
+ class_name: "BitCore::Slide",
7
+ foreign_key: :bit_core_slideshow_id,
8
+ dependent: :destroy,
9
+ inverse_of: :slideshow
10
+ has_one :content_provider, as: :source_content, inverse_of: :source_content
11
+
12
+ validates :title, presence: true
13
+
14
+ accepts_nested_attributes_for :slides
15
+ end
16
+ end
@@ -0,0 +1,25 @@
1
+ module BitCore
2
+ # A section of an application.
3
+ class Tool < ActiveRecord::Base
4
+ has_many :content_modules,
5
+ class_name: "BitCore::ContentModule",
6
+ foreign_key: :bit_core_tool_id,
7
+ inverse_of: :tool,
8
+ dependent: :destroy
9
+
10
+ validates :title, :position, presence: true
11
+ validates :position,
12
+ uniqueness: true,
13
+ numericality: { greater_than_or_equal_to: 0 }
14
+
15
+ def add_module(title)
16
+ content_modules.create(title: title, position: last_position + 1)
17
+ end
18
+
19
+ private
20
+
21
+ def last_position
22
+ content_modules.order(:position).last.try(:position) || 0
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>BitCore</title>
5
+ <%= stylesheet_link_tag "bit_core/application", media: "all" %>
6
+ <%= javascript_include_tag "bit_core/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ BitCore::Engine.routes.draw do
2
+ end
data/config/spring.rb ADDED
@@ -0,0 +1 @@
1
+ Spring.application_root = File.expand_path("../../spec/dummy", __FILE__)
@@ -0,0 +1,28 @@
1
+ class CreateBitCoreTools < ActiveRecord::Migration
2
+ def change
3
+ create_table :bit_core_tools do |t|
4
+ t.string :title, null: false, unique: true
5
+ t.integer :position, null: false, default: 0
6
+
7
+ t.timestamps
8
+ end
9
+
10
+ reversible do |dir|
11
+ dir.up do
12
+ # make deferrable so that positions can be updated
13
+ execute <<-SQL
14
+ ALTER TABLE bit_core_tools
15
+ ADD CONSTRAINT bit_core_tool_position UNIQUE (position)
16
+ DEFERRABLE INITIALLY IMMEDIATE
17
+ SQL
18
+ end
19
+
20
+ dir.down do
21
+ execute <<-SQL
22
+ ALTER TABLE bit_core_tools
23
+ DROP CONSTRAINT IF EXISTS bit_core_tool_position
24
+ SQL
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,40 @@
1
+ class CreateBitCoreContentModules < ActiveRecord::Migration
2
+ def change
3
+ create_table :bit_core_content_modules do |t|
4
+ t.string :title, null: false
5
+ t.integer :position, null: false, default: 1
6
+ t.integer :bit_core_tool_id, null: false
7
+
8
+ t.timestamps
9
+ end
10
+
11
+ reversible do |dir|
12
+ dir.up do
13
+ execute <<-SQL
14
+ ALTER TABLE bit_core_content_modules
15
+ ADD CONSTRAINT bit_core_content_module_position UNIQUE (bit_core_tool_id, position)
16
+ DEFERRABLE INITIALLY IMMEDIATE
17
+ SQL
18
+
19
+ execute <<-SQL
20
+ ALTER TABLE bit_core_content_modules
21
+ ADD CONSTRAINT fk_content_modules_tools
22
+ FOREIGN KEY (bit_core_tool_id)
23
+ REFERENCES bit_core_tools(id)
24
+ SQL
25
+ end
26
+
27
+ dir.down do
28
+ execute <<-SQL
29
+ ALTER TABLE bit_core_content_modules
30
+ DROP CONSTRAINT fk_content_modules_tools
31
+ SQL
32
+
33
+ execute <<-SQL
34
+ ALTER TABLE bit_core_content_modules
35
+ DROP CONSTRAINT IF EXISTS bit_core_content_module_position
36
+ SQL
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,42 @@
1
+ class CreateBitCoreContentProviders < ActiveRecord::Migration
2
+ def change
3
+ create_table :bit_core_content_providers do |t|
4
+ t.string :type, null: false
5
+ t.string :source_content_type
6
+ t.integer :source_content_id
7
+ t.integer :bit_core_content_module_id, null: false
8
+ t.integer :position, null: false, default: 1
9
+
10
+ t.timestamps
11
+ end
12
+
13
+ reversible do |dir|
14
+ dir.up do
15
+ execute <<-SQL
16
+ ALTER TABLE bit_core_content_providers
17
+ ADD CONSTRAINT bit_core_content_provider_position UNIQUE (bit_core_content_module_id, position)
18
+ DEFERRABLE INITIALLY IMMEDIATE
19
+ SQL
20
+
21
+ execute <<-SQL
22
+ ALTER TABLE bit_core_content_providers
23
+ ADD CONSTRAINT fk_content_providers_modules
24
+ FOREIGN KEY (bit_core_content_module_id)
25
+ REFERENCES bit_core_content_modules(id)
26
+ SQL
27
+ end
28
+
29
+ dir.down do
30
+ execute <<-SQL
31
+ ALTER TABLE bit_core_content_providers
32
+ DROP CONSTRAINT fk_content_providers_modules
33
+ SQL
34
+
35
+ execute <<-SQL
36
+ ALTER TABLE bit_core_content_providers
37
+ DROP CONSTRAINT IF EXISTS bit_core_content_provider_position
38
+ SQL
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,9 @@
1
+ class CreateBitCoreSlideshows < ActiveRecord::Migration
2
+ def change
3
+ create_table :bit_core_slideshows do |t|
4
+ t.string :title, null: false
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,43 @@
1
+ class CreateBitCoreSlides < ActiveRecord::Migration
2
+ def change
3
+ create_table :bit_core_slides do |t|
4
+ t.string :title, null: false
5
+ t.text :body, null: false
6
+ t.integer :position, null: false, default: 1
7
+ t.integer :bit_core_slideshow_id, null: false
8
+ t.string :type
9
+ t.boolean :is_title_visible, null: false, default: true
10
+
11
+ t.timestamps
12
+ end
13
+
14
+ reversible do |dir|
15
+ dir.up do
16
+ execute <<-SQL
17
+ ALTER TABLE bit_core_slides
18
+ ADD CONSTRAINT bit_core_slide_position UNIQUE (bit_core_slideshow_id, position)
19
+ DEFERRABLE INITIALLY IMMEDIATE
20
+ SQL
21
+
22
+ execute <<-SQL
23
+ ALTER TABLE bit_core_slides
24
+ ADD CONSTRAINT fk_slideshows_slides
25
+ FOREIGN KEY (bit_core_slideshow_id)
26
+ REFERENCES bit_core_slideshows(id)
27
+ SQL
28
+ end
29
+
30
+ dir.down do
31
+ execute <<-SQL
32
+ ALTER TABLE bit_core_slides
33
+ DROP CONSTRAINT fk_slideshows_slides
34
+ SQL
35
+
36
+ execute <<-SQL
37
+ ALTER TABLE bit_core_slides
38
+ DROP CONSTRAINT IF EXISTS bit_core_slide_position
39
+ SQL
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,12 @@
1
+ module BitCore
2
+ # Mountable engine with isolated namespace.
3
+ class Engine < ::Rails::Engine
4
+ isolate_namespace BitCore
5
+
6
+ config.generators do |g|
7
+ g.test_framework :rspec
8
+ g.assets false
9
+ g.helper false
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,4 @@
1
+ # nodoc
2
+ module BitCore
3
+ VERSION = "1.0.0"
4
+ end
data/lib/bit_core.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "bit_core/engine"
2
+
3
+ # nodoc
4
+ module BitCore
5
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :bit_core do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,7 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be
3
+ # available to Rake.
4
+
5
+ require File.expand_path("../config/application", __FILE__)
6
+
7
+ Rails.application.load_tasks
@@ -0,0 +1,13 @@
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
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
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 bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,6 @@
1
+ # Controller superclass.
2
+ class ApplicationController < ActionController::Base
3
+ # Prevent CSRF attacks by raising an exception.
4
+ # For APIs, you may want to use :null_session instead.
5
+ protect_from_forgery with: :exception
6
+ end
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all' %>
6
+ <%= csrf_meta_tags %>
7
+ </head>
8
+ <body>
9
+
10
+ <%= yield %>
11
+
12
+ </body>
13
+ </html>
@@ -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,8 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ load File.expand_path("../spring", __FILE__)
4
+ rescue LoadError
5
+ end
6
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
7
+ require_relative '../config/boot'
8
+ require 'rails/commands'
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ load File.expand_path("../spring", __FILE__)
4
+ rescue LoadError
5
+ end
6
+ require_relative '../config/boot'
7
+ require 'rake'
8
+ Rake.application.run
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This file loads spring without using Bundler, in order to be fast
4
+ # It gets overwritten when you run the `spring binstub` command
5
+
6
+ unless defined?(Spring)
7
+ require "rubygems"
8
+ require "bundler"
9
+
10
+ if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ spring \((.*?)\)$.*?^$/m)
11
+ ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
12
+ ENV["GEM_HOME"] = ""
13
+ Gem.paths = ENV
14
+
15
+ gem "spring", match[1]
16
+ require "spring/binstub"
17
+ end
18
+ end
@@ -0,0 +1,29 @@
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 "action_view/railtie"
8
+ require "sprockets/railtie"
9
+ # require "rails/test_unit/railtie"
10
+
11
+ Bundler.require(*Rails.groups)
12
+ require "bit_core"
13
+
14
+ module Dummy
15
+ class Application < Rails::Application
16
+ # Settings in config/environments/* take precedence over those specified here.
17
+ # Application configuration should go into files in config/initializers
18
+ # -- all .rb files in that directory are automatically loaded.
19
+
20
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
21
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
22
+ # config.time_zone = 'Central Time (US & Canada)'
23
+
24
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
25
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
26
+ # config.i18n.default_locale = :de
27
+ end
28
+ end
29
+
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)