jinda 0.3.5 → 0.3.6

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
- SHA256:
3
- metadata.gz: c9a75e9044c742215b4a88279c71bf994b083791e8b2968307cd9fd1272cd630
4
- data.tar.gz: 45b023769cd651c2b20310f01298d9477705604ea2b0dfece5312f7abcff11c6
2
+ SHA1:
3
+ metadata.gz: 9bec041cf98be98651af512b85110d7264c4cc1b
4
+ data.tar.gz: b6d8a3374fd9672f8acacb0558aa357e63e981f0
5
5
  SHA512:
6
- metadata.gz: 884f1007b8642e2e42d01b66811444279c4c9b01f1cb52e1baa9833f2677883a89c046172b459db665c3d86b97a9f57bc416b015e382f6d62ff2b6c640039f59
7
- data.tar.gz: e91ce213262754eaee44bcc6270113bf66429f4232c9380622eb0060eae31a976fa711a45999e2dd7bad665de7b9e3aa242f24a120637f88c301cefb2931d256
6
+ metadata.gz: 46d8b73c75a490d80c2d138730e2f289f46845d80cb7b3a3f689eaa221f118685e8f6813bde6ce89fd68bff07b932a2f3a2e37c13883ad78fe1267ccae9ccd4c
7
+ data.tar.gz: f207b175bb3647efed4426c546611d0323ab4ab8714e54d778ef54865f955e266cdd41ced36d2d4728ec9d61dd5e8ad2b971caf7ae0e0d40b8d68d16f737fe7d
@@ -7,9 +7,9 @@ module Jinda
7
7
  desc "Backup Files"
8
8
  def backup_files
9
9
  st=" "
10
- inside("config/initializers") {(File.file? "omniauth.rb") ? (run "mv omniauth.rb omniauth.rb.bak") : (puts "new omniauth.rb created")}
11
- inside("config/initializers") {(File.file? "mongoid.rb") ? (run "mv mongoid.rb omniauth.rb.bak") : (puts "new mongoid.rb created")}
12
- (File.file? ".env") ? (run "cp .env .env-bak") : (puts "backup .env")
10
+ # inside("config/initializers") {(File.file? "omniauth.rb") ? (copy_file "omniauth.rb", "omniauth.rb.bak") : (puts "new omniauth.rb created")}
11
+ # inside("config/initializers") {(File.file? "mongoid.rb") ? (copy_file "mongoid.rb", "omniauth.rb.bak") : (puts "new mongoid.rb created")}
12
+ (File.file? ".env") ? (copy_file ".env", ".env-bak") : (puts "backup .env")
13
13
  end
14
14
 
15
15
  desc "gen_image_store"
@@ -55,14 +55,14 @@ module Jinda
55
55
 
56
56
  def setup_app
57
57
  # inside("public") { run "mv index.html index.html.bak" }
