jinda 0.7.3 → 0.7.5.5
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.
- checksums.yaml +4 -4
- data/README.md +61 -42
- data/app/assets/stylesheets/images/gears.png +0 -0
- data/lib/generators/jinda/config_generator.rb +0 -1
- data/lib/generators/jinda/install_generator.rb +161 -133
- data/lib/generators/jinda/installer/gemfiles-org/custom_gems.rb +8 -0
- data/lib/generators/jinda/installer/gemfiles-org/dev_gems.rb +20 -0
- data/lib/generators/jinda/installer/gemfiles-org/runtime_gems.rb +30 -0
- data/lib/generators/jinda/installer/gemfiles-org/todo.md +3 -0
- data/lib/generators/jinda/installer/gems_install.rb +132 -0
- data/lib/generators/jinda/installer/test.rb +6 -0
- data/lib/generators/jinda/templates/README.md +2 -2
- data/lib/generators/jinda/templates/app/controllers/jinda_org/articles_controller.rb +3 -1
- data/lib/generators/jinda/templates/app/controllers/jinda_org/users_controller.rb +1 -0
- data/lib/generators/jinda/templates/app/views/articles/_report.haml +8 -0
- data/lib/generators/jinda/templates/app/views/articles/show.html.haml +20 -9
- data/lib/generators/jinda/templates/app/views/docs/doc_new/doc_form.html.erb +21 -15
- data/lib/generators/jinda/templates/app/views/users/user/enter_user.html.erb +2 -0
- data/lib/generators/jinda/templates/config/initializers/fix_mongoid_generator.rb +14 -0
- data/lib/generators/jinda/templates/spec/controllers/sessions_controller_spec.rb +7 -5
- data/lib/generators/jinda/templates/spec/features/userlogins_spec.rb +2 -2
- data/lib/generators/jinda/templates/spec/rails_helper.rb +0 -2
- data/lib/generators/jinda/templates/spec/spec_helper.rb +6 -3
- data/lib/generators/jinda/templates/spec/support/databasecleaner.rb +13 -0
- data/lib/jinda/themes.rb +10 -3
- data/lib/jinda/version.rb +1 -1
- data/lib/tasks/jinda.rake +14 -5
- metadata +26 -3
@@ -0,0 +1,20 @@
|
|
1
|
+
@dev_gems = Array.new
|
2
|
+
@dev_gems =
|
3
|
+
[
|
4
|
+
["shoulda"],
|
5
|
+
["rspec"],
|
6
|
+
["rspec-rails"],
|
7
|
+
["better_errors"],
|
8
|
+
["binding_of_caller"],
|
9
|
+
["pry-byebug"],
|
10
|
+
["factory_bot_rails"],
|
11
|
+
["database_cleaner"],
|
12
|
+
["guard"],
|
13
|
+
["guard-rspec"],
|
14
|
+
["guard-minitest"],
|
15
|
+
["capybara"],
|
16
|
+
["selenium-webdriver"],
|
17
|
+
["rb-fsevent"],
|
18
|
+
["valid_attribute"],
|
19
|
+
["faker"]
|
20
|
+
]
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# @runtime_gems = Array.new
|
2
|
+
@@runtime_gems =
|
3
|
+
[
|
4
|
+
["bson", "4.4.2"],
|
5
|
+
["maruku", "~> 0.7.3"],
|
6
|
+
["bcrypt"],
|
7
|
+
["rouge"],
|
8
|
+
["normalize-rails"],
|
9
|
+
["font-awesome-rails"],
|
10
|
+
["font-awesome-sass", "~> 5.12.0"],
|
11
|
+
["meta-tags"],
|
12
|
+
["jquery-turbolinks", "2.1.0"],
|
13
|
+
["mongo", "2.11.3"],
|
14
|
+
["turbolinks_render"],
|
15
|
+
["haml-rails", "~> 2.0.1"],
|
16
|
+
["haml", "~> 5.1", ">= 5.1.2"],
|
17
|
+
["mail"],
|
18
|
+
["prawn"],
|
19
|
+
["redcarpet"],
|
20
|
+
["oauth2", "1.4.4"],
|
21
|
+
["omniauth", "1.9.1"],
|
22
|
+
["omniauth-oauth2", "1.6.0"],
|
23
|
+
["omniauth-identity", "~> 1.1.1"],
|
24
|
+
["omniauth-facebook", "6.0.0"],
|
25
|
+
["omniauth-google-oauth2", "0.8.0"],
|
26
|
+
["dotenv-rails"],
|
27
|
+
["cloudinary", "1.13.2"],
|
28
|
+
["kaminari", "1.2.0"],
|
29
|
+
["jquery-rails", "4.3.5"]
|
30
|
+
]
|
@@ -0,0 +1,132 @@
|
|
1
|
+
def setup_gems
|
2
|
+
# # define required gems: jinda_gem, jinda_dev_gem
|
3
|
+
jinda_gem =
|
4
|
+
[
|
5
|
+
["bson", "4.4.2"],
|
6
|
+
["maruku", "~> 0.7.3"],
|
7
|
+
["bcrypt"],
|
8
|
+
["rouge"],
|
9
|
+
["normalize-rails"],
|
10
|
+
["font-awesome-rails"],
|
11
|
+
["font-awesome-sass", "~> 5.12.0"],
|
12
|
+
["meta-tags"],
|
13
|
+
["jquery-turbolinks", "2.1.0"],
|
14
|
+
["mongo", "2.11.3"],
|
15
|
+
["turbolinks_render"],
|
16
|
+
["haml-rails", "~> 2.0.1"],
|
17
|
+
["haml", "~> 5.1", ">= 5.1.2"],
|
18
|
+
["mail"],
|
19
|
+
["prawn"],
|
20
|
+
["redcarpet"],
|
21
|
+
["oauth2", "1.4.4"],
|
22
|
+
["omniauth", "1.9.1"],
|
23
|
+
["omniauth-oauth2", "1.6.0"],
|
24
|
+
["omniauth-identity", "~> 1.1.1"],
|
25
|
+
["omniauth-facebook", "6.0.0"],
|
26
|
+
["omniauth-google-oauth2", "0.8.0"],
|
27
|
+
["dotenv-rails"],
|
28
|
+
["cloudinary", "1.13.2"],
|
29
|
+
["kaminari", "1.2.0"],
|
30
|
+
["jquery-rails", "4.3.5"]
|
31
|
+
]
|
32
|
+
#
|
33
|
+
jinda_custom_gem =
|
34
|
+
[
|
35
|
+
["mongoid-paperclip", require: "mongoid_paperclip"],
|
36
|
+
["kaminari-mongoid", "1.0.1"],
|
37
|
+
["nokogiri", "~> 1.11.0"],
|
38
|
+
["mongoid", git: "git@github.com:kul1/mongoid-jinda.git"]
|
39
|
+
# ["mongoid", "~> 7.1.0"]
|
40
|
+
]
|
41
|
+
#
|
42
|
+
jinda_dev_gem =
|
43
|
+
[
|
44
|
+
["shoulda"],
|
45
|
+
["rspec"],
|
46
|
+
["rspec-rails"],
|
47
|
+
["better_errors"],
|
48
|
+
["binding_of_caller"],
|
49
|
+
["pry-byebug"],
|
50
|
+
["factory_bot_rails"],
|
51
|
+
["database_cleaner"],
|
52
|
+
["guard"],
|
53
|
+
["guard-rspec"],
|
54
|
+
["guard-minitest"],
|
55
|
+
["capybara"],
|
56
|
+
["selenium-webdriver"],
|
57
|
+
["rb-fsevent"],
|
58
|
+
["valid_attribute"],
|
59
|
+
["faker"]
|
60
|
+
]
|
61
|
+
|
62
|
+
# Check each jinda_gem and create new array if found one otherwise just create.
|
63
|
+
# Open Gemfile add gem if not exist
|
64
|
+
jinda_gem.each do |g|
|
65
|
+
unless (%x(gem list -e --no-versions #{g[0]})) == "#{g[0]}\n"
|
66
|
+
if g.count == 2
|
67
|
+
gem g[0], g[1]
|
68
|
+
else
|
69
|
+
gem g[0]
|
70
|
+
end
|
71
|
+
else
|
72
|
+
if g.count == 2
|
73
|
+
xgem_0 = %x(gem list -e #{g[0]})
|
74
|
+
unless xgem_0.include?(("#{g[1]}").gsub(/[~> ]/, ''))
|
75
|
+
# puts " Found existing #{xgem_0} in Gemfile or System, Please edit Gemfile", :red
|
76
|
+
puts " Found existing #{xgem_0} in Gemfile or System, Please edit Gemfile"
|
77
|
+
gem g[0], g[1]
|
78
|
+
else
|
79
|
+
# puts " Checking #{g[0]} found Ver. #{g[1]} already exist in Gemfile", :green
|
80
|
+
puts " Checking #{g[0]} found Ver. #{g[1]} already exist in Gemfile"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
# puts " SKIP adding #{g[0]} in Gemfile", :yellow
|
84
|
+
puts " SKIP adding #{g[0]} in Gemfile"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
# create list of gem in sub-group dev and test
|
89
|
+
jinda_dev_new = Array.new
|
90
|
+
jinda_dev_gem.each do |g|
|
91
|
+
unless (%x(gem list -e --no-versions #{g[0]})) == "#{g[0]}\n"
|
92
|
+
jinda_dev_new << g
|
93
|
+
else
|
94
|
+
# puts " #{g[0]} already exist in Gemfile", :yellow
|
95
|
+
puts " #{g[0]} already exist in Gemfile"
|
96
|
+
end
|
97
|
+
end
|
98
|
+
unless jinda_dev_new.count == 0
|
99
|
+
gem_group :development, :test do
|
100
|
+
jinda_dev_new.each do |n|
|
101
|
+
if n.count == 1
|
102
|
+
gem n[0]
|
103
|
+
else
|
104
|
+
gem n[0], n[1]
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
# create list of custom gem
|
111
|
+
jinda_custom_new = Array.new
|
112
|
+
jinda_custom_gem.each do |g|
|
113
|
+
# unless (%x(gem list -e --no-versions #{g[0]})) == "#{g[0]}\n"
|
114
|
+
unless File.read("Gemfile").include?("#{g[0]}, #{g[1]}")
|
115
|
+
jinda_custom_new << g
|
116
|
+
else
|
117
|
+
puts " #{g[0]} already exist in Gemfile", :yellow
|
118
|
+
puts " #{g[0]} already exist in Gemfile", :yellow
|
119
|
+
end
|
120
|
+
end
|
121
|
+
unless jinda_custom_new.count == 0
|
122
|
+
jinda_custom_new.each do |c|
|
123
|
+
# puts " Checking if #{c[0]} already exist in Gemfile", :yellow
|
124
|
+
puts " Checking if #{c[0]} already exist in Gemfile"
|
125
|
+
if c.count == 1
|
126
|
+
gem c[0]
|
127
|
+
else
|
128
|
+
gem c[0], c[1]
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
@@ -16,7 +16,7 @@ Rails Application Generator using Freemind
|
|
16
16
|
These versions works for sure but others may do.
|
17
17
|
|
18
18
|
* Ruby 2.7.0
|
19
|
-
* Rails 6.0.
|
19
|
+
* Rails 6.0.3
|
20
20
|
* MongoDB 6
|
21
21
|
* Freemind 1.0.1
|
22
22
|
|
@@ -36,7 +36,7 @@ app without ActiveRecord
|
|
36
36
|
|
37
37
|
## Add jinda to your Gemfile:
|
38
38
|
|
39
|
-
gem 'jinda'
|
39
|
+
gem 'jinda'
|
40
40
|
|
41
41
|
For Development (most updated)
|
42
42
|
|
@@ -15,7 +15,9 @@ class ArticlesController < ApplicationController
|
|
15
15
|
@article = Article.find(article_params)
|
16
16
|
@commentable = @article
|
17
17
|
@comments = @commentable.comments.desc(:created_at).page(params[:page]).per(10)
|
18
|
-
|
18
|
+
@user = User.find(@article.user_id)
|
19
|
+
@show = Hash.new
|
20
|
+
@show = {:article => @article, :comments => @comments, :user => @user}
|
19
21
|
prepare_meta_tags(title: @article.title,
|
20
22
|
description: @article.text,
|
21
23
|
keywords: @article.keywords)
|
@@ -9,6 +9,7 @@ class UsersController < ApplicationController
|
|
9
9
|
def update_user
|
10
10
|
# can't use session, current_ma_user inside jinda methods
|
11
11
|
$user.update_attribute :email, $xvars["enter_user"]["user"]["email"]
|
12
|
+
$user.update_attribute :image, $xvars["enter_user"]["user"]["image"]
|
12
13
|
end
|
13
14
|
def change_password
|
14
15
|
# check if old password correct
|
@@ -11,6 +11,9 @@
|
|
11
11
|
%table.table.no-margin
|
12
12
|
%thead
|
13
13
|
%tr
|
14
|
+
- unless current_ma_user.nil?
|
15
|
+
- if current_ma_user.role.include?"A"
|
16
|
+
%th Author
|
14
17
|
%th Title
|
15
18
|
%th Description
|
16
19
|
%th Created
|
@@ -18,7 +21,12 @@
|
|
18
21
|
%th Delete
|
19
22
|
%th Edit
|
20
23
|
- report.each do |article|
|
24
|
+
- user = User.find(article.user_id)
|
21
25
|
%tr
|
26
|
+
-# if current_ma_user.role.include?"A"
|
27
|
+
- unless current_ma_user.nil?
|
28
|
+
- if current_ma_user.role.include?"A"
|
29
|
+
%td= user.code
|
22
30
|
%td= link_to article.title, :controller=>"articles", :action=>"show", :article_id => article.id
|
23
31
|
%td= article.text.html_safe
|
24
32
|
%td= article.created_at.strftime('%m/%d/%Y')
|
@@ -1,23 +1,34 @@
|
|
1
|
-
- title @article
|
2
|
-
- description @article
|
3
|
-
- keywords @article
|
1
|
+
- title @show[:article][:title]
|
2
|
+
- description @show[:article][:text]
|
3
|
+
- keywords @show[:article][:keywords]
|
4
4
|
.container
|
5
5
|
%div.row::before
|
6
6
|
%div.col-md-12
|
7
7
|
.row-description
|
8
8
|
%h2.display-3.mt-5.pt-5
|
9
|
-
= @article
|
9
|
+
= @show[:article][:title]
|
10
10
|
= link_to image_tag('pencil.png', style:'border:none; float:right;', id: 'article_pen'), {controller: "articles", action: "edit", article_id: @article.id}, data: { confirm: "Please Confirm" }
|
11
|
+
%div.font-weight-light
|
12
|
+
by
|
13
|
+
%img.img-circle{:alt => "User Image", src: @show[:user][:image] }/
|
14
|
+
%div.font-weight-light
|
15
|
+
= @show[:user][:code]
|
16
|
+
%div.font-weight-light
|
17
|
+
= @show[:article][:created_at]
|
11
18
|
%hr
|
12
|
-
= @article
|
19
|
+
= @show[:article][:text]
|
13
20
|
%h4.row-body
|
14
|
-
= @article
|
21
|
+
= @show[:article][:body].html_safe
|
15
22
|
%hr
|
16
|
-
- @comments.each do |comment|
|
23
|
+
- @show[:comments].each do |comment|
|
17
24
|
%div#article-comment.ui-corner-all
|
18
25
|
.col-md-12
|
19
26
|
%div.small-box.bg-white.text-info
|
20
27
|
%div.inner
|
28
|
+
%div.font-weight-light
|
29
|
+
- user_image = get_user_image(comment.user_id)
|
30
|
+
%img.comment-user-image{:alt => "User Image", src: user_image}/
|
31
|
+
|
21
32
|
%div.font-weight-light
|
22
33
|
Author:
|
23
34
|
%b= comment.name if comment.name
|
@@ -30,9 +41,9 @@
|
|
30
41
|
%hr
|
31
42
|
%h4.col-md-12
|
32
43
|
Add a comment:
|
33
|
-
= form_with(model: [@article, Comment.new], local: true) do |f|
|
44
|
+
= form_with(model: [@show[:article], Comment.new], local: true) do |f|
|
34
45
|
.form-group
|
35
|
-
= f.hidden_field :article_id, :value => @article
|
46
|
+
= f.hidden_field :article_id, :value => @show[:article][:id]
|
36
47
|
.form-group
|
37
48
|
= f.label :body, "Comment"
|
38
49
|
.form-group
|
@@ -1,26 +1,32 @@
|
|
1
1
|
<%
|
2
2
|
doc = Jinda::Doc.new :issue_on=> Date.today, :process_at => Time.now
|
3
|
-
%>
|
3
|
+
%>
|
4
4
|
<%= fields_for doc do |f| %>
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
<div class="form-group">
|
6
|
+
<%= f.label :category, "Category" %>
|
7
|
+
<%= f.select :category, [["Book", "book"], ["Letter", "letter"], ["Brochure", "brochure"]] %>
|
8
|
+
</div>
|
9
|
+
<div class="form-group">
|
9
10
|
<%= f.label :issue_on, "Dated" %>
|
10
11
|
<%= f.date_field :issue_on, "blackDays"=>[0,6] %>
|
11
|
-
|
12
|
+
</div>
|
13
|
+
<div class="form-group">
|
12
14
|
<%= f.label :dscan, "Attached document" %>
|
15
|
+
</div>
|
16
|
+
<div class="form-group">
|
13
17
|
<%= f.file_field :dscan %>
|
14
|
-
|
15
|
-
|
18
|
+
</div>
|
19
|
+
<% end %>
|
20
|
+
<div class="form-group">
|
16
21
|
<%= label_tag :description, "Description" %>
|
17
22
|
<%= text_field_tag :description %>
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
23
|
+
</div>
|
24
|
+
<div class="form-group">
|
25
|
+
<%= label_tag :ma_display, "Display", :class=>"ui-input-text" %>
|
26
|
+
<%= select_tag :ma_display, options_for_select([['Yes', 'y'], ['No', 'n']],'y'), 'data-role'=>"slider" %>
|
27
|
+
</div>
|
28
|
+
<div class="form-group">
|
29
|
+
<%= label_tag :ma_display, "Display", :class=>"ui-input-text" %>
|
24
30
|
<%= label_tag :keywords, "Search Keywords" %>
|
25
31
|
<%= text_field_tag :keywords %>
|
26
|
-
|
32
|
+
</div>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/mongoid/config/config_generator'
|
3
|
+
|
4
|
+
if Gem::Version.new(Mongoid::VERSION) >= Gem::Version.new('7.3.0')
|
5
|
+
warn("You may need not this file: #{__FILE__}\nAfter https://github.com/mongodb/mongoid/pull/4953 is released.")
|
6
|
+
end
|
7
|
+
Mongoid::Generators::ConfigGenerator.class_eval do
|
8
|
+
def app_name
|
9
|
+
# Rails::Application.subclasses.first.parent.to_s.underscore
|
10
|
+
# No more Module#parent
|
11
|
+
# See https://github.com/rails/rails/commit/167b4153cac0069a21e0bb9689cb16f34f6abbaa
|
12
|
+
Rails::Application.subclasses.first.module_parent_name.underscore
|
13
|
+
end
|
14
|
+
end
|
@@ -22,14 +22,15 @@ describe SessionsController, type: :controller do
|
|
22
22
|
session[:user_id].should_not be_nil
|
23
23
|
end
|
24
24
|
|
25
|
-
it "should redirect the user to
|
25
|
+
it "should redirect the user to root_path " do
|
26
26
|
post :create, params: {provider: :google_oauth2}
|
27
|
-
response.should redirect_to
|
27
|
+
response.should redirect_to root_path
|
28
28
|
end
|
29
29
|
|
30
30
|
end
|
31
31
|
|
32
|
-
describe "#destroy", js: true do
|
32
|
+
#describe "#destroy", js: true do
|
33
|
+
describe "#destroy" do
|
33
34
|
before do
|
34
35
|
post :create, params: {provider: :google_oauth2}
|
35
36
|
end
|
@@ -49,7 +50,8 @@ describe SessionsController, type: :controller do
|
|
49
50
|
end
|
50
51
|
end
|
51
52
|
|
52
|
-
describe "Facebook" do
|
53
|
+
skip describe "Facebook" do
|
54
|
+
# skip or finish at config facebook
|
53
55
|
|
54
56
|
before do
|
55
57
|
@request.env['omniauth.auth'] = OmniAuth.config.mock_auth[:facebook]
|
@@ -71,7 +73,7 @@ describe SessionsController, type: :controller do
|
|
71
73
|
|
72
74
|
end
|
73
75
|
|
74
|
-
describe "#destroy"
|
76
|
+
describe "#destroy" do
|
75
77
|
before do
|
76
78
|
post :create, params: {provider: :facebook}
|
77
79
|
end
|
@@ -2,13 +2,13 @@ require 'rails_helper'
|
|
2
2
|
|
3
3
|
RSpec.feature "Userlogins", type: :feature do
|
4
4
|
scenario "Admin User Sign In" do
|
5
|
-
visit "/sessions/new"
|
5
|
+
skip visit "/sessions/new"
|
6
6
|
|
7
7
|
fill_in "User name", :with => "admin"
|
8
8
|
fill_in "Password", :with => "secret1"
|
9
9
|
click_button "Sign In"
|
10
10
|
|
11
|
-
|
11
|
+
xexpect(page).to have_text("My Articles")
|
12
12
|
end
|
13
13
|
|
14
14
|
scenario "Google User Sign In" do
|