maglove 0.8.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/.rubocop.yml +157 -0
  4. data/Gemfile.lock +59 -49
  5. data/bin/maglove +13 -13
  6. data/data/maglove/export.haml +11 -0
  7. data/data/maglove/index.haml +17 -0
  8. data/data/maglove/maglove.css +62 -0
  9. data/data/maglove/maglove.haml +18 -0
  10. data/data/maglove/maglove.js +68 -0
  11. data/lib/block_resolver.rb +6 -0
  12. data/lib/ext/thor/option.rb +43 -0
  13. data/lib/magloft/api.rb +39 -0
  14. data/lib/magloft/api_caller.rb +67 -0
  15. data/lib/magloft/remote_collection.rb +50 -0
  16. data/lib/magloft/remote_resource.rb +124 -0
  17. data/lib/magloft/transformable.rb +11 -0
  18. data/lib/magloft/typeloft_block.rb +18 -0
  19. data/lib/magloft/typeloft_image.rb +18 -0
  20. data/lib/magloft/typeloft_template.rb +18 -0
  21. data/lib/magloft/typeloft_theme.rb +41 -0
  22. data/lib/magloft.rb +3 -0
  23. data/lib/maglove/application.rb +10 -12
  24. data/lib/maglove/asset/theme.rb +37 -32
  25. data/lib/maglove/commands/assets.rb +85 -0
  26. data/lib/maglove/commands/base.rb +55 -0
  27. data/lib/maglove/commands/fonts.rb +69 -0
  28. data/lib/maglove/commands/main.rb +24 -0
  29. data/lib/maglove/commands/theme.rb +197 -0
  30. data/lib/maglove/helper/log_helper.rb +3 -18
  31. data/lib/maglove/middleware/live_reload.rb +97 -0
  32. data/lib/maglove/phantom_script.rb +9 -10
  33. data/lib/maglove/server.rb +46 -78
  34. data/lib/maglove/tilt/coffee_template.rb +7 -6
  35. data/lib/maglove/tilt/haml_template.rb +4 -4
  36. data/lib/maglove/tilt/js_template.rb +8 -8
  37. data/lib/maglove/tilt/less_template.rb +5 -4
  38. data/lib/maglove/tilt/scss_template.rb +17 -11
  39. data/lib/maglove/tilt/yaml_template.rb +3 -2
  40. data/lib/maglove/version.rb +1 -1
  41. data/lib/maglove/workspace.rb +41 -0
  42. data/lib/maglove.rb +38 -49
  43. data/lib/powersnap.rb +24 -0
  44. data/lib/workspace/workspace_dir/archive.rb +18 -0
  45. data/lib/workspace/workspace_dir.rb +98 -0
  46. data/lib/workspace/workspace_file/archive.rb +45 -0
  47. data/lib/workspace/workspace_file/media.rb +19 -0
  48. data/lib/workspace/workspace_file/net.rb +18 -0
  49. data/lib/workspace/workspace_file/parse.rb +21 -0
  50. data/lib/workspace/workspace_file.rb +99 -0
  51. data/lib/workspace.rb +11 -0
  52. data/maglove.gemspec +12 -12
  53. metadata +100 -86
  54. data/data/maglove/dump.haml +0 -58
  55. data/data/maglove/sdk.haml +0 -27
  56. data/lib/ext/commander/command.rb +0 -32
  57. data/lib/ext/commander/methods.rb +0 -8
  58. data/lib/maglove/asset/base_theme.rb +0 -17
  59. data/lib/maglove/command/compile.rb +0 -44
  60. data/lib/maglove/command/compress.rb +0 -28
  61. data/lib/maglove/command/copy.rb +0 -35
  62. data/lib/maglove/command/core.rb +0 -23
  63. data/lib/maglove/command/font.rb +0 -80
  64. data/lib/maglove/command/server.rb +0 -16
  65. data/lib/maglove/command/sync.rb +0 -17
  66. data/lib/maglove/command/theme.rb +0 -175
  67. data/lib/maglove/command/util.rb +0 -45
  68. data/lib/maglove/helper/asset_helper.rb +0 -24
  69. data/lib/maglove/helper/command_helper.rb +0 -67
  70. data/lib/maglove/helper/theme_helper.rb +0 -105
  71. data/lib/maglove/server/hpub.rb +0 -185
  72. data/lib/maglove/template/tumblr.rb +0 -81
  73. data/lib/maglove/tilt/twig_template.rb +0 -49
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maglove
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Strebitzer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-23 00:00:00.000000000 Z
11
+ date: 2016-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -25,89 +25,103 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.10'
27
27
  - !ruby/object:Gem::Dependency
