html_mockup 0.8.4 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/.gitignore +2 -2
  2. data/.travis.yml +12 -0
  3. data/CHANGELOG.md +11 -0
  4. data/Gemfile +5 -0
  5. data/README.md +95 -0
  6. data/Rakefile +9 -4
  7. data/bin/mockup +1 -1
  8. data/doc/cli.md +46 -0
  9. data/doc/mockupfile.md +3 -0
  10. data/doc/templating.md +88 -0
  11. data/html_mockup.gemspec +8 -4
  12. data/lib/html_mockup/cli.rb +57 -65
  13. data/lib/html_mockup/cli/command.rb +23 -0
  14. data/lib/html_mockup/cli/generate.rb +5 -0
  15. data/lib/html_mockup/cli/release.rb +10 -0
  16. data/lib/html_mockup/cli/serve.rb +29 -0
  17. data/lib/html_mockup/generators.rb +18 -1
  18. data/lib/html_mockup/generators/generator.rb +23 -0
  19. data/lib/html_mockup/generators/new.rb +4 -3
  20. data/lib/html_mockup/generators/templates/generator.tt +13 -0
  21. data/lib/html_mockup/project.rb +11 -11
  22. data/lib/html_mockup/release.rb +3 -3
  23. data/lib/html_mockup/resolver.rb +51 -28
  24. data/lib/html_mockup/template.rb +95 -11
  25. data/roger.gemspec +29 -0
  26. data/test/project/Gemfile +2 -1
  27. data/test/project/Gemfile.lock +17 -12
  28. data/test/project/Mockupfile +3 -0
  29. data/test/project/html/formats/index.html +1 -0
  30. data/test/project/html/formats/json.json.erb +0 -0
  31. data/test/project/html/layouts/content-for.html.erb +17 -0
  32. data/test/project/html/mockup/encoding.html +3 -0
  33. data/test/project/html/partials/load_path.html.erb +3 -0
  34. data/test/project/layouts/test.html.erb +8 -1
  35. data/test/project/layouts/yield.html.erb +1 -0
  36. data/test/project/lib/generators/test.rb +9 -0
  37. data/test/project/partials/formats/erb.html.erb +1 -0
  38. data/test/project/partials/partials-test.html.erb +1 -0
  39. data/test/project/partials/test/front_matter.html.erb +1 -0
  40. data/test/project/partials/test/json.json.erb +1 -0
  41. data/test/project/partials/test/simple.html.erb +1 -0
  42. data/test/project/partials2/partials2-test.html.erb +1 -0
  43. data/test/unit/cli_test.rb +12 -0
  44. data/test/unit/generators_test.rb +75 -0
  45. data/test/unit/release/cleaner_test.rb +13 -8
  46. data/test/unit/resolver_test.rb +92 -0
  47. data/test/unit/template_test.rb +127 -0
  48. metadata +100 -8
  49. data/README.rdoc +0 -89
  50. data/test/generator-subcommand.rb +0 -54
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html_mockup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4
4
+ version: 0.9.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-02-27 00:00:00.000000000 Z
14
+ date: 2014-04-29 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: thor
@@ -52,7 +52,7 @@ dependencies:
52
52
  requirements:
53
53
  - - ~>
54
54
  - !ruby/object:Gem::Version
55
- version: 1.4.0
55
+ version: 2.0.1
56
56
  type: :runtime
57
57
  prerelease: false
58
58
  version_requirements: !ruby/object:Gem::Requirement
@@ -60,7 +60,23 @@ dependencies:
60
60
  requirements:
61
61
  - - ~>
62
62
  - !ruby/object:Gem::Version
63
- version: 1.4.0
63
+ version: 2.0.1
64
+ - !ruby/object:Gem::Dependency
65
+ name: mime-types
66
+ requirement: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ~>
70
+ - !ruby/object:Gem::Version
71
+ version: '2.2'
72
+ type: :runtime
73
+ prerelease: false
74
+ version_requirements: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ~>
78
+ - !ruby/object:Gem::Version
79
+ version: '2.2'
64
80
  - !ruby/object:Gem::Dependency
65
81
  name: sass
66
82
  requirement: !ruby/object:Gem::Requirement
@@ -77,6 +93,22 @@ dependencies:
77
93
  - - ! '>='
