jinda 0.6.0 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e04cd357d30062a6b765e150ef9ed68f727431fd8aa38d95b89bc6c6724adff
4
- data.tar.gz: 82d27af5714824521aca90a0250177a615cfb4a7c75c7d925f3d9d6b9dddf876
3
+ metadata.gz: '042968bc00874bfb253e1896812521a4805d587be5470ea5f8149a32bb301e88'
4
+ data.tar.gz: 8d1cf09efbefda3e8beb9d7023d7aee88cafe86a22ee0d4b9de2356cd494a8a5
5
5
  SHA512:
6
- metadata.gz: 8764b341b8ff83145342f8bef2463deb743f9e357db9174ed0459e017433ceb1d791ec267fbd90a66aae97eacc13f90cfeab3da9a60f00872f97f53e8eb55002
7
- data.tar.gz: 9d96d1c74a3a99822de78c346537fc744a15fdeb6cd9c6a414011cf8b80f20751b35dc6143bb737dd6c5a8ce8b05969c17b768872306bb0dbdda2b293f412327
6
+ metadata.gz: d3090a6c9d17d67bc8f4a01f5274703346104a5fd30020dd8176ed8a56c998c046e290af3fa1b1499f89da8e7472df86ff81220a83bef65962b6918653e9bfc7
7
+ data.tar.gz: fa18290337837f65b553de8a27901a706ea7b6086b884c958f0158f91d3dd872549390b9c9f8d7d574e91fd3226df761ee419cc0f8f16212709f6733e5598325
data/README.md CHANGED
@@ -40,7 +40,7 @@ app without ActiveRecord
40
40
 
41
41
  ## Add jinda to your Gemfile:
42
42
 
43
- gem 'jinda', '~> 0.6.0'
43
+ gem 'jinda', '~> 0.6.2'
44
44
 
45
45
  For Development (most updated)
46
46
 
@@ -19,7 +19,7 @@ module Jinda
19
19
  gem 'bson', '4.4.2'
20
20
  gem 'mongoid', '7.1.0.rc0'
21
21
  gem 'turbolinks_render'
22
- gem 'nokogiri', '1.10.9'
22
+ gem 'nokogiri', '1.10.10'
23
23
  gem 'haml', '~> 5.1', '>= 5.1.2'
24
24
  gem 'haml-rails', '~> 2.0.1'
25
25
  gem 'mail'
@@ -0,0 +1,24 @@
1
+ # https://docs.docker.com/compose/rails/
2
+ FROM ruby:2.6.3
3
+ RUN apt-get update -qq
4
+ RUN mkdir /myapp
5
+ WORKDIR /myapp
6
+ COPY Gemfile /myapp/Gemfile
7
+ # COPY Gemfile.lock /myapp/Gemfile.lock
8
+
9
+ RUN bundle install
10
+ COPY . /myapp
11
+
12
+ # Set Rails environment to production
13
+ # ENV RAILS_ENV production
14
+ # RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
15
+ # && apt install -y nodejs
16
+
17
+ # Add a script to be executed every time the container starts.
18
+ COPY entrypoint.sh /usr/bin/
19
+ RUN chmod +x /usr/bin/entrypoint.sh
20
+ ENTRYPOINT ["entrypoint.sh"]
21
+ EXPOSE 3000
22
+
23
+ # Start the main process.
24
+ CMD ["rails", "server", "-b", "0.0.0.0"]
@@ -12,8 +12,10 @@ class ArticlesController < ApplicationController
12
12
  end
13
13
 
14
14
  def show
15
- @article = Article.find(params[:article_id])
16
- @comments = @article.comments.desc(:created_at).page(params[:page]).per(10)
15
+ @article = Article.find(article_params)
16
+ @commentable = @article
17
+ @comments = @commentable.comments.desc(:created_at).page(params[:page]).per(10)
18
+
17
19
  prepare_meta_tags(title: @article.title,
18
20
  description: @article.text,
19
21
  keywords: @article.keywords)
@@ -92,7 +94,7 @@ class ArticlesController < ApplicationController
92
94
  end
93
95
 
94
96
  def article_params
95
- params[:article_id]
97
+ [params[:article_id], params[:id]].detect { |p| !p.nil? }
96
98
  end
97
99
 
98
100
  def load_edit_article
@@ -1,19 +1,31 @@
1
1
  class CommentsController < ApplicationController
2
+ before_action :comment_params, only: [:create]
3
+ before_action :load_commmentable
4
+
5
+ def index
6
+ @comments = @commentable.comments
7
+ end
2
8
 
3
9
  def create
