mindapp 0.0.7 → 0.0.8

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
  SHA1:
3
- metadata.gz: 0fbc93f8fc1b361c54e1f33c87ed76eb7315bf1b
4
- data.tar.gz: 9a5a2f3a2dc26803f34f7c17d37871da864590e7
3
+ metadata.gz: 1ae3a12a90d64de82b3bccef37f24fde071a639c
4
+ data.tar.gz: 6bd400b13017d054771976a07b35e0583326168d
5
5
  SHA512:
6
- metadata.gz: 90b38731142c98f6bbb3956e6061e23d6582bda3deec3933a21d8f4444d6eed0a7302da2277bce7936fa04047dc1d81e8282a9c11df9360be7689446f842aa33
7
- data.tar.gz: 5e5fd77b10976f97304a5590ba7fc1cae28f2dc810f502f8e05df6f4ed5e21857111f2e99f9cf5f270d9f19f7e8dbb9171b4bf0853d114ada60e5999df2b3420
6
+ metadata.gz: 2a98cdca223168ea047bffb59e1cad500098f6d3caa799926ef264877e4abc07afc7d0caf35fd27c4c8ea74aca3e6eb57364a73dd12d3b9985ef46a24fb40e69
7
+ data.tar.gz: 0f14953ff04e32536ae16722067b1d191e9fbddf5e9892360aa6387a8858b94c59f7a26737e3c4dc1fc427745729cc64ffe2c8ac574a868b4064aed442cccce0
data/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  I like to develop application using Ruby on Rails. I find that most of my projects has some common tasks such as basic design, user administration, logging, workflow, etc. So I decide to use mind map to act as a language to explain what I want and have the tool generates the application that conform to standard framework so I can then customize everything later on. Mind map is used in design phase where it generates models and controller, in execution phase where it controls the work flow, and also use to generate documentation. System Analyst could use mind map to communicate with technical team to align their requirements and help in development.
4
4
 
5
+ ## Changelog
6
+
7
+ * v0.0.8 update for Rails 4
8
+
5
9
  ## Prerequisites
6
10
 
7
11
  These versions works for sure but others may do.
@@ -64,16 +68,19 @@ generate mindapp application
64
68
 
65
69
  $ rails generate mindapp:install
66
70
 
67
- it will ask to overwrite the seeds.rb file, enter y, then run bundle again to install additional gems added by mindapp
71
+ Then run bundle again to install additional gems added by mindapp
68
72
 
69
73
  $ bundle
70
74
 
71
75
  The next step is create admin user
72
76
 
73
- $ rake db:seed
77
+ $ rake mindapp:seed
74
78
 
75
79
  now the application is ready, start it as any Rails application
76
80
 
81
+ **Note** if you have nokogiri error then you can comment it out in Gemfile. Nokogiri is used
82
+ for mindapp/doc only.
83
+
77
84
  $ rails server
78
85
 
79
86
  go to http://localhost:3000, click *Sign In* on the left menu, and enter user name `admin` and password `secret`
@@ -12,10 +12,11 @@ module Mindapp
12
12
 
13
13
  route "resources :identities"
14
14
  route "resources :sessions"
15
- route "match '/auth/:provider/callback' => 'sessions#create'"
16
- route "match '/auth/failure' => 'sessions#failure'"
17
- route "match '/logout' => 'sessions#destroy', :as => 'logout'"
18
- route "match ':controller(/:action(/:id))(.:format)'"
15
+ route "post '/auth/:provider/callback' => 'sessions#create'"
16
+ route "get '/auth/failure' => 'sessions#failure'"
17
+ route "get '/logout' => 'sessions#destroy', :as => 'logout'"
18
+ route "get ':controller(/:action(/:id))(.:format)'"
19
+ route "post ':controller(/:action(/:id))(.:format)'"
19
20
  end
20
21
 
21
22
  def setup_env
@@ -25,7 +26,6 @@ module Mindapp
25
26
  # gem "bson_ext", "1.5.1"
26
27
  # gem "mongoid"
27
28
  # run "bundle install"
28
- generate "mongoid:config"
29
29
  # generate "rspec:install"
30
30
  inject_into_file 'config/application.rb', :after => 'require "active_resource/railtie"' do
31
31
  "\nrequire 'mongoid/railtie'\n"
@@ -77,9 +77,6 @@ IMAGE_LOCATION = "upload"
77
77
  inject_into_file 'config/environments/production.rb', :after => 'config.assets.compile = false' do