78
94
  - !ruby/object:Gem::Version
79
95
  version: '0'
96
+ - !ruby/object:Gem::Dependency
97
+ name: yui-compressor
98
+ requirement: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ! '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
80
112
  - !ruby/object:Gem::Dependency
81
113
  name: hpricot
82
114
  requirement: !ruby/object:Gem::Requirement
@@ -93,6 +125,22 @@ dependencies:
93
125
  - - ! '>='
94
126
  - !ruby/object:Gem::Version
95
127
  version: 0.6.4
128
+ - !ruby/object:Gem::Dependency
129
+ name: test-unit
130
+ requirement: !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ~>
134
+ - !ruby/object:Gem::Version
135
+ version: 2.5.5
136
+ type: :development
137
+ prerelease: false
138
+ version_requirements: !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - ~>
142
+ - !ruby/object:Gem::Version
143
+ version: 2.5.5
96
144
  description:
97
145
  email:
98
146
  - info@digitpaint.nl
@@ -101,14 +149,19 @@ executables:
101
149
  - mockup
102
150
  extensions: []
103
151
  extra_rdoc_files:
104
- - README.rdoc
152
+ - README.md
105
153
  files:
106
154
  - .gitignore
155
+ - .travis.yml
107
156
  - CHANGELOG.md
157
+ - Gemfile
108
158
  - MIT_LICENSE
109
- - README.rdoc
159
+ - README.md
110
160
  - Rakefile
111
161
  - bin/mockup
162
+ - doc/cli.md
163
+ - doc/mockupfile.md
164
+ - doc/templating.md
112
165
  - examples/default_template/.gitignore
113
166
  - examples/default_template/CHANGELOG
114
167
  - examples/default_template/Gemfile
@@ -117,9 +170,15 @@ files:
117
170
  - examples/default_template/partials/.empty_directory
118
171
  - html_mockup.gemspec
119
172
  - lib/html_mockup/cli.rb
173
+ - lib/html_mockup/cli/command.rb
174
+ - lib/html_mockup/cli/generate.rb
175
+ - lib/html_mockup/cli/release.rb
176
+ - lib/html_mockup/cli/serve.rb
120
177
  - lib/html_mockup/extractor.rb
121
178
  - lib/html_mockup/generators.rb
179
+ - lib/html_mockup/generators/generator.rb
122
180
  - lib/html_mockup/generators/new.rb
181
+ - lib/html_mockup/generators/templates/generator.tt
123
182
  - lib/html_mockup/mockup_template.rb
124
183
  - lib/html_mockup/mockupfile.rb
125
184
  - lib/html_mockup/project.rb
@@ -146,28 +205,45 @@ files:
146
205
  - lib/html_mockup/server.rb
147
206
  - lib/html_mockup/template.rb
148
207
  - lib/html_mockup/w3c_validator.rb
208
+ - roger.gemspec
149
209
  - test/Mockupfile-syntax.rb
150
- - test/generator-subcommand.rb
151
210
  - test/project/.rvmrc
152
211
  - test/project/Gemfile
153
212
  - test/project/Gemfile.lock
154
213
  - test/project/Mockupfile
155
214
  - test/project/html/formats/erb.html.erb
215
+ - test/project/html/formats/index.html
216
+ - test/project/html/formats/json.json.erb
156
217
  - test/project/html/formats/markdown.md
157
218
  - test/project/html/formats/mockup.html
158
219
  - test/project/html/front_matter/erb.html.erb
159
220
  - test/project/html/front_matter/markdown.md
221
+ - test/project/html/layouts/content-for.html.erb
160
222
  - test/project/html/layouts/erb.html.erb
223
+ - test/project/html/mockup/encoding.html
161
224
  - test/project/html/partials/erb.html.erb
225
+ - test/project/html/partials/load_path.html.erb
162
226
  - test/project/html/partials/mockup.html
163
227
  - test/project/html/static/non-relative.html.erb
164
228
  - test/project/html/static/relative.html.erb
165
229
  - test/project/layouts/test.html.erb
230
+ - test/project/layouts/yield.html.erb
231
+ - test/project/lib/generators/test.rb
232
+ - test/project/partials/formats/erb.html.erb
233
+ - test/project/partials/partials-test.html.erb
166
234
  - test/project/partials/test/erb.html.erb