4
- @article = Article.find(article_params["article_id"])
5
- @comment = @article.comments.new(comment_params)
10
+ @comment = @commentable.comments.new comment_params
6
11
  @comment.save!
7
- redirect_to controller: 'articles', action: 'show', article_id: @article
12
+ redirect_to [@commentable], notice: "Comment created"
8
13
  end
9
14
 
10
15
  private
11
16
 
12
- def article_params
13
- params.require(:comment).permit(:article_id)
14
- end
17
+ # def article_params
18
+ # params.require(:comment).permit(:article_id)
19
+ # end
15
20
 
16
21
  def comment_params
17
- params.require(:comment).permit(:body, :article_id, :user_id)
22
+ resource = request.path.split('/')[1]
23
+ commentable_id = "#{resource.singularize.to_sym}_id" #:article_id
24
+ params.require(:comment).permit(:body, :user_id, commentable_id.to_sym)
18
25
  end
26
+
27
+ def load_commmentable
28
+ resource, id = request.path.split('/')[1,2]
29
+ @commentable = resource.singularize.classify.constantize.find(id)
30
+ end
19
31
  end
@@ -25,7 +25,7 @@
25
25
  </node>
26
26
  </node>
27
27
  </node>
28
- <node CREATED="1275752678377" ID="ID_1348489452" MODIFIED="1588883079396" TEXT="admins:Admin">
28
+ <node CREATED="1275752678377" FOLDED="true" ID="ID_1348489452" MODIFIED="1602251558474" TEXT="admins:Admin">
29
29
  <node CREATED="1275752688167" ID="ID_229996461" MODIFIED="1275752690948" TEXT="role:a"/>
30
30
  <node CREATED="1282722836614" ID="ID_1213363124" MODIFIED="1330477902602" TEXT="edit_role:edit user role">
31
31
  <node CREATED="1282722862918" ID="ID_1190117882" MODIFIED="1330477922159" TEXT="select_user:select user">
@@ -44,7 +44,7 @@
44
44
  <node CREATED="1275790679363" ID="ID_829325467" MODIFIED="1511159696044" TEXT="link: logs: /jinda/logs"/>
45
45
  <node CREATED="1507573166973" ID="ID_351025910" MODIFIED="1511159700908" TEXT="link: docs: /jinda/doc"/>
46
46
  </node>
47
- <node CREATED="1273706796854" ID="ID_1003882979" MODIFIED="1588964401951" TEXT="devs: Developer">
47
+ <node CREATED="1273706796854" FOLDED="true" ID="ID_1003882979" MODIFIED="1602251560242" TEXT="devs: Developer">
48
48
  <node CREATED="1275373154914" ID="ID_340725299" MODIFIED="1275373158632" TEXT="role:d"/>
49
49
  <node CREATED="1275788317299" ID="ID_716276608" MODIFIED="1511159716471" TEXT="link: error_logs: /jinda/error_logs"/>
50
50
  <node CREATED="1275788317299" ID="ID_1570419198" MODIFIED="1587858894833" TEXT="link: notice_logs: /jinda/notice_logs"/>
@@ -87,7 +87,7 @@
87
87
  </node>
88
88
  </node>
89
89
  </node>
90
- <node CREATED="1493393619430" ID="ID_554831343" MODIFIED="1592926786394" TEXT="notes: Notes">
90
+ <node CREATED="1493393619430" FOLDED="true" ID="ID_554831343" MODIFIED="1602251562724" TEXT="notes: Notes">
91
91
  <node CREATED="1493489768542" ID="ID_737469676" MODIFIED="1589772615102" TEXT="link:My Notes: /notes/my">
92
92
  <node CREATED="1493490295677" ID="ID_514416082" MODIFIED="1493490302239" TEXT="role:m"/>
93
93
  </node>
@@ -151,7 +151,7 @@
151
151
  </node>
152
152
  </node>
153
153
  </node>
154
- <node CREATED="1493393619430" ID="ID_328863650" MODIFIED="1592785024002" TEXT="articles: Article">
154
+ <node CREATED="1493393619430" FOLDED="true" ID="ID_328863650" MODIFIED="1602251538059" TEXT="articles: Article">
155
155
  <node CREATED="1493419096527" ID="ID_1521905276" MODIFIED="1493478060121" TEXT="link: All Articles: /articles"/>
156
156
  <node CREATED="1493489768542" FOLDED="true" ID="ID_1376361427" MODIFIED="1589757167952" TEXT="link: My article: /articles/my">
157
157
  <node CREATED="1493490295677" ID="ID_628476988" MODIFIED="1493490302239" TEXT="role:m"/>
@@ -199,7 +199,7 @@
199
199
  </node>
200
200
  </node>
