repres-bootstrap 1.2 → 1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +40 -0
- data/lib/generators/repres/bootstrap/platform/USAGE +31 -4
- data/lib/generators/repres/bootstrap/platform/platform_generator.rb +106 -152
- data/lib/generators/repres/bootstrap/platform/templates/app/helpers/platform_helper.rb +6 -0
- data/lib/repres/bootstrap/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf0d2aaf347c6aacf1c84fa71d47bf1796eb9d28
|
4
|
+
data.tar.gz: 76b475f28a6cb559c4119e52c731af05902287f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c3c5b510474d7bd30b3fa84e2f8a8bb6ec187b8b1e7287a345b46831bd2b3dfb4a62e5c8b3c74fce6405558e0dcee32af9a65872eefb18d4340e7b0506d26bc
|
7
|
+
data.tar.gz: 780b260280b843fbbb0db4c8366713e2005bc86d3590816e21c287138ef07227ffbf6523f6ad5977d2c032f8effd410c73a7364b48588bd67dd96a4f9cc1e271
|
data/README.md
CHANGED
@@ -210,3 +210,43 @@ Here are more options:
|
|
210
210
|
- readonly: the readonly attribute of a HTML input tag.
|
211
211
|
- required: the required attribute of a HTML input tag.
|
212
212
|
- rows: the rows of a HTML Text Area
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
## Generators
|
217
|
+
|
218
|
+
### Platform generator
|
219
|
+
The platform generator generates a platform with a version number. The platform name is administration in the following example.
|
220
|
+
```shell
|
221
|
+
rails generate repres:bootstrap:platform administration --version 4
|
222
|
+
```
|
223
|
+
|
224
|
+
This will insert the following routings into the config/routes.rb file:
|
225
|
+
```ruby
|
226
|
+
namespace :administration do
|
227
|
+
namespace :v3 do
|
228
|
+
resources :dashboards, only: :show
|
229
|
+
end
|
230
|
+
end
|
231
|
+
```
|
232
|
+
|
233
|
+
This will create the following files:
|
234
|
+
```shell
|
235
|
+
app/assets/images/administration/v4/.keep
|
236
|
+
app/assets/images/shared/.keep
|
237
|
+
app/assets/images/administration/v4/shared/.keep
|
238
|
+
app/assets/javascripts/administration/v4/.keep
|
239
|
+
app/assets/javascripts/shared/.keep
|
240
|
+
app/assets/javascripts/administration/v4/shared/.keep
|
241
|
+
app/assets/stylesheets/administration/v4/.keep
|
242
|
+
app/assets/stylesheets/shared/.keep
|
243
|
+
app/assets/stylesheets/administration/v4/shared/.keep
|
244
|
+
app/controllers/concerns/priviledge_protection.rb
|
245
|
+
app/controllers/administration/v4/privileged_controller.rb
|
246
|
+
app/controllers/administration/v4/dashboards_controller.rb
|
247
|
+
app/helpers/administration/v4/application_helper.rb
|
248
|
+
app/views/layouts/administration/v4.html.erb
|
249
|
+
app/views/shared/.keep
|
250
|
+
app/views/administration/v4/shared/_script.html.erb
|
251
|
+
app/views/administration/v4/shared/_style.html.erb
|
252
|
+
```
|
@@ -1,8 +1,35 @@
|
|
1
1
|
Description:
|
2
|
-
|
2
|
+
|
3
|
+
Generate the platform scaffold for the Bootstrap framework.
|
3
4
|
|
4
5
|
Example:
|
5
|
-
rails generate platform Thing
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
rails generate repres:bootstrap:platform administration --version 4
|
8
|
+
|
9
|
+
This will insert the following routing into the config/routes.rb:
|
10
|
+
|
11
|
+
namespace :administration do
|
12
|
+
namespace :v4 do
|
13
|
+
resources :dashboards, only: :show
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
This will create the following files:
|
18
|
+
|
19
|
+
app/assets/images/administration/v4/.keep
|
20
|
+
app/assets/images/shared/.keep
|
21
|
+
app/assets/images/administration/v4/shared/.keep
|
22
|
+
app/assets/javascripts/administration/v4/.keep
|
23
|
+
app/assets/javascripts/shared/.keep
|
24
|
+
app/assets/javascripts/administration/v4/shared/.keep
|
25
|
+
app/assets/stylesheets/administration/v4/.keep
|
26
|
+
app/assets/stylesheets/shared/.keep
|
27
|
+
app/assets/stylesheets/administration/v4/shared/.keep
|
28
|
+
app/controllers/concerns/priviledge_protection.rb
|
29
|
+
app/controllers/administration/v4/privileged_controller.rb
|
30
|
+
app/controllers/administration/v4/dashboards_controller.rb
|
31
|
+
app/helpers/administration/v4/application_helper.rb
|
32
|
+
app/views/layouts/administration/v4.html.erb
|
33
|
+
app/views/shared/.keep
|
34
|
+
app/views/administration/v4/shared/_script.html.erb
|
35
|
+
app/views/administration/v4/shared/_style.html.erb
|
@@ -7,8 +7,9 @@ class Repres::Bootstrap::PlatformGenerator < Rails::Generators::NamedBase
|
|
7
7
|
|
8
8
|
source_root File.expand_path('../templates', __FILE__)
|
9
9
|
|
10
|
-
def
|
10
|
+
def produce
|
11
11
|
|
12
|
+
=begin
|
12
13
|
puts "file_name = #{file_name.inspect}"
|
13
14
|
puts "file_path = #{file_path.inspect}"
|
14
15
|
puts "namespace = #{namespace.inspect}"
|
@@ -19,15 +20,27 @@ class Repres::Bootstrap::PlatformGenerator < Rails::Generators::NamedBase
|
|
19
20
|
|
20
21
|
puts '---- ----'
|
21
22
|
puts "class_options = #{self.class.class_options.inspect}"
|
23
|
+
=end
|
22
24
|
|
23
25
|
@platform_name = file_name.downcase
|
24
26
|
@version_number = options['version'].to_i
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
generate_asset_image
|
29
|
+
generate_asset_image_shared
|
30
|
+
generate_asset_script
|
31
|
+
generate_asset_script_shared
|
32
|
+
generate_asset_style
|
33
|
+
generate_asset_style_shared
|
34
|
+
|
35
|
+
generate_concern
|
36
|
+
generate_controller
|
37
|
+
|
38
|
+
generate_helper
|
39
|
+
|
40
|
+
generate_view_layout
|
41
|
+
generate_view_shared
|
42
|
+
|
43
|
+
generate_route
|
31
44
|
|
32
45
|
end
|
33
46
|
|
@@ -39,6 +52,67 @@ class Repres::Bootstrap::PlatformGenerator < Rails::Generators::NamedBase
|
|
39
52
|
content
|
40
53
|
end
|
41
54
|
|
55
|
+
# image
|
56
|
+
#
|
57
|
+
# app/assets/images/platform/version/
|
58
|
+
#
|
59
|
+
def generate_asset_image
|
60
|
+
copy_file '.keep', "app/assets/images/#{platform_name}/#{version_name}/.keep"
|
61
|
+
#empty_directory "app/assets/images/#{platform_name}/#{version_name}"
|
62
|
+
end
|
63
|
+
|
64
|
+
# image_shared
|
65
|
+
#
|
66
|
+
# app/assets/images/shared/
|
67
|
+
#
|
68
|
+
def generate_asset_image_shared
|
69
|
+
copy_file '.keep', 'app/assets/images/shared/.keep'
|
70
|
+
copy_file '.keep', "app/assets/images/#{platform_name}/#{version_name}/shared/.keep"
|
71
|
+
#empty_directory "app/assets/images/shared"
|
72
|
+
end
|
73
|
+
|
74
|
+
# script
|
75
|
+
#
|
76
|
+
# app/assets/javascripts/platform/version/
|
77
|
+
#
|
78
|
+
def generate_asset_script
|
79
|
+
copy_file '.keep', "app/assets/javascripts/#{platform_name}/#{version_name}/.keep"
|
80
|
+
#empty_directory "app/assets/javascripts/#{platform_name}/#{version_name}"
|
81
|
+
end
|
82
|
+
|
83
|
+
# script_shared
|
84
|
+
#
|
85
|
+
# app/assets/javascripts/shared/
|
86
|
+
# app/assets/javascripts/platform/version/shared/
|
87
|
+
#
|
88
|
+
def generate_asset_script_shared
|
89
|
+
copy_file '.keep', 'app/assets/javascripts/shared/.keep'
|
90
|
+
copy_file '.keep', "app/assets/javascripts/#{platform_name}/#{version_name}/shared/.keep"
|
91
|
+
#empty_directory "app/assets/javascripts/shared"
|
92
|
+
#empty_directory "app/assets/javascripts/#{platform_name}/#{version_name}/shared"
|
93
|
+
end
|
94
|
+
|
95
|
+
# style
|
96
|
+
#
|
97
|
+
# app/assets/stylesheets/platform/version/
|
98
|
+
#
|
99
|
+
def generate_asset_style
|
100
|
+
copy_file '.keep', "app/assets/stylesheets/#{platform_name}/#{version_name}/.keep"
|
101
|
+
#empty_directory "app/assets/stylesheets/#{platform_name}/#{version_name}"
|
102
|
+
end
|
103
|
+
|
104
|
+
# style_shared
|
105
|
+
#
|
106
|
+
# app/assets/stylesheets/shared/
|
107
|
+
# app/assets/stylesheets/platform/version/shared/
|
108
|
+
#
|
109
|
+
def generate_asset_style_shared
|
110
|
+
copy_file '.keep', 'app/assets/stylesheets/shared/.keep'
|
111
|
+
copy_file '.keep', "app/assets/stylesheets/#{platform_name}/#{version_name}/shared/.keep"
|
112
|
+
#empty_directory "app/assets/stylesheets/shared"
|
113
|
+
#empty_directory "app/assets/stylesheets/#{platform_name}/#{version_name}/shared"
|
114
|
+
end
|
115
|
+
|
42
116
|
# concern
|
43
117
|
#
|
44
118
|
# app/controllers/concerns/priviledge_protection.rb
|
@@ -59,49 +133,46 @@ class Repres::Bootstrap::PlatformGenerator < Rails::Generators::NamedBase
|
|
59
133
|
|
60
134
|
# helper
|
61
135
|
#
|
62
|
-
# app/helpers/
|
136
|
+
# app/helpers/platform/version/helper.rb
|
63
137
|
#
|
64
138
|
def generate_helper
|
139
|
+
copy_file('app/helpers/platform_helper.rb', "app/helpers/#{platform_name}/#{version_name}/application_helper.rb") { |content| define_namespace content }
|
65
140
|
end
|
66
141
|
|
67
|
-
#
|
68
|
-
#
|
69
|
-
# app/views/layouts/platform/version.html.erb
|
70
|
-
#
|
71
|
-
def generate_layout_view
|
72
|
-
copy_file('app/views/layouts/platform.html.erb', "app/views/layouts/#{platform_name}/#{version_name}.html.erb") { |content| define_namespace content }
|
73
|
-
end
|
74
|
-
|
75
|
-
# shared_view
|
142
|
+
# view_shared
|
76
143
|
#
|
77
144
|
# app/views/shared/
|
78
145
|
# app/views/platform/version/shared/_script.html.erb
|
79
146
|
# app/views/platform/version/shared/_style.html.erb
|
80
147
|
#
|
81
|
-
def
|
82
|
-
empty_directory 'app/views/shared'
|
148
|
+
def generate_view_shared
|
149
|
+
#empty_directory 'app/views/shared'
|
150
|
+
copy_file '.keep', 'app/views/shared/.keep'
|
83
151
|
copy_file('app/views/shared/_script.html.erb', "app/views/#{platform_name}/#{version_name}/shared/_script.html.erb") { |content| define_namespace content }
|
84
152
|
copy_file('app/views/shared/_style.html.erb', "app/views/#{platform_name}/#{version_name}/shared/_style.html.erb") { |content| define_namespace content }
|
85
153
|
end
|
86
154
|
|
155
|
+
# view_layout
|
156
|
+
#
|
157
|
+
# app/views/layouts/platform/version.html.erb
|
158
|
+
#
|
159
|
+
def generate_view_layout
|
160
|
+
copy_file('app/views/layouts/platform.html.erb', "app/views/layouts/#{platform_name}/#{version_name}.html.erb") { |content| define_namespace content }
|
161
|
+
end
|
162
|
+
|
87
163
|
# route
|
88
164
|
#
|
89
165
|
# config/routes.rb
|
90
166
|
#
|
91
167
|
def generate_route
|
92
168
|
source = File.expand_path find_in_source_paths('config/routes.rb')
|
93
|
-
File.open(source, 'rb')
|
94
|
-
#route f.read.to_s.strip.gsub(/platform_name/, platform_name).gsub(/version_name/, version_name)
|
95
|
-
route define_namespace(f.read.to_s.strip)
|
96
|
-
end
|
97
|
-
#File.open(Pathname.new(self.class.source_root).join('config', 'routes.rb'), 'r') do |f|
|
98
|
-
# route f.read.to_s.strip.gsub(/platform_name/, platform_name).gsub(/version_name/, version_name)
|
99
|
-
#end
|
169
|
+
File.open(source, 'rb') { |f| route define_namespace(f.read.to_s.strip) }
|
100
170
|
end
|
101
171
|
|
102
172
|
# Administration
|
103
173
|
def platform_module_name
|
104
|
-
|
174
|
+
#@platform_name.capitalize
|
175
|
+
@platform_name.camelize
|
105
176
|
end
|
106
177
|
|
107
178
|
# administration
|
@@ -129,10 +200,15 @@ class Repres::Bootstrap::PlatformGenerator < Rails::Generators::NamedBase
|
|
129
200
|
@version_number
|
130
201
|
end
|
131
202
|
|
132
|
-
private :define_namespace,
|
133
|
-
:
|
134
|
-
:
|
135
|
-
:
|
203
|
+
private :define_namespace,
|
204
|
+
:generate_asset_image, :generate_asset_image_shared,
|
205
|
+
:generate_asset_script, :generate_asset_script_shared,
|
206
|
+
:generate_asset_style, :generate_asset_style_shared,
|
207
|
+
:generate_concern, :generate_controller, :generate_helper,
|
208
|
+
:generate_view_layout, :generate_view_shared,
|
209
|
+
:generate_route,
|
210
|
+
:platform_module_name, :platform_name, :platform_version_module_name,
|
211
|
+
:version_module_name, :version_name, :version_number
|
136
212
|
|
137
213
|
end
|
138
214
|
|
@@ -196,125 +272,3 @@ end
|
|
196
272
|
=end
|
197
273
|
|
198
274
|
|
199
|
-
|
200
|
-
=begin interface == bootstrap
|
201
|
-
|
202
|
-
route
|
203
|
-
|
204
|
-
namespace :administration do
|
205
|
-
namespace :v1 do
|
206
|
-
resources :dashboards, only: :show
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
|
-
concern
|
211
|
-
|
212
|
-
? app/controllers/concerns/priviledge_protection.rb
|
213
|
-
|
214
|
-
controller
|
215
|
-
|
216
|
-
app/controllers/administration/v1/privileged_controller.rb
|
217
|
-
class Administration::V1::PrivilegedController < ApplicationController
|
218
|
-
layout 'administration/v1'
|
219
|
-
? include PriviledgeProtection
|
220
|
-
helper Administration::V1::Helper
|
221
|
-
end
|
222
|
-
|
223
|
-
app/controllers/administration/v1/dashboards_controller.rb
|
224
|
-
class Administration::V1::DashboardsController < Administration::V1::PrivilegedController
|
225
|
-
def show
|
226
|
-
? redirect_to administration_profiles_path(Unidom::Common::SELF)
|
227
|
-
end
|
228
|
-
end
|
229
|
-
|
230
|
-
layout_view
|
231
|
-
|
232
|
-
app/views/layouts/administration/v1.html.erb
|
233
|
-
|
234
|
-
shared_view
|
235
|
-
|
236
|
-
app/views/shared/
|
237
|
-
app/views/administration/v1/shared/
|
238
|
-
app/views/administration/v1/shared/_script.html.erb
|
239
|
-
app/views/administration/v1/shared/_style.html.erb
|
240
|
-
|
241
|
-
helper
|
242
|
-
|
243
|
-
app/helpers/administration/v1/helper.rb
|
244
|
-
module Administration::V1::Helper
|
245
|
-
end
|
246
|
-
|
247
|
-
image
|
248
|
-
|
249
|
-
app/assets/images/administration/v1/
|
250
|
-
|
251
|
-
shared_image
|
252
|
-
|
253
|
-
app/assets/images/shared/
|
254
|
-
|
255
|
-
style
|
256
|
-
|
257
|
-
app/assets/stylesheets/administration/v1/
|
258
|
-
|
259
|
-
shared_style
|
260
|
-
|
261
|
-
app/assets/stylesheets/shared/
|
262
|
-
app/assets/stylesheets/administration/v1/shared/
|
263
|
-
|
264
|
-
script
|
265
|
-
|
266
|
-
app/assets/javascripts/administration/v1/
|
267
|
-
|
268
|
-
shared_script
|
269
|
-
|
270
|
-
app/assets/javascripts/shared/
|
271
|
-
app/assets/javascripts/administration/v1/shared/
|
272
|
-
|
273
|
-
=end
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
=begin interface == swagger
|
278
|
-
|
279
|
-
gem
|
280
|
-
|
281
|
-
swagger
|
282
|
-
|
283
|
-
route
|
284
|
-
|
285
|
-
scope '/administration-api/v1', module: 'administration/dosser/v1', as: 'administration_dosser_v1' do
|
286
|
-
resources :portals, only: :show
|
287
|
-
end
|
288
|
-
|
289
|
-
controller
|
290
|
-
|
291
|
-
app/controllers/administration/dosser/v1/presentation_controller.rb
|
292
|
-
class Administration::Dosser::V1::PresentationController < ApplicationController
|
293
|
-
clear_helpers
|
294
|
-
include Repres::Dosser::Concerns::ResourcePresentation
|
295
|
-
layout nil
|
296
|
-
end
|
297
|
-
|
298
|
-
app/controllers/administration/dosser/v1/portals_controller.rb
|
299
|
-
class Administration::Dosser::V1::::PortalsController < Administration::Dosser::V1::PresentationController
|
300
|
-
def show
|
301
|
-
self.criteria = { id: params[:id] }
|
302
|
-
render_ok collection: [
|
303
|
-
{
|
304
|
-
name: 'XX系统',
|
305
|
-
links: [
|
306
|
-
{ rel: 'self', href: administration_dosser_v1_portal_url( Unidom::Common::SELF, format: request.format.symbol) },
|
307
|
-
{ rel: 'canonial', href: administration_dosser_v1_portal_url( Unidom::Common::SELF, format: :json ) },
|
308
|
-
{ rel: 'alternate', href: administration_dosser_v1_portal_url( Unidom::Common::SELF, format: :xml ) },
|
309
|
-
{ rel: 'dosser/{action}/{resource}', href: administration_dosser_v1_{resources}_url( format: request.format.symbol) }
|
310
|
-
]
|
311
|
-
}
|
312
|
-
]
|
313
|
-
end
|
314
|
-
end
|
315
|
-
|
316
|
-
swagger
|
317
|
-
|
318
|
-
lib/swagger/administration_api_v1.json
|
319
|
-
|
320
|
-
=end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: repres-bootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- lib/generators/repres/bootstrap/platform/templates/app/controllers/concerns/priviledge_protection.rb
|
67
67
|
- lib/generators/repres/bootstrap/platform/templates/app/controllers/dashboards_controller.rb
|
68
68
|
- lib/generators/repres/bootstrap/platform/templates/app/controllers/privileged_controller.rb
|
69
|
+
- lib/generators/repres/bootstrap/platform/templates/app/helpers/platform_helper.rb
|
69
70
|
- lib/generators/repres/bootstrap/platform/templates/app/views/layouts/platform.html.erb
|
70
71
|
- lib/generators/repres/bootstrap/platform/templates/app/views/shared/_script.html.erb
|
71
72
|
- lib/generators/repres/bootstrap/platform/templates/app/views/shared/_style.html.erb
|