78
78
  "\n config.assets.compile = true"
79
79
  end
80
- inject_into_file 'config/mongoid.yml', :after => ' # raise_not_found_error: true' do
81
- "\n raise_not_found_error: false"
82
- end
83
80
  end
84
81
 
85
82
  def setup_omniauth
@@ -116,11 +113,15 @@ end
116
113
  end
117
114
 
118
115
  def setup_gems
119
- gem "mongo", '1.5.1'
120
- gem "bson_ext", '1.5.1'
121
- gem "mongoid"
116
+ gem "mongo"
117
+ gem "bson_ext"
118
+ # gem "mongo", '1.5.1'
119
+ # gem "bson_ext", '1.5.1'
120
+ # for Rails 4
121
+ gem 'mongoid', '~> 4.0.0'
122
+ # gem "mongoid"
122
123
  gem "nokogiri" # use for mindapp/doc
123
- gem "rmagick", :require => "RMagick", :platform => "ruby"
124
+ # gem "rmagick", :require => "RMagick", :platform => "ruby"
124
125
  gem 'haml-rails'
125
126
  gem "mail"
126
127
  gem "prawn"
@@ -138,6 +139,10 @@ end
138
139
  end
139
140
  end
140
141
 
142
+ def finish
143
+ puts "Mindapp installation finish, please run bundle install again to install additional gems. Then run rails generate mindapp:mongoid"
144
+ end
145
+
141
146
  end
142
147
  end
143
148
  end
@@ -0,0 +1,17 @@
1
+ module Mindapp
2
+ module Generators
3
+ class MongoidGenerator < Rails::Generators::Base
4
+ desc "Set up mongoid config"
5
+ def setup_mongoid
6
+ generate "mongoid:config"
7
+ inject_into_file 'config/mongoid.yml', :after => ' # raise_not_found_error: true' do
8
+ "\n raise_not_found_error: false"
9
+ end
10
+ end
11
+ def finish
12
+ puts "Mongoid configured, please run rake mindapp:seed to set up admin/secret user"
13
+ end
14
+
15
+ end
16
+ end
17
+ end
@@ -238,7 +238,11 @@ class MindappController < ApplicationController
238
238
  if @xvars['p']['return']
239
239
  redirect_to @xvars['p']['return'] and return
240
240
  else
241
- redirect_to :action=>'pending' and return
241
+ if @user
242
+ redirect_to :action=>'pending' and return
243
+ else
244
+ redirect_to_root and return
245
+ end
242
246
  end
243
247
  else
244
248
  @xmain.update_attribute :current_runseq, next_runseq.id
@@ -4,8 +4,10 @@
4
4
  <%#= fields_for doc do |f| %>
5
5
  <%#= f.label :rnum, "Reference number" %>
6
6
  <%#= f.text_field :rnum %>
7
- <%#= f.label :confidential, "Confidentiality" %>
8
- <%#= f.select :confidential, [['normal',0],['secret',1],['top secret',2]],{},"data-native-menu"=>"false" %>
7
+ <!--div>
8
+ <%#= f.label :confidential, "Confidentiality" , :class=>"ui-input-text" %>
9
+ <%#= f.select :confidential, [['normal',0],['secret',1],['top secret',2]],{},"data-native-menu"=>"false" %>
10
+ </div-->
9
11
  <%#= f.label :issue_on, "Dated" %>
10
12
  <%#= f.date_field :issue_on, "blackDays"=>[0,6] %>
11
13
  <%#= f.label :summary, "Summary" %>
@@ -16,6 +18,6 @@
16
18
  <%#= label_tag :hotel, "Ungroup field" %>
17
19
  <%#= text_field_tag :hotel %>
18
20
  <!--div>
19
- <%#= label_tag :done1, "Logic field" %>
21
+ <%#= label_tag :done1, "Logic field", :class=>"ui-input-text" %>
20
22
  <%#= select_tag :done1, options_for_select([['Yes', 'y'], ['No', 'n']],'y'), 'data-role'=>"slider" %>
21
23
  </div-->
@@ -2,7 +2,7 @@ class Identity
2
2
  include Mongoid::Document
3
3
  include OmniAuth::Identity::Models::Mongoid
4
4
  self.auth_key 'code'
5
-
5
+
6
6
  field :code, :type => String
7
7
  field :email, :type => String
8
8
  field :password_digest, :type => String