201
201
  </node>
202
- <node CREATED="1493664700564" ID="ID_704959130" MODIFIED="1592950100226" TEXT="comments: Comment">
202
+ <node CREATED="1493664700564" FOLDED="true" ID="ID_704959130" MODIFIED="1602251564023" TEXT="comments: Comment">
203
203
  <icon BUILTIN="button_cancel"/>
204
204
  <node CREATED="1493665155709" ID="ID_1973520751" MODIFIED="1591392666652" TEXT="new_comment: New Comment">
205
205
  <icon BUILTIN="button_cancel"/>
@@ -281,7 +281,7 @@
281
281
  <node CREATED="1273819855875" ID="ID_1429503284" MODIFIED="1330477311102" TEXT="a: admin"/>
282
282
  <node CREATED="1273819859775" ID="ID_568365839" MODIFIED="1330477315009" TEXT="d: developer"/>
283
283
  </node>
284
- <node CREATED="1273819456867" FOLDED="true" ID="ID_1677010054" MODIFIED="1591392810437" POSITION="left" TEXT="models">
284
+ <node CREATED="1273819456867" ID="ID_1677010054" MODIFIED="1602123498759" POSITION="left" TEXT="models">
285
285
  <node CREATED="1292122118499" FOLDED="true" ID="ID_1957754752" MODIFIED="1493705885123" TEXT="person">
286
286
  <node CREATED="1292122135809" ID="ID_1617970069" MODIFIED="1332878659106" TEXT="fname"/>
287
287
  <node CREATED="1292122150362" ID="ID_1200135538" MODIFIED="1332878662388" TEXT="lname"/>
@@ -305,7 +305,7 @@
305
305
  <node CREATED="1292243471343" ID="ID_1859608350" MODIFIED="1310195256623" TEXT="lat: float"/>
306
306
  <node CREATED="1292243477436" ID="ID_48497260" MODIFIED="1310195262534" TEXT="lng: float"/>
307
307
  </node>
308
- <node CREATED="1493418879485" FOLDED="true" ID="ID_1995497233" MODIFIED="1583097163789" TEXT="article">
308
+ <node CREATED="1493418879485" ID="ID_1995497233" MODIFIED="1602529325998" TEXT="article">
309
309
  <node CREATED="1493418891110" ID="ID_364756011" MODIFIED="1493418905253" TEXT="title"/>
310
310
  <node CREATED="1493418906868" ID="ID_1676483995" MODIFIED="1493418911919" TEXT="text"/>
311
311
  <node CREATED="1493487131376" ID="ID_1334057464" MODIFIED="1538328284823" TEXT="belongs_to :user, :class_name =&gt; &quot;User&quot;">
@@ -320,18 +320,6 @@
320
320
  <node CREATED="1494181636998" ID="ID_229502630" MODIFIED="1494181660419" TEXT="body"/>
321
321
  <node CREATED="1497913676275" ID="ID_404103076" MODIFIED="1497913685065" TEXT="keywords"/>
322
322
  </node>
323
- <node CREATED="1493418915637" FOLDED="true" ID="ID_429078131" MODIFIED="1583097162517" TEXT="comment">
324
- <node CREATED="1493418939760" ID="ID_1251093062" MODIFIED="1493418943423" TEXT="body"/>
325
- <node CREATED="1493418945686" ID="ID_911071644" MODIFIED="1493418986711" TEXT="belongs_to :article">
326
- <icon BUILTIN="edit"/>
327
- </node>
328
- <node CREATED="1493643129947" ID="ID_588013696" MODIFIED="1493643146424" TEXT="belongs_to :user">
329
- <icon BUILTIN="edit"/>
330
- </node>
331
- <node CREATED="1493718512191" ID="ID_173203253" MODIFIED="1493718583874" TEXT="validates :body, :user_id, :article_id, presence: true">
332
- <icon BUILTIN="edit"/>
333
- </node>
334
- </node>
335
323
  <node CREATED="1494040082403" FOLDED="true" ID="ID_864577403" MODIFIED="1583097161145" TEXT="picture">
336
324
  <node CREATED="1494040091583" ID="ID_679208099" MODIFIED="1494040119098" TEXT="picture"/>
337
325
  <node CREATED="1494040120208" ID="ID_1266154874" MODIFIED="1494040125130" TEXT="description"/>
@@ -361,6 +349,21 @@
361
349
  <icon BUILTIN="edit"/>
362
350
  </node>
363
351
  </node>
