my_forum 0.0.1.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +16 -0
  4. data/Rakefile +35 -0
  5. data/app/assets/javascripts/my_forum/admin/categories.js.coffee +0 -0
  6. data/app/assets/javascripts/my_forum/admin/dashboard.js.coffee +0 -0
  7. data/app/assets/javascripts/my_forum/admin/forums.js.coffee +0 -0
  8. data/app/assets/javascripts/my_forum/admin/roles.js +2 -0
  9. data/app/assets/javascripts/my_forum/admin/users.js +2 -0
  10. data/app/assets/javascripts/my_forum/application.js +16 -0
  11. data/app/assets/javascripts/my_forum/forums.js.coffee +0 -0
  12. data/app/assets/javascripts/my_forum/posts.js.coffee +0 -0
  13. data/app/assets/javascripts/my_forum/topics.js.coffee +0 -0
  14. data/app/assets/javascripts/my_forum/users.js.coffee +0 -0
  15. data/app/assets/javascripts/my_forum/welcome.js.coffee +0 -0
  16. data/app/assets/stylesheets/my_forum/admin/categories.css.scss +0 -0
  17. data/app/assets/stylesheets/my_forum/admin/dashboard.css.scss +3 -0
  18. data/app/assets/stylesheets/my_forum/admin/forums.css.scss +7 -0
  19. data/app/assets/stylesheets/my_forum/admin/roles.css +4 -0
  20. data/app/assets/stylesheets/my_forum/admin/users.css +4 -0
  21. data/app/assets/stylesheets/my_forum/application.css.scss +29 -0
  22. data/app/assets/stylesheets/my_forum/forums.css.scss +31 -0
  23. data/app/assets/stylesheets/my_forum/posts.css.scss +76 -0
  24. data/app/assets/stylesheets/my_forum/private_messages.css.scss +7 -0
  25. data/app/assets/stylesheets/my_forum/topics.css.scss +12 -0
  26. data/app/assets/stylesheets/my_forum/users.css.scss +0 -0
  27. data/app/assets/stylesheets/my_forum/welcome.css.scss +66 -0
  28. data/app/controllers/my_forum/admin/categories_controller.rb +36 -0
  29. data/app/controllers/my_forum/admin/dashboard_controller.rb +13 -0
  30. data/app/controllers/my_forum/admin/forums_controller.rb +35 -0
  31. data/app/controllers/my_forum/admin/roles_controller.rb +38 -0
  32. data/app/controllers/my_forum/admin/users_controller.rb +14 -0
  33. data/app/controllers/my_forum/application_controller.rb +56 -0
  34. data/app/controllers/my_forum/forums_controller.rb +39 -0
  35. data/app/controllers/my_forum/posts_controller.rb +29 -0
  36. data/app/controllers/my_forum/private_messages_controller.rb +67 -0
  37. data/app/controllers/my_forum/topics_controller.rb +47 -0
  38. data/app/controllers/my_forum/users_controller.rb +89 -0
  39. data/app/controllers/my_forum/welcome_controller.rb +12 -0
  40. data/app/helpers/my_forum/admin/dashboard_helper.rb +4 -0
  41. data/app/helpers/my_forum/admin/forums_helper.rb +4 -0
  42. data/app/helpers/my_forum/admin/roles_helper.rb +4 -0
  43. data/app/helpers/my_forum/admin/users_helper.rb +4 -0
  44. data/app/helpers/my_forum/application_helper.rb +39 -0
  45. data/app/helpers/my_forum/forums_helper.rb +42 -0
  46. data/app/helpers/my_forum/posts_helper.rb +29 -0
  47. data/app/helpers/my_forum/private_messages_helper.rb +18 -0
  48. data/app/helpers/my_forum/topics_helper.rb +11 -0
  49. data/app/helpers/my_forum/users_helper.rb +23 -0
  50. data/app/helpers/my_forum/welcome_helper.rb +4 -0
  51. data/app/mailers/application_mailer.rb +4 -0
  52. data/app/mailers/my_forum/user_mailer.rb +14 -0
  53. data/app/models/my_forum/category.rb +7 -0
  54. data/app/models/my_forum/category_permission.rb +6 -0
  55. data/app/models/my_forum/forum.rb +56 -0
  56. data/app/models/my_forum/log_read_mark.rb +4 -0
  57. data/app/models/my_forum/post.rb +14 -0
  58. data/app/models/my_forum/private_message.rb +8 -0
  59. data/app/models/my_forum/role.rb +6 -0
  60. data/app/models/my_forum/topic.rb +33 -0
  61. data/app/models/my_forum/user.rb +45 -0
  62. data/app/models/my_forum/user_group.rb +13 -0
  63. data/app/models/my_forum/user_group_link.rb +6 -0
  64. data/app/models/my_forum/user_roles.rb +6 -0
  65. data/app/views/layouts/mailer.html.erb +5 -0
  66. data/app/views/layouts/mailer.text.erb +1 -0
  67. data/app/views/layouts/my_forum/_guest_navbar.html.haml +4 -0
  68. data/app/views/layouts/my_forum/_user_navbar.html.haml +18 -0
  69. data/app/views/layouts/my_forum/admin_application.haml +27 -0
  70. data/app/views/layouts/my_forum/application.haml +21 -0
  71. data/app/views/my_forum/admin/categories/edit.haml +9 -0
  72. data/app/views/my_forum/admin/categories/new.haml +8 -0
  73. data/app/views/my_forum/admin/dashboard/index.haml +0 -0
  74. data/app/views/my_forum/admin/forums/index.haml +37 -0
  75. data/app/views/my_forum/admin/forums/new.haml +6 -0
  76. data/app/views/my_forum/admin/roles/index.haml +12 -0
  77. data/app/views/my_forum/admin/roles/new.haml +22 -0
  78. data/app/views/my_forum/admin/users/index.haml +10 -0
  79. data/app/views/my_forum/forums/_topic_subject.html.haml +15 -0
  80. data/app/views/my_forum/forums/show.haml +28 -0
  81. data/app/views/my_forum/private_messages/_sidebar.haml +10 -0
  82. data/app/views/my_forum/private_messages/inbox.haml +24 -0
  83. data/app/views/my_forum/private_messages/new.haml +16 -0
  84. data/app/views/my_forum/private_messages/show.haml +10 -0
  85. data/app/views/my_forum/topics/_post.haml +12 -0
  86. data/app/views/my_forum/topics/_quick_answer.haml +8 -0
  87. data/app/views/my_forum/topics/_topic_header.haml +4 -0
  88. data/app/views/my_forum/topics/_user_info.haml +9 -0
  89. data/app/views/my_forum/topics/new.haml +12 -0
  90. data/app/views/my_forum/topics/show.haml +21 -0
  91. data/app/views/my_forum/user_mailer/reset_password_email.haml +1 -0
  92. data/app/views/my_forum/user_mailer/reset_password_email.text.erb +1 -0
  93. data/app/views/my_forum/users/edit.haml +12 -0
  94. data/app/views/my_forum/users/forgot_password.haml +10 -0
  95. data/app/views/my_forum/users/new.haml +14 -0
  96. data/app/views/my_forum/users/signin.haml +14 -0
  97. data/app/views/my_forum/users/signout.haml +0 -0
  98. data/app/views/my_forum/welcome/index.haml +21 -0
  99. data/config/locales/en.yml +65 -0
  100. data/config/locales/ru.yml +121 -0
  101. data/config/routes.rb +31 -0
  102. data/db/migrate/20141117122725_create_my_forum_forums.rb +12 -0
  103. data/db/migrate/20141117122742_create_my_forum_topics.rb +17 -0
  104. data/db/migrate/20141117122751_create_my_forum_posts.rb +11 -0
  105. data/db/migrate/20141118081021_create_my_forum_categories.rb +8 -0
  106. data/db/migrate/20141118131215_create_my_forum_users.rb +25 -0
  107. data/db/migrate/20141222094522_create_my_forum_roles.rb +10 -0
  108. data/db/migrate/20141222094538_create_my_forum_user_roles.rb +9 -0
  109. data/db/migrate/20150202115250_create_my_forum_log_read_marks.rb +10 -0
  110. data/db/migrate/20150215200453_create_my_forum_user_groups.rb +15 -0
  111. data/db/migrate/20150215204852_create_my_forum_user_group_links.rb +9 -0
  112. data/db/migrate/20150215212443_create_my_forum_category_permissions.rb +9 -0
  113. data/db/migrate/20150227210814_create_my_forum_private_messages.rb +14 -0
  114. data/lib/my_forum/engine.rb +31 -0
  115. data/lib/my_forum/version.rb +3 -0
  116. data/lib/my_forum.rb +4 -0
  117. data/lib/tasks/my_forum_tasks.rake +4 -0
  118. data/spec/controllers/my_forum/private_messages_controller_spec.rb +7 -0
  119. data/spec/controllers/my_forum/users_controller_spec.rb +76 -0
  120. data/spec/dummy/README.rdoc +28 -0
  121. data/spec/dummy/Rakefile +6 -0
  122. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  123. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  124. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  125. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  126. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  127. data/spec/dummy/bin/bundle +3 -0
  128. data/spec/dummy/bin/rails +4 -0
  129. data/spec/dummy/bin/rake +4 -0
  130. data/spec/dummy/config/application.rb +23 -0
  131. data/spec/dummy/config/boot.rb +5 -0
  132. data/spec/dummy/config/database.yml +25 -0
  133. data/spec/dummy/config/environment.rb +5 -0
  134. data/spec/dummy/config/environments/development.rb +37 -0
  135. data/spec/dummy/config/environments/production.rb +78 -0
  136. data/spec/dummy/config/environments/test.rb +39 -0
  137. data/spec/dummy/config/initializers/assets.rb +8 -0
  138. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  139. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  140. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  141. data/spec/dummy/config/initializers/inflections.rb +16 -0
  142. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  143. data/spec/dummy/config/initializers/session_store.rb +3 -0
  144. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  145. data/spec/dummy/config/locales/en.yml +23 -0
  146. data/spec/dummy/config/routes.rb +4 -0
  147. data/spec/dummy/config/secrets.yml +22 -0
  148. data/spec/dummy/config.ru +4 -0
  149. data/spec/dummy/db/development.sqlite3 +0 -0
  150. data/spec/dummy/db/schema.rb +128 -0
  151. data/spec/dummy/db/test.sqlite3 +0 -0
  152. data/spec/dummy/log/development.log +97 -0
  153. data/spec/dummy/log/test.log +4926 -0
  154. data/spec/dummy/public/404.html +67 -0
  155. data/spec/dummy/public/422.html +67 -0
  156. data/spec/dummy/public/500.html +66 -0
  157. data/spec/dummy/public/favicon.ico +0 -0
  158. data/spec/helpers/my_forum/private_messages_helper_spec.rb +17 -0
  159. data/spec/models/my_forum/private_message_spec.rb +7 -0
  160. data/spec/models/my_forum/user_spec.rb +13 -0
  161. data/spec/rails_helper.rb +52 -0
  162. data/spec/spec_helper.rb +87 -0
  163. metadata +348 -0
