yaw 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +31 -0
  5. data/app/assets/javascripts/yaw/application.js +13 -0
  6. data/app/assets/stylesheets/scaffold.css +56 -0
  7. data/app/assets/stylesheets/yaw/application.sass +1 -0
  8. data/app/assets/stylesheets/yaw/wiki.sass +0 -0
  9. data/app/controllers/yaw/application_controller.rb +7 -0
  10. data/app/controllers/yaw/wiki_page_controller.rb +45 -0
  11. data/app/decorators/wiki_page_decorator.rb +17 -0
  12. data/app/models/wiki_page.rb +41 -0
  13. data/app/models/wiki_page_revision.rb +6 -0
  14. data/app/models/wiki_space.rb +8 -0
  15. data/app/views/layouts/wiki.haml +1 -0
  16. data/app/views/yaw/wiki_page/_form.html.haml +11 -0
  17. data/app/views/yaw/wiki_page/edit.html.haml +2 -0
  18. data/app/views/yaw/wiki_page/new.html.haml +3 -0
  19. data/app/views/yaw/wiki_page/show.html.haml +15 -0
  20. data/config/locales/en.yml +2 -0
  21. data/config/routes.rb +13 -0
  22. data/db/migrate/20180508080612_add_table_wiki_pages.rb +8 -0
  23. data/db/migrate/20180508082530_add_table_wiki_pages1.rb +10 -0
  24. data/db/migrate/20180508082549_add_table_wiki_pages2.rb +11 -0
  25. data/db/migrate/20180509041839_remove_unique_index_from_wiki_page.rb +5 -0
  26. data/db/migrate/20180509042022_add_index_from_wiki_page.rb +5 -0
  27. data/db/migrate/20180509093458_rename_table_wikis_to_wiki_spaces.rb +5 -0
  28. data/db/migrate/20180509101020_rename_column_wiki_idto_wiki_space_id_for_wiki_pages.rb +5 -0
  29. data/lib/mountable/lib/mountable/enginize.rb +39 -0
  30. data/lib/mountable/lib/mountable/mountable_helper.rb +18 -0
  31. data/lib/mountable/lib/mountable.rb +6 -0
  32. data/lib/tasks/wiki_tasks.rake +5 -0
  33. data/lib/yaw/engine.rb +10 -0
  34. data/lib/yaw/version.rb +5 -0
  35. data/lib/yaw.rb +9 -0
  36. data/spec/dummy/README.rdoc +28 -0
  37. data/spec/dummy/Rakefile +6 -0
  38. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  39. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  40. data/spec/dummy/app/controllers/application_controller.rb +9 -0
  41. data/spec/dummy/app/decorators/user_decorator.rb +6 -0
  42. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  43. data/spec/dummy/app/models/ability.rb +8 -0
  44. data/spec/dummy/app/models/application_record.rb +3 -0
  45. data/spec/dummy/app/models/user.rb +2 -0
  46. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  47. data/spec/dummy/app/views/layouts/exam_base.html.erb +14 -0
  48. data/spec/dummy/bin/bundle +3 -0
  49. data/spec/dummy/bin/rails +4 -0
  50. data/spec/dummy/bin/rake +4 -0
  51. data/spec/dummy/bin/setup +34 -0
  52. data/spec/dummy/bin/update +29 -0
  53. data/spec/dummy/config/application.rb +15 -0
  54. data/spec/dummy/config/boot.rb +3 -0
  55. data/spec/dummy/config/cable.yml +9 -0
  56. data/spec/dummy/config/database.yml +25 -0
  57. data/spec/dummy/config/environment.rb +5 -0
  58. data/spec/dummy/config/environments/development.rb +54 -0
  59. data/spec/dummy/config/environments/production.rb +86 -0
  60. data/spec/dummy/config/environments/test.rb +42 -0
  61. data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
  62. data/spec/dummy/config/initializers/assets.rb +11 -0
  63. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  64. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
  65. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  66. data/spec/dummy/config/initializers/inflections.rb +16 -0
  67. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  68. data/spec/dummy/config/initializers/new_framework_defaults.rb +20 -0
  69. data/spec/dummy/config/initializers/session_store.rb +3 -0
  70. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  71. data/spec/dummy/config/locales/en.yml +23 -0
  72. data/spec/dummy/config/puma.rb +47 -0
  73. data/spec/dummy/config/routes.rb +3 -0
  74. data/spec/dummy/config/secrets.yml +22 -0
  75. data/spec/dummy/config/spring.rb +6 -0
  76. data/spec/dummy/config.ru +4 -0
  77. data/spec/dummy/db/migrate/20160413040436_create_users.rb +9 -0
  78. data/spec/dummy/db/schema.rb +47 -0
  79. data/spec/dummy/db/test.sqlite3 +0 -0
  80. data/spec/dummy/log/test.log +1450 -0
  81. data/spec/dummy/public/404.html +67 -0
  82. data/spec/dummy/public/422.html +67 -0
  83. data/spec/dummy/public/500.html +66 -0
  84. data/spec/dummy/public/favicon.ico +0 -0
  85. data/spec/factories/wiki.rb +27 -0
  86. data/spec/rails_helper.rb +92 -0
  87. data/spec/spec_helper.rb +16 -0
  88. data/spec/yaw/wiki_controller_spec.rb +62 -0
  89. data/spec/yaw/wiki_page_decorator_spec.rb +20 -0
  90. data/spec/yaw/wiki_page_model_spec.rb +54 -0
  91. metadata +328 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 54982ee864ddff612ec93c72046f930e0a5e18a2