352
+ <node CREATED="1493418915637" ID="ID_429078131" MODIFIED="1602591443455" TEXT="comment">
353
+ <node CREATED="1493418939760" ID="ID_1251093062" MODIFIED="1493418943423" TEXT="body"/>
354
+ <node CREATED="1493418945686" ID="ID_911071644" MODIFIED="1602529513657" TEXT="belongs_to :article, :class_name =&gt; &quot;Article&quot; ">
355
+ <icon BUILTIN="edit"/>
356
+ </node>
357
+ <node CREATED="1493643129947" ID="ID_588013696" MODIFIED="1602110865206" TEXT="belongs_to :user, :class_name =&gt; &quot;User&quot; ">
358
+ <icon BUILTIN="edit"/>
359
+ </node>
360
+ <node CREATED="1601847760278" ID="ID_1288333428" MODIFIED="1602591549062" TEXT="belongs_to :commentable, polymorphic: true ">
361
+ <icon BUILTIN="edit"/>
362
+ </node>
363
+ <node CREATED="1602591560333" ID="ID_598892151" MODIFIED="1602592677709" TEXT="index({ commentable_id: 1, commentable_type: 1}) ">
364
+ <icon BUILTIN="edit"/>
365
+ </node>
366
+ </node>
364
367
  </node>
365
368
  </node>
366
369
  </map>
@@ -4,8 +4,10 @@ class Comment
4
4
  # jinda begin
5
5
  include Mongoid::Timestamps
6
6
  field :body, :type => String
7
- belongs_to :article
8
- belongs_to :user, :class_name => "User"
9
- validates :body, :user_id, :article_id, presence: true
7
+ belongs_to :article, :class_name => "Article"
8
+ belongs_to :user, :class_name => "User"
9
+ belongs_to :job, :class_name => "Job"
10
+ belongs_to :commentable, polymorphic: true
11
+ index({ commentable_id: 1, commentable_type: 1})
10
12
  # jinda end
11
13
  end
@@ -17,7 +17,8 @@
17
17
  -#
18
18
  - if login?
19
19
  %h3 Add a comment:
20
- = form_for([@comment, @article.comments.build]) do |f|
20
+ =# form_for([@comment, @article.comments.build]) do |f|
21
+ = form_with(model: [@article, Comment.new], local: true) do |f|
21
22
  = f.hidden_field :article_id, :value => @article.id
22
23
  = f.label :body, "Comment"
23
24
  = f.text_area :body
@@ -33,7 +33,7 @@
33
33
  %div.inner
34
34
  %b Installation
35
35
  %ul
36
- %li add gem 'jinda', '0.5.8' to Gemfile then $ bundle
36
+ %li add gem 'jinda', '0.6.5' to Gemfile then $ bundle
37
37
  %li rails generate jinda:install, then bundle
38
38
  %li rails generate jinda:config
39
39
  %li rails jinda:seed, will create initial user:password admin:secret
