rails-calendar 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/.coveralls.yml +1 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +4 -0
  4. data/.travis.yml +12 -0
  5. data/CHANGELOG.md +4 -0
  6. data/Gemfile +14 -0
  7. data/Guardfile +5 -0
  8. data/MIT-LICENSE +21 -0
  9. data/README.md +72 -0
  10. data/Rakefile +21 -0
  11. data/lib/rails_calendar/configuration.rb +51 -0
  12. data/lib/rails_calendar/helpers.rb +7 -0
  13. data/lib/rails_calendar/simple.rb +95 -0
  14. data/lib/rails_calendar/version.rb +3 -0
  15. data/lib/rails_calendar.rb +28 -0
  16. data/lib/tasks/rails_calendar_tasks.rake +4 -0
  17. data/rails_calendar.gemspec +31 -0
  18. data/spec/dummy/README.rdoc +28 -0
  19. data/spec/dummy/Rakefile +6 -0
  20. data/spec/dummy/app/assets/images/.keep +0 -0
  21. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  22. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  23. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  24. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  25. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  26. data/spec/dummy/app/mailers/.keep +0 -0
  27. data/spec/dummy/app/models/.keep +0 -0
  28. data/spec/dummy/app/models/concerns/.keep +0 -0
  29. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  30. data/spec/dummy/bin/bundle +3 -0
  31. data/spec/dummy/bin/rails +4 -0
  32. data/spec/dummy/bin/rake +4 -0
  33. data/spec/dummy/config/application.rb +29 -0
  34. data/spec/dummy/config/boot.rb +5 -0
  35. data/spec/dummy/config/database.yml +25 -0
  36. data/spec/dummy/config/environment.rb +5 -0
  37. data/spec/dummy/config/environments/development.rb +37 -0
  38. data/spec/dummy/config/environments/production.rb +82 -0
  39. data/spec/dummy/config/environments/test.rb +39 -0
  40. data/spec/dummy/config/initializers/assets.rb +8 -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/lib/assets/.keep +0 -0
  53. data/spec/dummy/log/.keep +0 -0
  54. data/spec/dummy/public/404.html +67 -0
  55. data/spec/dummy/public/422.html +67 -0
  56. data/spec/dummy/public/500.html +66 -0
  57. data/spec/dummy/public/favicon.ico +0 -0
  58. data/spec/rails_calendar/configuration_spec.rb +50 -0
  59. data/spec/rails_calendar/helpers_spec.rb +39 -0
  60. data/spec/rails_calendar/simple_spec.rb +271 -0
  61. data/spec/rails_calendar_spec.rb +23 -0
  62. data/spec/spec_helper.rb +84 -0
  63. data/vendor/assets/stylesheets/rails_calendar/base.css.sass +18 -0
  64. data/vendor/assets/stylesheets/rails_calendar/theme.css.sass +25 -0
  65. data/vendor/assets/stylesheets/rails_calendar.css.sass +3 -0
  66. metadata +290 -0
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ spec/dummy/db/*.sqlite3
5
+ spec/dummy/db/*.sqlite3-journal
6
+ spec/dummy/log/*.log
7
+ spec/dummy/tmp/
8
+ spec/dummy/.sass-cache
9
+ Gemfile.lock
10
+ coverage
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --require rspec/legacy_formatters
3
+ --require spec_helper
4
+ --format doc
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ cache: bundler
3
+
4
+ rvm:
5
+ - 1.9.3
6
+ - 2.0.0
7
+ - 2.1.0
8
+
9
+ script: 'bundle exec rspec'
10
+
11
+ notifications:
12
+ email: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ 0.2.0 (September 1, 2014)
2
+ ------------------------
3
+
4
+ * Helper `rails_calendar`.
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Declare your gem's dependencies in rails_calendar.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+ gemspec
7
+
8
+ # Declare any dependencies that are still in development here instead of in
9
+ # your gemspec. These might include edge Rails or gems from your path or
10
+ # Git. Remember to move these dependencies to your gemspec before releasing
11
+ # your gem to rubygems.org.
12
+
13
+ # To use debugger
14
+ # gem 'debugger'
data/Guardfile ADDED
@@ -0,0 +1,5 @@
1
+ guard :rspec, cmd: 'bundle exec rspec' do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
+ watch('spec/spec_helper.rb') { "spec" }
5
+ end
data/MIT-LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Rodrigo Díaz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # RailsCalendar
2
+
3
+ [![Coverage Status](https://coveralls.io/repos/rdiazv/rails_calendar/badge.png?branch=master)](https://coveralls.io/r/rdiazv/rails_calendar?branch=master)
4
+ [![Build Status](https://travis-ci.org/rdiazv/rails_calendar.svg?branch=master)](https://travis-ci.org/rdiazv/rails_calendar)
5
+
6
+ An easy to use calendar for your rails app.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'rails_calendar'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ ```
19
+ $ bundle
20
+ ```
21
+
22
+ Or install it yourself as:
23
+
24
+ ```
25
+ $ gem install rails_calendar
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ Use the provided helper to render the calendar in your view:
31
+
32
+ ```erb
33
+ <%= rails_calendar %>
34
+ ```
35
+
36
+ By default the calendar will show the current month, but can be easily
37
+ changed passing a Date object to the helper. For example, to render the
38
+ calendar for March 2000:
39
+
40
+ ```erb
41
+ <%= rails_calendar(Date.new(2000, 3)) %>
42
+ ```
43
+
44
+ Additionally, you can specify a block that will be invoked for each day to
45
+ show custom information in any calendar cell:
46
+
47
+ ```erb
48
+ <%
49
+ events = {
50
+ '2014-03-01' => [ 'TODO 1', 'TODO 2' ],
51
+ '2014-03-03' => [ 'TODO 3' ]
52
+ }
53
+ %>
54
+
55
+ <%= rails_calendar(Date.new(2014, 3)) do |date| %>
56
+ <% if events[date.to_s].present? %>
57
+ <ul>
58
+ <% events[date.to_s].each do |event| %>
59
+ <li><%= event %></li>
60
+ <% end %>
61
+ </ul>
62
+ <% end %>
63
+ <% end %>
64
+ ```
65
+
66
+ ## Contributing
67
+
68
+ 1. Fork it ( https://github.com/rdiazv/rails_calendar/fork )
69
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
70
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
71
+ 4. Push to the branch (`git push origin my-new-feature`)
72
+ 5. Create a new Pull Request
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
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'RailsCalendar'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+
19
+
20
+ Bundler::GemHelper.install_tasks
21
+
@@ -0,0 +1,51 @@
1
+ module RailsCalendar
2
+ class Configuration
3
+ attr_accessor :class_prefix
4
+ attr_accessor :i18n_days
5
+ attr_accessor :table_class
6
+ attr_accessor :day_number_class
7
+ attr_accessor :day_cell_class
8
+ attr_accessor :day_name_class
9
+ attr_accessor :day_contents_class
10
+ attr_accessor :today_class
11
+ attr_accessor :another_month_class
12
+ attr_accessor :start_of_week
13
+
14
+ def initialize
15
+ reset!
16
+ end
17
+
18
+ def to_h
19
+ {
20
+ class_prefix: @class_prefix,
21
+ i18n_days: @i18n_days,
22
+ table_class: @table_class,
23
+ day_number_class: @day_number_class,
24
+ day_cell_class: @day_cell_class,
25
+ day_name_class: @day_name_class,
26
+ day_contents_class: @day_contents_class,
27
+ today_class: @today_class,
28
+ another_month_class: @another_month_class,
29
+ start_of_week: @start_of_week
30
+ }
31
+ end
32
+
33
+ def reset!
34
+ @class_prefix = 'calendar-'
35
+ @i18n_days = 'date.abbr_day_names'
36
+ @table_class = 'table'
37
+ @day_number_class = 'day-number'
38
+ @day_cell_class = 'day-cell'
39
+ @day_name_class = 'day-name'
40
+ @day_contents_class = 'day-contents'
41
+ @today_class = 'today'
42
+ @another_month_class = 'another-month'
43
+ @start_of_week = :sunday
44
+ end
45
+
46
+ def get_class(name)
47
+ name = "#{name}_class" unless name.to_s.end_with?('_class')
48
+ "#{@class_prefix}#{send(name)}"
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,7 @@
1
+ module RailsCalendar
2
+ module Helpers
3
+ def rails_calendar(date = Date.today, &block)
4
+ RailsCalendar::Simple.new(date, self, &block)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,95 @@
1
+ require 'action_view'
2
+ require 'active_support/all'
3
+
4
+ module RailsCalendar
5
+ class Simple
6
+ include ActionView::Helpers
7
+ include ActionView::Context
8
+
9
+ attr_reader :config
10
+ attr_accessor :calendar_day
11
+ attr_accessor :callback
12
+ attr_accessor :view_context
13
+
14
+ DAYS = [:sunday, :monday, :tuesday, :wednesday, :thursday, :friday, :saturday]
15
+
16
+ def initialize(calendar_day, view_context = nil, &block)
17
+ @config = RailsCalendar.configuration
18
+ @calendar_day = calendar_day
19
+ @view_context = view_context
20
+ @callback = block
21
+ end
22
+
23
+ def to_s
24
+ table
25
+ end
26
+
27
+ private
28
+
29
+ def table
30
+ content_tag :table, class: config.get_class(:table) do
31
+ header + body
32
+ end
33
+ end
34
+
35
+ def header
36
+ index = DAYS.index(config.start_of_week)
37
+
38
+ content_tag :thead do
39
+ content_tag :tr do
40
+ I18n.t(config.i18n_days).rotate(index).each do |day|
41
+ concat content_tag(:th, day.titleize, class: config.get_class(:day_name))
42
+ end
43
+ end
44
+ end
45
+ end
46
+
47
+ def body
48
+ rows = weeks.map do |week|
49
+ content_tag :tr do
50
+ week.each do |day|
51
+ concat day_cell(day)
52
+ end
53
+ end
54
+ end
55
+
56
+ content_tag :tbody, rows.join('').html_safe
57
+ end
58
+
59
+ def weeks
60
+ first = calendar_day.beginning_of_month.beginning_of_week(config.start_of_week)
61
+ last = calendar_day.end_of_month.end_of_week(config.start_of_week)
62
+ (first..last).to_a.in_groups_of(7)
63
+ end
64
+
65
+ def date_callback(date)
66
+ return nil unless callback.present?
67
+
68
+ if view_context.present?
69
+ view_context.capture(date, &callback)
70
+ else
71
+ capture(date, &callback)
72
+ end
73
+ end
74
+
75
+ def day_cell(date)
76
+ callback_contents = date_callback(date)
77
+
78
+ content_tag(:td, class: day_cell_classes(date)) do
79
+ concat content_tag(:span, date.day, class: config.get_class(:day_number))
80
+
81
+ if callback_contents.present?
82
+ concat content_tag(:div, callback_contents, class: config.get_class(:day_contents))
83
+ end
84
+ end
85
+ end
86
+
87
+ def day_cell_classes(date)
88
+ classes = []
89
+ classes << config.get_class(:day_cell)
90
+ classes << config.get_class(:today) if date == Date.today
91
+ classes << config.get_class(:another_month) unless date.month == calendar_day.month
92
+ classes.empty? ? nil : classes.join(' ')
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,3 @@
1
+ module RailsCalendar
2
+ VERSION = "0.2.0"
3
+ end
@@ -0,0 +1,28 @@
1
+ require 'rails_calendar/simple'
2
+ require 'rails_calendar/configuration'
3
+ require 'rails_calendar/helpers'
4
+
5
+ module RailsCalendar
6
+ if defined?(::Rails)
7
+ class Engine < ::Rails::Engine
8
+ end
9
+
10
+ class Railtie < ::Rails::Railtie
11
+ initializer 'rails-calendar.helpers' do
12
+ ActionView::Base.send :include, Helpers
13
+ end
14
+ end
15
+ end
16
+
17
+ class << self
18
+ attr_accessor :configuration
19
+
20
+ def configure(&block)
21
+ block.yield(configuration)
22
+ end
23
+
24
+ def configuration
25
+ @configuration ||= Configuration.new
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :rails_calendar do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,31 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ # Maintain your gem's version:
4
+ require "rails_calendar/version"
5
+
6
+ # Describe your gem and declare its dependencies:
7
+ Gem::Specification.new do |s|
8
+ s.name = "rails-calendar"
9
+ s.version = RailsCalendar::VERSION
10
+ s.authors = ["Rodrigo Díaz V."]
11
+ s.email = ["rdiazv89@gmail.com"]
12
+ s.homepage = "https://github.com/rdiazv/rails_calendar"
13
+ s.summary = "An easy to use calendar for your rails app"
14
+ s.description = "An easy to use calendar for your rails app"
15
+ s.license = "MIT"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_dependency "rails", ">= 3.0"
23
+
24
+ s.add_development_dependency "sqlite3"
25
+ s.add_development_dependency "rspec-rails", "~> 3.0.2"
26
+ s.add_development_dependency "rspec-legacy_formatters", "~> 1.0.0"
27
+ s.add_development_dependency "guard", "~> 2.6.1"
28
+ s.add_development_dependency "guard-rspec", "~> 4.3.1"
29
+ s.add_development_dependency "coveralls", "~> 0.7.1"
30
+ s.add_development_dependency "capybara", "~> 2.4.1"
31
+ 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,6 @@
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 available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
File without changes
@@ -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,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
File without changes
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
File without changes
File without changes
File without changes
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </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,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
@@ -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 "rails_calendar"
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__)
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ #
7
+ default: &default
8
+ adapter: sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ development:
13
+ <<: *default
14
+ database: db/development.sqlite3
15
+
16
+ # Warning: The database defined as "test" will be erased and
17
+ # re-generated from your development database when you run "rake".
18
+ # Do not set this db to the same as development or production.
19
+ test:
20
+ <<: *default
21
+ database: db/test.sqlite3
22
+
23
+ production:
24
+ <<: *default
25
+ database: db/production.sqlite3
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,37 @@
1
+ Rails.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
+ # Do not eager load code on boot.
10
+ config.eager_load = false
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
+ # Raise an error on page load if there are pending migrations.
23
+ config.active_record.migration_error = :page_load
24
+
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
28
+ config.assets.debug = true
29
+
30
+ # Adds additional error checking when serving assets at runtime.
31
+ # Checks for improperly declared sprockets dependencies.
32
+ # Raises helpful error messages.
33
+ config.assets.raise_runtime_errors = true
34
+
35
+ # Raises error for missing translations
36
+ # config.action_view.raise_on_missing_translations = true
37
+ end