4
+ data.tar.gz: 6d8e17cd90368566ad012360d24e7c6b5c58a7ef
5
+ SHA512:
6
+ metadata.gz: 4736f51108702169e8a07db58acf077b711488f179a1fd2725988276f00ac400bcf8d782b174cb8e8f5090439352901abff427c654db4c567986ac79baa104d6
7
+ data.tar.gz: 9e5b602c90e7b6cdefb6eb1d476b0465fd31f2f2be88f724442e720c053f7a89e63c2bc1f0b80830264ceb9db3739b296344b1b3acf653f3d45f2a293fc4714a
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2016 Terry Yin
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.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = Exam
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ begin
4
+ require 'bundler/setup'
5
+ rescue LoadError
6
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
7
+ end
8
+
9
+ require 'rdoc/task'
10
+
11
+ RDoc::Task.new(:rdoc) do |rdoc|
12
+ rdoc.rdoc_dir = 'rdoc'
13
+ rdoc.title = 'yaw'
14
+ rdoc.options << '--line-numbers'
15
+ rdoc.rdoc_files.include('README.rdoc')
16
+ rdoc.rdoc_files.include('lib/**/*.rb')
17
+ end
18
+
19
+ APP_RAKEFILE = File.expand_path('spec/dummy/Rakefile', __dir__)
20
+ load 'rails/tasks/engine.rake'
21
+
22
+ require 'rubocop/rake_task'
23
+ RuboCop::RakeTask.new
24
+
25
+ require 'rspec/core/rake_task'
26
+ RSpec::Core::RakeTask.new(:spec)
27
+ task default: %i[spec]
28
+
29
+ load 'rails/tasks/statistics.rake'
30
+
31
+ Bundler::GemHelper.install_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,56 @@
1
+ body { background-color: #fff; color: #333; }
2
+
3
+ body, p, ol, ul, td {
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ pre {
10
+ background-color: #eee;
11
+ padding: 10px;
12
+ font-size: 11px;
13
+ }
14
+
15
+ a { color: #000; }
16
+ a:visited { color: #666; }
17
+ a:hover { color: #fff; background-color:#000; }
18
+
19
+ div.field, div.actions {
20
+ margin-bottom: 10px;
21
+ }
22
+
23
+ #notice {
24
+ color: green;
25
+ }
26
+
27
+ .field_with_errors {
28
+ padding: 2px;
29
+ background-color: red;
30
+ display: table;
31
+ }
32
+
33
+ #error_explanation {
34
+ width: 450px;
35
+ border: 2px solid red;
36
+ padding: 7px;
37
+ padding-bottom: 0;
38
+ margin-bottom: 20px;
39
+ background-color: #f0f0f0;
40
+ }
41
+
42
+ #error_explanation h2 {
43
+ text-align: left;
44
+ font-weight: bold;
45
+ padding: 5px 5px 5px 15px;
46
+ font-size: 12px;
47
+ margin: -7px;
48
+ margin-bottom: 0px;
49
+ background-color: #c00;
50
+ color: #fff;
51
+ }
52
+
53
+ #error_explanation ul li {
54
+ font-size: 12px;
55
+ list-style: square;
56
+ }
@@ -0,0 +1 @@
1
+ @import *
File without changes
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yaw
4
+ class ApplicationController < ::ApplicationController
5
+ layout 'wiki'
6
+ end
7
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yaw
4
+ class WikiPageController < Yaw::ApplicationController
5
+ layout 'wiki'
6
+ before_action :set_wiki_space
7
+ before_action :set_object, only: %i[show edit update]
8
+ respond_to :html
9
+
10
+ def show
11
+ @title = @wiki_page.title
12
+ render 'new' unless @wiki_page.id?
13
+ end
14
+
15
+ def edit; end
16
+
17
+ def create
18
+ @wiki_page = @wiki_space.wiki_pages.create(wiki_page_params.merge(user: current_user))
19
+ respond_with(@wiki_space, @wiki_page)
20
+ end
21
+
22
+ def update
23
+ @wiki_page.update(wiki_page_params.merge(user: current_user))
24
+ respond_with(@wiki_space, @wiki_page)
25
+ end
26
+
27
+ private
28
+
29
+ def path
30
+ CGI.unescape params[:path]
31
+ end
32
+
33
+ def set_wiki_space
34
+ @wiki_space = WikiSpace.find_by!(title: params[:wiki_space_id])
35
+ end
36
+
37
+ def set_object
38
+ @wiki_page = @wiki_space.wiki_pages.find_or_initialize_by(path: path)
39
+ end
40
+
41
+ def wiki_page_params
42
+ params.require(:wiki_page).permit(:path, :body, :title)
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ class WikiPageDecorator < Draper::Decorator
4
+ delegate_all
5
+
6
+ def render_body
7
+ # rubocop:disable all
8
+ link_reg = /\[\[([^\]]+)\]\]/
9
+ body.gsub(link_reg) do |match|
10
+ matched = match[link_reg, 1]
11
+ options = { class: 'internal' }
12
+ options[:class] = 'absent' if find_sibling(matched).blank?
13
+ h.link_to matched, h.yaw.wiki_space_wiki_page_path(wiki_space, matched), options
14
+ end.html_safe
15
+ # rubocop:enable all
16
+ end
17
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ class WikiPage < ApplicationRecord
4
+ delegate :title=, :body=, :user=, to: :dirty_revision
5
+ after_save :reset_dirty_revision
6
+ belongs_to :wiki_space, required: true, inverse_of: :wiki_pages
7
+ validates :path, uniqueness: { scope: :wiki_space_id }
8
+ has_many :wiki_page_revisions,
9
+ -> { order id: :desc },
10
+ autosave: true,
11
+ inverse_of: :wiki_page
12
+
13
+ def current_revision
14
+ @dirty_revision || wiki_page_revisions.first
15
+ end
16
+
17
+ def to_param
18
+ path
19
+ end
20
+
21
+ delegate :body, to: :current_revision, allow_nil: true
22
+ def title
23
+ current_revision&.title || path&.split('/')&.last
24
+ end
25
+
26
+ delegate :render_body, to: :decorate
27
+
28
+ def find_sibling(path)
29
+ wiki_space.wiki_pages.find_by(path: path)
30
+ end
31
+
32
+ private
33
+
34
+ def dirty_revision
35
+ @dirty_revision ||= wiki_page_revisions.build
36
+ end
37
+
38
+ def reset_dirty_revision
39
+ @dirty_revision = nil
40
+ end
41
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ class WikiPageRevision < ApplicationRecord
4
+ belongs_to :user
5
+ belongs_to :wiki_page, inverse_of: :wiki_page_revisions
6
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class WikiSpace < ApplicationRecord
4
+ has_many :wiki_pages, inverse_of: :wiki_space, dependent: :destroy
5
+ def to_param
6
+ title
7
+ end
8
+ end
@@ -0,0 +1 @@
1
+ =yield
@@ -0,0 +1,11 @@
1
+ = simple_form_for([@wiki_space, @wiki_page]) do |f|
2
+ = f.error_notification
3
+
4
+ .form-inputs
5
+ = f.input :title
6
+ = f.input :body, as:"ckeditor", :input_html => { :ckeditor => {:toolbar => 'mini'} }
7
+ = f.input :path, as: :hidden
8
+
9
+ .form-actions
10
+ = f.button :submit
11
+
@@ -0,0 +1,2 @@
1
+ .container
2
+ =render "form"
@@ -0,0 +1,3 @@
1
+ .container
2
+ =render "form"
3
+
@@ -0,0 +1,15 @@
1
+ .container.wiki.main_content
2
+ %h1.wiki-title
3
+ =@wiki_page.title
4
+ = link_to "Edit This Wiki Page", wiki_space_wiki_edit_path(@wiki_space, @wiki_page), class:"btn btn-default pull-right"
5
+ .wiki-body
6
+ =@wiki_page.render_body
7
+ .well
8
+ %ul
9
+ - @wiki_page.wiki_page_revisions.each do |revision|
10
+ %li.wiki-revision
11
+ Edited By:
12
+ = revision.user&.decorate&.link
13
+ %span.wiki-revision-date
14
+ On:
15
+ = revision.created_at.to_date
@@ -0,0 +1,2 @@
1
+ en:
2
+
data/config/routes.rb ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ Yaw::Engine.routes.draw do
4
+ resources :wiki_spaces, path: '/', only: [] do
5
+ nested do
6
+ post 'wiki' => 'wiki_page#create', as: 'wiki_pages'
7
+ get 'wiki/*path' => 'wiki_page#show', as: 'wiki_page'
8
+ patch 'wiki/*path' => 'wiki_page#update'
9
+ put 'wiki/*path' => 'wiki_page#update'
10
+ get 'edit/*path' => 'wiki_page#edit', as: 'wiki_edit'
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,8 @@
1
+ class AddTableWikiPages < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :wikis do |t|
4
+ t.string :title
5
+ t.timestamps
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ class AddTableWikiPages1 < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :wiki_pages do |t|
4
+ t.references :wiki, foreign_key: true
5
+ t.string :path, null: false
6
+ t.timestamps
7
+ end
8
+ add_index :wiki_pages, :path, unique: true
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ class AddTableWikiPages2 < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :wiki_page_revisions do |t|
4
+ t.references :user, foreign_key: true, type: :integer
5
+ t.references :wiki_page, foreign_key: true
6
+ t.string :title
7
+ t.text :body
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ class RemoveUniqueIndexFromWikiPage < ActiveRecord::Migration[5.1]
2
+ def change
3
+ remove_index :wiki_pages, column: :path
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddIndexFromWikiPage < ActiveRecord::Migration[5.1]
2
+ def change
3
+ add_index :wiki_pages, :path
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class RenameTableWikisToWikiSpaces < ActiveRecord::Migration[5.1]
2
+ def change
3
+ rename_table :wikis, :wiki_spaces
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class RenameColumnWikiIdtoWikiSpaceIdForWikiPages < ActiveRecord::Migration[5.1]
2
+ def change
3
+ rename_column :wiki_pages, :wiki_id, :wiki_space_id
4
+ end
5
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'draper'
4
+ require 'responders'
5
+ require_relative 'mountable_helper'
6
+
7
+ module Mountable
8
+ module Enginizer
9
+ def _prepare(module_name)
10
+ module_ = module_name.constantize
11
+ isolate_namespace module_
12
+ config.to_prepare do
13
+ # so that I can use safe_join
14
+ Draper::Decorator.send(:include, ActionView::Helpers::OutputSafetyHelper)
15
+ [Mountable::MountableHelper, Rails.application.helpers].each { |h| module_.const_get('ApplicationController').helper h }
16
+ Dir.glob(Rails.root + "app/#{module_name.underscore}/*_patch*.rb").each(&method(:require_dependency))
17
+ end
18
+ end
19
+
20
+ def enginize
21
+ _prepare(name.split('::').first)
22
+
23
+ config.generators do |g|
24
+ g.test_framework :rspec, fixture: false
25
+ g.fixture_replacement :factory_girl, dir: 'spec/factories'
26
+ g.assets false
27
+ g.helper false
28
+ end
29
+
30
+ config.generators do |g|
31
+ g.template_engine :haml
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ ::Rails::Engine.class_eval do
38
+ extend Mountable::Enginizer
39
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mountable
4
+ # :nodoc:
5
+ module MountableHelper
6
+ def method_missing(method, *args, &block)
7
+ if respond_to_missing?(method, args)
8
+ main_app.send(method, *args)
9
+ else
10
+ super
11
+ end
12
+ end
13
+
14
+ def respond_to_missing?(method, *)
15
+ (method.to_s.end_with?('_path', '_url') && main_app.respond_to?(method)) || super
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'mountable/enginize'
4
+
5
+ module Mountable
6
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+ # desc "Explaining what the task does"
3
+ # task :wiki do
4
+ # # Task goes here
5
+ # end
data/lib/yaw/engine.rb ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../mountable/lib/mountable'
4
+
5
+ module Yaw
6
+ # :nodoc:
7
+ class Engine < ::Rails::Engine
8
+ enginize
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yaw
4
+ VERSION = '0.0.1'
5
+ end
data/lib/yaw.rb ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yaw/engine'
4
+
5
+ module Yaw
6
+ # :nodoc:
7
+ class C
8
+ end
9
+ 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,9 @@
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
+
6
+ def current_user
7
+ # dummy
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ class UserDecorator < Draper::Decorator
2
+ include Exam::PersonDecorator
3
+ def identification
4
+ 'cool name(with email)'
5
+ end
6
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,8 @@
1
+ class Ability
2
+ include ::CanCan::Ability
3
+
4
+ def initialize(user)
5
+ merge(::Exam::Ability.new(user))
6
+ end
7
+ end
8
+
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -0,0 +1,2 @@
1
+ class User < ActiveRecord::Base
2
+ end
@@ -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,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', __dir__)
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