@@ -0,0 +1,182 @@
1
+ development:
2
+ # Configure available database clients. (required)
3
+ clients:
4
+ # Defines the default client. (required)
5
+ default:
6
+ # Mongoid can connect to a URI accepted by the driver:
7
+ # uri: mongodb://user:password@mongodb.domain.com:27017/shop263603_development
8
+
9
+ # Otherwise define the parameters separately.
10
+ # This defines the name of the default database that Mongoid can connect to.
11
+ # (required).
12
+ database: shop263603_development
13
+ # Provides the hosts the default client can connect to. Must be an array
14
+ # of host:port pairs. (required)
15
+ hosts:
16
+ # - localhost:27017
17
+ - mongodb
18
+ options:
19
+ # Note that all options listed below are Ruby driver client options (the mongo gem).
20
+ # Please refer to the driver documentation of the version of the mongo gem you are using
21
+ # for the most up-to-date list of options.
22
+ #
23
+ # Change the default write concern. (default = { w: 1 })
24
+ # write:
25
+ # w: 1
26
+
27
+ # Change the default read preference. Valid options for mode are: :secondary,
28
+ # :secondary_preferred, :primary, :primary_preferred, :nearest
29
+ # (default: primary)
30
+ # read:
31
+ # mode: :secondary_preferred
32
+ # tag_sets:
33
+ # - use: web
34
+
35
+ # The name of the user for authentication.
36
+ # user: 'user'
37
+
38
+ # The password of the user for authentication.
39
+ # password: 'password'
40
+
41
+ # The user's database roles.
42
+ # roles:
43
+ # - 'dbOwner'
44
+
45
+ # Change the default authentication mechanism. Valid options are: :scram,
46
+ # :mongodb_cr, :mongodb_x509, and :plain. Note that all authentication
47
+ # mechanisms require username and password, with the exception of :mongodb_x509.
48
+ # Default on mongoDB 3.0 is :scram, default on 2.4 and 2.6 is :plain.
49
+ # auth_mech: :scram
50
+
51
+ # The database or source to authenticate the user against.
52
+ # (default: the database specified above or admin)
53
+ # auth_source: admin
54
+
55
+ # Force a the driver cluster to behave in a certain manner instead of auto-
56
+ # discovering. Can be one of: :direct, :replica_set, :sharded. Set to :direct
57
+ # when connecting to hidden members of a replica set.
58
+ # connect: :direct
59
+
60
+ # Changes the default time in seconds the server monitors refresh their status
61
+ # via ismaster commands. (default: 10)
62
+ # heartbeat_frequency: 10
63
+
64
+ # The time in seconds for selecting servers for a near read preference. (default: 0.015)
65
+ # local_threshold: 0.015
66
+
67
+ # The timeout in seconds for selecting a server for an operation. (default: 30)
68
+ # server_selection_timeout: 30
69
+
70
+ # The maximum number of connections in the connection pool. (default: 5)
71
+ # max_pool_size: 5
72
+
73
+ # The minimum number of connections in the connection pool. (default: 1)
74
+ # min_pool_size: 1
75
+
76
+ # The time to wait, in seconds, in the connection pool for a connection
77
+ # to be checked in before timing out. (default: 5)
78
+ # wait_queue_timeout: 5
79
+
80
+ # The time to wait to establish a connection before timing out, in seconds.
81
+ # (default: 10)
82
+ # connect_timeout: 10
83
+
84
+ # The timeout to wait to execute operations on a socket before raising an error.
85
+ # (default: 5)
86
+ # socket_timeout: 5
87
+
88
+ # The name of the replica set to connect to. Servers provided as seeds that do
89
+ # not belong to this replica set will be ignored.
90
+ # replica_set: name
91
+
92
+ # Whether to connect to the servers via ssl. (default: false)
93
+ # ssl: true
94
+
95
+ # The certificate file used to identify the connection against MongoDB.
96
+ # ssl_cert: /path/to/my.cert
97
+
98
+ # The private keyfile used to identify the connection against MongoDB.
99
+ # Note that even if the key is stored in the same file as the certificate,
100
+ # both need to be explicitly specified.
101
+ # ssl_key: /path/to/my.key
102
+
103
+ # A passphrase for the private key.
104
+ # ssl_key_pass_phrase: password
105
+
106
+ # Whether to do peer certification validation. (default: true)
107
+ # ssl_verify: true
108
+
109
+ # The file containing concatenated certificate authority certificates
110
+ # used to validate certs passed from the other end of the connection.
111
+ # ssl_ca_cert: /path/to/ca.cert
112
+
113
+ # Whether to truncate long log lines. (default: true)
114
+ # truncate_logs: true
115
+
116
+ # Configure Mongoid specific options. (optional)
117
+ options:
118
+ # Includes the root model name in json serialization. (default: false)
119
+ # include_root_in_json: false
120
+
121
+ # Include the _type field in serialization. (default: false)
122
+ # include_type_for_serialization: false
123
+
124
+ # Preload all models in development, needed when models use
125
+ # inheritance. (default: false)
126
+ # preload_models: false
127
+
128
+ # Raise an error when performing a #find and the document is not found.
129
+ # (default: true)
130
+ # raise_not_found_error: true
131
+ raise_not_found_error: false
132
+
133
+ # Raise an error when defining a scope with the same name as an
134
+ # existing method. (default: false)
135
+ # scope_overwrite_exception: false
136
+
137
+ # Raise an error when defining a field with the same name as an
138
+ # existing method. (default: false)
139
+ # duplicate_fields_exception: false
140
+
141
+ # Use Active Support's time zone in conversions. (default: true)
142
+ # use_activesupport_time_zone: true
143
+
144
+ # Ensure all times are UTC in the app side. (default: false)
145
+ # use_utc: false
146
+
147
+ # Set the Mongoid and Ruby driver log levels when not in a Rails
148
+ # environment. The Mongoid logger will be set to the Rails logger
149
+ # otherwise.(default: :info)
150
+ # log_level: :info
151
+
152
+ # Control whether `belongs_to` association is required. By default
153
+ # `belongs_to` will trigger a validation error if the association
154
+ # is not present. (default: true)
155
+ # belongs_to_required_by_default: true
156
+ belongs_to_required_by_default: false
157
+
158
+ # Application name that is printed to the mongodb logs upon establishing a
159
+ # connection in server versions >= 3.4. Note that the name cannot exceed 128 bytes.
160
+ # app_name: MyApplicationName
161
+
162
+ production:
163
+ clients:
164
+ default:
165
+ uri: <%= ENV['MONGODB_URI'] %>
166
+ options:
167
+ raise_not_found_error: false
168
+ belongs_to_required_by_default: false
169
+
170
+
171
+ # Use background indexes by default if `background` option not specified. (default: false)
172
+ # background_indexing: false
173
+ test:
174
+ clients:
175
+ default:
176
+ database: shop263603_test
177
+ hosts:
178
+ - localhost:27017
179
+ options:
180
+ read:
181
+ mode: :primary
182
+ max_pool_size: 1
@@ -0,0 +1,182 @@
1
+ development:
2
+ # Configure available database clients. (required)
3
+ clients:
4
+ # Defines the default client. (required)
5
+ default:
6
+ # Mongoid can connect to a URI accepted by the driver:
7
+ # uri: mongodb://user:password@mongodb.domain.com:27017/shop263603_development
8
+
9
+ # Otherwise define the parameters separately.
10
+ # This defines the name of the default database that Mongoid can connect to.
11
+ # (required).
12
+ database: shop263603_development
13
+ # Provides the hosts the default client can connect to. Must be an array
14
+ # of host:port pairs. (required)
15
+ hosts:
16
+ - localhost:27017
17
+ # - mongodb
18
+ options:
19
+ # Note that all options listed below are Ruby driver client options (the mongo gem).
20
+ # Please refer to the driver documentation of the version of the mongo gem you are using
21
+ # for the most up-to-date list of options.
22
+ #
23
+ # Change the default write concern. (default = { w: 1 })
24
+ # write:
25
+ # w: 1
26
+
27
+ # Change the default read preference. Valid options for mode are: :secondary,
28
+ # :secondary_preferred, :primary, :primary_preferred, :nearest
29
+ # (default: primary)
30
+ # read:
31
+ # mode: :secondary_preferred
32
+ # tag_sets:
33
+ # - use: web
34
+
35
+ # The name of the user for authentication.
36
+ # user: 'user'
37
+
38
+ # The password of the user for authentication.
39
+ # password: 'password'
40
+
41
+ # The user's database roles.
42
+ # roles:
43
+ # - 'dbOwner'
44
+
45
+ # Change the default authentication mechanism. Valid options are: :scram,
46
+ # :mongodb_cr, :mongodb_x509, and :plain. Note that all authentication
47
+ # mechanisms require username and password, with the exception of :mongodb_x509.
48
+ # Default on mongoDB 3.0 is :scram, default on 2.4 and 2.6 is :plain.
49
+ # auth_mech: :scram
50
+
51
+ # The database or source to authenticate the user against.
52
+ # (default: the database specified above or admin)
53
+ # auth_source: admin
54
+
55
+ # Force a the driver cluster to behave in a certain manner instead of auto-
56
+ # discovering. Can be one of: :direct, :replica_set, :sharded. Set to :direct
57
+ # when connecting to hidden members of a replica set.
58
+ # connect: :direct
59
+
60
+ # Changes the default time in seconds the server monitors refresh their status
61
+ # via ismaster commands. (default: 10)
62
+ # heartbeat_frequency: 10
63
+
64
+ # The time in seconds for selecting servers for a near read preference. (default: 0.015)
65
+ # local_threshold: 0.015
66
+
67
+ # The timeout in seconds for selecting a server for an operation. (default: 30)
68
+ # server_selection_timeout: 30
69
+
70
+ # The maximum number of connections in the connection pool. (default: 5)
71
+ # max_pool_size: 5
72
+
73
+ # The minimum number of connections in the connection pool. (default: 1)
74
+ # min_pool_size: 1
75
+
76
+ # The time to wait, in seconds, in the connection pool for a connection
77
+ # to be checked in before timing out. (default: 5)
78
+ # wait_queue_timeout: 5
79
+
80
+ # The time to wait to establish a connection before timing out, in seconds.
81
+ # (default: 10)
82
+ # connect_timeout: 10
83
+
84
+ # The timeout to wait to execute operations on a socket before raising an error.
85
+ # (default: 5)
86
+ # socket_timeout: 5
87
+
88
+ # The name of the replica set to connect to. Servers provided as seeds that do
89
+ # not belong to this replica set will be ignored.
90
+ # replica_set: name
91
+
92
+ # Whether to connect to the servers via ssl. (default: false)
93
+ # ssl: true
94
+
95
+ # The certificate file used to identify the connection against MongoDB.
96
+ # ssl_cert: /path/to/my.cert
97
+
98
+ # The private keyfile used to identify the connection against MongoDB.
99
+ # Note that even if the key is stored in the same file as the certificate,
100
+ # both need to be explicitly specified.
101
+ # ssl_key: /path/to/my.key
102
+
103
+ # A passphrase for the private key.
104
+ # ssl_key_pass_phrase: password
105
+
106
+ # Whether to do peer certification validation. (default: true)
107
+ # ssl_verify: true
108
+
109
+ # The file containing concatenated certificate authority certificates
110
+ # used to validate certs passed from the other end of the connection.
111
+ # ssl_ca_cert: /path/to/ca.cert
112
+
113
+ # Whether to truncate long log lines. (default: true)
114
+ # truncate_logs: true
115
+
116
+ # Configure Mongoid specific options. (optional)
117
+ options:
118
+ # Includes the root model name in json serialization. (default: false)
119
+ # include_root_in_json: false
120
+
121
+ # Include the _type field in serialization. (default: false)
122
+ # include_type_for_serialization: false
123
+
124
+ # Preload all models in development, needed when models use
125
+ # inheritance. (default: false)
126
+ # preload_models: false
127
+
128
+ # Raise an error when performing a #find and the document is not found.
129
+ # (default: true)
130
+ # raise_not_found_error: true
131
+ raise_not_found_error: false
132
+
133
+ # Raise an error when defining a scope with the same name as an
134
+ # existing method. (default: false)
135
+ # scope_overwrite_exception: false
136
+
137
+ # Raise an error when defining a field with the same name as an
138
+ # existing method. (default: false)
139
+ # duplicate_fields_exception: false
140
+
141
+ # Use Active Support's time zone in conversions. (default: true)
142
+ # use_activesupport_time_zone: true
143
+
144
+ # Ensure all times are UTC in the app side. (default: false)
145
+ # use_utc: false
146
+
147
+ # Set the Mongoid and Ruby driver log levels when not in a Rails
148
+ # environment. The Mongoid logger will be set to the Rails logger
149
+ # otherwise.(default: :info)
150
+ # log_level: :info
151
+
152
+ # Control whether `belongs_to` association is required. By default
153
+ # `belongs_to` will trigger a validation error if the association
154
+ # is not present. (default: true)
155
+ # belongs_to_required_by_default: true
156
+ belongs_to_required_by_default: false
157
+
158
+ # Application name that is printed to the mongodb logs upon establishing a
159
+ # connection in server versions >= 3.4. Note that the name cannot exceed 128 bytes.
160
+ # app_name: MyApplicationName
161
+
162
+ production:
163
+ clients:
164
+ default:
165
+ uri: <%= ENV['MONGODB_URI'] %>
166
+ options:
167
+ raise_not_found_error: false
168
+ belongs_to_required_by_default: false
169
+
170
+
171
+ # Use background indexes by default if `background` option not specified. (default: false)
172
+ # background_indexing: false
173
+ test:
174
+ clients:
175
+ default:
176
+ database: shop263603_test
177
+ hosts:
178
+ - localhost:27017
179
+ options:
180
+ read:
181
+ mode: :primary
182
+ max_pool_size: 1
@@ -0,0 +1,16 @@
1
+ version: '3'
2
+ services:
3
+ web:
4
+ build: .
5
+ command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
6
+ volumes:
7
+ - .:/myapp
8
+ ports:
9
+ - "3000:3000"
10
+ depends_on:
11
+ - mongodb
12
+
13
+ mongodb:
14
+ image: mongo
15
+ ports:
16
+ - "27017:27017"
@@ -0,0 +1,12 @@
1
+ #!/bin/bash
2
+ set -e
3
+ # change mongoid.yml for docker
4
+ cp /myapp/config/mongoid.yml-docker /myapp/config/mongoid.yml
5
+ # Remove a potentially pre-existing server.pid for Rails.
6
+ rm -f /myapp/tmp/pids/server.pid
7
+ # Compile the assets
8
+ # bundle exec rake assets:precompile
9
+ # Add admin user
10
+ rake jinda:seed
11
+ # Then exec the container's main process (what's set as CMD in the Dockerfile).
12
+ exec "$@"
@@ -645,7 +645,10 @@ module Jinda
645
645
  if a[:edit]