58
- inside("app/views/layouts") {(File.file? "application.html.erb") ? (run "mv application.html.erb application.html.erb.bak" ) : ( puts "no app/views/layout/ application.html.erb")}
59
- inside("app/controllers") {(File.file? "application_controller.rb") ? (run "mv application_controller.rb application_controller.rb.bak" ) : ( puts "no app/controller/application_controller.rb")}
60
- inside("app/helpers") {(File.file? "application_helper.rb") ? (run "mv application_helper.rb application_helper.rb.bak") : ( puts "no app/helpers/application_helper.rb")}
61
- inside("app/assets/javascripts") {(File.file? "javascripts.js") ? (run "mv javascripts.js javascripts.js.bak") : ( puts "no javascript.js")}
62
- inside("app/assets/stylesheets") {(File.file? "javascripts.css") ? (run "mv javascripts.css javascripts.css.bak") : ( puts "no javascript.css")}
63
- inside("config/initializers") {(File.file? "omniauth.rb") ? (run "mv omniauth.rb omniauth.rb.bak") : (puts "new omniauth.rb created")}
64
- inside("config/initializers") {(File.file? "mongoid.rb") ? (run "mv mongoid.rb omniauth.rb.bak") : (puts "new mongoid.rb created")}
65
- inside("config/initializers") {(File.file? "ckeditor.rb") ? (run "mv ckeditor.rb ckeditor.rb.bak") : (puts "new ckeditor.rb created")}
58
+ inside("app/views/layouts") {(File.file? "application.html.erb") ? (copy_file 'application.html.erb', 'application.html.erb.bak') : ( puts "no app/views/layout/ application.html.erb")}
59
+ inside("app/controllers") {(File.file? "application_controller.rb") ? (copy_file 'application_controller.rb', 'application_controller.rb.bak' ) : ( puts "no app/controller/application_controller.rb")}
60
+ inside("app/helpers") {(File.file? "application_helper.rb") ? (copy_file 'application_helper.rb', 'application_helper.rb.bak') : ( puts "no app/helpers/application_helper.rb")}
61
+ inside("app/assets/javascripts") {(File.file? "javascripts.js") ? (copy_file 'javascripts.js', 'javascripts.js.bak') : ( puts "no javascript.js")}
62
+ inside("app/assets/stylesheets") {(File.file? "javascripts.css") ? (copy_file 'javascripts.css', 'javascripts.css.bak') : ( puts "no javascript.css")}
63
+ inside("config/initializers") {(File.file? "omniauth.rb") ? (copy_file 'omniauth.rb', 'omniauth.rb.bak') : (puts "no omniauth.rb")}
64
+ # inside("config/initializers") {(File.file? "mongoid.rb") ? (copy_file 'mongoid.rb', 'mongoid.rb.bak') : (puts "no mongoid.rb")}
65
+ # inside("config/initializers") {(File.file? "ckeditor.rb") ? (copy_file 'ckeditor.rb ckeditor.rb.bak') : (puts "no ckeditor.rb ")}
66
66
  directory "app"
67
67
  directory "spec"
68
68
  end
@@ -92,7 +92,7 @@ module Jinda
92
92
  end
93
93
 
94
94
  def setup_env
95
- run "mv README.md README.md.bak"
95
+ copy_file "README.md", "README.md.bak"
96
96
  create_file 'README.md', ''
97
97
  copy_file 'install.sh', 'install.sh'
98
98
  inject_into_file 'config/application.rb', :after => 'require "active_resource/railtie"' do
@@ -11,7 +11,7 @@ module Jinda
11
11
  empty_directory "spec/support"
12
12
  empty_directory "spec/model"
13
13
  empty_directory "spec/routing"
14
- run "mv .rspec .rspec.bak"
14
+ copy_file ".rspec", ".rspec.bak"
15
15
  run "guard init"
16
16
  copy_file ".rspec",".rspec"
17
17
  end
