tin_opener 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. checksums.yaml +7 -0
  2. data/LICENSE +662 -0
  3. data/README.md +37 -0
  4. data/Rakefile +33 -0
  5. data/app/assets/javascripts/tin_opener/application.js +13 -0
  6. data/app/assets/stylesheets/tin_opener/application.css +15 -0
  7. data/app/controllers/tin_opener/application_controller.rb +4 -0
  8. data/app/controllers/tin_opener/data_sets_controller.rb +51 -0
  9. data/app/controllers/tin_opener/records_controller.rb +62 -0
  10. data/app/helpers/tin_opener/application_helper.rb +4 -0
  11. data/app/models/tin_opener/data_set.rb +39 -0
  12. data/app/models/tin_opener/record.rb +8 -0
  13. data/app/views/layouts/tin_opener/application.html.erb +14 -0
  14. data/app/views/tin_opener/data_sets/_form.html.erb +25 -0
  15. data/app/views/tin_opener/data_sets/edit.html.erb +6 -0
  16. data/app/views/tin_opener/data_sets/index.html.erb +29 -0
  17. data/app/views/tin_opener/data_sets/show.html.erb +19 -0
  18. data/app/views/tin_opener/records/_form.html.erb +24 -0
  19. data/app/views/tin_opener/records/_record.html.erb +8 -0
  20. data/app/views/tin_opener/records/edit.html.erb +6 -0
  21. data/app/views/tin_opener/records/index.html.erb +25 -0
  22. data/app/views/tin_opener/records/new.html.erb +5 -0
  23. data/app/views/tin_opener/records/show.html.erb +11 -0
  24. data/config/routes.rb +7 -0
  25. data/config/spring.rb +1 -0
  26. data/db/migrate/20151024183112_enable_hstore.rb +5 -0
  27. data/db/migrate/20151024183219_create_tin_opener_data_sets.rb +10 -0
  28. data/db/migrate/20151024194928_create_tin_opener_records.rb +10 -0
  29. data/lib/tasks/tin_opener_tasks.rake +4 -0
  30. data/lib/tin_opener/data_file_processor.rb +22 -0
  31. data/lib/tin_opener/engine.rb +21 -0
  32. data/lib/tin_opener/version.rb +3 -0
  33. data/lib/tin_opener.rb +8 -0
  34. data/spec/dummy/README.rdoc +28 -0
  35. data/spec/dummy/Rakefile +6 -0
  36. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  37. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  38. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  39. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  40. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  41. data/spec/dummy/bin/bundle +3 -0
  42. data/spec/dummy/bin/rails +8 -0
  43. data/spec/dummy/bin/rake +8 -0
  44. data/spec/dummy/bin/rspec +7 -0
  45. data/spec/dummy/bin/setup +29 -0
  46. data/spec/dummy/bin/spring +15 -0
  47. data/spec/dummy/config/application.rb +31 -0
  48. data/spec/dummy/config/boot.rb +5 -0
  49. data/spec/dummy/config/database.yml +18 -0
  50. data/spec/dummy/config/environment.rb +5 -0
  51. data/spec/dummy/config/environments/development.rb +41 -0
  52. data/spec/dummy/config/environments/production.rb +79 -0
  53. data/spec/dummy/config/environments/test.rb +42 -0
  54. data/spec/dummy/config/initializers/assets.rb +11 -0
  55. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  56. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  57. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  58. data/spec/dummy/config/initializers/inflections.rb +16 -0
  59. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  60. data/spec/dummy/config/initializers/session_store.rb +3 -0
  61. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  62. data/spec/dummy/config/locales/en.yml +23 -0
  63. data/spec/dummy/config/routes.rb +4 -0
  64. data/spec/dummy/config/secrets.yml +22 -0
  65. data/spec/dummy/config.ru +4 -0
  66. data/spec/dummy/db/schema.rb +34 -0
  67. data/spec/dummy/log/development.log +205 -0
  68. data/spec/dummy/log/test.log +812 -0
  69. data/spec/dummy/public/404.html +67 -0
  70. data/spec/dummy/public/422.html +67 -0
  71. data/spec/dummy/public/500.html +66 -0
  72. data/spec/dummy/public/favicon.ico +0 -0
  73. data/spec/examples.txt +7 -0
  74. data/spec/factories/tin_opener_data_sets.rb +6 -0
  75. data/spec/factories/tin_opener_records.rb +6 -0
  76. data/spec/fixtures/data_sets/bici_disponibilidad.csv +71 -0
  77. data/spec/models/tin_opener/data_set_spec.rb +24 -0
  78. data/spec/models/tin_opener/record_spec.rb +10 -0
  79. data/spec/rails_helper.rb +68 -0
  80. data/spec/spec_helper.rb +93 -0
  81. metadata +324 -0
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # tin_opener
2
+ [![Build Status](https://travis-ci.org/dgilperez/tin_opener.svg?branch=master)](https://travis-ci.org/dgilperez/tin_opener)
3
+ [![Code Climate](https://codeclimate.com/github/dgilperez/tin_opener/badges/gpa.svg)](https://codeclimate.com/github/dgilperez/tin_opener)
4
+
5
+ Opening Data, one Tin at a time.
6
+
7
+ Rails Engine developed in the context of the Ayuntamiento de Madrid's Open Data project [https://twitter.com/hashtag/openmad](#OpenMad).
8
+
9
+ ## Usage
10
+
11
+ Add gem to `Gemfile`:
12
+
13
+ gem 'tin_opener', github: 'dgilperez/tin_opener'
14
+
15
+ Add a mounting point to your `routes.rb`
16
+
17
+ mount TinOpener::Engine => "/tin_opener"
18
+
19
+ Run migrations:
20
+
21
+ rake tin_opener:install:migrations
22
+ rake db:migrate
23
+
24
+ This gem provides the following models:
25
+
26
+ * `TinOpener::DataSet` is any type of data structure you declare in your data domain. It's defined by it's name and headers, which in turn is a hash of key name and data type pairs.
27
+ * `TinOpener::Record` is a instance of data belonging to a DataSet format, extracted from any CSV form.
28
+
29
+ Data input format support:
30
+
31
+ * CSV
32
+
33
+ ## TODO
34
+
35
+ Support for more data formats:
36
+
37
+ * Excel
data/Rakefile ADDED
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+
8
+ # require 'rdoc/task'
9
+ #
10
+ # RDoc::Task.new(:rdoc) do |rdoc|
11
+ # rdoc.rdoc_dir = 'rdoc'
12
+ # rdoc.title = 'TinOpener'
13
+ # rdoc.options << '--line-numbers'
14
+ # rdoc.rdoc_files.include('README.rdoc')
15
+ # rdoc.rdoc_files.include('lib/**/*.rb')
16
+ # end
17
+
18
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
19
+ load 'rails/tasks/engine.rake'
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+ Bundler::GemHelper.install_tasks
24
+
25
+ Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each {|f| load f }
26
+
27
+ require 'rspec/core'
28
+ require 'rspec/core/rake_task'
29
+
30
+ desc "Run all specs in spec directory (excluding plugin specs)"
31
+ RSpec::Core::RakeTask.new(spec: 'app:db:test:prepare')
32
+
33
+ task default: :spec
@@ -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 any plugin's vendor/assets/javascripts directory 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/rails/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 any plugin's vendor/assets/stylesheets directory 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 TinOpener
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,51 @@
1
+ require_dependency "tin_opener/application_controller"
2
+
3
+ module TinOpener
4
+ class DataSetsController < ApplicationController
5
+ before_action :set_data_set, only: [:show, :edit, :update, :destroy]
6
+
7
+ def index
8
+ @data_sets = DataSet.all
9
+ @data_set = DataSet.new
10
+ end
11
+
12
+ def show
13
+ @records = @data_set.records
14
+ end
15
+
16
+ def edit
17
+ end
18
+
19
+ def create
20
+ @data_set = DataSet.new(data_set_params)
21
+
22
+ if @data_set.save
23
+ redirect_to @data_set, notice: 'Data set was successfully created.'
24
+ else
25
+ render :new
26
+ end
27
+ end
28
+
29
+ def update
30
+ if @data_set.update(data_set_params)
31
+ redirect_to @data_set, notice: 'Data set was successfully updated.'
32
+ else
33
+ render :edit
34
+ end
35
+ end
36
+
37
+ def destroy
38
+ @data_set.destroy
39
+ redirect_to data_sets_url, notice: 'Data set was successfully destroyed.'
40
+ end
41
+
42
+ private
43
+ def set_data_set
44
+ @data_set = DataSet.find(params[:id])
45
+ end
46
+
47
+ def data_set_params
48
+ params.require(:data_set).permit(:name, :headers, :data_file)
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,62 @@
1
+ require_dependency "tin_opener/application_controller"
2
+
3
+ module TinOpener
4
+ class RecordsController < ApplicationController
5
+ before_action :set_data_set
6
+ before_action :set_record, only: [:show, :edit, :update, :destroy]
7
+
8
+ def index
9
+ @records = @data_set.records
10
+ end
11
+
12
+ def show
13
+ end
14
+
15
+ def new
16
+ @record = @data_set.records.new
17
+ end
18
+
19
+ def edit
20
+ end
21
+
22
+ def create
23
+ @record = @data_set.records.new(record_params)
24
+
25
+ if @record.save
26
+ redirect_to data_set_record_url(@data_set, @record), notice: 'Record was successfully created.'
27
+ else
28
+ render :new
29
+ end
30
+ end
31
+
32
+ def update
33
+ if @record.update(record_params)
34
+ redirect_to data_set_record_url(@data_set, @record), notice: 'Record was successfully updated.'
35
+ else
36
+ render :edit
37
+ end
38
+ end
39
+
40
+ def destroy
41
+ @record.destroy
42
+ redirect_to data_set_records_url(@data_set), notice: 'Record was successfully destroyed.'
43
+ end
44
+
45
+ private
46
+ def set_data_set
47
+ @data_set = DataSet.find(params[:data_set_id])
48
+ end
49
+
50
+ def set_record
51
+ @record = @data_set.records.find(params[:id])
52
+ end
53
+
54
+ def record_params
55
+ row_data = params[:record].delete(:row_data)
56
+ # ActionController::Parameters.new(record: { row_data: row_data })
57
+ params[:record].permit!.tap do |whitelisted|
58
+ whitelisted[:row_data] = row_data
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,4 @@
1
+ module TinOpener
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,39 @@
1
+ module TinOpener
2
+ class DataSet < ActiveRecord::Base
3
+ has_many :records, dependent: :destroy
4
+
5
+ attr_reader :data_file
6
+
7
+ validates :name, presence: true, uniqueness: { scope: :headers }
8
+ validates :headers, presence: true
9
+
10
+ before_validation :process_data_file
11
+
12
+ def data_file=(data_file)
13
+ @data_file = data_file.respond_to?(:tempfile) ? data_file.tempfile : data_file
14
+ end
15
+
16
+ private
17
+
18
+ def process_data_file
19
+ return unless data_file.is_a?(File)
20
+
21
+ data_file_processor = DataFileProcessor.new(file: data_file)
22
+
23
+ self.headers = data_file_processor.headers
24
+
25
+ import_records(data_file_processor.rows)
26
+ # data_file_processor.rows.each do |row|
27
+ # records.new(row_data: row)
28
+ # end
29
+ end
30
+
31
+ def import_records(record_attrs)
32
+ to_import = record_attrs.map do |row|
33
+ records.new(row_data: row)
34
+ end
35
+
36
+ Record.import to_import
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,8 @@
1
+ module TinOpener
2
+ class Record < ActiveRecord::Base
3
+ belongs_to :data_set
4
+
5
+ validates :data_set, presence: true
6
+ validates :row_data, presence: true
7
+ end
8
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>TinOpener</title>
5
+ <%= stylesheet_link_tag "tin_opener/application", media: "all" %>
6
+ <%= javascript_include_tag "tin_opener/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,25 @@
1
+ <%= form_for(@data_set, multipart: true) do |f| %>
2
+ <% if @data_set.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@data_set.errors.count, "error") %> prohibited this data_set from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @data_set.errors.full_messages.each do |message| %>
8
+ <li><%= message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="actions">
15
+ <div>
16
+ <%= f.text_field :name %>
17
+ </div>
18
+ <div>
19
+ <% if @data_set.new_record? %>
20
+ <%= f.file_field :data_file %>
21
+ <% end %>
22
+ </div>
23
+ <%= f.submit %>
24
+ </div>
25
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing Data Set</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @data_set %> |
6
+ <%= link_to 'Back', data_sets_path %>
@@ -0,0 +1,29 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <h1>Listing Data Sets</h1>
4
+
5
+ <table>
6
+ <thead>
7
+ <tr>
8
+ <th colspan="3"></th>
9
+ </tr>
10
+ </thead>
11
+
12
+ <tbody>
13
+ <% @data_sets.each do |data_set| %>
14
+ <tr>
15
+ <td><%= data_set.name %></td>
16
+ <td><%= link_to 'Show', data_set %></td>
17
+ <td><%= link_to 'Edit', edit_data_set_path(data_set) %></td>
18
+ <td><%= link_to 'Add more records', new_data_set_record_path(data_set) %></td>
19
+ <td><%= button_to 'Destroy', data_set, method: :delete, data: { confirm: 'Are you sure?' } %></td>
20
+ </tr>
21
+ <% end %>
22
+ </tbody>
23
+ </table>
24
+
25
+ <br>
26
+
27
+ New Data Set
28
+
29
+ <%= render 'form' %>
@@ -0,0 +1,19 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <%= link_to 'Edit', edit_data_set_path(@data_set) %> |
4
+ <%= link_to 'Back', data_sets_path %>
5
+
6
+ <h1><%= @data_set.name %></h1>
7
+
8
+ <h2>Structure</h2>
9
+ <p>
10
+ <%= @data_set.headers.keys.join(', ') %>
11
+ </p>
12
+
13
+ <h2>Records</h2>
14
+
15
+ <% if @records.present? %>
16
+ <%= render @records %>
17
+ <% else %>
18
+ <p>No records added for this data set yet.</p>
19
+ <% end %>
@@ -0,0 +1,24 @@
1
+ <%= form_for([@data_set, @record]) do |f| %>
2
+ <% if @record.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@record.errors.count, "error") %> prohibited this record from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @record.errors.full_messages.each do |message| %>
8
+ <li><%= message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="actions">
15
+ <%= f.fields_for :row_data do |header_fields| %>
16
+ <% @data_set.headers.each do |key, _| %>
17
+ <div>
18
+ <%= header_fields.text_field key, value: @record.row_data.try{ |h| h[key] } %>
19
+ </div>
20
+ <% end %>
21
+ <% end %>
22
+ <%= f.submit %>
23
+ </div>
24
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <h3>Record#<%= record.id %></h3>
2
+
3
+ <dl>
4
+ <% record.row_data.each do |key, value| %>
5
+ <dt><%= key %></dt>
6
+ <dd><%= value %></dd>
7
+ <% end %>
8
+ </dl>
@@ -0,0 +1,6 @@
1
+ <h1>Editing Record</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @record %> |
6
+ <%= link_to 'Back', data_set_records_path(@data_set) %>
@@ -0,0 +1,25 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <h1>Listing Records</h1>
4
+
5
+ <table>
6
+ <thead>
7
+ <tr>
8
+ <th colspan="3"></th>
9
+ </tr>
10
+ </thead>
11
+
12
+ <tbody>
13
+ <% @records.each do |record| %>
14
+ <tr>
15
+ <td><%= link_to 'Show', data_set_record_path(@data_set, record) %></td>
16
+ <td><%= link_to 'Edit', edit_data_set_record_path(@data_set, record) %></td>
17
+ <td><%= button_to 'Destroy', data_set_record_path(@data_set, record), method: :delete, data: { confirm: 'Are you sure?' } %></td>
18
+ </tr>
19
+ <% end %>
20
+ </tbody>
21
+ </table>
22
+
23
+ <br>
24
+
25
+ <%= link_to 'New Record', new_data_set_record_path(@data_set) %>
@@ -0,0 +1,5 @@
1
+ <h1>New Record for DataSet: <%= @data_set.name %></h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', data_set_records_path(@data_set) %>
@@ -0,0 +1,11 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <%= link_to 'Edit', edit_data_set_record_path(@data_set, @record) %> |
4
+ <%= link_to 'Back', data_set_records_path(@data_set) %>
5
+
6
+ <h2>Data set</h2>
7
+ <%= @record.data_set.name %>
8
+
9
+ <h2>Datos</h2>
10
+
11
+ <%= render @record %>
data/config/routes.rb ADDED
@@ -0,0 +1,7 @@
1
+ TinOpener::Engine.routes.draw do
2
+ resources :data_sets, only: [:index, :show, :create, :edit, :update, :destroy] do
3
+ resources :records
4
+ end
5
+
6
+ root 'data_sets#index'
7
+ end
data/config/spring.rb ADDED
@@ -0,0 +1 @@
1
+ Spring.application_root = './spec/dummy'
@@ -0,0 +1,5 @@
1
+ class EnableHstore < ActiveRecord::Migration
2
+ def change
3
+ enable_extension 'hstore' unless extension_enabled?('hstore')
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ class CreateTinOpenerDataSets < ActiveRecord::Migration
2
+ def change
3
+ create_table :tin_opener_data_sets do |t|
4
+ t.string :name
5
+ t.hstore :headers
6
+
7
+ t.timestamps null: false
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ class CreateTinOpenerRecords < ActiveRecord::Migration
2
+ def change
3
+ create_table :tin_opener_records do |t|
4
+ t.hstore :row_data
5
+ t.belongs_to :data_set
6
+
7
+ t.timestamps null: false
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :tin_opener do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,22 @@
1
+ module TinOpener
2
+ class DataFileProcessor
3
+ def initialize(args = {})
4
+ @file = args.fetch(:file)
5
+ @separator = args.fetch(:separator) { ';' }
6
+ end
7
+
8
+ def headers
9
+ @headers ||= rows.first.try do |row|
10
+ row.transform_values do |value|
11
+ value.class.name
12
+ end
13
+ end
14
+ end
15
+
16
+ def rows
17
+ @csv_data ||= CSV.parse(@file, col_sep: @separator, headers: true).map do |row|
18
+ row.to_hash.transform_keys{ |a| a.squeeze.strip.gsub(/\s/, '_').underscore.to_sym }
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,21 @@
1
+ module TinOpener
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace TinOpener
4
+
5
+ config.generators do |g|
6
+ g.test_framework :rspec, view_specs: false, controller_specs: false,
7
+ routing_specs: false, helper_specs: false, request_specs: false
8
+ g.integration_tool :rspec
9
+ g.fixture_replacement :factory_girl, dir: 'spec/factories'
10
+
11
+ g.stylesheets false
12
+ g.javascripts false
13
+ g.helper false
14
+ end
15
+
16
+ # config.paths.add "lib", eager_load: true
17
+ # config.paths.add "app", eager_load: true
18
+ # config.autoload_paths += Dir["#{config.root}/lib/**/"]
19
+ # config.autoload_paths += Dir["#{config.root}/app/**/"]
20
+ end
21
+ end
@@ -0,0 +1,3 @@
1
+ module TinOpener
2
+ VERSION = "0.0.1"
3
+ end
data/lib/tin_opener.rb ADDED
@@ -0,0 +1,8 @@
1
+ require "tin_opener/engine"
2
+ require "tin_opener/data_file_processor"
3
+ require "csv"
4
+ require "activerecord-import"
5
+ require 'pry-byebug' unless Rails.env.production?
6
+
7
+ module TinOpener
8
+ 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
@@ -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 any plugin's vendor/assets/javascripts directory 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/rails/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 any plugin's vendor/assets/stylesheets directory 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
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end