646
646
  doc += " #{a[:text]}\n"
647
647
  else
648
- doc += " field :#{a[:code]}, :type => #{a[:type].capitalize}\n"
648
+ # Fixed: Capitalize only first char
649
+ # doc += " field :#{a[:code]}, :type => #{a[:type].capitalize}\n"
650
+ a[:type][0] = a[:type][0].capitalize
651
+ doc += " field :#{a[:code]}, :type => #{a[:type]}\n"
649
652
  end
650
653
  end
651
654
  doc += " #{@etext}\n"
@@ -1,3 +1,3 @@
1
1
  module Jinda
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.5"
3
3
  end
metadata CHANGED
@@ -1,30 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jinda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Prateep Kul
8
8
  - Korakot Leemakdej
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-07-08 00:00:00.000000000 Z
12
+ date: 2020-11-16 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: bundler
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - "~>"
19
- - !ruby/object:Gem::Version
20
- version: '1.16'
21
- type: :development
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - "~>"
26
- - !ruby/object:Gem::Version
27
- version: '1.16'
28
14
  - !ruby/object:Gem::Dependency
29
15
  name: rake
30
16
  requirement: !ruby/object:Gem::Requirement
@@ -43,40 +29,40 @@ dependencies:
43
29
  name: activesupport
44
30
  requirement: !ruby/object:Gem::Requirement