data/config/routes.rb ADDED
@@ -0,0 +1,31 @@
1
+ MyForum::Engine.routes.draw do
2
+ root 'welcome#index'
3
+
4
+ match 'signin', to: 'users#signin', via: [:get, :post]
5
+ match 'logout', to: 'users#logout', via: [:get]
6
+ match 'forgot_password', to: 'users#forgot_password', via: [:get, :post]
7
+
8
+ match 'unread_topics', to: 'forums#unread_topics', via: [:get], as: :unread_topics
9
+ match 'mark_all_as_read', to: 'forums#mark_all_as_read', via: [:get], as: :mark_all_as_read
10
+
11
+ resources :users
12
+ resources :private_messages
13
+
14
+ resources :forums, only: [:index, :show] do
15
+ resources :topics do
16
+ resources :posts
17
+ end
18
+ end
19
+
20
+ namespace :admin do
21
+ root 'dashboard#index'
22
+
23
+ match 'forums', to: 'forums#index', via: [:get]
24
+
25
+ resources :users
26
+ resources :roles
27
+ resources :categories do
28
+ resources :forums
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,12 @@
1
+ class CreateMyForumForums < ActiveRecord::Migration
2
+ def change
3
+ create_table :my_forum_forums do |t|
4
+ t.integer :category_id
5
+ t.string :name
6
+ t.string :description
7
+ t.integer :topics_count
8
+ t.integer :posts_count
9
+ t.timestamps null: false
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ class CreateMyForumTopics < ActiveRecord::Migration
2
+ def change
3
+ create_table :my_forum_topics do |t|
4
+ t.integer :forum_id
5
+ t.integer :user_id
6
+ t.integer :latest_post_id
7
+ t.string :name
8
+ t.string :description
9
+ t.integer :views
10
+ t.integer :posts_count, default: 0
11
+ t.boolean :pinned, default: false
12
+ t.boolean :closed, default: false
13
+ t.boolean :deleted, default: false
14
+ t.timestamps null: false
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,11 @@
1
+ class CreateMyForumPosts < ActiveRecord::Migration
2
+ def change
3
+ create_table :my_forum_posts do |t|
4
+ t.integer :user_id
5
+ t.integer :topic_id
6
+ t.integer :forum_id
7
+ t.text :text
8
+ t.timestamps null: false
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ class CreateMyForumCategories < ActiveRecord::Migration
2
+ def change
3
+ create_table :my_forum_categories do |t|
4
+ t.string :name
5
+ t.timestamps null: false
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,25 @@
1
+ class CreateMyForumUsers < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :my_forum_users do |t|
4
+ t.string :login
5
+ t.string :password
6
+ t.string :salt
7
+ t.string :email
8
+ t.integer :posts_count
9
+ t.boolean :is_admin, default: false
10
+ t.boolean :is_moderator, default: false
11
+ t.boolean :is_deleted, default: false
12
+ t.boolean :permanently_banned, default: false
13
+ t.timestamps null: false
14
+ t.timestamp :last_logged_in
15
+ end
16
+
17
+ MyForum::User.reset_column_information
18
+ user = MyForum::User.new(login: 'admin', password: 'admin', is_admin: true, email: 'admin@example.com')
19
+ user.save
20
+ end
21
+
22
+ def self.down
23
+ drop_table :my_forum_users
24
+ end
25
+ end
@@ -0,0 +1,10 @@
1
+ class CreateMyForumRoles < ActiveRecord::Migration
2
+ def change
3
+ create_table :my_forum_roles do |t|
4
+ t.string :name
5
+ t.string :color
6
+ t.text :rights
7
+ t.timestamps null: false
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ class CreateMyForumUserRoles < ActiveRecord::Migration
2
+ def change
3
+ create_table :my_forum_user_roles do |t|
4
+ t.integer :user_id
5
+ t.integer :role_id
6
+ t.timestamps null: false
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ class CreateMyForumLogReadMarks < ActiveRecord::Migration
2
+ def change
3
+ create_table :my_forum_log_read_marks do |t|
4
+ t.integer :user_id
5
+ t.integer :topic_id
6
+ t.integer :post_id
7
+ t.timestamps null: false
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ class CreateMyForumUserGroups < ActiveRecord::Migration
2
+ def change
3
+ create_table :my_forum_user_groups do |t|
4
+ t.string :name
5
+ t.string :html_color
6
+ t.boolean :default, default: false
7
+ t.timestamps null: false
8
+ end
9
+
10
+ MyForum::UserGroup.create!(name: 'Guests')
11
+ MyForum::UserGroup.create!(name: 'Member', default: true)
12
+ MyForum::UserGroup.create!(name: 'Moderator')
13
+ MyForum::UserGroup.create!(name: 'Admin')
14
+ end
15
+ end
@@ -0,0 +1,9 @@
1
+ class CreateMyForumUserGroupLinks < ActiveRecord::Migration
2
+ def change
3
+ create_table :my_forum_user_group_links do |t|
4
+ t.integer :user_id
5
+ t.integer :user_group_id
6
+ t.timestamps null: false
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class CreateMyForumCategoryPermissions < ActiveRecord::Migration
2
+ def change
3
+ create_table :my_forum_category_permissions do |t|
4
+ t.integer :user_group_id
5
+ t.integer :category_id
6
+ t.timestamps null: false
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ class CreateMyForumPrivateMessages < ActiveRecord::Migration
2
+ def change
3
+ create_table :my_forum_private_messages do |t|
4
+ t.integer :sender_id
5
+ t.integer :recipient_id
6
+ t.boolean :sender_deleted, :default => false
7
+ t.boolean :recipient_deleted, :default => false
8
+ t.boolean :unread, :default => true
9
+ t.string :subject
10
+ t.text :body
11
+ t.timestamps null: false
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,31 @@
1
+ module MyForum
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace MyForum
4
+
5
+ require "jquery-rails"
6
+ require 'bootstrap-sass'
7
+
8
+ config.generators do |g|
9
+ g.test_framework :rspec, :fixture => false
10
+ g.assets false
11
+ g.helper false
12
+ end
13
+
14
+ USE_CUSTOM_USER_MODEL = false
15
+ CUSTOM_USER_CLASS = 'User'
16
+ CUSTOM_USER_LOGIN_ATTR = 'login'
17
+ CUSTOM_USER_PASSWORD_ATTR = 'password'
18
+ CUSTOM_AUTHENTICATE_METHOD = 'users#authenticate'
19
+
20
+ attr_accessor :use_custom_user_model, :custom_user_class, :custom_user_login_attr, :custom_user_password_attr,
21
+ :custom_authenticate_method
22
+
23
+ def initialize
24
+ self.use_custom_user_model = USE_CUSTOM_USER_MODEL
25
+ self.custom_user_class = CUSTOM_USER_CLASS
26
+ self.custom_user_login_attr = CUSTOM_USER_LOGIN_ATTR
27
+ self.custom_user_password_attr = CUSTOM_USER_PASSWORD_ATTR
28
+ self.custom_authenticate_method = CUSTOM_AUTHENTICATE_METHOD
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,3 @@
1
+ module MyForum
2
+ VERSION = "0.0.1.beta1"
3
+ end
data/lib/my_forum.rb ADDED
@@ -0,0 +1,4 @@
1
+ require "my_forum/engine"
2
+
3
+ module MyForum
4
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :my_forum do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,7 @@
1
+ require 'rails_helper'
2
+
3
+ module MyForum
4
+ RSpec.describe PrivateMessagesController, type: :controller do
5
+
6
+ end
7
+ end
@@ -0,0 +1,76 @@
1
+ require 'rails_helper'
2
+
3
+ module MyForum
4
+ RSpec.describe UsersController, type: :controller do
5
+ routes { MyForum::Engine.routes }
6
+
7
+ describe 'Loggin in' do
8
+ it 'should login user by password' do
9
+ user = User.create!(login: 'demo', password: '12345678', email: 'demo@example.com')
10
+
11
+ post :signin, user: { login: 'demo', password: '12345678' }
12
+ expect(session[:user_id]).to eq(user.id)
13
+ expect(response).to redirect_to(root_path)
14
+ end
15
+
16
+ it 'should not login user if login or password incorrect' do
17
+ post :signin, user: { login: '', password: '' }
18
+ expect(response).to render_template(:signin)
19
+ expect(session[:user_id]).to eq(nil)
20
+
21
+ post :signin, user: { login: 'wrong', password: 'credentials' }
22
+ expect(response).to render_template(:signin)
23
+ expect(session[:user_id]).to eq(nil)
24
+ end
25
+ end
26
+
27
+ describe "#forgot_password" do
28
+ it 'should send new generated password for user' do
29
+ user = User.create!(login: 'demo', password: '12345678', email: 'demo@example.com')
30
+ session[:user_id] = user.id
31
+ expect(user.valid_password?('12345678')).to be true
32
+
33
+ post :forgot_password, user: { email: 'demo@example.com'}
34
+ expect(user.reload.valid_password?('12345678')).to be false
35
+
36
+ last_delivery = ActionMailer::Base.deliveries.last
37
+ new_password = last_delivery.text_part.body.decoded.split(' ').last
38
+ expect(user.reload.valid_password?(new_password)).to be true
39
+ end
40
+ end
41
+
42
+ describe "#edit" do
43
+ before :each do
44
+ @user = User.create!(login: 'demo', password: '12345678', email: 'demo@example.com')
45
+ session[:user_id] = @user.id
46
+ end
47
+
48
+ it 'should not change password' do
49
+ patch :update, id: @user.id, user: {email: 'abc@google.com', password: ''}
50
+ expect(@user.reload.valid_password?('12345678')).to be true
51
+ expect(@user.reload.email).to eq('abc@google.com')
52
+ end
53
+
54
+ it 'should not change password if old password not given' do
55
+ patch :update, id: @user.id, user: {email: 'abc@google.com', password: 'new_password'}
56
+ expect(@user.reload.valid_password?('new_password')).to be false
57
+ end
58
+
59
+ it 'should update user with password' do
60
+ expect(@user.reload.valid_password?('12345678')).to be true
61
+ patch :update, id: @user.id, user: {email: 'abc@google.com', password: '12345678', new_password: 'new_password'}
62
+ expect(@user.reload.valid_password?('new_password')).to be true
63
+ expect(@user.reload.email).to eq('abc@google.com')
64
+ end
65
+ end
66
+
67
+ describe "#create" do
68
+ it 'should create new user' do
69
+ post :create, user: {email: 'new_user@google.com', password: 'new_user_pass', login: 'new_user'}
70
+ user = User.find_by_email('new_user@google.com')
71
+ expect(user.login).to eq('new_user')
72
+ expect(user.valid_password?('new_user_pass')).to be true
73
+ end
74
+ end
75
+ end
76
+ 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 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
@@ -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', 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,23 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require(*Rails.groups)
6
+ require "my_forum"
7
+
8
+ module Dummy
9
+ class Application < Rails::Application
10
+ # Settings in config/environments/* take precedence over those specified here.
11
+ # Application configuration should go into files in config/initializers
12
+ # -- all .rb files in that directory are automatically loaded.
13
+
14
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
15
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
16
+ # config.time_zone = 'Central Time (US & Canada)'
17
+
18
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
19
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
20
+ # config.i18n.default_locale = :de
21
+ end
22
+ end
23
+
@@ -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
@@ -0,0 +1,78 @@
1
+ Rails.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
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both threaded web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on.
14
+ config.consider_all_requests_local = false
15
+ config.action_controller.perform_caching = true
16
+
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
+ # config.action_dispatch.rack_cache = true
21
+
22
+ # Disable Rails's static asset server (Apache or nginx will already do this).
23
+ config.serve_static_files = false
24
+
25
+ # Compress JavaScripts and CSS.
26
+ config.assets.js_compressor = :uglifier
27
+ # config.assets.css_compressor = :sass
28
+
29
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
30
+ config.assets.compile = false
31
+
32
+ # Generate digests for assets URLs.
33
+ config.assets.digest = true
34
+
35
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
36
+
37
+ # Specifies the header that your server uses for sending files.
38
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
39
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
40
+
41
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
42
+ # config.force_ssl = true
43
+
44
+ # Set to :debug to see everything in the log.
45
+ config.log_level = :info
46
+
47
+ # Prepend all log lines with the following tags.
48
+ # config.log_tags = [ :subdomain, :uuid ]
49
+
50
+ # Use a different logger for distributed setups.
51
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
52
+
53
+ # Use a different cache store in production.
54
+ # config.cache_store = :mem_cache_store
55
+
56
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
57
+ # config.action_controller.asset_host = "http://assets.example.com"
58
+
59
+ # Ignore bad email addresses and do not raise email delivery errors.
60
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
61
+ # config.action_mailer.raise_delivery_errors = false
62
+
63
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
64
+ # the I18n.default_locale when a translation cannot be found).
65
+ config.i18n.fallbacks = true
66
+
67
+ # Send deprecation notices to registered listeners.
68
+ config.active_support.deprecation = :notify
69
+
70
+ # Disable automatic flushing of the log to improve performance.
71
+ # config.autoflush_log = false
72
+
73
+ # Use default logging formatter so that PID and timestamp are not suppressed.
74
+ config.log_formatter = ::Logger::Formatter.new
75
+
76
+ # Do not dump schema after migrations.
77
+ config.active_record.dump_schema_after_migration = false
78
+ end