ultra_light_wizard 0.0.5 → 0.0.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
2
  SHA1:
3
- metadata.gz: 2929282783a52ec498589168a0c2d4f9a293ba48
4
- data.tar.gz: 1a659b6b9a05a82a7f7464e6fe335cadb3f0c73c
3
+ metadata.gz: c477bed626ccfefdabaa81d8537e8e045db42feb
4
+ data.tar.gz: b5e197995d61a13d57ac1ca1fc932894212cdb4a
5
5
  SHA512:
6
- metadata.gz: 8ed1443f1dc071f13c03abfaa9956aa9dc852aab3657fc990f1b06b8ed47be1f46f790e63e4a7fbabad92d88a9067c988a24dbd85a300b62c914e5380f3e67eb
7
- data.tar.gz: 49bd8560e293d95aa42ab7c0f183a35a7f8bb61d6a5ca86865c2f54d288affcee70c4ce46ac2c7251211f61b1eb8036dbb2008f9629a055f1e708cd80c922572
6
+ metadata.gz: c4c0c47bbe0ebd1b983a6eab5c1e5635aa65a8ae4b2600638f0475a9f956e82c12a29fadacd5a3fb7604f197a252fc12c710fb35049e3e4899f7a4d7cc65da26
7
+ data.tar.gz: 785dfb392fcca6b2bb73115a2133a9b1cc3afc429ad0d2a38f7c61955b26c683088fe696d3f5222a5a6ba34e8276ee04e291056b52e31da2351b8a7dbeeef663
data/README.md CHANGED
@@ -11,50 +11,134 @@ https://www.youtube.com/watch?v=muyfoiKHMMA
11
11
  Instructions
12
12
  ============
13
13
 
14
- ```rails generate ultra_light_wizard:wizard (resource) steps=(step1),(step2),(step3),...```
14
+ Simply use the following command in place of the Rails scaffold generator, and it will scaffold both standard resource and wizard components
15
+
16
+ ```rails generate ultra_light_wizard:wizard (resource) steps:(step1),(step2),(step3),... attributes:(attribute1:db_type1),(attribute2:db_type2),...```
15
17
 
16
18
  This will generate wizard step routes, controller, models, and views
17
19
 
18
20
  Example:
19
21
 
20
- ```rails generate ultra_light_wizard:wizard Project steps:basic_info,project_detail,file_uploads,preview```
22
+ ```rails generate ultra_light_wizard:wizard Project steps:basic_info,project_detail,file_uploads,preview attributes:name:string,description:text,start_date:date,delivery_date:date```
21
23
 
22
24
  Output:
23
25
 
24
26
  ```
25
- create app/controllers/project_steps_controller.rb
26
- create app/models/project/basic_info.rb
27
- create app/views/project_steps/basic_info.html.erb
28
- create app/models/project/project_detail.rb
29
- create app/views/project_steps/project_detail.html.erb
30
- create app/models/project/file_uploads.rb
31
- create app/views/project_steps/file_uploads.html.erb
32
- create app/models/project/preview.rb
33
- create app/views/project_steps/preview.html.erb
34
- route resources :projects, only: [:create, :show] do
27
+ generate scaffold
28
+ invoke active_record
29
+ create db/migrate/20160201025849_create_projects.rb
30
+ create app/models/project.rb
31
+ invoke test_unit
32
+ create test/models/project_test.rb
33
+ create test/fixtures/projects.yml
34
+ invoke resource_route
35
+ route resources :projects
36
+ invoke scaffold_controller
37
+ create app/controllers/projects_controller.rb
38
+ invoke erb
39
+ create app/views/projects
40
+ create app/views/projects/index.html.erb
41
+ create app/views/projects/edit.html.erb
42
+ create app/views/projects/show.html.erb
43
+ create app/views/projects/new.html.erb
44
+ create app/views/projects/_form.html.erb
45
+ invoke test_unit
46
+ create test/controllers/projects_controller_test.rb
47
+ invoke helper
48
+ create app/helpers/projects_helper.rb
49
+ invoke test_unit
50
+ invoke jbuilder
51
+ create app/views/projects/index.json.jbuilder
52
+ create app/views/projects/show.json.jbuilder
53
+ invoke assets
54
+ invoke coffee
55
+ create app/assets/javascripts/projects.coffee
56
+ invoke scss
57
+ create app/assets/stylesheets/projects.scss
58
+ invoke scss
59
+ identical app/assets/stylesheets/scaffolds.scss
60
+ conflict app/controllers/projects_controller.rb
61
+ Overwrite /cygdrive/c/Users/a_mal_000/OneDrive/code/rails_example/app/controllers/projects_controller.rb? (enter "h" for help) [Ynaqdh] a
62
+ force app/controllers/projects_controller.rb
63
+ create app/controllers/project_steps_controller.rb
64
+ create app/helpers/project_steps_helper.rb
65
+ create app/views/project_steps/_step_navigation.html.erb
66
+ create app/models/project/name.rb
67
+ create app/views/project_steps/name.html.erb
68
+ create app/models/project/description.rb
69
+ create app/views/project_steps/description.html.erb
70
+ create app/models/project/start_date.rb
71
+ create app/views/project_steps/start_date.html.erb
72
+ create app/models/project/delivery_date.rb
73
+ create app/views/project_steps/delivery_date.html.erb
74
+ create app/models/project/preview.rb
75
+ create app/views/project_steps/preview.html.erb
76
+ route resources :projects, only: [:create, :show] do
35
77
  resources :project_steps, only: [:edit, :update]
36
78
  end
37
79
  ```