45
31
  requirements:
46
- - - ">="
32
+ - - "~>"
47
33
  - !ruby/object:Gem::Version
48
34
  version: 4.1.11
49
- - - "~>"
35
+ - - ">="
50
36
  - !ruby/object:Gem::Version
51
37
  version: 4.1.11
52
38
  type: :development
53
39
  prerelease: false
54
40
  version_requirements: !ruby/object:Gem::Requirement
55
41
  requirements:
56
- - - ">="
42
+ - - "~>"
57
43
  - !ruby/object:Gem::Version
58
44
  version: 4.1.11
59
- - - "~>"
45
+ - - ">="
60
46
  - !ruby/object:Gem::Version
61
47
  version: 4.1.11
62
48
  - !ruby/object:Gem::Dependency
63
49
  name: mongoid
64
50
  requirement: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - ">="
52
+ - - "~>"
67
53
  - !ruby/object:Gem::Version
68
54
  version: 4.1.11
69
- - - "~>"
55
+ - - ">="
70
56
  - !ruby/object:Gem::Version
71
57
  version: 4.1.11
72
58
  type: :development
73
59
  prerelease: false
74
60
  version_requirements: !ruby/object:Gem::Requirement
75
61
  requirements:
76
- - - ">="
62
+ - - "~>"
77
63
  - !ruby/object:Gem::Version