@@ -0,0 +1,173 @@
1
+ # Jinda
2
+ Rails Application Generator using Freemind
3
+
4
+ * [jinda](https://github.com/kul1/jinda)
5
+ - ![jinda-screen](https://user-images.githubusercontent.com/3953832/41832753-0143339a-7813-11e8-9ef9-c1601443c604.png)
6
+
7
+ ## Additional Extension themes also available at
8
+ * [jinda_adminlte](https://github.com/kul1/jinda_adminlte)
9
+ - ![j18-screen](https://user-images.githubusercontent.com/3953832/34298172-faa7e962-e6e1-11e7-93e2-19dfd4ab42af.png)
10
+
11
+ * [jinda_adminbsb](https://github.com/kul1/jinda_adminbsb)
12
+ - ![jinda-bsb](https://user-images.githubusercontent.com/3953832/34320779-bb0980d2-e7c6-11e7-855c-fafc23487ba5.png)
13
+
14
+ ## Prerequisites
15
+
16
+ These versions works for sure but others may do.
17
+
18
+ * Ruby 2.5.0
19
+ * Rails 5.2.3
20
+ * MongoDB 6
21
+ * Freemind 1.0.1
22
+
23
+ ## Convention
24
+
25
+ * database is MongoDB
26
+ * images stored in upload directory, unset IMAGE_LOCATION in `initializer/jinda.rb` to use Cloudinary
27
+ * mail use Gmail SMTP, config in `config/application.rb`
28
+ * authentication use omniauth-identity
29
+
30
+ ## Sample Application
31
+
32
+ Supposed we want to create ecommerce web site, first create a Rails
33
+ app without ActiveRecord
34
+
35
+ $ rails new YOURAPP -BOT
36
+
37
+ ## Add jinda to your Gemfile:
38
+
39
+ gem 'jinda', '~> 0.3.6'
40
+
41
+ For Development (most updated)
42
+
43
+ gem 'jinda', github:'kul1/jinda'
44
+
45
+ depend on your operating system, you may need to uncomment
46
+
47
+ gem 'therubyracer', :platforms => :ruby
48
+
49
+ install gems
50
+
51
+ $ bundle
52
+
53
+ generate jinda application
54
+
55
+ $ rails generate jinda:install
56
+
57
+ Then run bundle again to install additional gems added by jinda
58
+
59
+ $ bundle
60
+
61
+ (or run all with "sh install.sh" )
62
+
63
+ configure mongoid, omniauth
64
+
65
+ $ rails generate jinda:config
66
+
67
+ Please make sure mongod is running then create admin user
68
+
69
+ $ rails jinda:seed
70
+
71
+ now the application is ready, start it as any Rails application
72
+
73
+ $ rails server
74
+
75
+ go to http://localhost:3000, click *Sign In* on the left menu, and enter user name `admin` and password `secret`
76
+
77
+ ![login](https://user-images.githubusercontent.com/3953832/41832924-d868f8f0-7813-11e8-93bb-19c0357cf604.png)
78
+
79
+ Now open file `app/jinda/index.mm` using Freemind
80
+
81
+ ![index mm](https://user-images.githubusercontent.com/3953832/34680350-7906fbe8-f45e-11e7-8df5-969b4c735c6e.png)
82
+
83
+ The 3 main branches are
84
+
85
+ * models - this defines all the models to use in the application
86
+ * services - this defines services which will be come the menu on the left of the screen. There will be 2 levels; the first sub branch is the main menu (modules) and the second sub branch is the sub menu (services)
87
+ * roles - this defines role for all users
88
+
89
+ ### models
90
+
91
+ Fiirst, we need to create some product so we click on models we'll see 2 models person and address. These are sample only. You can delete them or modify them however you want. We'll take a look at them first
92
+
93
+ ![models](https://user-images.githubusercontent.com/3953832/34681380-50b27dd6-f461-11e7-8472-3a14d76e0f16.png)
94
+
95
+ The first sub branch (e.g. person) is the model name. According to Rails convention, this should be a singular word. The next sub branch are columns in the database. Let's take a look at each:
96
+
97
+ * `fname` - this create a column (field) called fname which is a String by default
98
+ * `sex: integer` - this create a column called sex, it is integer so must be explicity defined. The next sub branch (1: male) is disregarded by Jinda so we can put whatever we want. Here I just put some reminder.
99
+ * `belongs_to :address` - here we have ![pen](https://cloud.githubusercontent.com/assets/3953832/25600038/3a4ffb66-2f0b-11e7-9f03-b875e550eefe.png)
100
+ icon. this means whatever text on this line will be added as is to the model Jinda generates. You use this to specify anything you want such as association, index, remarks in code, etc. according to mongoid gem. To draw the icon, rest mouse on the branch and hit &ltAlt-I&gt.
101
+ * `dob: date` - use any type that mongoid provides.
102
+ * `photo` - for file field, just use String here. Jinda will receive the binary file and store in file system or cloudinary then generate a url link to it.
103
+
104
+ In this example we just want a product model, so delete the person and address model and add a product branch like so
105
+
106
+ ![freemind1](https://user-images.githubusercontent.com/3953832/34680349-78f1eea6-f45e-11e7-8e43-50d9025bb449.png)
107
+
108
+ Save the mind map then run:
109
+
110
+ rake jinda:update
111
+
112
+ This will create file `app/models/product.rb`. In this file, note the comment lines `# jinda begin` and ` # jinda end`. Everything inside these comments will get overwritten when you change the models branch in the mind map so if you need to put anything inside here, use the mind map instead. You can add anything outside these comment lines which will be preserved when doing jinda:update.
113
+
114
+ ### services
115
+
116
+ Next we'll add some product into the database, we'll first take a look at the services branch, which already has 3 sub branches; users, admins, and devs. Unlike models person and address branches, these branches are actively used by the system so I recommend that you leave them alone. Let's open the users branch
117
+
118
+ ![image](https://cloud.githubusercontent.com/assets/3953832/25599895/ecf46466-2f09-11e7-82aa-81ade6b9cd83.png)
119
+
120
+ The text `users:User` on the sub branch has these implications:
121
+
122
+ * `users` correspond to `app/controllers/users_controller.rb` which already exist when you do rails generate jinda:install. New branch will create new controller if not exist. In Jinda term, this will be called module.
123
+ * `User` will create entry in main menu on the left of the screen. You don't see it in the screenshot above because it's controlled by the sub branch `role:m` which means this menu only available for login member. If you already signed in as admin, you should see it now.
124
+
125
+ The next sub branches has the following:
126
+
127
+ * `role: m` - means that this module (menu) is available only to user who has role m (if you open the role branch now will see that role m is member). All registered user has role m by default. User who is not log on would not be able to access this module.
128
+ * `link:info: /users` - means that this is a link, the format is link: *submenu label* : *url* where submenu label is the text to show in the submenu and url is the link to go to, in this case, it woud go to http://localhost:3000/users which will perform index action of UsersController.
129
+ * `user:edit` the branch that do not start with role:, rule:, nor link: will be a Jinda service. You will then specify the sequence of the execution as in this example there are 3 sub branches - enter_user, update_user, and rule:login? Let's take a look at them:
130
+
131
+ * `enter_user:edit` - the first step is to display a form to input user information, this is accompanied by icon ![image](https://cloud.githubusercontent.com/assets/3953832/25599946/47c32cf6-2f0a-11e7-80a8-2c02c6294c9a.png)
132
+ which means user interface screen. and will correspond to a view file `app/views/users/user/enter_user.html.erb` where `/users` comes from the module name (the sub branch of services), `/user` comes from the service name (the sub branch of users), and `enter_user.html.erb` comes from the first part of this branch. The `edit` after the colon is just a description of this step. This branch also has sub branch `rule:login? && own_xmain?` which specify rule for this step that the user must be login and can continue this task if he is the one who started it. *task* in here means each instance of service.
133
+ * `update_user` - this icon ![image](https://cloud.githubusercontent.com/assets/3953832/25599976/87b69ad2-2f0a-11e7-9aba-1bd4e9546d3e.png) means to execute method update_user within `users_controller.rb`
134
+
135
+ Armed with this knowledge, we are ready to add new product into our application like so:
136
+
137
+ ![add_enter](https://cloud.githubusercontent.com/assets/3953832/25600158/582d1fbe-2f0c-11e7-9bde-01a195a45b6c.png)
138
+
139
+
140
+ To generate controller and views we save this mind map and run
141
+
142
+ rake jinda:update
143
+
144
+ open file `app/views/products/add/enter.html.erb` you'll see some sample view already in there but commented. edit the file so it look like this
145
+
146
+
147
+ ![product_enter](https://cloud.githubusercontent.com/assets/3953832/25600363/e5cc8282-2f0d-11e7-81f7-273c9bdc1a63.png)
148
+
149
+
150
+ Note that we do not specify form_tag and submit_tag, these will be supplied by Jinda.
151
+
152
+ then open file `app/controllers/products_controller.rb` and add `create` method as follow. The method name has to be correspond to the ![bookmark](http://songrit.googlecode.com/files/bookmark.png) branch.
153
+
154
+ ![products_controller](http://songrit.googlecode.com/files/products_controller.png)
155
+
156
+ ## Testing
157
+
158
+ run following command:
159
+
160
+ rails generate jinda:rspec
161
+ guard init
162
+ guard
163
+
164
+ ![rspec](https://user-images.githubusercontent.com/3953832/34680352-7931d426-f45e-11e7-9f40-8b85b94c61bf.png)
165
+
166
+
167
+ ## Contributing
168
+
169
+ 1. Fork it
170
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
171
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
172
+ 4. Push to the branch (`git push origin my-new-feature`)
173
+ 5. Create new Pull Request
@@ -21,7 +21,7 @@
21
21
 
22
22
  %h2 Installation
23
23
  %ul
24
- %li add gem 'jinda', '0.3.5'
24
+ %li add gem 'jinda', '0.3.6'
25
25
  %li bundle
26
26
  %li rails generate jinda:install
27
27
  %li (run all with "sh install.sh" )
@@ -1,3 +1,3 @@
1
1
  module Jinda
2
- VERSION = "0.3.5"
2
+ VERSION = "0.3.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jinda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Prateep Kul
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-04-26 00:00:00.000000000 Z
12
+ date: 2019-08-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -111,40 +111,40 @@ dependencies:
111
111
  name: activesupport
112
112
  requirement: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - ">="
114
+ - - "~>"
115
115
  - !ruby/object:Gem::Version
116
116
  version: 4.1.11
117
- - - "~>"
117
+ - - ">="
118
118
  - !ruby/object:Gem::Version
119
119
  version: 4.1.11
120
120
  type: :development
121
121
  prerelease: false
122
122
  version_requirements: !ruby/object:Gem::Requirement
123
123
  requirements:
124
- - - ">="
124
+ - - "~>"
125
125
  - !ruby/object:Gem::Version
126
126
  version: 4.1.11
127
- - - "~>"
127
+ - - ">="
128
128
  - !ruby/object:Gem::Version
129
129
  version: 4.1.11
130
130
  - !ruby/object:Gem::Dependency
131
131
  name: mongoid
132
132
  requirement: !ruby/object:Gem::Requirement
133
133
  requirements:
134
- - - ">="
134
+ - - "~>"
135
135
  - !ruby/object:Gem::Version
136
136
  version: 4.1.11
137
- - - "~>"
137
+ - - ">="
138
138
  - !ruby/object:Gem::Version
139
139
  version: 4.1.11
140
140
  type: :development
141
141
  prerelease: false
142
142
  version_requirements: !ruby/object:Gem::Requirement
143
143
  requirements:
144
- - - ">="
144
+ - - "~>"
145
145
  - !ruby/object:Gem::Version
146
146
  version: 4.1.11
147
- - - "~>"
147
+ - - ">="
148
148
  - !ruby/object:Gem::Version
149
149
  version: 4.1.11
150
150
  - !ruby/object:Gem::Dependency
@@ -185,6 +185,7 @@ files:
185
185
  - lib/generators/jinda/minitest_generator.rb
186
186
  - lib/generators/jinda/rspec_generator.rb
187
187
  - lib/generators/jinda/templates/.env
188
+ - lib/generators/jinda/templates/README.md
188
189
  - lib/generators/jinda/templates/app/assets/config/manifest.js
189
190
  - lib/generators/jinda/templates/app/assets/images/4dcity-old.ico
190
191
  - lib/generators/jinda/templates/app/assets/images/4dcity.ico
@@ -463,7 +464,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
463
464
  - !ruby/object:Gem::Version
464
465
  version: '0'
465
466
  requirements: []
466
- rubygems_version: 3.0.3
467
+ rubyforge_project:
468
+ rubygems_version: 2.5.2.3
467
469
  signing_key:
468
470
  specification_version: 4
469
471
  summary: 'Rails workflow from mind map: Freemind'