235
+ - test/project/partials/test/front_matter.html.erb
236
+ - test/project/partials/test/json.json.erb
167
237
  - test/project/partials/test/markdown.md
168
238
  - test/project/partials/test/mockup.part.html
239
+ - test/project/partials/test/simple.html.erb
240
+ - test/project/partials2/partials2-test.html.erb
241
+ - test/unit/cli_test.rb
242
+ - test/unit/generators_test.rb
169
243
  - test/unit/release/cleaner_test.rb
170
244
  - test/unit/release/processors/require_js_test.rb
245
+ - test/unit/resolver_test.rb
246
+ - test/unit/template_test.rb
171
247
  homepage: http://github.com/digitpaint/html_mockup
172
248
  licenses:
173
249
  - MIT
@@ -196,24 +272,40 @@ specification_version: 3
196
272
  summary: HTML Mockup is a set of tools to create self-containing HTML mockups.
197
273
  test_files:
198
274
  - test/Mockupfile-syntax.rb
199
- - test/generator-subcommand.rb
200
275
  - test/project/.rvmrc
201
276
  - test/project/Gemfile
202
277
  - test/project/Gemfile.lock
203
278
  - test/project/Mockupfile
204
279
  - test/project/html/formats/erb.html.erb
280
+ - test/project/html/formats/index.html
281
+ - test/project/html/formats/json.json.erb
205
282
  - test/project/html/formats/markdown.md
206
283
  - test/project/html/formats/mockup.html
207
284
  - test/project/html/front_matter/erb.html.erb
208
285
  - test/project/html/front_matter/markdown.md
286
+ - test/project/html/layouts/content-for.html.erb
209
287
  - test/project/html/layouts/erb.html.erb
288
+ - test/project/html/mockup/encoding.html
210
289
  - test/project/html/partials/erb.html.erb
290
+ - test/project/html/partials/load_path.html.erb
211
291
  - test/project/html/partials/mockup.html
212
292
  - test/project/html/static/non-relative.html.erb
213
293
  - test/project/html/static/relative.html.erb
214
294
  - test/project/layouts/test.html.erb
295
+ - test/project/layouts/yield.html.erb
296
+ - test/project/lib/generators/test.rb
297
+ - test/project/partials/formats/erb.html.erb
298
+ - test/project/partials/partials-test.html.erb
215
299
  - test/project/partials/test/erb.html.erb
300
+ - test/project/partials/test/front_matter.html.erb
301
+ - test/project/partials/test/json.json.erb
216
302
  - test/project/partials/test/markdown.md
217
303
  - test/project/partials/test/mockup.part.html
304
+ - test/project/partials/test/simple.html.erb
305
+ - test/project/partials2/partials2-test.html.erb
306
+ - test/unit/cli_test.rb
307
+ - test/unit/generators_test.rb
218
308
  - test/unit/release/cleaner_test.rb
219
309
  - test/unit/release/processors/require_js_test.rb