38
80
 
81
+ It will ask you at one point to overwrite projects_controller generated in included scaffold. Type y or a to have it continue.
82
+
39
83
  If you'd like to customize the term "step", you can add a step_alias:(alias) option as in the following:
40
84
 
41
85
  Example:
42
86
 
43
- ```rails generate ultra_light_wizard:wizard Project steps:basic_info,project_detail,file_uploads,preview step_alias:part```
87
+ ```rails generate ultra_light_wizard:wizard Project steps:basic_info,project_detail,file_uploads,preview attributes:name:string,description:text,start_date:date,delivery_date:date step_alias:part```
44
88
 
45
89
  Output:
46
90
 
47
91
  ```
48
- create app/controllers/project_parts_controller.rb
49
- create app/models/project/basic_info.rb
50
- create app/views/project_parts/basic_info.html.erb
51
- create app/models/project/project_detail.rb
52
- create app/views/project_parts/project_detail.html.erb
53
- create app/models/project/file_uploads.rb
54
- create app/views/project_parts/file_uploads.html.erb
55
- create app/models/project/preview.rb
56
- create app/views/project_parts/preview.html.erb
57
- route resources :projects, only: [:create, :show] do
92
+ generate scaffold
93
+ invoke active_record
94
+ create db/migrate/20160201025849_create_projects.rb
95
+ create app/models/project.rb
96
+ invoke test_unit
97
+ create test/models/project_test.rb
98
+ create test/fixtures/projects.yml
99
+ invoke resource_route
100
+ route resources :projects
101
+ invoke scaffold_controller
102
+ create app/controllers/projects_controller.rb
103
+ invoke erb
104
+ create app/views/projects
105
+ create app/views/projects/index.html.erb
106
+ create app/views/projects/edit.html.erb
107
+ create app/views/projects/show.html.erb
108
+ create app/views/projects/new.html.erb
109
+ create app/views/projects/_form.html.erb
110
+ invoke test_unit
111
+ create test/controllers/projects_controller_test.rb
112
+ invoke helper
113
+ create app/helpers/projects_helper.rb
114
+ invoke test_unit
115
+ invoke jbuilder
116
+ create app/views/projects/index.json.jbuilder
117
+ create app/views/projects/show.json.jbuilder
118
+ invoke assets
119
+ invoke coffee
120
+ create app/assets/javascripts/projects.coffee
121
+ invoke scss
122
+ create app/assets/stylesheets/projects.scss
123
+ invoke scss
124
+ identical app/assets/stylesheets/scaffolds.scss
125
+ conflict app/controllers/projects_controller.rb
126
+ Overwrite /cygdrive/c/Users/a_mal_000/OneDrive/code/rails_example/app/controllers/projects_controller.rb? (enter "h" for help) [Ynaqdh] a
127
+ force app/controllers/projects_controller.rb
128
+ create app/controllers/project_parts_controller.rb
129
+ create app/helpers/project_parts_helper.rb
130
+ create app/views/project_parts/_part_navigation.html.erb
131
+ create app/models/project/name.rb
132
+ create app/views/project_parts/name.html.erb
133
+ create app/models/project/description.rb
134
+ create app/views/project_parts/description.html.erb
135
+ create app/models/project/start_date.rb
136
+ create app/views/project_parts/start_date.html.erb
137
+ create app/models/project/delivery_date.rb
138
+ create app/views/project_parts/delivery_date.html.erb
139
+ create app/models/project/preview.rb
140
+ create app/views/project_parts/preview.html.erb
141
+ route resources :projects, only: [:create, :show] do
58
142
  resources :project_parts, only: [:edit, :update]
59
143
  end
60
144
  ```
@@ -96,8 +180,9 @@ Features
96
180
  + [DONE] Route helper methods
97
181
  + [DONE] Wizard kick-off helper/view
98
182
  + [DONE] Forms
99
- - Scaffolding of main model controller/views/migration
100
- - Support for attributes
183
+ - Form fields
184
+ + [DONE] Scaffolding of main model controller/views/migration
185
+ + [DONE] Support for attributes
101
186
  - Support for nested resources