28
- name: dotenv
28
+ name: haml
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
33
+ version: '4.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.0'
40
+ version: '4.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: haml
42
+ name: thor
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '4.0'
47
+ version: '0.19'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '4.0'
54
+ version: '0.19'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: hamloft
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.2.1
61
+ version: 0.2.4
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.2.1
68
+ version: 0.2.4
69
69
  - !ruby/object:Gem::Dependency
70
- name: rubyzip
70
+ name: activesupport
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '1.1'
75
+ version: '4.0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '1.1'
82
+ version: '4.0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: activesupport
84
+ name: actionpack
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '4.0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '4.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: maglove-widgets
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: '5.0'
103
+ version: '1.0'
90
104
  type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: '5.0'
110
+ version: '1.0'
97
111
  - !ruby/object:Gem::Dependency
98
- name: actionpack
112
+ name: open_uri_redirections
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: '5.0'
117
+ version: '0.2'
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
- version: '5.0'
124
+ version: '0.2'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: logging
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -151,159 +165,145 @@ dependencies:
151
165
  - !ruby/object:Gem::Version
152
166
  version: '2.4'
153
167
  - !ruby/object:Gem::Dependency
154
- name: minitar
168
+ name: less
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
171
  - - "~>"
158
172
  - !ruby/object:Gem::Version
159
- version: '0.5'
173
+ version: '2.6'
160
174
  type: :runtime
161
175
  prerelease: false
162
176
  version_requirements: !ruby/object:Gem::Requirement
163
177
  requirements:
164
178
  - - "~>"
165
179
  - !ruby/object:Gem::Version
166
- version: '0.5'
180
+ version: '2.6'
167
181
  - !ruby/object:Gem::Dependency
168
- name: therubyracer
182
+ name: sass
169
183
  requirement: !ruby/object:Gem::Requirement
170
184
  requirements:
171
185
  - - "~>"
172
186
  - !ruby/object:Gem::Version
173
- version: '0.12'
187
+ version: '3.4'
174
188
  type: :runtime
175
189
  prerelease: false
176
190
  version_requirements: !ruby/object:Gem::Requirement
177
191
  requirements:
178
192
  - - "~>"
179
193
  - !ruby/object:Gem::Version
180
- version: '0.12'
194
+ version: '3.4'
181
195
  - !ruby/object:Gem::Dependency
182
- name: less
196
+ name: dialers
183
197
  requirement: !ruby/object:Gem::Requirement
184
198
  requirements:
185
199
  - - "~>"
186
200
  - !ruby/object:Gem::Version
187
- version: '2.6'
201
+ version: '0.2'
188
202
  type: :runtime
189
203
  prerelease: false
190
204
  version_requirements: !ruby/object:Gem::Requirement
191
205
  requirements:
192
206
  - - "~>"
193
207
  - !ruby/object:Gem::Version
194
- version: '2.6'
208
+ version: '0.2'
195
209
  - !ruby/object:Gem::Dependency
196
- name: sass
210
+ name: rubyzip
197
211
  requirement: !ruby/object:Gem::Requirement
198
212
  requirements:
199
213
  - - "~>"
200
214
  - !ruby/object:Gem::Version
201
- version: '3.4'
215
+ version: '1.1'
202
216
  type: :runtime
203
217
  prerelease: false
204
218
  version_requirements: !ruby/object:Gem::Requirement
205
219
  requirements:
206
220
  - - "~>"
207
221
  - !ruby/object:Gem::Version
208
- version: '3.4'
222
+ version: '1.1'
209
223
  - !ruby/object:Gem::Dependency
210
- name: webrick
224
+ name: image_optim
211
225
  requirement: !ruby/object:Gem::Requirement
212
226
  requirements:
213
227
  - - "~>"
214
228
  - !ruby/object:Gem::Version
215
- version: '1.3'
229
+ version: '0.21'
216
230
  type: :runtime
217
231
  prerelease: false
218
232
  version_requirements: !ruby/object:Gem::Requirement
219
233
  requirements:
220
234
  - - "~>"
221
235
  - !ruby/object:Gem::Version
222
- version: '1.3'
236
+ version: '0.21'
223
237
  - !ruby/object:Gem::Dependency
224
- name: commander
238
+ name: image_optim_pack
225
239
  requirement: !ruby/object:Gem::Requirement
226
240
  requirements:
227
241
  - - "~>"
228
242
  - !ruby/object:Gem::Version
229
- version: '4.3'
243
+ version: '0.2'
230
244
  type: :runtime
231
245
  prerelease: false
232
246
  version_requirements: !ruby/object:Gem::Requirement
233
247
  requirements:
234
248
  - - "~>"
235
249
  - !ruby/object:Gem::Version
236
- version: '4.3'
250
+ version: '0.2'
237
251
  - !ruby/object:Gem::Dependency
238
- name: filewatcher
252
+ name: puma
239
253
  requirement: !ruby/object:Gem::Requirement
240
254
  requirements:
241
255
  - - "~>"
242
256
  - !ruby/object:Gem::Version
243
- version: '0.5'
257
+ version: '3.6'
244
258
  type: :runtime
245
259
  prerelease: false
246
260
  version_requirements: !ruby/object:Gem::Requirement
247
261
  requirements:
248
262
  - - "~>"
249
263
  - !ruby/object:Gem::Version
250
- version: '0.5'
264
+ version: '3.6'
251
265
  - !ruby/object:Gem::Dependency
252
- name: image_optim
266
+ name: filewatcher
253
267
  requirement: !ruby/object:Gem::Requirement
254
268
  requirements:
255
269
  - - "~>"
256
270
  - !ruby/object:Gem::Version
257
- version: '0.21'
271
+ version: '0.5'
258
272
  type: :runtime
259
273
  prerelease: false
260
274
  version_requirements: !ruby/object:Gem::Requirement
261
275
  requirements:
262
276
  - - "~>"
263
277
  - !ruby/object:Gem::Version
264
- version: '0.21'
278
+ version: '0.5'
265
279
  - !ruby/object:Gem::Dependency
266
- name: image_optim_pack
280
+ name: faye
267
281
  requirement: !ruby/object:Gem::Requirement
268
282
  requirements:
269
283
  - - "~>"
270
284
  - !ruby/object:Gem::Version
271
- version: '0.2'
285
+ version: '1.2'
272
286
  type: :runtime
273
287
  prerelease: false
274
288
  version_requirements: !ruby/object:Gem::Requirement
275
289
  requirements:
276
290
  - - "~>"
277
291
  - !ruby/object:Gem::Version
278
- version: '0.2'
279
- - !ruby/object:Gem::Dependency
280
- name: rspec
281
- requirement: !ruby/object:Gem::Requirement
282
- requirements:
283
- - - "~>"
284
- - !ruby/object:Gem::Version
285
- version: '3.3'
286
- type: :development
287
- prerelease: false
288
- version_requirements: !ruby/object:Gem::Requirement
289
- requirements:
290
- - - "~>"
291
- - !ruby/object:Gem::Version
292
- version: '3.3'
292
+ version: '1.2'
293
293
  - !ruby/object:Gem::Dependency
294
- name: pry
294
+ name: faraday
295
295
  requirement: !ruby/object:Gem::Requirement
296
296
  requirements:
297
297
  - - "~>"
298
298
  - !ruby/object:Gem::Version
299
- version: '0.10'
300
- type: :development
299
+ version: '0.9'
300
+ type: :runtime
301
301
  prerelease: false
302
302
  version_requirements: !ruby/object:Gem::Requirement
303
303
  requirements:
304
304
  - - "~>"
305
305
  - !ruby/object:Gem::Version
306
- version: '0.10'
306
+ version: '0.9'
307
307
  - !ruby/object:Gem::Dependency
308
308
  name: rubocop
309
309
  requirement: !ruby/object:Gem::Requirement
@@ -327,14 +327,19 @@ extensions: []
327
327
  extra_rdoc_files: []
328
328
  files:
329
329
  - ".gitignore"
330
+ - ".rubocop.yml"
330
331
  - Gemfile
331
332
  - Gemfile.lock
332
333
  - README.md
333
334
  - bin/maglove
334
- - data/maglove/dump.haml
335
+ - data/maglove/export.haml
335
336
  - data/maglove/hpub/index.css
336
337
  - data/maglove/hpub/index.haml
337
338
  - data/maglove/hpub/page.haml
339
+ - data/maglove/index.haml
340
+ - data/maglove/maglove.css
341
+ - data/maglove/maglove.haml
342
+ - data/maglove/maglove.js
338
343
  - data/maglove/scaffold/base/base.coffee
339
344
  - data/maglove/scaffold/base/base.less
340
345
  - data/maglove/scaffold/base/images/base/loading-bars.svg