310
+ - test/unit/resolver_test.rb
311
+ - test/unit/template_test.rb
@@ -1,89 +0,0 @@
1
- {<img src="https://badge.fury.io/rb/html_mockup.png" alt="Gem Version" />}[http://badge.fury.io/rb/html_mockup]
2
-
3
- == HtmlMockup
4
-
5
- HTML Mockup is a set of tools to create self-containing HTML mockups. HtmlMockup gives you the flexibility
6
- of a templatinglanguage but at the same time keeps all HTML files viewable. HTML comments are
7
- used to determine what partial (sub-template) to render.
8
-
9
- HtmlMockup also provides tools for HTML validation.
10
-
11
- === Requirements
12
- HtmlMockup requires the following dependencies
13
-
14
- * Ruby 1.8.x (or 1.9.x)
15
- * Rubygems
16
- * Thor (to use mockup binary)
17
- * Rack > 1.0 (to use mockup serve)
18
-
19
- === Usage
20
-
21
- Just write regular HTML files and include comment's like this:
22
-
23
- <!-- [START:partial_name] -->Text<!-- [STOP:partial_name] -->
24
-
25
- The data between the tags will be replaced by the partial contents. Partials are searched in
26
- "../partials" relative to the directory the script you run resides in. This can be overridden with
27
- commandline parameters. Partials always must have a .part.r?html ending and are evaluated as ERB during
28
- insertion.
29
-
30
- === Syntax for HTML files
31
-
32
- ==== Standard partials
33
-
34
- <!-- [START:partial_name] -->Text<!-- [STOP:partial_name] -->
35
-
36
- ==== Pass parameters to partials
37
-
38
- You can pass in parameters to partials in the format of key=value&key2=value2 (it's just a regular CGI
39
- query string and is parsed by CGI#parse). The partials wich are evaluated as ERB can access the variables
40
- through standard instance methods. The example below would create the instance variable @key.
41
-
42
- <!-- [START:partial_name?key=value] -->Text<!-- [STOP:partial_name] -->
43
-
44
- === Partials in subdirectories
45
-
46
- The partials path can have it's own directory structure. You can create tags with slashes in them
47
- to access partials in subdirectories.
48
-
49
-
50
- === Mockup commandline
51
-
52
- ==== mockup serve [directory]
53
-
54
- Serve can be used during development as a simple webserver (Puma, Mongrel, Thin, Webrick). It also supports on-the-fly HTML validation.
55
-
56
- The directory to serve must contain `[directory]/html` and `[directory]/partials` (unless you have specified `--partial_path` and `--html_path`)
57
-
58
- Options:
59
- --port:: The port the server should listen on. Defaults to 9000
60
- --partial_path:: the path where the partial files can be found (*.part.html), defaults to directory `[directory]/partials`
61
- --html_path:: the path where the html files can be found (*.html), defaults to directory `[directory]/html`
62
- --validate:: Flag to set wether or not we should validate all html files (defaults to false)
63
-
64
- ==== mockup release [directory]
65
-
66
- Makes a release of the current mockup project
67
-
68
- ==== mockup new [directory]
69
-
70
- Generate creates a directory structure in directory for use with new HTML mockups.
71
-
72
- ==== mockup extract [source_path] [target_path]
73
-
74
- Extract a fully relative html mockup into target_path. It will expand all absolute href's, src's and action's into relative links if they are absolute
75
-
76
- Options:
77
- --partial_path:: Defaults to [directory]/partials
78
- --filter:: What files should be converted defaults to **/*.html
79
-
80
- ==== mockup validate [directory/file]
81
-
82
- Validates all files within directory or just file with the W3C validator webservice.
83
-
84
- Options:
85
- --show_valid:: Flag to print a line for each valid file too (defaults to false)
86
- --filter:: What files should be validated, defaults to [^_]*.html
87
-
88
- === Copyright & license
89
- Copyright (c) 2012 Flurin Egger, Edwin van der Graaf, DigitPaint, MIT Style License. (see MIT-LICENSE)
@@ -1,54 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # This testfile is just a small testcase on how
4
- # to do something with nested generators. It's
5
- # just some basics and needs to be explored further.
6
-
7
- # What we need for/from a generator:
8
- # - It needs to be registered in our Generators::Generate class
9
- # - It needs to be automatically loaded from:
10
- # - The mockup: <root>/generators/<name>/<name>_generator.rb
11
- # - The gem
12
- # - Other gems which have been manually required (?)
13
- # - It needs to have access to the current Mockup::Project instance
14
- # - It needs to have the following file structure:
15
- # - <name>
16
- # - <name>_generator.rb
17
- # - ...support files...
18
-
19
- require 'rubygems'
20
- require 'thor'
21
- require 'thor/group'
22
-
23
-
24
- module Generators
25
- class Generate < Thor
26
- end
27
-
28
- class GeneratorBase < Thor::Group
29
- def self.inherited(sub)
30
- name = sub.to_s.sub(/Generator$/, "").sub(/^Generators::/,"").downcase
31
- Generate.register sub, name, name, "Run #{name}"
32
- end
33
- end
34
-
35
- class ThingGenerator < GeneratorBase
36
- def done
37
- puts "Yep, done the thing"
38
- end
39
- end
40
-
41
- class BlingGenerator < GeneratorBase
42
- def done
43
- puts "Here is some bling!"
44
- end
45
- end
46
- end
47
-
48
- module CLI
49
- class Base < Thor
50
- register Generators::Generate, "generate", "generate [COMMAND]", "Run a generator"
51
- end
52
- end
53
-
54
- CLI::Base.start