@@ -10,5 +10,5 @@ class Identity
10
10
  validates_presence_of :code
11
11
  validates_uniqueness_of :code
12
12
  validates_uniqueness_of :email
13
- validates_format_of :email, :with => /^[-a-z0-9_+\.]+\@([-a-z0-9]+\.)+[a-z0-9]{2,4}$/i
13
+ # validates_format_of :email, :with => /^[-a-z0-9_+\.]+\@([-a-z0-9]+\.)+[a-z0-9]{2,4}$/i
14
14
  end
@@ -8,6 +8,7 @@ class Mindapp::Notice
8
8
  belongs_to :user
9
9
 
10
10
  def self.recent(user_id, ip)
11
- where(unread: true, user_id: user_id, ip: ip).last
11
+ where(unread: true, ip: ip).last
12
+ # where(unread: true, user_id: user_id, ip: ip).last
12
13
  end
13
14
  end
@@ -19,6 +19,6 @@ class Mindapp::Runseq
19
19
  field :xml, :type => String
20
20
  field :ip, :type => String
21
21
 
22
- scope :form_action, where(:action.in=> ['form','output','pdf'])
22
+ scope :form_action, ->{where(:action.in=> ['form','output','pdf'])}
23
23
 
24
24
  end
@@ -6,9 +6,8 @@
6
6
  <title>eLocal</title>
7
7
  <link rel="shortcut icon" href="/assets/favicon.ico" />
8
8
  <meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
9
- <%= stylesheet_link_tag "style", "gma", "sarabun" %>
10
- <meta name="description" content="ระบบบริหารงานองค์กรปกครองส่วนท้องถิ่น" />
11
- <meta name="keywords" content="อปท, องค์กรปกครองส่วนท้องถิ่น, lao" />
9
+ <%= stylesheet_link_tag "mindapp", "sarabun" %>
10
+ <meta name="description" content="Mindapp" />
12
11
  <%= javascript_include_tag "jquery.tools.min.js" %>
13
12
  <%= javascript_include_tag "application", "flashobject", "FusionCharts" %>
14
13
  </head>
@@ -6,7 +6,7 @@
6
6
  <meta name="language" content="en, th" />
7
7
  <title>eLocal</title>
8
8
  <link rel="shortcut icon" href="/assets/favicon.ico" />
9
- <%= stylesheet_link_tag "gma", "sarabun", :media=>"all" %>
9
+ <%= stylesheet_link_tag "sarabun", :media=>"all" %>
10
10
  </head>
11
11
  <style type="text/css" >