102
187
  - Modularize (perhaps extracting sub-generators)
103
188
  + [DONE] Customize name conventions
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.6
@@ -1,4 +1,10 @@
1
1
  class <%= class_name %>::<%= @wizard_step.camelize %> < <%= class_name %>
2
+ # Include step validations here
3
+
4
+ # Include step after_initialize attribute default settings here
5
+
6
+ # Include step after_save changes here
7
+
2
8
  def editable?
3
9
  true
4
10
  end
@@ -4,8 +4,10 @@ module UltraLightWizard
4
4
  source_root File.expand_path("../../templates", __FILE__)
5
5
  def arguments
6
6
  args.inject({}) do |output, arg|
7
- arg_parts = arg.split(':')
8
- output.merge(arg_parts.first => arg_parts.last)
7
+ # Accommodate argument values containing colon by matching against
8
+ # occurance of it only
9
+ arg_parts = arg.match(/^([^:]+)\:(.+)$/)
10
+ output.merge(arg_parts[1] => arg_parts[2])
9
11
  end
10
12
  end
11
13
 
@@ -29,8 +31,23 @@ module UltraLightWizard
29
31
  file_path.pluralize
30
32
  end
31
33
 
34
+ def model_attributes
35
+ arguments['attributes']
36
+ end
37
+
38
+ def hashed_model_attributes
39
+ model_attributes.split(',').inject({}) do |output, pair|
40
+ split_pair = pair.split(':')
41
+ output.merge(split_pair.first => split_pair.last)
42
+ end
43
+ end
44
+
45
+ def scaffold_attributes
46
+ model_attributes.sub(',', ' ')
47
+ end
48
+
32
49
  def controller_attribute_names
33
- [].join(',')
50
+ hashed_model_attributes.keys.map {|key| "\"#{key}\""}.join(', ')
34
51
  end
35
52
 
36
53
  def human_name
@@ -43,6 +60,7 @@ module UltraLightWizard
43
60
 
44
61
  desc "Creates a configuration file for a specific application context (e.g. admin). Takes context path as argument (e.g. admin or internal/wiki) to create config/features/[context_path].yml"
45
62
  def copy_config
63
+ generate "scaffold", "#{file_path} #{scaffold_attributes}"
46
64
  template "app/controllers/model_controller.rb.erb", "app/controllers/#{file_path.pluralize}_controller.rb"
47
65
  template "app/controllers/wizard_steps_controller.rb.erb", "app/controllers/#{file_path}_#{step_alias.pluralize}_controller.rb"
48
66
  template "app/helpers/wizard_steps_helper.rb.erb", "app/helpers/#{file_path}_#{step_alias.pluralize}_helper.rb"
@@ -1,17 +1,17 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in rakefile, and run 'rake gemspec'
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: ultra_light_wizard 0.0.5 ruby lib
5
+ # stub: ultra_light_wizard 0.0.6 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "ultra_light_wizard"
9
- s.version = "0.0.5"
9
+ s.version = "0.0.6"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Andy Maleh"]
14
- s.date = "2016-01-30"
14
+ s.date = "2016-02-01"
15
15
  s.description = "Ultra light & maintainble wizards in Rails that honor REST, MVC, and OO with minimal writing of code involved and maximum flexibility"
16
16
  s.email = "andy.am@gmail.com"
17
17
  s.extra_rdoc_files = [
@@ -43,7 +43,7 @@ Gem::Specification.new do |s|
43
43
  ]
44
44
  s.homepage = "http://github.com/AndyObtiva/ultra_light_wizard"
45
45
  s.licenses = ["MIT"]
46
- s.rubygems_version = "2.4.8"
46
+ s.rubygems_version = "2.4.6"
47
47
  s.summary = "Ultra Light & Maintainable Wizards In Rails"
48
48
 
49
49
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ultra_light_wizard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-30 00:00:00.000000000 Z
11
+ date: 2016-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jeweler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.8.8
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.8.8
27
27
  description: Ultra light & maintainble wizards in Rails that honor REST, MVC, and
@@ -33,8 +33,8 @@ extra_rdoc_files:
33
33
  - LICENSE.txt
34
34
  - README.md
35
35
  files:
36
- - ".ruby-gemset"
37
- - ".ruby-version"
36
+ - .ruby-gemset
37
+ - .ruby-version
38
38
  - Gemfile
39
39
  - Gemfile.lock
40
40
  - LICENSE.txt
@@ -64,17 +64,17 @@ require_paths:
64
64
  - lib
65
65
  required_ruby_version: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ">="
67
+ - - '>='
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ">="
72
+ - - '>='
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  requirements: []
76
76
  rubyforge_project:
77
- rubygems_version: 2.4.8
77
+ rubygems_version: 2.4.6
78
78
  signing_key:
79
79
  specification_version: 4
80
80
  summary: Ultra Light & Maintainable Wizards In Rails