@@ -395,40 +400,49 @@ files:
395
400
  - data/maglove/scaffold/theme/templates/toc.yml
396
401
  - data/maglove/scaffold/theme/theme.coffee
397
402
  - data/maglove/scaffold/theme/theme.less
398
- - data/maglove/sdk.haml
399
403
  - data/maglove/thumbnail.haml
400
404
  - data/maglove/thumbnail.js
401
- - lib/ext/commander/command.rb
402
- - lib/ext/commander/methods.rb
405
+ - lib/block_resolver.rb
406
+ - lib/ext/thor/option.rb
407
+ - lib/magloft.rb
408
+ - lib/magloft/api.rb
409
+ - lib/magloft/api_caller.rb
410
+ - lib/magloft/remote_collection.rb
411
+ - lib/magloft/remote_resource.rb
412
+ - lib/magloft/transformable.rb
413
+ - lib/magloft/typeloft_block.rb
414
+ - lib/magloft/typeloft_image.rb
415
+ - lib/magloft/typeloft_template.rb
416
+ - lib/magloft/typeloft_theme.rb
403
417
  - lib/maglove.rb
404
418
  - lib/maglove/application.rb
405
- - lib/maglove/asset/base_theme.rb
406
419
  - lib/maglove/asset/theme.rb
407
- - lib/maglove/command/compile.rb
408
- - lib/maglove/command/compress.rb
409
- - lib/maglove/command/copy.rb
410
- - lib/maglove/command/core.rb
411
- - lib/maglove/command/font.rb
412
- - lib/maglove/command/server.rb
413
- - lib/maglove/command/sync.rb
414
- - lib/maglove/command/theme.rb
415
- - lib/maglove/command/util.rb
416
- - lib/maglove/helper/asset_helper.rb
417
- - lib/maglove/helper/command_helper.rb
420
+ - lib/maglove/commands/assets.rb
421
+ - lib/maglove/commands/base.rb
422
+ - lib/maglove/commands/fonts.rb
423
+ - lib/maglove/commands/main.rb
424
+ - lib/maglove/commands/theme.rb
418
425
  - lib/maglove/helper/log_helper.rb
419
- - lib/maglove/helper/theme_helper.rb
426
+ - lib/maglove/middleware/live_reload.rb
420
427
  - lib/maglove/phantom_script.rb
421
428
  - lib/maglove/server.rb
422
- - lib/maglove/server/hpub.rb
423
- - lib/maglove/template/tumblr.rb
424
429
  - lib/maglove/tilt/coffee_template.rb
425
430
  - lib/maglove/tilt/haml_template.rb
426
431
  - lib/maglove/tilt/js_template.rb
427
432
  - lib/maglove/tilt/less_template.rb
428
433
  - lib/maglove/tilt/scss_template.rb
429
- - lib/maglove/tilt/twig_template.rb
430
434
  - lib/maglove/tilt/yaml_template.rb
431
435
  - lib/maglove/version.rb
436
+ - lib/maglove/workspace.rb
437
+ - lib/powersnap.rb
438
+ - lib/workspace.rb
439
+ - lib/workspace/workspace_dir.rb
440
+ - lib/workspace/workspace_dir/archive.rb
441
+ - lib/workspace/workspace_file.rb
442
+ - lib/workspace/workspace_file/archive.rb
443
+ - lib/workspace/workspace_file/media.rb
444
+ - lib/workspace/workspace_file/net.rb
445
+ - lib/workspace/workspace_file/parse.rb
432
446
  - maglove.gemspec
433
447
  homepage: https://github.com/MagLoft/maglove
434
448
  licenses:
@@ -1,58 +0,0 @@
1
- !!! 5
2
- %html
3
- %head
4
- %meta{ charset: "UTF-8" }
5
- %title= "#{theme} - #{template}"
6
- %meta{ name: "viewport", content: "width=device-width, initial-scale=1.0" }
7
- %link{ href: "themes/#{theme}/theme.css", media: "screen", rel: "stylesheet" }
8
- %link{ href: "fonts/fonts.css", media: "screen", rel: "stylesheet" }
9
- %script{ src: "themes/#{theme}/theme.js", type: "text/javascript" }
10
- :css
11
- div#__inspector {
12
- position: fixed !important;
13
- top: 8px !important;
14
- right: 8px !important;
15
- height: 32px !important;
16
- background: #FFF !important;
17
- line-height: 32px !important;
18
- z-index: 1000000 !important;
19
- text-transform: uppercase !important;
20
- font-size: 11px !important;
21
- font-weight: bold !important;
22
- letter-spacing: 1px !important;
23
- font-family: "Helvetica Neue" !important;
24
- opacity: 0.25 !important;
25
- transition: opacity 300ms !important;
26
- }
27
-
28
- div#__inspector:hover {
29
- opacity: 1 !important;
30
- }
31
-
32
- div#__inspector a {
33
- color: #171717 !important;
34
- padding: 0px 12px !important;
35
- border-left: 1px solid #F5F5F5 !important;
36
- border-right: none !important;
37
- border-top: none !important;
38
- border-bottom: none !important;
39
- display: inline-block !important;
40
- float: left !important;
41
- }
42
-
43
- div#__inspector a:hover {
44
- color: #FFFFFF !important;
45
- background: #000000 !important;
46
- }
47
-
48
- div#__inspector a:first-child {
49
- border-left: none !important;
50
- }
51
-
52
- %body
53
- = contents
54
- - if templates.count > 1
55
- #__inspector
56
- - templates.each do |template|
57
- %a{href: "#{template}.html"}
58
- = template
@@ -1,27 +0,0 @@
1
- !!! 5
2
- %html
3
- %head
4
- %meta{ charset: "UTF-8" }
5
- %title= "#{theme} - #{template}"
6
- %meta{ name: "viewport", content: "width=device-width, initial-scale=1.0" }
7
- %meta{ name: "pageid", content: "0" }
8
- %link{ href: "/themes/#{theme}/theme.css", media: "screen", rel: "stylesheet" }
9
- %link{ href: "/fonts/fonts.css", media: "screen", rel: "stylesheet" }
10
- %script{ src: "/themes/#{theme}/theme.js", type: "text/javascript" }
11
- :css
12
- div#__inspector{position:fixed !important;top:8px !important;right:8px !important;height:32px !important;background:#FFF !important;line-height:32px !important;z-index:1000000 !important;text-transform:uppercase !important;font-size:11px !important;font-weight:bold !important;letter-spacing:1px !important;font-family:"Helvetica Neue" !important;opacity:0.25 !important;transition:opacity 300ms !important;}
13
- div#__inspector:hover{opacity:1 !important;}
14
- div#__inspector a{color:#171717 !important;padding:0px 12px !important;border-left:1px solid #F5F5F5 !important;border-right:none !important;border-top:none !important;border-bottom:none !important;display:inline-block !important;float:left !important;}
15
- div#__inspector a:hover{color:#FFFFFF !important;background:#000000 !important;}
16
- div#__inspector a:first-child{border-left:none !important;}
17
- div#__bs_notify__{border-radius:0 !important;right:inherit !important;left:8px !important;height:32px !important;top:8px !important;line-height:32px !important;padding:0px 26px !important;color:#171717 !important;z-index:1000000 !important;background:#FFF !important;}
18
- %body
19
- = contents
20
- #__inspector
21
- - templates.each do |template|
22
- %a{href: "/#{template}"}
23
- = template
24
- :javascript
25
- if(window.ThemeApi) {
26
- window.ThemeApi.init({deviceId: 'AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE', appId: 'com.magloft.maglove', apiHost: 'www.magloft.com'});
27
- }
@@ -1,32 +0,0 @@
1
- module Commander
2
- class Command
3
- attr_accessor :block
4
-
5
- class Options
6
-
7
- def __merge(params)
8
- new_options = self.__clone
9
- new_options.__hash__.merge!(params)
10
- new_options
11
- end
12
-
13
- def __clone
14
- new_options = Options.new
15
- new_options.__hash__.merge!(__hash__)
16
- new_options
17
- end
18
-
19
- end
20
-
21
- def invoke(args=[], options=nil)
22
- options = options ? options.__clone : Options.new
23
- self.block.call(args, options)
24
- end
25
-
26
- def task_action(*args, &block)
27
- when_called(*args, &block)
28
- self.block = block
29
- end
30
-
31
- end
32
- end
@@ -1,8 +0,0 @@
1
- module Commander
2
- module Methods
3
- include MagLove::Helper::LogHelper
4
- include MagLove::Helper::CommandHelper
5
- include MagLove::Helper::ThemeHelper
6
- include MagLove::Helper::AssetHelper
7
- end
8
- end
@@ -1,17 +0,0 @@
1
- module MagLove
2
- module Asset
3
- class BaseTheme < Theme
4
- attr_reader :version
5
-
6
- def initialize(path, theme, version, locals={})
7
- @version = version
8
- super(path, theme, locals)
9
- end
10
-
11
- def absolute_path
12
- File.absolute_path("src/base/#{version}/#{path}")
13
- end
14
-
15
- end
16
- end
17
- end
@@ -1,44 +0,0 @@
1
- module MagLove
2
- module Command
3
- class Compile
4
- include Commander::Methods
5
-
6
- def run
7
-
8
- task :coffee, theme: "!" do |args, options|
9
- asset = theme_asset("theme.coffee", options.theme)
10
- debug("▸ created #{asset.logical_path}") if asset.write!
11
- end
12
-
13
- task :css, theme: "!" do |args, options|
14
- if File.exists?(theme_path("theme.scss", options.theme))
15
- asset = theme_asset("theme.scss", options.theme)
16
- else
17
- asset = theme_asset("theme.less", options.theme)
18
- end
19
- debug("▸ created #{asset.logical_path}") if asset.write!
20
- end
21
-
22
- task :yaml, theme: "!" do |args, options|
23
- asset = theme_asset("theme.yml", options.theme)
24
- debug("▸ created #{asset.logical_path}") if asset.write!
25
- end
26
-
27
- task :templates, theme: "!", bucket: "localhost:3002" do |args, options|
28
- Hamloft::Options.defaults[:asset_uri] = "http://#{options.bucket}"
29
- theme_glob("templates/*.{html,haml,twig}", options.theme).each do |file|
30
- # check if yaml file exists
31
- locals = {}
32
- locals_contents = theme_contents(file.sub(/\.[^.]+\z/, ".yml"), options.theme)
33
- if locals_contents
34
- locals = YAML.load(locals_contents).with_indifferent_access
35
- end
36
- asset = theme_asset(file, options.theme, locals)
37
- debug("▸ created #{asset.logical_path}") if asset.write!
38
- end
39
- end
40
-
41
- end
42
- end
43
- end
44
- end
@@ -1,28 +0,0 @@
1
- module MagLove
2
- module Command
3
- class Compress
4
- include Commander::Methods
5
-
6
- def run
7
-
8
- task :theme, theme: "!" do |args, options|
9
- # archive_path("dist/themes/#{options.theme}", "**/*", "#{options.theme}.tar.gz")
10
- target = "themes/#{options.theme}/#{options.theme}.tar.gz"
11
- Dir.chdir("dist") do
12
- tgz = Zlib::GzipWriter.new(File.open(target, "wb"))
13
- Archive::Tar::Minitar::Output.open(tgz) do |tar|
14
- Dir["themes/#{options.theme}/**/*"].reject{|file| file == target}.each do |file|
15
- if !(/^themes\/#{options.theme}\/(images|thumbs|templates)/.match(file))
16
- Archive::Tar::Minitar::pack_file(file, tar)
17
- end
18
- end
19
- end
20
- end
21
-
22
- debug("▸ created #{options.theme}.tar.gz")
23
- end
24
-
25
- end
26
- end
27
- end
28
- end
@@ -1,35 +0,0 @@
1
- module MagLove
2
- module Command
3
- class Copy
4
- include Commander::Methods
5
-
6
- def run
7
-
8
- task :base_images, theme: "!", pattern: "images/**/*.{jpg,png,gif,svg}" do |args, options|
9
- pattern = options.pattern.gsub(theme_base_path("", options.theme), "")
10
- theme_base_glob(pattern, options.theme).each do |file|
11
- asset = base_theme_asset(file, options.theme)
12
- debug("▸ created #{asset.logical_path}") if asset.write!
13
- end
14
- end
15
-
16
- task :images, theme: "!", pattern: "images/**/*.{jpg,png,gif,svg}" do |args, options|
17
- pattern = options.pattern.gsub(theme_path("", options.theme), "")
18
- theme_glob(pattern, options.theme).each do |file|
19
- asset = theme_asset(file, options.theme)
20
- debug("▸ created #{asset.logical_path}") if asset.write!
21
- end
22
- end
23
-
24
- task :thumbs, theme: "!", pattern: "thumbs/**/*.{jpg,png,gif,svg}" do |args, options|
25
- pattern = options.pattern.gsub(theme_path("", options.theme), "")
26
- theme_glob(pattern, options.theme).each do |file|
27
- asset = theme_asset(file, options.theme)
28
- debug("▸ created #{asset.logical_path}") if asset.write!
29
- end
30
- end
31
-
32
- end
33
- end
34
- end
35
- end