12
12
  body {
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <title>eLocal Output</title>
5
5
  <meta content='text/html; charset=utf-8' http-equiv='content-type' />
6
- <link href='/stylesheets/style.css' rel='stylesheet' type='text/css' media="all"/>
6
+ <link href='/stylesheets/mindapp.css' rel='stylesheet' type='text/css' media="all"/>
7
7
  <%= stylesheet_link_tag "sarabun", :media=>"all" %>
8
8
  </head>
9
9
  <style type="text/css" >
@@ -74,7 +74,7 @@ module Mindapp
74
74
  %w(call ws redirect invoke email).include? s
75
75
  end
76
76
  def set_global
77
- $xmain= @xmain ; $runseq = @runseq ; $user = current_user ; $xvars= @xmain.xvars
77
+ $xmain= @xmain ; $runseq = @runseq ; $user = current_user ; $xvars= @xmain.xvars; $ip = request.env["REMOTE_ADDR"]
78
78
  end
79
79
  def authorize? # use in pending tasks
80
80
  @runseq= @xmain.runseqs.find @xmain.current_runseq
@@ -111,13 +111,15 @@ module Mindapp
111
111
  end
112
112
  end
113
113
  def ma_log(message)
114
- if $user
115
114
  Mindapp::Notice.create :message => ERB::Util.html_escape(message.gsub("`","'")),
116
- :user_id => $user.id, :unread=> true, :ip=> env["REMOTE_ADDR"]
117
- else
118
- Mindapp::Notice.create :message => ERB::Util.html_escape(message.gsub("`","'")),
119
- :unread=> true, :ip=> env["REMOTE_ADDR"]
120
- end
115
+ :unread=> true, :ip=> ($ip || request.env["REMOTE_ADDR"])
116
+ # if session[:user_id]
117
+ # Mindapp::Notice.create :message => ERB::Util.html_escape(message.gsub("`","'")),
118
+ # :user_id => $user.id, :unread=> true, :ip=> env["REMOTE_ADDR"]
119
+ # else
120
+ # Mindapp::Notice.create :message => ERB::Util.html_escape(message.gsub("`","'")),
121
+ # :unread=> true, :ip=> env["REMOTE_ADDR"]
122
+ # end
121
123
  end
122
124
 
123
125
  alias :ma_notice :ma_log
@@ -179,7 +181,7 @@ module Mindapp
179
181
  # methods that I don't know where they came from
180
182
  def current_user
181
183
  if session[:user_id]
182
- return @user ||= User.find(session[:user_id])
184
+ return @user ||= User.find(session[:user_id]['$oid'])
183
185
  else
184
186
  return nil
185
187
  end
@@ -1,3 +1,3 @@
1
1
  module Mindapp
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -6,7 +6,7 @@ require 'mindapp/version'
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "mindapp"
8
8
  gem.version = Mindapp::VERSION
9
- gem.authors = ["songrit"]
9
+ gem.authors = ["Korakot Leemakdej"]
10
10
  gem.email = ["songrit@gmail.com"]
11
11
  gem.description = %q{generate Ruby on Rails app from mind map}
12
12
  gem.summary = %q{generate Ruby on Rails app from mind map}
@@ -18,9 +18,10 @@ Gem::Specification.new do |gem|
18
18
  gem.require_paths = ["lib"]
19
19
  gem.license = 'MIT'
20
20
 
21
- gem.add_dependency('mongo', '= 1.5.1')
22
- gem.add_dependency('bson_ext', '= 1.5.1')
23
- gem.add_dependency('mongoid')
21
+ # gem.add_dependency('mongo', '= 1.5.1')
22
+ # gem.add_dependency('bson_ext', '= 1.5.1')
23
+ # gem.add_dependency('mongoid')
24
+
24
25
  # gem.add_dependency('nokogiri') # for mindapp/doc
25
26
  # gem.add_dependency('haml-rails')
26
27
  # gem.add_dependency('mail')
metadata CHANGED
@@ -1,57 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mindapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
- - songrit
7
+ - Korakot Leemakdej
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-23 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: mongo
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '='
18
- - !ruby/object:Gem::Version
19
- version: 1.5.1
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '='
25
- - !ruby/object:Gem::Version
26
- version: 1.5.1
27
- - !ruby/object:Gem::Dependency
28
- name: bson_ext
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '='
32
- - !ruby/object:Gem::Version
33
- version: 1.5.1
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '='
39
- - !ruby/object:Gem::Version
40
- version: 1.5.1
41
- - !ruby/object:Gem::Dependency
42
- name: mongoid
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '>='
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
11
+ date: 2014-11-06 00:00:00.000000000 Z
12
+ dependencies: []
55
13
  description: generate Ruby on Rails app from mind map
56
14
  email:
57
15
  - songrit@gmail.com
@@ -59,13 +17,14 @@ executables: []
59
17
  extensions: []
60
18
  extra_rdoc_files: []
61
19
  files:
62
- - .gitignore
20
+ - ".gitignore"
63
21
  - Gemfile
64
22
  - LICENSE.txt
65
23
  - README.md
66
24
  - Rakefile
67
25
  - lib/generators/mindapp/USAGE
68
26
  - lib/generators/mindapp/install_generator.rb
27
+ - lib/generators/mindapp/mongoid_generator.rb
69
28
  - lib/generators/mindapp/templates/app/assets/images/account.png
70
29
  - lib/generators/mindapp/templates/app/assets/images/add.png
71
30
  - lib/generators/mindapp/templates/app/assets/images/ajax-loader-circle.gif
@@ -290,17 +249,17 @@ require_paths:
290
249
  - lib
291
250
  required_ruby_version: !ruby/object:Gem::Requirement
292
251
  requirements:
293
- - - '>='
252
+ - - ">="
294
253
  - !ruby/object:Gem::Version
295
254
  version: '0'
296
255
  required_rubygems_version: !ruby/object:Gem::Requirement
297
256
  requirements:
298
- - - '>='
257
+ - - ">="
299
258
  - !ruby/object:Gem::Version
300
259
  version: '0'
301
260
  requirements: []
302
261
  rubyforge_project:
303
- rubygems_version: 2.0.3
262
+ rubygems_version: 2.2.2
304
263
  signing_key:
305
264
  specification_version: 4
306
265
  summary: generate Ruby on Rails app from mind map