78
64
  version: 4.1.11
79
- - - "~>"
65
+ - - ">="
80
66
  - !ruby/object:Gem::Version
81
67
  version: 4.1.11
82
68
  description: 'Generate Rails workflow from mind map: Freemind'
@@ -96,6 +82,7 @@ files:
96
82
  - lib/generators/jinda/install_generator.rb
97
83
  - lib/generators/jinda/minitest_generator.rb
98
84
  - lib/generators/jinda/rspec_generator.rb
85
+ - lib/generators/jinda/templates/Dockerfile
99
86
  - lib/generators/jinda/templates/README.md
100
87
  - lib/generators/jinda/templates/app/assets/config/manifest.js
101
88
  - lib/generators/jinda/templates/app/assets/images/4dcity-old.ico
@@ -351,9 +338,13 @@ files:
351
338
  - lib/generators/jinda/templates/app/views/users/pwd/enter.html.erb
352
339
  - lib/generators/jinda/templates/app/views/users/user/enter_user.html.erb
353
340
  - lib/generators/jinda/templates/config/cloudinary.yml
341
+ - lib/generators/jinda/templates/config/mongoid.yml-docker
342
+ - lib/generators/jinda/templates/config/mongoid.yml-localhost
354
343
  - lib/generators/jinda/templates/db/seeds.rb
344
+ - lib/generators/jinda/templates/docker-compose.yml
355
345
  - lib/generators/jinda/templates/dot/dot.env
356
346
  - lib/generators/jinda/templates/dotrspec
347
+ - lib/generators/jinda/templates/entrypoint.sh
357
348
  - lib/generators/jinda/templates/jinda.yml
358
349
  - lib/generators/jinda/templates/public/404.html
359
350
  - lib/generators/jinda/templates/public/422.html
@@ -391,7 +382,7 @@ homepage: https://github.com/kul1/jinda
391
382
  licenses:
392
383
  - MIT
393
384
  metadata: {}
394
- post_install_message:
385
+ post_install_message:
395
386
  rdoc_options: []
396
387
  require_paths:
397
388
  - lib
@@ -406,8 +397,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
406
397
  - !ruby/object:Gem::Version
407
398
  version: '0'
408
399
  requirements: []
409
- rubygems_version: 3.0.8
410
- signing_key:
400
+ rubygems_version: 3.1.4
401
+ signing_key:
411
402
  specification_version: 4
412
403
  summary: 'Rails workflow from mind map: Freemind'
413
404
  test_files: []