mdd 3.0.2 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/app/helpers/mdwa_helper.rb +2 -1
- data/lib/generators/mdwa/association/association_generator.rb +1 -1
- data/lib/generators/mdwa/association/templates/migrate/many_to_many.rb +1 -1
- data/lib/generators/mdwa/association/templates/migrate/one_field.rb +2 -1
- data/lib/generators/mdwa/code/code_generator.rb +54 -22
- data/lib/generators/mdwa/code/templates/migration.rb +2 -1
- data/lib/generators/mdwa/entity/entity_generator.rb +1 -2
- data/lib/generators/mdwa/entity/templates/entity.rb +2 -1
- data/lib/generators/mdwa/from_requirements/from_requirements_generator.rb +56 -0
- data/lib/generators/mdwa/process/USAGE +4 -0
- data/lib/generators/mdwa/process/process_generator.rb +24 -0
- data/lib/generators/mdwa/process/templates/process.rb +49 -0
- data/lib/generators/mdwa/requirement/USAGE +4 -0
- data/lib/generators/mdwa/requirement/requirement_generator.rb +24 -0
- data/lib/generators/mdwa/requirement/templates/requirement.rb +21 -0
- data/lib/generators/mdwa/sandbox/sandbox_generator.rb +1 -1
- data/lib/generators/mdwa/sandbox/templates/app/assets/stylesheets/mdwa/template/backend.css.erb +2 -2
- data/lib/generators/mdwa/sandbox/templates/app/controllers/a/backend_controller.rb +2 -1
- data/lib/generators/mdwa/sandbox/templates/app/controllers/a/users/sessions_controller.rb +1 -1
- data/lib/generators/mdwa/sandbox/templates/app/controllers/public_controller.rb +1 -0
- data/lib/generators/mdwa/sandbox/templates/config/initializers/devise.rb +1 -0
- data/lib/generators/mdwa/sandbox/templates/config/initializers/mdwa_layout.rb +2 -1
- data/lib/generators/mdwa/sandbox/templates/config/locales/mdwa.en.yml +1 -1
- data/lib/generators/mdwa/sandbox/templates/db/migrate/devise_create_users.rb +1 -1
- data/lib/generators/mdwa/sandbox/templates/db/seeds.rb +1 -1
- data/lib/generators/mdwa/sandbox/templates/db/seeds/site.rb +1 -1
- data/lib/generators/mdwa/scaffold/scaffold_generator.rb +10 -3
- data/lib/generators/mdwa/scaffold/templates/controllers/ajax_controller.rb +2 -1
- data/lib/generators/mdwa/scaffold/templates/controllers/controller.rb +2 -1
- data/lib/generators/mdwa/scaffold/templates/db_migrate/migrate.rb +2 -1
- data/lib/generators/mdwa/scaffold/templates/models/model.rb +2 -1
- data/lib/generators/mdwa/scaffold/templates/models/module.rb +2 -1
- data/lib/generators/mdwa/user/templates/user.rb +12 -0
- data/lib/generators/mdwa/user/user_generator.rb +13 -104
- data/lib/generators/mdwa/{user → user_scaffold}/USAGE +1 -1
- data/lib/generators/mdwa/{user → user_scaffold}/templates/controllers/ajax_controller.rb +2 -1
- data/lib/generators/mdwa/{user → user_scaffold}/templates/controllers/controller.rb +2 -1
- data/lib/generators/mdwa/{user → user_scaffold}/templates/migrate.rb +2 -1
- data/lib/generators/mdwa/{user → user_scaffold}/templates/views/update.js.erb +0 -0
- data/lib/generators/mdwa/user_scaffold/user_scaffold_generator.rb +139 -0
- data/lib/mdd.rb +1 -1
- data/lib/mdwa.rb +1 -1
- data/lib/mdwa/all.rb +1 -1
- data/lib/mdwa/dsl.rb +17 -4
- data/lib/mdwa/dsl/action.rb +78 -0
- data/lib/mdwa/dsl/entities.rb +4 -4
- data/lib/mdwa/dsl/entity.rb +59 -23
- data/lib/mdwa/dsl/entity_actions.rb +73 -0
- data/lib/mdwa/dsl/entity_association.rb +1 -1
- data/lib/mdwa/dsl/entity_attribute.rb +1 -1
- data/lib/mdwa/dsl/entity_specification.rb +22 -0
- data/lib/mdwa/dsl/process.rb +53 -0
- data/lib/mdwa/dsl/process_detail.rb +57 -0
- data/lib/mdwa/dsl/process_detail_next_action.rb +16 -0
- data/lib/mdwa/dsl/requirement.rb +23 -0
- data/lib/mdwa/dsl/requirements.rb +57 -0
- data/lib/mdwa/dsl/user.rb +34 -0
- data/lib/mdwa/dsl/users.rb +57 -0
- data/lib/mdwa/dsl/workflow.rb +57 -0
- data/lib/mdwa/generators.rb +1 -1
- data/lib/mdwa/generators/model.rb +3 -1
- data/lib/mdwa/generators/model_association.rb +4 -1
- data/lib/mdwa/generators/model_attribute.rb +2 -1
- data/lib/mdwa/layout.rb +1 -1
- data/lib/mdwa/layout/base.rb +1 -1
- data/lib/mdwa/layout/helper.rb +1 -1
- data/lib/mdwa/version.rb +1 -1
- data/test/entity_actions_test.rb +101 -0
- data/test/entity_specifications_test.rb +37 -0
- data/test/entity_test.rb +1 -1
- data/test/layout_test.rb +1 -1
- data/test/process_test.rb +86 -0
- data/test/requirements_test.rb +44 -0
- data/test/users_test.rb +55 -0
- metadata +37 -10
- data/lib/mdwa/dsl/generator.rb +0 -10
- data/test/generators_test.rb +0 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'mdwa/dsl'
|
3
|
+
|
4
|
+
require 'minitest/spec'
|
5
|
+
require 'minitest/autorun'
|
6
|
+
|
7
|
+
describe MDWA::DSL::Entity do
|
8
|
+
|
9
|
+
before do
|
10
|
+
MDWA::DSL.entities.register 'Spec' do |e|
|
11
|
+
e.resource = true
|
12
|
+
|
13
|
+
e.specify "fields should not be invalid" do |s|
|
14
|
+
s.such_as "date should be valid"
|
15
|
+
s.such_as "administrator must not be empty"
|
16
|
+
s.such_as "description must not be empty"
|
17
|
+
end
|
18
|
+
e.specify "date should not be in the past"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should store specifications correctly' do
|
23
|
+
|
24
|
+
entity = MDWA::DSL.entity('Spec')
|
25
|
+
entity.specifications.count.must_equal 2
|
26
|
+
entity.specifications.first.details.count.must_equal 3
|
27
|
+
entity.specifications.last.details.count.must_equal 0
|
28
|
+
|
29
|
+
entity.specifications.first.description.must_equal "fields should not be invalid"
|
30
|
+
entity.specifications.first.details[0].must_equal "date should be valid"
|
31
|
+
entity.specifications.first.details[1].must_equal "administrator must not be empty"
|
32
|
+
entity.specifications.first.details[2].must_equal "description must not be empty"
|
33
|
+
entity.specifications.last.description.must_equal "date should not be in the past"
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
data/test/entity_test.rb
CHANGED
data/test/layout_test.rb
CHANGED
@@ -0,0 +1,86 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'mdwa/dsl'
|
3
|
+
|
4
|
+
require 'minitest/spec'
|
5
|
+
require 'minitest/autorun'
|
6
|
+
|
7
|
+
describe MDWA::DSL::Workflow do
|
8
|
+
|
9
|
+
before do
|
10
|
+
MDWA::DSL.workflow.register 'Manage projects' do |p|
|
11
|
+
|
12
|
+
# The process start point for every user role
|
13
|
+
# Params: :user_role, alias or entity listing
|
14
|
+
p.start_for 'ProjectManager', 'new_project_group'
|
15
|
+
p.start_for 'TeamMember', 'new_task'
|
16
|
+
|
17
|
+
p.detail 'New Project Group' do |d|
|
18
|
+
d.user_roles = ['ProjectManager']
|
19
|
+
d.action 'project_group', 'new'
|
20
|
+
d.next_action 'create_project_group', :method => :post
|
21
|
+
end
|
22
|
+
|
23
|
+
p.detail "Create project group" do |d|
|
24
|
+
|
25
|
+
d.user_roles = ['ProjectManager', 'TeamMember']
|
26
|
+
d.action 'project_group', 'create'
|
27
|
+
|
28
|
+
d.next_action 'new_project_group', :when => 'save failed'
|
29
|
+
d.next_action 'project_group_list', :redirect => true, :when => 'save ok'
|
30
|
+
d.next_action 'new_project', :when => 'clicked save & new project'
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
it "should store data correctly" do
|
39
|
+
MDWA::DSL.workflow.all.count.must_equal 1
|
40
|
+
p = MDWA::DSL.process 'manage_projects'
|
41
|
+
|
42
|
+
p.nil?.must_equal false
|
43
|
+
p.start_for_roles.count.must_equal 2
|
44
|
+
p.start_for_roles['ProjectManager'].must_equal 'new_project_group'
|
45
|
+
p.start_for_roles['TeamMember'].must_equal 'new_task'
|
46
|
+
|
47
|
+
p.details.count.must_equal 2
|
48
|
+
p.details['new_project_group'].must_be_instance_of MDWA::DSL::ProcessDetail
|
49
|
+
p.details['new_project_group'].description.must_equal 'New Project Group'
|
50
|
+
p.details['new_project_group'].user_roles.count.must_equal 1
|
51
|
+
p.details['new_project_group'].user_roles.first.must_equal 'ProjectManager'
|
52
|
+
p.details['new_project_group'].detail_action.entity.must_equal 'project_group'
|
53
|
+
p.details['new_project_group'].detail_action.action.must_equal 'new'
|
54
|
+
p.details['new_project_group'].next_actions.count.must_equal 1
|
55
|
+
p.details['new_project_group'].next_actions.first.must_be_instance_of MDWA::DSL::ProcessDetailNextAction
|
56
|
+
|
57
|
+
p.details['create_project_group'].must_be_instance_of MDWA::DSL::ProcessDetail
|
58
|
+
p.details['create_project_group'].description.must_equal 'Create project group'
|
59
|
+
p.details['create_project_group'].user_roles.count.must_equal 2
|
60
|
+
p.details['create_project_group'].user_roles.first.must_equal 'ProjectManager'
|
61
|
+
p.details['create_project_group'].user_roles.last.must_equal 'TeamMember'
|
62
|
+
p.details['create_project_group'].detail_action.entity.must_equal 'project_group'
|
63
|
+
p.details['create_project_group'].detail_action.action.must_equal 'create'
|
64
|
+
p.details['create_project_group'].next_actions.count.must_equal 3
|
65
|
+
p.details['create_project_group'].next_actions[0].must_be_instance_of MDWA::DSL::ProcessDetailNextAction
|
66
|
+
p.details['create_project_group'].next_actions[1].must_be_instance_of MDWA::DSL::ProcessDetailNextAction
|
67
|
+
p.details['create_project_group'].next_actions[2].must_be_instance_of MDWA::DSL::ProcessDetailNextAction
|
68
|
+
|
69
|
+
# next actions
|
70
|
+
p.details['new_project_group'].next_actions.first.alias.must_equal 'create_project_group'
|
71
|
+
p.details['new_project_group'].next_actions.first.method.must_equal :post
|
72
|
+
p.details['new_project_group'].next_actions.first.request.must_equal :html
|
73
|
+
|
74
|
+
p.details['create_project_group'].next_actions[0].alias.must_equal 'new_project_group'
|
75
|
+
p.details['create_project_group'].next_actions[0].when.must_equal 'save failed'
|
76
|
+
p.details['create_project_group'].next_actions[0].redirect.must_equal false
|
77
|
+
p.details['create_project_group'].next_actions[1].alias.must_equal 'project_group_list'
|
78
|
+
p.details['create_project_group'].next_actions[1].when.must_equal 'save ok'
|
79
|
+
p.details['create_project_group'].next_actions[1].redirect.must_equal true
|
80
|
+
p.details['create_project_group'].next_actions[2].alias.must_equal 'new_project'
|
81
|
+
p.details['create_project_group'].next_actions[2].when.must_equal 'clicked save & new project'
|
82
|
+
p.details['create_project_group'].next_actions[2].redirect.must_equal false
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'mdwa/dsl'
|
3
|
+
|
4
|
+
require 'minitest/spec'
|
5
|
+
require 'minitest/autorun'
|
6
|
+
|
7
|
+
describe MDWA::DSL::Entity do
|
8
|
+
|
9
|
+
before do
|
10
|
+
MDWA::DSL.requirements.register do |r|
|
11
|
+
r.summary = 'Manage Projects'
|
12
|
+
|
13
|
+
r.description = %q{Detailed description of the requirement.}
|
14
|
+
r.entities = ['ProjectGroup', 'Project', 'Task', 'Milestone']
|
15
|
+
r.users = ['Administrator', 'TeamMember']
|
16
|
+
end
|
17
|
+
|
18
|
+
MDWA::DSL.requirements.register 'Manage clients' do |r|
|
19
|
+
r.alias = 'clients'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should store data correctly' do
|
24
|
+
|
25
|
+
requirement = MDWA::DSL.requirement('manage_projects')
|
26
|
+
requirement.summary.must_equal 'Manage Projects'
|
27
|
+
requirement.description.must_equal 'Detailed description of the requirement.'
|
28
|
+
requirement.entities.count.must_equal 4
|
29
|
+
requirement.entities[0].must_equal 'ProjectGroup'
|
30
|
+
requirement.entities[1].must_equal 'Project'
|
31
|
+
requirement.entities[2].must_equal 'Task'
|
32
|
+
requirement.entities[3].must_equal 'Milestone'
|
33
|
+
requirement.users.count.must_equal 2
|
34
|
+
requirement.users[0].must_equal 'Administrator'
|
35
|
+
requirement.users[1].must_equal 'TeamMember'
|
36
|
+
|
37
|
+
requirement_client = MDWA::DSL.requirement('clients')
|
38
|
+
requirement_client.nil?.must_equal false
|
39
|
+
requirement_client.summary.must_equal 'Manage clients'
|
40
|
+
requirement_client.alias.must_equal 'clients'
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
data/test/users_test.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'mdwa/dsl'
|
3
|
+
|
4
|
+
require 'minitest/spec'
|
5
|
+
require 'minitest/autorun'
|
6
|
+
|
7
|
+
describe MDWA::Layout::Base do
|
8
|
+
|
9
|
+
before do
|
10
|
+
|
11
|
+
MDWA::DSL.users.register 'Administrator' do |u|
|
12
|
+
u.description = 'Administrator and super user of the system.'
|
13
|
+
|
14
|
+
u.user_roles = ['Administrator', 'SuperAdmin', 'Director']
|
15
|
+
end
|
16
|
+
|
17
|
+
MDWA::DSL.users.register 'Programmer' do |u|
|
18
|
+
u.user_roles = 'Tester'
|
19
|
+
end
|
20
|
+
|
21
|
+
MDWA::DSL.users.register 'Tester' do |u|
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should store correct values" do
|
27
|
+
|
28
|
+
administrator = MDWA::DSL.user 'Administrator'
|
29
|
+
programmer = MDWA::DSL.user 'Programmer'
|
30
|
+
tester = MDWA::DSL.user 'Tester'
|
31
|
+
|
32
|
+
MDWA::DSL.users.all.count.must_equal 3
|
33
|
+
|
34
|
+
administrator.name.must_equal 'Administrator'
|
35
|
+
administrator.description.must_equal 'Administrator and super user of the system.'
|
36
|
+
administrator.user_roles.count.must_equal 3
|
37
|
+
administrator.user_roles.include?( 'SuperAdmin' ).must_equal true
|
38
|
+
administrator.user_roles.include?( 'Director' ).must_equal true
|
39
|
+
administrator.user_roles.include?( 'Administrator' ).must_equal true
|
40
|
+
administrator.user_roles.include?( 'Manager' ).must_equal false
|
41
|
+
|
42
|
+
programmer.name.must_equal 'Programmer'
|
43
|
+
programmer.description.blank?.must_equal true
|
44
|
+
programmer.user_roles.count.must_equal 2
|
45
|
+
programmer.user_roles.include?('Programmer').must_equal true
|
46
|
+
programmer.user_roles.include?('Tester').must_equal true
|
47
|
+
programmer.user_roles.include?('Director').must_equal false
|
48
|
+
|
49
|
+
tester.name.must_equal 'Tester'
|
50
|
+
tester.user_roles.count.must_equal 1
|
51
|
+
tester.user_roles.include?('Tester').must_equal true
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mdd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -172,6 +172,13 @@ files:
|
|
172
172
|
- lib/generators/mdwa/entity/USAGE
|
173
173
|
- lib/generators/mdwa/entity/entity_generator.rb
|
174
174
|
- lib/generators/mdwa/entity/templates/entity.rb
|
175
|
+
- lib/generators/mdwa/from_requirements/from_requirements_generator.rb
|
176
|
+
- lib/generators/mdwa/process/USAGE
|
177
|
+
- lib/generators/mdwa/process/process_generator.rb
|
178
|
+
- lib/generators/mdwa/process/templates/process.rb
|
179
|
+
- lib/generators/mdwa/requirement/USAGE
|
180
|
+
- lib/generators/mdwa/requirement/requirement_generator.rb
|
181
|
+
- lib/generators/mdwa/requirement/templates/requirement.rb
|
175
182
|
- lib/generators/mdwa/sandbox/USAGE
|
176
183
|
- lib/generators/mdwa/sandbox/sandbox_generator.rb
|
177
184
|
- lib/generators/mdwa/sandbox/templates/app/assets/images/.DS_Store
|
@@ -306,23 +313,35 @@ files:
|
|
306
313
|
- lib/generators/mdwa/scaffold/templates/views/index.js.erb
|
307
314
|
- lib/generators/mdwa/scaffold/templates/views/new.html.erb
|
308
315
|
- lib/generators/mdwa/scaffold/templates/views/show.html.erb
|
309
|
-
- lib/generators/mdwa/user/
|
310
|
-
- lib/generators/mdwa/user/templates/controllers/ajax_controller.rb
|
311
|
-
- lib/generators/mdwa/user/templates/controllers/controller.rb
|
312
|
-
- lib/generators/mdwa/user/templates/migrate.rb
|
313
|
-
- lib/generators/mdwa/user/templates/views/update.js.erb
|
316
|
+
- lib/generators/mdwa/user/templates/user.rb
|
314
317
|
- lib/generators/mdwa/user/user_generator.rb
|
318
|
+
- lib/generators/mdwa/user_scaffold/USAGE
|
319
|
+
- lib/generators/mdwa/user_scaffold/templates/controllers/ajax_controller.rb
|
320
|
+
- lib/generators/mdwa/user_scaffold/templates/controllers/controller.rb
|
321
|
+
- lib/generators/mdwa/user_scaffold/templates/migrate.rb
|
322
|
+
- lib/generators/mdwa/user_scaffold/templates/views/update.js.erb
|
323
|
+
- lib/generators/mdwa/user_scaffold/user_scaffold_generator.rb
|
315
324
|
- lib/mdd.rb
|
316
325
|
- lib/mdwa.rb
|
317
326
|
- lib/mdwa/.DS_Store
|
318
327
|
- lib/mdwa/all.rb
|
319
328
|
- lib/mdwa/dsl.rb
|
320
329
|
- lib/mdwa/dsl/.DS_Store
|
330
|
+
- lib/mdwa/dsl/action.rb
|
321
331
|
- lib/mdwa/dsl/entities.rb
|
322
332
|
- lib/mdwa/dsl/entity.rb
|
333
|
+
- lib/mdwa/dsl/entity_actions.rb
|
323
334
|
- lib/mdwa/dsl/entity_association.rb
|
324
335
|
- lib/mdwa/dsl/entity_attribute.rb
|
325
|
-
- lib/mdwa/dsl/
|
336
|
+
- lib/mdwa/dsl/entity_specification.rb
|
337
|
+
- lib/mdwa/dsl/process.rb
|
338
|
+
- lib/mdwa/dsl/process_detail.rb
|
339
|
+
- lib/mdwa/dsl/process_detail_next_action.rb
|
340
|
+
- lib/mdwa/dsl/requirement.rb
|
341
|
+
- lib/mdwa/dsl/requirements.rb
|
342
|
+
- lib/mdwa/dsl/user.rb
|
343
|
+
- lib/mdwa/dsl/users.rb
|
344
|
+
- lib/mdwa/dsl/workflow.rb
|
326
345
|
- lib/mdwa/generators.rb
|
327
346
|
- lib/mdwa/generators/.DS_Store
|
328
347
|
- lib/mdwa/generators/model.rb
|
@@ -334,9 +353,13 @@ files:
|
|
334
353
|
- lib/mdwa/layout/helper.rb
|
335
354
|
- lib/mdwa/version.rb
|
336
355
|
- mdd.gemspec
|
356
|
+
- test/entity_actions_test.rb
|
357
|
+
- test/entity_specifications_test.rb
|
337
358
|
- test/entity_test.rb
|
338
|
-
- test/generators_test.rb
|
339
359
|
- test/layout_test.rb
|
360
|
+
- test/process_test.rb
|
361
|
+
- test/requirements_test.rb
|
362
|
+
- test/users_test.rb
|
340
363
|
homepage: https://github.com/marcelotheodoro/mdd
|
341
364
|
licenses: []
|
342
365
|
post_install_message:
|
@@ -362,6 +385,10 @@ signing_key:
|
|
362
385
|
specification_version: 3
|
363
386
|
summary: MDD-based code generation tools to avoid repetitive tasks in Rails dev.
|
364
387
|
test_files:
|
388
|
+
- test/entity_actions_test.rb
|
389
|
+
- test/entity_specifications_test.rb
|
365
390
|
- test/entity_test.rb
|
366
|
-
- test/generators_test.rb
|
367
391
|
- test/layout_test.rb
|
392
|
+
- test/process_test.rb
|
393
|
+
- test/requirements_test.rb
|
394
|
+
- test/users_test.rb
|
data/lib/mdwa/dsl/generator.rb
DELETED
data/test/generators_test.rb
DELETED
File without changes
|