easy_html_generator 1.0.4 → 1.0.5
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/.codeclimate.yml +6 -0
- data/.gitignore +12 -0
- data/.rubocop.yml +18 -0
- data/.travis.yml +14 -0
- data/Gemfile +3 -0
- data/README.md +51 -337
- data/Rakefile +42 -0
- data/config.ru +4 -0
- data/docs/CONFIGURATION.md +84 -0
- data/{CONTRIBUTING.md → docs/CONTRIBUTING.md} +2 -0
- data/docs/GENERATORS.md +210 -0
- data/docs/GETSTARTED.md +92 -0
- data/easy_html_generator.gemspec +54 -0
- data/lib/easy_html_generator/checksum.rb +4 -0
- data/lib/easy_html_generator/config.rb +0 -77
- data/lib/easy_html_generator/generator/base.rb +20 -58
- data/lib/easy_html_generator/generator/combine.rb +9 -19
- data/lib/easy_html_generator/generator/compile/base.rb +51 -0
- data/lib/easy_html_generator/generator/compile/coffee.rb +6 -13
- data/lib/easy_html_generator/generator/compile/haml/helper/activesupport_override.rb +1 -6
- data/lib/easy_html_generator/generator/compile/haml/helper/asset_helper.rb +7 -7
- data/lib/easy_html_generator/generator/compile/haml.rb +20 -45
- data/lib/easy_html_generator/generator/compile/sass.rb +9 -13
- data/lib/easy_html_generator/generator/copy.rb +7 -14
- data/lib/easy_html_generator/generator/delete.rb +4 -13
- data/lib/easy_html_generator/generator/minimize/css.rb +5 -12
- data/lib/easy_html_generator/generator/minimize/html.rb +5 -12
- data/lib/easy_html_generator/generator/minimize/images.rb +6 -20
- data/lib/easy_html_generator/generator/minimize/js.rb +5 -12
- data/lib/easy_html_generator/generator/service/analytics.rb +19 -19
- data/lib/easy_html_generator/generator/service/bower.rb +21 -17
- data/lib/easy_html_generator/generator/service/grunt.rb +12 -11
- data/lib/easy_html_generator/generator/service/sitemap.rb +33 -0
- data/lib/easy_html_generator/generator/structure.rb +2 -6
- data/lib/easy_html_generator/generator.rb +6 -6
- data/lib/easy_html_generator/project.rb +5 -0
- data/lib/easy_html_generator/project_path_resolver.rb +57 -0
- data/lib/easy_html_generator/rack_dispatcher.rb +1 -1
- data/lib/easy_html_generator/version.rb +4 -0
- data/lib/easy_html_generator/workspace.rb +1 -1
- data/lib/easy_html_generator.rb +19 -18
- data/src/demo/assets/styles/app.css.sass +47 -2
- data/src/demo/lib/helper/projecthelper.rb +3 -0
- data/src/demo/project.yml +142 -0
- data/src/demo/views/index/_bower_and_grunt.haml +7 -0
- data/src/demo/views/index/_dry.haml +16 -0
- data/src/demo/views/index/_haml_sass_coffee.haml +11 -0
- data/src/demo/views/index/_inline_coffee_and_sass.haml +43 -0
- data/src/demo/views/index/_sass_mixins.haml +76 -0
- data/src/demo/views/index.html.haml +13 -1
- data/src/demo/views/layout/_assets.javascripts.haml +7 -0
- data/src/demo/views/layout/_assets.metadata.haml +12 -0
- data/src/demo/views/layout/_assets.stylesheets.haml +9 -0
- data/src/demo/views/layout/_footer.haml +3 -0
- data/src/demo/views/layout/_header.haml +1 -0
- data/src/demo/views/layout.haml +8 -4
- data/src/demo/views/plain.html +1 -0
- data/src/shared/assets/styles/mixins/_bootstrap-fixes.sass +12 -0
- data/src/shared/assets/styles/mixins/_headjs-bootstrap-mediaqueries.sass +30 -0
- data/src/shared/project.yml +56 -35
- data/src/template/project.yml +57 -43
- metadata +75 -7
- data/src/demo/views/index/_lore_ipsum.haml +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 09e261a245dc181a7eccc30b1996735cef82ac01
|
4
|
+
data.tar.gz: 9b16640da263e0de0e464b282fe8caa1a53cb386
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bb7994ee0aab9b4892f4ef48564d1fc2f861b16de6aced27466a43a5e3f3e16372043ae55afb2a94c8e2db57fa37b920dc48155a8b9b72412e65c09b1311cf4
|
7
|
+
data.tar.gz: c3699481eaf0aab10f8b55174e7c922b7e4add82d337c0d4a2cdb582a4b1dffe5abe5dab51f06bdffbc8f8d637d6e12a0d156445ef5ba3a8a1661251bd460aee
|
data/.codeclimate.yml
ADDED
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Metrics/LineLength:
|
2
|
+
Max: 79
|
3
|
+
|
4
|
+
AllCops:
|
5
|
+
Include:
|
6
|
+
- '**/Rakefile'
|
7
|
+
- '**/config.ru'
|
8
|
+
Exclude:
|
9
|
+
- spec/fixtures/**/*
|
10
|
+
|
11
|
+
Style/Encoding:
|
12
|
+
Enabled: true
|
13
|
+
|
14
|
+
Style/RedundantException:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
Style/ClassAndModuleChildren:
|
18
|
+
Enabled: false
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
CHANGED
@@ -1,364 +1,78 @@
|
|
1
1
|
# easy-html-generator [](https://travis-ci.org/creative-workflow/easy-html-generator) [](https://codeclimate.com/github/creative-workflow/easy-html-generator) [](http://badge.fury.io/rb/easy_html_generator)
|
2
2
|
|
3
|
-
This gem is a powerful and easy to use web development tool that helps developing modern web sites by generating static html pages.
|
3
|
+
This gem is a powerful and easy to use web development tool that helps developing modern web sites in a comfortable and fast way by generating static html pages.
|
4
|
+
|
5
|
+
#### ehg utilizes:
|
4
6
|
* [CoffeScript](http://coffeescript.org/) a.k.a. Javascript
|
5
7
|
* [Sass](http://sass-lang.com/) a.k.a. Css
|
6
8
|
* [Haml](http://haml.info/) a.k.a. Html
|
7
9
|
* [ActionView](https://github.com/rails/rails/tree/master/actionview) for ruby haml templating comfort
|
8
|
-
* ~ 600 lines of code
|
9
10
|
|
10
|
-
|
11
|
+
#### ehg supports:
|
11
12
|
* [Bootstrap](http://getbootstrap.com/) for responsive and modern html layouts
|
12
13
|
* [HeadJS](http://headjs.com/) for performance optimized resource loading
|
13
14
|
* [Bower](http://bower.io/) for javascript dependency management
|
14
15
|
* [Grunt](http://gruntjs.com/) for javascript based task management
|
15
16
|
* [Google Anlaytics](https://www.google.com/analytics/) tracking of pageclicks
|
16
|
-
* minimizing of coffee-, javascript-, sass-, css-, png- and jpg files
|
17
|
-
*
|
18
|
-
*
|
19
|
-
|
20
|
-
It is developed with:
|
21
|
-
- [Ruby](https://www.ruby-lang.org/) as implementation language
|
22
|
-
- [Rspec](http://rspec.info/) for testing
|
23
|
-
- [RuboCop](https://github.com/bbatsov/rubocop) for code quality
|
24
|
-
|
25
|
-
It is based on:
|
26
|
-
- [EasyHtmlCreator](https://github.com/dennisvandehoef/easy-html-creator) which was the fundament [Dennis van de Hoef](https://github.com/dennisvandehoef) and me developed on.
|
27
|
-
|
28
|
-
## Get started
|
29
|
-
At first you need [Ruby](https://www.ruby-lang.org/de/) and [Bundler](http://bundler.io/).
|
30
|
-
|
31
|
-
For specific generators install:
|
32
|
-
* [OptiPng](http://optipng.sourceforge.net/) for png image minimizing
|
33
|
-
* [JpegOptim](https://github.com/tjko/jpegoptim) for jpg image minimizing
|
34
|
-
* [NodeJs](https://nodejs.org/download/) to use bower and grunt https://www.npmjs.com/
|
35
|
-
* [Bower](http://bower.io/) to use bower `npm install -g bower`
|
36
|
-
* [Grunt](http://gruntjs.com/getting-started) to use grunt `npm install -g grunt-cli`
|
37
|
-
|
38
|
-
Create a new workspace folder
|
39
|
-
|
40
|
-
mkdir my_workspace
|
41
|
-
cd my_workspace
|
42
|
-
|
43
|
-
Create a ruby `Gemfile`
|
44
|
-
|
45
|
-
touch Gemfile
|
46
|
-
|
47
|
-
Paste this into the `Gemfile`
|
48
|
-
|
49
|
-
source 'https://rubygems.org'
|
50
|
-
|
51
|
-
gem 'easy_html_generator'
|
52
|
-
|
53
|
-
Run in terminal
|
54
|
-
|
55
|
-
bundle install
|
56
|
-
ehg --init
|
57
|
-
ehg --create my_project
|
58
|
-
|
59
|
-
Now you should see the following folder structure with `ls -alR`
|
60
|
-
|
61
|
-
my_workspace
|
62
|
-
├── dist # the generated result will be stored here
|
63
|
-
└── src # the generation input is stored here
|
64
|
-
├── demo
|
65
|
-
├── my_project # this is a project and will be available via http://localhost:9292/my_project
|
66
|
-
│ ├── assets
|
67
|
-
│ │ ├── images # content will be copied to `dist/my_project/images`
|
68
|
-
│ │ ├── public # public content gets directly copied to `dist/my_project/`
|
69
|
-
│ │ ├── scripts # content will be copied to `dist/my_project/scripts`
|
70
|
-
│ │ └── styles # content will be copied to `dist/my_project/styles`
|
71
|
-
│ ├── lib
|
72
|
-
│ │ ├── generators # project specific generators
|
73
|
-
│ │ └── helper # project specific view helpers you can use in haml files
|
74
|
-
│ ├── project.yml # project specific generators config
|
75
|
-
│ └── views
|
76
|
-
│ ├── index.html.haml # the ham file for index.html
|
77
|
-
│ └── layout.haml # the layout file index.html will use
|
78
|
-
|
|
79
|
-
└── shared # shared content over all projects
|
80
|
-
├── assets # shared assets over all projects
|
81
|
-
│ ├── images
|
82
|
-
│ ├── public
|
83
|
-
│ ├── scripts
|
84
|
-
│ └── styles
|
85
|
-
│ └── mixins # here are css helpers for bootstrap and head js
|
86
|
-
├── lib
|
87
|
-
│ ├── generators # generators shared over all projects
|
88
|
-
│ └── helper # view helpers you can use in haml files
|
89
|
-
└── project.yml # if a project doesnt have a `project.yml` this config will be used
|
90
|
-
|
91
|
-
Now run
|
92
|
-
|
93
|
-
ehg --server
|
94
|
-
|
95
|
-
...and navigate your web browser to `http://localhost:9292`
|
96
|
-
|
97
|
-
After a short time of generating you should see a directory listening in your browser.
|
98
|
-
|
99
|
-
## Usage Terminal
|
100
|
-
Usage: ehg [options]
|
101
|
-
-s, --server [HOST_AND_PORT] start the rack server, default: 0.0.0.0:9292
|
102
|
-
-g, --generate [PROJECT] generate one or all projects, default: all
|
103
|
-
-i, --init initialize ehg workspace
|
104
|
-
-c, --create [PROJECT] create a new project from template, default: demo
|
105
|
-
-h, --help Show this message
|
106
|
-
|
107
|
-
## Usage Generators
|
108
|
-
There are several generators controlled by the `project.yml`. If a project misses the project.yml the file `my_workspace/shared/project.yml` will be loaded and looks like this:
|
109
|
-
|
110
|
-
paths:
|
111
|
-
src:
|
112
|
-
images: 'assets/images'
|
113
|
-
scripts: 'assets/scripts'
|
114
|
-
styles: 'assets/styles'
|
115
|
-
...
|
116
|
-
|
117
|
-
generators:
|
118
|
-
- structure:
|
119
|
-
enabled: true
|
120
|
-
|
121
|
-
- compile_coffee:
|
122
|
-
enabled: true
|
123
|
-
minimize: true
|
124
|
-
selector: '**/*.js.coffee'
|
125
|
-
|
126
|
-
- service_bower:
|
127
|
-
enabled: true
|
128
|
-
selector: 'bower.json'
|
129
|
-
target: 'lib'
|
130
|
-
...
|
131
|
-
|
132
|
-
## Generators
|
133
|
-
Generators are processed the way they appear in the `project.yml`. At the moment only one generator instance per `project.yml` is allowed. Every generator has the property `enabled`.
|
134
|
-
|
135
|
-
### Basic-Generators
|
136
|
-
#### Structure
|
137
|
-
* operates on: `dist`
|
138
|
-
* creates necessary dist folders
|
139
|
-
* config:
|
140
|
-
|
141
|
-
```
|
142
|
-
generators:
|
143
|
-
- structure:
|
144
|
-
enabled: true
|
145
|
-
```
|
146
|
-
|
147
|
-
#### Copy
|
148
|
-
* operates on: `dist` and `src`
|
149
|
-
* copies folder or files from dist to src per default
|
150
|
-
* supports `src://` and `dist://`
|
151
|
-
* config:
|
152
|
-
|
153
|
-
```
|
154
|
-
generators:
|
155
|
-
- copy:
|
156
|
-
enabled: true
|
157
|
-
dirs:
|
158
|
-
-
|
159
|
-
source: 'assets/styles'
|
160
|
-
target: 'styles'
|
161
|
-
selector: '**/*.css'
|
162
|
-
-
|
163
|
-
source: 'src://assets/scripts'
|
164
|
-
target: 'dist://scripts'
|
165
|
-
selector: '**/*.js'
|
166
|
-
```
|
167
|
-
|
168
|
-
#### Combine
|
169
|
-
* operates on: `dist`
|
170
|
-
* combines merges files on dist per default
|
171
|
-
* supports `src://` and `dist://`
|
172
|
-
* config:
|
173
|
-
|
174
|
-
```
|
175
|
-
generators:
|
176
|
-
- combine
|
177
|
-
enabled: true
|
178
|
-
packages:
|
179
|
-
-
|
180
|
-
file: 'scripts/combined.js'
|
181
|
-
files:
|
182
|
-
- 'scripts/**/*.js'
|
183
|
-
-
|
184
|
-
file: 'dist://styles/combined.css'
|
185
|
-
files:
|
186
|
-
- 'src://styles/**/*.css'
|
187
|
-
```
|
188
|
-
|
189
|
-
#### Delete
|
190
|
-
* operates on: `dist`
|
191
|
-
* deletes files or folders on dist per default
|
192
|
-
* supports `src://` and `dist://`
|
193
|
-
* config:
|
194
|
-
|
195
|
-
```
|
196
|
-
generators:
|
197
|
-
- delete
|
198
|
-
enabled: false
|
199
|
-
files:
|
200
|
-
- '*'
|
201
|
-
- 'src://bower_components'
|
202
|
-
```
|
203
|
-
|
204
|
-
### Compile-Generators
|
205
|
-
#### Compile::Haml
|
206
|
-
* operates on: `dist` and `src`
|
207
|
-
* compiles haml files from src to html files in dist, supports partials, action view syntax and minimizing
|
208
|
-
* config:
|
209
|
-
|
210
|
-
```
|
211
|
-
generators:
|
212
|
-
- compile_haml:
|
213
|
-
enabled: true
|
214
|
-
minimize: true
|
215
|
-
default_layout: 'views/layout.haml'
|
216
|
-
selector: '**/*.html.haml'
|
217
|
-
renderer:
|
218
|
-
attr_wrapper: '"'
|
219
|
-
format: :html5
|
220
|
-
shared_helper_path: 'shared/lib'
|
221
|
-
```
|
222
|
-
|
223
|
-
#### Compile::Sass
|
224
|
-
* operates on: `dist` and `src`
|
225
|
-
* compiles sass files from src to css files in dist, supports shared mixins and minimizing
|
226
|
-
* config:
|
227
|
-
|
228
|
-
```
|
229
|
-
generators:
|
230
|
-
- compile_sass:
|
231
|
-
enabled: true
|
232
|
-
minimize: true
|
233
|
-
selector: '**/*.css.sass'
|
234
|
-
```
|
235
|
-
|
236
|
-
#### Compile::Coffee
|
237
|
-
* operates on: `dist` and `src`
|
238
|
-
* compiles coffee files from src to js files in dist, supports minimizing
|
239
|
-
* config:
|
240
|
-
|
241
|
-
```
|
242
|
-
generators:
|
243
|
-
- compile_coffee:
|
244
|
-
enabled: true
|
245
|
-
minimize: true
|
246
|
-
selector: '**/*.js.coffee'
|
247
|
-
```
|
248
|
-
|
249
|
-
### Minimize-Generators
|
250
|
-
#### Minimize::Html
|
251
|
-
* operates on: `dist` and `src`
|
252
|
-
* minimizes src html files and copies to dist
|
253
|
-
* config:
|
254
|
-
|
255
|
-
```
|
256
|
-
generators:
|
257
|
-
- minimize_html:
|
258
|
-
enabled: true
|
259
|
-
selector: '**/*.html'
|
260
|
-
prefix_extension: ''
|
261
|
-
```
|
262
|
-
|
263
|
-
#### Minimize::Css
|
264
|
-
* operates on: `dist` and `src`
|
265
|
-
* minimizes src css files and copies to dist
|
266
|
-
* config:
|
267
|
-
|
268
|
-
```
|
269
|
-
generators:
|
270
|
-
- minimize_css:
|
271
|
-
enabled: true
|
272
|
-
selector: '**/*.css'
|
273
|
-
prefix_extension: '.min'
|
274
|
-
```
|
275
|
-
|
276
|
-
#### Minimize::Js
|
277
|
-
* operates on: `dist` and `src`
|
278
|
-
* minimizes src js files and copies to dist
|
279
|
-
* config:
|
17
|
+
* `minimizing` of coffee-, javascript-, sass-, css-, html-, haml-, png- and jpg files
|
18
|
+
* workspace `shared` generator-, haml-helper-, static-, sass- and image files
|
19
|
+
* `inline` sass and coffee script in haml files, `inline_stylesheet_link_tag` and `inline_javascript_include_tag`
|
20
|
+
* `partitial templates` and `layout files` for haml
|
280
21
|
|
281
|
-
|
282
|
-
generators:
|
283
|
-
- minimize_js:
|
284
|
-
enabled: true
|
285
|
-
selector: '**/*.js'
|
286
|
-
prefix_extension: '.min'
|
287
|
-
```
|
22
|
+
## Resources
|
288
23
|
|
289
|
-
|
290
|
-
* operates on: `dist` and `src`
|
291
|
-
* minimizes src image files and copies to dist, uses [Piet](https://github.com/albertbellonch/piet)
|
292
|
-
* config:
|
24
|
+
> "[Getting started](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/GETSTARTED.md)"
|
293
25
|
|
294
|
-
|
295
|
-
generators:
|
296
|
-
- minimize_images:
|
297
|
-
enabled: true
|
298
|
-
selector: '**/*.{jpg,jpeg,png}'
|
299
|
-
options:
|
300
|
-
quality: 90
|
301
|
-
level: 3
|
302
|
-
verbose: true
|
303
|
-
```
|
26
|
+
> "[Configuration](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/CONFIGURATION.md)"
|
304
27
|
|
305
|
-
|
306
|
-
#### Service::Bower
|
307
|
-
* operates on: `dist` and `src`
|
308
|
-
* resolves my_workspace/bower.json and copies bower_components to target in dist
|
309
|
-
* config:
|
28
|
+
> "[Generators](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/GENERATORS.md)"
|
310
29
|
|
311
|
-
|
312
|
-
generators:
|
313
|
-
- service_bower:
|
314
|
-
enabled: true
|
315
|
-
selector: 'bower.json'
|
316
|
-
target: 'lib'
|
317
|
-
```
|
30
|
+
>"[Contributing](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/CONTRIBUTING.md)"
|
318
31
|
|
319
|
-
#### Service::Grunt
|
320
|
-
* operates on: `dist`
|
321
|
-
* resolves my_workspace/Gruntfile.coffee and runs a task
|
322
|
-
* config:
|
323
32
|
|
324
|
-
|
325
|
-
generators:
|
326
|
-
- service_grunt:
|
327
|
-
enabled: true
|
328
|
-
selector: 'Gruntfile.coffee'
|
329
|
-
task: 'default'
|
330
|
-
```
|
33
|
+
## Changes
|
331
34
|
|
332
|
-
####
|
333
|
-
*
|
334
|
-
*
|
335
|
-
*
|
35
|
+
#### Version 1.0.5
|
36
|
+
* refactor Generator::* and clean up code
|
37
|
+
* implement Generator::Service::Sitemap
|
38
|
+
* add repetitive feature to every generator
|
39
|
+
* add generic support for analytic codes, not only for google
|
40
|
+
* implement src:// and dest:// path expanding for all config values, streamline config names
|
41
|
+
* streamline project.yml parameter names
|
42
|
+
* you have to adjust your project.yml by adding path shortcuts to all your generators `src://` and `dest://` (see README for more path shortcuts) and rename some parameter names
|
336
43
|
|
44
|
+
#### Version 1.0.4
|
45
|
+
* add src:// and dest:// path expanding to basic generators
|
46
|
+
* raise on missing partial rendering
|
47
|
+
* set thin server to debug level, see requests
|
48
|
+
* extend bootsrap fixes
|
49
|
+
* add headjs hide-* mixins and classes
|
50
|
+
* better override path_to_stylesheet instead of hole stylesheet_link_tag method to make action_view_helper work with ehg
|
51
|
+
* don’t cache combined result
|
52
|
+
* create target dir on copy
|
53
|
+
* add missing rubocop dev dependency
|
337
54
|
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
google:
|
345
|
-
enabled: true
|
346
|
-
code: "<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', '{GOOGLE_UA_ID}', 'auto');ga('send', 'pageview');</script>"
|
347
|
-
id: -1
|
348
|
-
```
|
55
|
+
#### Version 1.0.3
|
56
|
+
* bower target relative from dist folder not from dist/scripts folder
|
57
|
+
* optimize rack for local pagespeed testing
|
58
|
+
* fix directory listening
|
59
|
+
* add Rack::ShowExceptions
|
60
|
+
* project.uri_path retuns now relative paths
|
349
61
|
|
350
|
-
|
351
|
-
*
|
352
|
-
*
|
353
|
-
*
|
354
|
-
* https://rubygems.org/gems/easy_html_generator
|
355
|
-
* http://www.rubydoc.info/gems/easy_html_generator
|
356
|
-
* https://github.com/dennisvandehoef/easy-html-creator
|
62
|
+
#### Version 1.0.2
|
63
|
+
* fix generate all `ehg -g`
|
64
|
+
* refactor rack app, use thin server
|
65
|
+
* implement ehg as rack middleware
|
357
66
|
|
358
|
-
|
67
|
+
#### Version 1.0.1
|
68
|
+
* setup instructions
|
69
|
+
* travis integration
|
70
|
+
* code coverage
|
71
|
+
* rubocop rake task
|
359
72
|
|
360
|
-
[Tom Hanoldt](https://github.com/monotom)
|
361
73
|
|
362
|
-
#
|
74
|
+
# Authors
|
363
75
|
|
364
|
-
|
76
|
+
- [Tom Hanoldt](https://github.com/monotom)
|
77
|
+
- [Alexander Illmayer](https://github.com/arecords)
|
78
|
+
- It is based on: [EasyHtmlCreator](https://github.com/dennisvandehoef/easy-html-creator) which was the fundament [Dennis van de Hoef](https://github.com/dennisvandehoef) and me developed on.
|
data/Rakefile
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'rake'
|
3
|
+
require 'easy_html_generator'
|
4
|
+
require 'bundler/gem_tasks'
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
|
7
|
+
desc 'generate one or all project ditributions'
|
8
|
+
task :generate do |project|
|
9
|
+
if project
|
10
|
+
EasyHtmlGenerator.generate_project project
|
11
|
+
else
|
12
|
+
EasyHtmlGenerator.generate_all
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'Starts the rack server, see config.ru'
|
17
|
+
task :server, :host_and_port do |_t, args|
|
18
|
+
host_and_port = args[:host_and_port] || '0.0.0.0:9292'
|
19
|
+
|
20
|
+
tmp = host_and_port.split ':'
|
21
|
+
host = tmp.first
|
22
|
+
port = tmp.last
|
23
|
+
|
24
|
+
Rack::Server.start(app: EasyHtmlGenerator::Rackapp, Host: host, Port: port)
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'runs rubocop'
|
28
|
+
task :lint do
|
29
|
+
puts `rubocop .`
|
30
|
+
end
|
31
|
+
|
32
|
+
desc 'create a new project'
|
33
|
+
task :create, :name do |_t, args|
|
34
|
+
EasyHtmlGenerator::Workspace.create_project args[:name]
|
35
|
+
end
|
36
|
+
|
37
|
+
RSpec::Core::RakeTask.new
|
38
|
+
|
39
|
+
desc 'Run tests'
|
40
|
+
task test: :spec
|
41
|
+
|
42
|
+
task default: :test
|
data/config.ru
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Configuration
|
2
|
+
|
3
|
+
### project.yml
|
4
|
+
There are several generators controlled by the `project.yml`. If a project misses the project.yml the file `my_workspace/shared/project.yml` will be loaded and looks like this:
|
5
|
+
|
6
|
+
paths:
|
7
|
+
src:
|
8
|
+
images: 'assets/images'
|
9
|
+
scripts: 'assets/scripts'
|
10
|
+
styles: 'assets/styles'
|
11
|
+
[...]
|
12
|
+
generators:
|
13
|
+
- structure:
|
14
|
+
enabled: true
|
15
|
+
- compile_coffee:
|
16
|
+
enabled: true
|
17
|
+
minimize: true
|
18
|
+
selector: 'src.scripts://**/*.js.coffee'
|
19
|
+
[...]
|
20
|
+
|
21
|
+
### Path shortcuts
|
22
|
+
Any config value can use `path shortcuts` which will be resolved at runtime. The following shortcuts are available:
|
23
|
+
* `src://`: project.src_path
|
24
|
+
* `dist://`: project.dist_path
|
25
|
+
* `src.scripts://`: project.src_path_to(:scripts)
|
26
|
+
* `src.styles://`: project.src_path_to(:styles)
|
27
|
+
* `src.images://`: project.src_path_to(:images)
|
28
|
+
* `src.public://`: project.src_path_to(:public)
|
29
|
+
* `src.views://`: project.src_path_to(:views),
|
30
|
+
* `dist.scripts://`: project.dist_path_to(:scripts)
|
31
|
+
* `dist.styles://`: project.dist_path_to(:styles)
|
32
|
+
* `dist.images://`: project.dist_path_to(:images)
|
33
|
+
* `dist.public://`: project.dist_path_to(:public)
|
34
|
+
* `dist.views://`: project.dist_path_to(:views),
|
35
|
+
* `workspace.root://`: EasyHtmlGenerator::WORKSPACE_PATH
|
36
|
+
* `ehg.root://`: EasyHtmlGenerator::EHG_SRC_PATH
|
37
|
+
|
38
|
+
If we have a config value like ```src.scripts://bower_components/*``` the value will be expanded to ```/Users/mono/code/cw/tools/easy-html-generator/src/scripts/bower_components/*``` for ex..
|
39
|
+
|
40
|
+
### Path regexp
|
41
|
+
based on ruby's [Dir method](http://www.rubydoc.info/stdlib/core/2.2.2/Dir.glob) pattern resolving.
|
42
|
+
* `*`matches all files
|
43
|
+
* `m*` matches all files beginning with m
|
44
|
+
* `*o` matches all files ending with o
|
45
|
+
* `*no*` matches all files that have no in them
|
46
|
+
* `**` matches directories recursively
|
47
|
+
* `?` matches any one character
|
48
|
+
* `[set]` matches any one character in set
|
49
|
+
* `{p,q}` matches either literal p or literal q
|
50
|
+
* `\` escapes the next metacharacter
|
51
|
+
|
52
|
+
### Repetitive configuration
|
53
|
+
Nearly any generator can be configured repetitive. That means that the following copy generator configuration...
|
54
|
+
|
55
|
+
- copy:
|
56
|
+
enabled: true
|
57
|
+
source: 'src.styles://'
|
58
|
+
target: 'dist.styles://'
|
59
|
+
selector: '**/*.css'
|
60
|
+
|
61
|
+
...can be transformed to:
|
62
|
+
|
63
|
+
- copy:
|
64
|
+
enabled: true
|
65
|
+
selector: '**/*'
|
66
|
+
repetitive:
|
67
|
+
-
|
68
|
+
source: 'src.images://'
|
69
|
+
target: 'dist.images://'
|
70
|
+
-
|
71
|
+
source: 'src.styles://'
|
72
|
+
target: 'dist.styles://'
|
73
|
+
selector: '**/*.css'
|
74
|
+
|
75
|
+
|
76
|
+
Note that the repetitive config will be merged with the configuration from root node (see `selector`).
|
77
|
+
|
78
|
+
# Resources
|
79
|
+
|
80
|
+
> "[Getting started](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/GETSTARTED.md)"
|
81
|
+
|
82
|
+
> "[Generators](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/GENERATORS.md)"
|
83
|
+
|
84
|
+
>"[Contributing](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/CONTRIBUTING.md)"
|