fuck_comments 2.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +30 -0
- data/.ruby-gemset.example +1 -0
- data/.ruby-version.example +1 -0
- data/.rvmrc.example +1 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +338 -0
- data/Rakefile +1 -0
- data/app/assets/javascripts/the_comments.js.coffee +108 -0
- data/app/assets/javascripts/the_comments_manage.js.coffee +27 -0
- data/app/assets/stylesheets/the_comments.css.scss +248 -0
- data/app/controllers/_templates_/comments_controller.rb +44 -0
- data/app/controllers/concerns/the_comments/controller.rb +197 -0
- data/app/controllers/concerns/the_comments/view_token.rb +20 -0
- data/app/helpers/render_comments_tree_helper.rb +111 -0
- data/app/models/_templates_/comment.rb +38 -0
- data/app/models/concerns/the_comments/comment.rb +116 -0
- data/app/models/concerns/the_comments/comment_states.rb +80 -0
- data/app/models/concerns/the_comments/commentable.rb +69 -0
- data/app/models/concerns/the_comments/user.rb +56 -0
- data/app/views/the_comments/_tree.html.erb +3 -0
- data/app/views/the_comments/haml/_additional_info.html.haml +13 -0
- data/app/views/the_comments/haml/_comment.html.haml +1 -0
- data/app/views/the_comments/haml/_comment_body.html.haml +25 -0
- data/app/views/the_comments/haml/_comment_edit.html.haml +26 -0
- data/app/views/the_comments/haml/_form.html.haml +8 -0
- data/app/views/the_comments/haml/_guest_form.html.haml +22 -0
- data/app/views/the_comments/haml/_logined_form.html.haml +18 -0
- data/app/views/the_comments/haml/_manage_controls.html.haml +30 -0
- data/app/views/the_comments/haml/_sidebar.html.haml +9 -0
- data/app/views/the_comments/haml/_sidebar_admin.html.haml +12 -0
- data/app/views/the_comments/haml/_sidebar_backlink.html.haml +3 -0
- data/app/views/the_comments/haml/_sidebar_user.html.haml +29 -0
- data/app/views/the_comments/haml/_tree.html.haml +16 -0
- data/app/views/the_comments/haml/manage.html.haml +26 -0
- data/app/views/the_comments/slim/_additional_info.html.slim +13 -0
- data/app/views/the_comments/slim/_comment.html.slim +1 -0
- data/app/views/the_comments/slim/_comment_body.html.slim +24 -0
- data/app/views/the_comments/slim/_comment_edit.html.slim +26 -0
- data/app/views/the_comments/slim/_form.html.slim +8 -0
- data/app/views/the_comments/slim/_guest_form.html.slim +22 -0
- data/app/views/the_comments/slim/_logined_form.html.slim +18 -0
- data/app/views/the_comments/slim/_manage_controls.html.slim +30 -0
- data/app/views/the_comments/slim/_sidebar.html.slim +9 -0
- data/app/views/the_comments/slim/_sidebar_admin.html.slim +12 -0
- data/app/views/the_comments/slim/_sidebar_backlink.html.slim +3 -0
- data/app/views/the_comments/slim/_sidebar_user.html.slim +29 -0
- data/app/views/the_comments/slim/_tree.html.slim +16 -0
- data/app/views/the_comments/slim/index.html.slim +18 -0
- data/app/views/the_comments/slim/manage.html.slim +26 -0
- data/app/views/the_comments/slim/my_comments.html.slim +28 -0
- data/config/initializers/the_comments.rb +15 -0
- data/config/locales/en.yml +68 -0
- data/config/locales/ru.yml +71 -0
- data/config/routes.rb +38 -0
- data/db/migrate/20130101010101_the_comments_change_user.rb +18 -0
- data/db/migrate/20130101010102_the_comments_create_comments.rb +50 -0
- data/db/migrate/20130101010103_the_comments_change_commentable.rb +13 -0
- data/docs/admin_ui_installation.md +145 -0
- data/docs/advanced_installation.md +185 -0
- data/docs/comment_api.md +58 -0
- data/docs/commentable_api.md +59 -0
- data/docs/config_file.md +27 -0
- data/docs/content_preprocessors.md +73 -0
- data/docs/customazation_of_views.md +30 -0
- data/docs/denormalization_and_recent_comments.md +40 -0
- data/docs/documentation.md +29 -0
- data/docs/generators.md +74 -0
- data/docs/pagination.md +123 -0
- data/docs/routes.md +77 -0
- data/docs/screencast.jpg +0 -0
- data/docs/the_comments.jpg +0 -0
- data/docs/the_comments_view_1.gif +0 -0
- data/docs/the_comments_view_2.gif +0 -0
- data/docs/the_comments_view_3.gif +0 -0
- data/docs/the_comments_view_4.gif +0 -0
- data/docs/the_comments_view_5.gif +0 -0
- data/docs/user_api.md +75 -0
- data/docs/what_is_comcoms.md +63 -0
- data/docs/whats_wrong_with_other_gems.md +28 -0
- data/docs/where_is_example_application.md +37 -0
- data/gem_version.rb +3 -0
- data/lib/generators/the_comments/USAGE +44 -0
- data/lib/generators/the_comments/the_comments_generator.rb +56 -0
- data/lib/generators/the_comments/views_generator.rb +79 -0
- data/lib/the_comments/config.rb +39 -0
- data/lib/the_comments/version.rb +1 -0
- data/lib/the_comments.rb +27 -0
- data/spec/dummy_app/.gitignore +18 -0
- data/spec/dummy_app/.rspec +1 -0
- data/spec/dummy_app/Gemfile +43 -0
- data/spec/dummy_app/README.md +33 -0
- data/spec/dummy_app/Rakefile +6 -0
- data/spec/dummy_app/app/assets/images/.keep +0 -0
- data/spec/dummy_app/app/assets/javascripts/admin_panel.js +5 -0
- data/spec/dummy_app/app/assets/javascripts/application.js +16 -0
- data/spec/dummy_app/app/assets/stylesheets/admin_panel.css +3 -0
- data/spec/dummy_app/app/assets/stylesheets/app.css.scss +4 -0
- data/spec/dummy_app/app/assets/stylesheets/application.css +16 -0
- data/spec/dummy_app/app/controllers/application_controller.rb +7 -0
- data/spec/dummy_app/app/controllers/comments_controller.rb +28 -0
- data/spec/dummy_app/app/controllers/concerns/.keep +0 -0
- data/spec/dummy_app/app/controllers/posts_controller.rb +13 -0
- data/spec/dummy_app/app/controllers/users_controller.rb +7 -0
- data/spec/dummy_app/app/helpers/application_helper.rb +2 -0
- data/spec/dummy_app/app/mailers/.keep +0 -0
- data/spec/dummy_app/app/models/.keep +0 -0
- data/spec/dummy_app/app/models/comment.rb +32 -0
- data/spec/dummy_app/app/models/concerns/.keep +0 -0
- data/spec/dummy_app/app/models/post.rb +17 -0
- data/spec/dummy_app/app/models/user.rb +21 -0
- data/spec/dummy_app/app/views/layouts/admin.html.haml +25 -0
- data/spec/dummy_app/app/views/layouts/application.html.haml +20 -0
- data/spec/dummy_app/app/views/posts/index.html.haml +22 -0
- data/spec/dummy_app/app/views/posts/show.html.haml +7 -0
- data/spec/dummy_app/bin/bundle +3 -0
- data/spec/dummy_app/bin/rails +4 -0
- data/spec/dummy_app/bin/rake +4 -0
- data/spec/dummy_app/config/application.rb +23 -0
- data/spec/dummy_app/config/boot.rb +4 -0
- data/spec/dummy_app/config/database.yml +11 -0
- data/spec/dummy_app/config/environment.rb +5 -0
- data/spec/dummy_app/config/environments/development.rb +29 -0
- data/spec/dummy_app/config/environments/production.rb +80 -0
- data/spec/dummy_app/config/environments/test.rb +36 -0
- data/spec/dummy_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy_app/config/initializers/inflections.rb +16 -0
- data/spec/dummy_app/config/initializers/mime_types.rb +5 -0
- data/spec/dummy_app/config/initializers/secret_token.rb +12 -0
- data/spec/dummy_app/config/initializers/session_store.rb +3 -0
- data/spec/dummy_app/config/initializers/sorcery.rb +437 -0
- data/spec/dummy_app/config/initializers/the_comments.rb +15 -0
- data/spec/dummy_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy_app/config/locales/en.yml +23 -0
- data/spec/dummy_app/config/routes.rb +19 -0
- data/spec/dummy_app/config.ru +4 -0
- data/spec/dummy_app/db/migrate/20130712061503_sorcery_core.rb +16 -0
- data/spec/dummy_app/db/migrate/20130712065951_create_posts.rb +11 -0
- data/spec/dummy_app/db/migrate/20131027185332_change_user.the_comments_engine.rb +19 -0
- data/spec/dummy_app/db/migrate/20131027185333_create_comments.the_comments_engine.rb +51 -0
- data/spec/dummy_app/db/migrate/20131027185334_change_commentable.the_comments_engine.rb +14 -0
- data/spec/dummy_app/db/schema.rb +74 -0
- data/spec/dummy_app/db/seeds.rb +42 -0
- data/spec/dummy_app/lib/assets/.keep +0 -0
- data/spec/dummy_app/lib/tasks/.keep +0 -0
- data/spec/dummy_app/lib/tasks/app_bootstrap.rake +15 -0
- data/spec/dummy_app/log/.keep +0 -0
- data/spec/dummy_app/public/404.html +58 -0
- data/spec/dummy_app/public/422.html +58 -0
- data/spec/dummy_app/public/500.html +57 -0
- data/spec/dummy_app/public/favicon.ico +0 -0
- data/spec/dummy_app/public/robots.txt +5 -0
- data/spec/dummy_app/spec/factories/post.rb +6 -0
- data/spec/dummy_app/spec/factories/user.rb +6 -0
- data/spec/dummy_app/spec/models/user_counters_spec.rb +339 -0
- data/spec/dummy_app/spec/spec_helper.rb +29 -0
- data/spec/dummy_app/test/controllers/.keep +0 -0
- data/spec/dummy_app/test/fixtures/.keep +0 -0
- data/spec/dummy_app/test/helpers/.keep +0 -0
- data/spec/dummy_app/test/integration/.keep +0 -0
- data/spec/dummy_app/test/mailers/.keep +0 -0
- data/spec/dummy_app/test/models/.keep +0 -0
- data/spec/dummy_app/test/test_helper.rb +15 -0
- data/spec/dummy_app/vendor/assets/javascripts/.keep +0 -0
- data/spec/dummy_app/vendor/assets/stylesheets/.keep +0 -0
- data/the_comments.gemspec +23 -0
- data/views_converter.rb +16 -0
- metadata +332 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
← [documentation](documentation.md)
|
2
|
+
|
3
|
+
### What's wrong with other gems?
|
4
|
+
|
5
|
+
Take a look at [Ruby-Toolbox](https://www.ruby-toolbox.com/categories/rails_comments). What can we see?
|
6
|
+
|
7
|
+
* [Acts as commentable with threading](https://github.com/elight/acts_as_commentable_with_threading) - Where is the render helper for the tree? There is no helper! Am I supposed to write a render helper for the tree myself? Nooooo!!! I'm sorry, I can't use this gem.
|
8
|
+
* [acts_as_commentable](https://github.com/jackdempsey/acts_as_commentable) - I can see the code for models. But I can't see the code for controllers and views. Unfortunately, there is no threading. This isn't enough for me.
|
9
|
+
* [opinio](https://github.com/Draiken/opinio) - Better, but still no threading. I can do better!
|
10
|
+
* [has_threaded_comments](https://github.com/aarongough/has_threaded_comments) - A solid gem. Has model, controller and view helpers for tree rendering! **But** last activity was 2 years ago, it still needs a few features - I can do better.
|
11
|
+
|
12
|
+
### Why is TheComments better than other gems?
|
13
|
+
|
14
|
+
1. TheComments allows for threaded comments
|
15
|
+
2. **Only TheComments has special helper for tree rendering** (based on [TheSortableTree](https://github.com/the-teacher/the_sortable_tree)).
|
16
|
+
3. TheComments is designed to reduce database requests. Helpful for cache counters.
|
17
|
+
4. TheComments has a solution for [building Recent Comments](https://github.com/the-teacher/the_comments/blob/master/docs/denormalization_and_recent_comments.md) (for polymorphic relations)
|
18
|
+
5. TheComments is designed for text preprocessors (Textile, Markdown, Sanitize, Coderay etc.)
|
19
|
+
6. TheComments has an admin UI based on bootstrap 3
|
20
|
+
7. TheComments is an "all-in-one" solution.<br>
|
21
|
+
It has: Models and Controllers logic (via concerns), Generators, Views, Helper for fast Tree rendering and Admin UI.
|
22
|
+
8. If you have problems with TheComments, I'll try to help you via skype: **ilya.killich**
|
23
|
+
|
24
|
+
### TheComments based on:
|
25
|
+
|
26
|
+
1. [AwesomeNestedSet](https://github.com/collectiveidea/awesome_nested_set) - for comments threading
|
27
|
+
2. [TheSortableTree](https://github.com/the-teacher/the_sortable_tree) - for fast rendering of comments tree
|
28
|
+
3. [State Machine](https://github.com/pluginaweek/state_machine) - to provide easy and correct recalculation cache counters on states transitions
|
@@ -0,0 +1,37 @@
|
|
1
|
+
← [documentation](documentation.md)
|
2
|
+
|
3
|
+
### Dummy Application
|
4
|
+
|
5
|
+
TheComments repository contains a dummy application for development and testing.
|
6
|
+
|
7
|
+
It's here: [Dummy App](https://github.com/the-teacher/the_comments/tree/master/spec/dummy_app)
|
8
|
+
|
9
|
+
To run the dummy app:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
git clone https://github.com/the-teacher/the_comments.git
|
13
|
+
|
14
|
+
cd the_comments/spec/dummy_app/
|
15
|
+
|
16
|
+
bundle
|
17
|
+
|
18
|
+
rake db:bootstrap_and_seed
|
19
|
+
|
20
|
+
rails s -p 3000 -b localhost
|
21
|
+
```
|
22
|
+
|
23
|
+
### Run tests
|
24
|
+
|
25
|
+
To run the RSPEC tests:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
git clone https://github.com/the-teacher/the_comments.git
|
29
|
+
|
30
|
+
cd the_comments/spec/dummy_app/
|
31
|
+
|
32
|
+
bundle
|
33
|
+
|
34
|
+
rake db:bootstrap RAILS_ENV=test
|
35
|
+
|
36
|
+
rspec --format documentation
|
37
|
+
```
|
data/gem_version.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
Description:
|
2
|
+
TheComments: generators will copy files for organize comments tree in your web project
|
3
|
+
|
4
|
+
Usage: [bundle exec] rails g the_comments NAME
|
5
|
+
Usage: [bundle exec] rails g the_comments:views NAME
|
6
|
+
|
7
|
+
# This text:
|
8
|
+
> rails g the_comments --help
|
9
|
+
|
10
|
+
# Main generators:
|
11
|
+
> rails g the_comments install
|
12
|
+
|
13
|
+
This will create:
|
14
|
+
config/initializers/the_comments.rb
|
15
|
+
app/controllers/comments_controller.rb
|
16
|
+
app/models/comment.rb
|
17
|
+
|
18
|
+
# Controller generators:
|
19
|
+
> rails g the_comments controllers
|
20
|
+
|
21
|
+
This will create:
|
22
|
+
app/controllers/comments_controller.rb
|
23
|
+
|
24
|
+
# Model generators:
|
25
|
+
> rails g the_comments models
|
26
|
+
|
27
|
+
This will create:
|
28
|
+
app/models/comment.rb
|
29
|
+
|
30
|
+
# Config generators:
|
31
|
+
> rails g the_comments config
|
32
|
+
|
33
|
+
# Locals generators:
|
34
|
+
> rails g the_comments locales
|
35
|
+
|
36
|
+
# View Generators:
|
37
|
+
> rails g the_comments:views js
|
38
|
+
> rails g the_comments:views css
|
39
|
+
> rails g the_comments:views assets
|
40
|
+
> rails g the_comments:views helper
|
41
|
+
> rails g the_comments:views views
|
42
|
+
|
43
|
+
# Migrations:
|
44
|
+
> rake the_comments_engine:install:migrations
|
@@ -0,0 +1,56 @@
|
|
1
|
+
class TheCommentsGenerator < Rails::Generators::NamedBase
|
2
|
+
source_root File.expand_path('../templates', __FILE__)
|
3
|
+
# argument :xname, type: :string, default: :xname
|
4
|
+
|
5
|
+
# > rails g the_comments NAME
|
6
|
+
def generate_controllers
|
7
|
+
case gen_name
|
8
|
+
when 'locales'
|
9
|
+
cp_locales
|
10
|
+
when 'models'
|
11
|
+
cp_models
|
12
|
+
when 'controllers'
|
13
|
+
cp_controllers
|
14
|
+
when 'config'
|
15
|
+
cp_config
|
16
|
+
when 'install'
|
17
|
+
cp_config
|
18
|
+
cp_models
|
19
|
+
cp_controllers
|
20
|
+
else
|
21
|
+
puts 'TheComments Generator - wrong Name'
|
22
|
+
puts 'Try to use [ install | config | controllers | models ]'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def root_path; TheComments::Engine.root; end
|
29
|
+
|
30
|
+
def gen_name
|
31
|
+
name.to_s.downcase
|
32
|
+
end
|
33
|
+
|
34
|
+
def cp_config
|
35
|
+
copy_file "#{root_path}/config/initializers/the_comments.rb",
|
36
|
+
"config/initializers/the_comments.rb"
|
37
|
+
end
|
38
|
+
|
39
|
+
def cp_models
|
40
|
+
copy_file "#{root_path}/app/models/_templates_/comment.rb",
|
41
|
+
"app/models/comment.rb"
|
42
|
+
end
|
43
|
+
|
44
|
+
def cp_controllers
|
45
|
+
copy_file "#{root_path}/app/controllers/_templates_/comments_controller.rb",
|
46
|
+
"app/controllers/comments_controller.rb"
|
47
|
+
end
|
48
|
+
|
49
|
+
def cp_locales
|
50
|
+
copy_file "#{root_path}/config/locales/en.yml",
|
51
|
+
"config/locales/en.the_comments.yml"
|
52
|
+
|
53
|
+
copy_file "#{root_path}/config/locales/ru.yml",
|
54
|
+
"config/locales/ru.the_comments.yml"
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module TheComments
|
2
|
+
module Generators
|
3
|
+
class ViewsGenerator < Rails::Generators::NamedBase
|
4
|
+
source_root TheComments::Engine.root
|
5
|
+
|
6
|
+
def self.banner
|
7
|
+
<<-BANNER.chomp
|
8
|
+
|
9
|
+
USAGE: [bundle exec] rails g the_comments:views NAME
|
10
|
+
|
11
|
+
> rails g the_comments:views js
|
12
|
+
> rails g the_comments:views css
|
13
|
+
> rails g the_comments:views assets
|
14
|
+
|
15
|
+
> rails g the_comments:views views
|
16
|
+
> rails g the_comments:views helper
|
17
|
+
|
18
|
+
> rails g the_comments:views all
|
19
|
+
|
20
|
+
BANNER
|
21
|
+
end
|
22
|
+
|
23
|
+
def copy_sortable_tree_files
|
24
|
+
copy_gem_files
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def param_name
|
30
|
+
name.downcase
|
31
|
+
end
|
32
|
+
|
33
|
+
def copy_gem_files
|
34
|
+
case param_name
|
35
|
+
when 'js'
|
36
|
+
js_copy
|
37
|
+
when 'css'
|
38
|
+
css_copy
|
39
|
+
when 'assets'
|
40
|
+
js_copy; css_copy
|
41
|
+
when 'views'
|
42
|
+
views_copy
|
43
|
+
when 'helper'
|
44
|
+
helper_copy
|
45
|
+
when 'all'
|
46
|
+
js_copy
|
47
|
+
css_copy
|
48
|
+
views_copy
|
49
|
+
helper_copy
|
50
|
+
else
|
51
|
+
puts 'TheComments View Generator - wrong Name'
|
52
|
+
puts "Wrong params - use only [ js | css | assets | views | helper | all ] values"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def js_copy
|
57
|
+
f1 = "app/assets/javascripts/the_comments.js.coffee"
|
58
|
+
f2 = "app/assets/javascripts/the_comments_manage.js.coffee"
|
59
|
+
copy_file f1, f1
|
60
|
+
copy_file f2, f2
|
61
|
+
end
|
62
|
+
|
63
|
+
def css_copy
|
64
|
+
f1 = "app/assets/stylesheets/the_comments.css.scss"
|
65
|
+
copy_file f1, f1
|
66
|
+
end
|
67
|
+
|
68
|
+
def views_copy
|
69
|
+
d1 = "app/views/the_comments"
|
70
|
+
directory d1, d1
|
71
|
+
end
|
72
|
+
|
73
|
+
def helper_copy
|
74
|
+
f1 = "app/helpers/render_comments_tree_helper.rb"
|
75
|
+
copy_file f1, f1
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module TheComments
|
2
|
+
def self.configure(&block)
|
3
|
+
yield @config ||= TheComments::Configuration.new
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.config
|
7
|
+
@config
|
8
|
+
end
|
9
|
+
|
10
|
+
# Configuration class
|
11
|
+
class Configuration
|
12
|
+
include ActiveSupport::Configurable
|
13
|
+
|
14
|
+
config_accessor :max_reply_depth,
|
15
|
+
:tolerance_time,
|
16
|
+
:default_state,
|
17
|
+
:default_owner_state,
|
18
|
+
:empty_inputs,
|
19
|
+
:default_title,
|
20
|
+
:template_engine,
|
21
|
+
:empty_trap_protection,
|
22
|
+
:tolerance_time_protection,
|
23
|
+
:cookie_domain
|
24
|
+
end
|
25
|
+
|
26
|
+
configure do |config|
|
27
|
+
config.max_reply_depth = 3
|
28
|
+
config.tolerance_time = 5
|
29
|
+
config.default_state = :draft
|
30
|
+
config.default_owner_state = :published
|
31
|
+
config.empty_inputs = [:message]
|
32
|
+
config.default_title = 'Undefined title'
|
33
|
+
config.template_engine = :haml
|
34
|
+
|
35
|
+
config.empty_trap_protection = true
|
36
|
+
config.tolerance_time_protection = true
|
37
|
+
config.cookie_domain = :all
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require File.expand_path('../../../gem_version', __FILE__)
|
data/lib/the_comments.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'state_machine'
|
2
|
+
require 'state_machine/version'
|
3
|
+
|
4
|
+
require 'the_simple_sort'
|
5
|
+
require 'the_sortable_tree'
|
6
|
+
|
7
|
+
require 'the_comments/config'
|
8
|
+
require 'the_comments/version'
|
9
|
+
|
10
|
+
module TheComments
|
11
|
+
COMMENTS_COOKIES_TOKEN = 'JustTheCommentsCookies'
|
12
|
+
|
13
|
+
class Engine < Rails::Engine
|
14
|
+
config.autoload_paths += Dir["#{config.root}/app/controllers/concerns/**/"]
|
15
|
+
config.autoload_paths += Dir["#{config.root}/app/models/concerns/**/"]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# Loading of concerns
|
20
|
+
_root_ = File.expand_path('../../', __FILE__)
|
21
|
+
require "#{_root_}/config/routes.rb"
|
22
|
+
|
23
|
+
if StateMachine::VERSION.to_f <= 1.2
|
24
|
+
module StateMachine::Integrations::ActiveModel
|
25
|
+
public :around_validation
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
6
|
+
|
7
|
+
# Ignore bundler config.
|
8
|
+
/.bundle
|
9
|
+
.rvmrc
|
10
|
+
|
11
|
+
# Ignore the default SQLite database.
|
12
|
+
/db/*.db
|
13
|
+
/db/*.sqlite3
|
14
|
+
/db/*.sqlite3-journal
|
15
|
+
|
16
|
+
# Ignore all logfiles and tempfiles.
|
17
|
+
/log/*.log
|
18
|
+
/tmp
|
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
@@ -0,0 +1,43 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Base gems
|
4
|
+
gem 'rails', '4.1.4 ' #github: 'rails/rails', branch: 'master'
|
5
|
+
gem 'sqlite3'
|
6
|
+
|
7
|
+
gem 'jquery-rails'
|
8
|
+
gem 'jbuilder', '~> 1.2'
|
9
|
+
|
10
|
+
gem 'uglifier', '>= 1.3.0'
|
11
|
+
gem 'sass-rails', '~> 4.0.0'
|
12
|
+
gem 'coffee-rails', '~> 4.0.0'
|
13
|
+
|
14
|
+
gem 'thin', group: [:development]
|
15
|
+
# gem 'therubyracer', platforms: :ruby
|
16
|
+
gem 'sdoc', require: false, group: [:doc]
|
17
|
+
|
18
|
+
# App gems
|
19
|
+
gem 'haml'
|
20
|
+
gem 'sorcery'
|
21
|
+
gem 'kaminari'
|
22
|
+
gem 'haml-rails'
|
23
|
+
|
24
|
+
# TheComments requires
|
25
|
+
gem 'the_comments',
|
26
|
+
path: '../../'
|
27
|
+
|
28
|
+
gem 'bootstrap-sass',
|
29
|
+
github: 'thomas-mcdonald/bootstrap-sass'
|
30
|
+
|
31
|
+
gem 'awesome_nested_set',
|
32
|
+
git: 'https://github.com/collectiveidea/awesome_nested_set.git',
|
33
|
+
branch: 'master'
|
34
|
+
|
35
|
+
# Test gems
|
36
|
+
group :development, :test do
|
37
|
+
gem 'faker'
|
38
|
+
gem 'factory_girl'
|
39
|
+
gem "factory_girl_rails"
|
40
|
+
gem 'rspec-rails', '~> 2.0'
|
41
|
+
|
42
|
+
# gem 'database_cleaner'
|
43
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
## TheComments Dummy App
|
2
|
+
|
3
|
+
### First step
|
4
|
+
|
5
|
+
```
|
6
|
+
git clone https://github.com/the-teacher/the_comments.git
|
7
|
+
|
8
|
+
cd the_comments/spec/dummy_app/
|
9
|
+
|
10
|
+
bundle
|
11
|
+
```
|
12
|
+
|
13
|
+
### App start
|
14
|
+
|
15
|
+
```
|
16
|
+
rake db:bootstrap_and_seed
|
17
|
+
|
18
|
+
rails s -p 3000 -b localhost
|
19
|
+
```
|
20
|
+
|
21
|
+
Browser
|
22
|
+
|
23
|
+
```
|
24
|
+
http://localhost:3000/
|
25
|
+
```
|
26
|
+
|
27
|
+
### Tests start
|
28
|
+
|
29
|
+
```
|
30
|
+
rake db:bootstrap RAILS_ENV=test
|
31
|
+
|
32
|
+
rspec --format documentation
|
33
|
+
```
|
File without changes
|