easy_html_generator 1.0.5 → 1.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: 09e261a245dc181a7eccc30b1996735cef82ac01
4
- data.tar.gz: 9b16640da263e0de0e464b282fe8caa1a53cb386
3
+ metadata.gz: d07a17b32647e6e36affe56f1f8955efa48da46e
4
+ data.tar.gz: bb3959c6583bf927747c456756772bb0f9d494ca
5
5
  SHA512:
6
- metadata.gz: 5bb7994ee0aab9b4892f4ef48564d1fc2f861b16de6aced27466a43a5e3f3e16372043ae55afb2a94c8e2db57fa37b920dc48155a8b9b72412e65c09b1311cf4
7
- data.tar.gz: c3699481eaf0aab10f8b55174e7c922b7e4add82d337c0d4a2cdb582a4b1dffe5abe5dab51f06bdffbc8f8d637d6e12a0d156445ef5ba3a8a1661251bd460aee
6
+ metadata.gz: 779d74ab4c0732c436054a4fbadf1a324a2713ddfd8559cc39ac28b9653aa19c90f65ee56d49b46dad2a0fafa5cbc1e9fe91f7191e0a5aed9318a824f5f258f3
7
+ data.tar.gz: 3f2b4abc6cace1733293676b04ac720c370149a5d38db9f339d989854eed5b93031cee9419dec2dc611a0b7f24a9a162901dd79f6371ea72a92110567fe16596
data/README.md CHANGED
@@ -13,11 +13,11 @@ This gem is a powerful and easy to use web development tool that helps developin
13
13
  * [HeadJS](http://headjs.com/) for performance optimized resource loading
14
14
  * [Bower](http://bower.io/) for javascript dependency management
15
15
  * [Grunt](http://gruntjs.com/) for javascript based task management
16
- * [Google Anlaytics](https://www.google.com/analytics/) tracking of pageclicks
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
16
+ * analytics code injections for **visitor tracking**
17
+ * **minimizing** of coffee-, javascript-, sass-, css-, html-, haml-, png- and jpg files
18
+ * per **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
21
21
 
22
22
  ## Resources
23
23
 
@@ -32,6 +32,16 @@ This gem is a powerful and easy to use web development tool that helps developin
32
32
 
33
33
  ## Changes
34
34
 
35
+ #### Version 1.0.6
36
+ * locals for partials
37
+ * asset versions for images, scripts and styles
38
+ * content_for haml implementation
39
+ * rake task clean added, cleans dist path `ehg --clean`
40
+ * rake task generate cleans now dist path
41
+ * minimize generators now adding prefix to file extension only
42
+ * fix default layout fallback
43
+ * add description for haml templating (docs/HAMLTEMPLATING.md)
44
+
35
45
  #### Version 1.0.5
36
46
  * refactor Generator::* and clean up code
37
47
  * implement Generator::Service::Sitemap
data/Rakefile CHANGED
@@ -6,11 +6,13 @@ require 'rspec/core/rake_task'
6
6
 
7
7
  desc 'generate one or all project ditributions'
8
8
  task :generate do |project|
9
- if project
10
- EasyHtmlGenerator.generate_project project
11
- else
12
- EasyHtmlGenerator.generate_all
13
- end
9
+ EasyHtmlGenerator::Workspace.clean_dist_folder project
10
+ EasyHtmlGenerator::Workspace.generate project
11
+ end
12
+
13
+ desc 'remove all files inside of the dist folder'
14
+ task :clean do |project|
15
+ EasyHtmlGenerator::Workspace.clean_dist_folder project
14
16
  end
15
17
 
16
18
  desc 'Starts the rack server, see config.ru'
data/bin/ehg CHANGED
@@ -20,14 +20,13 @@ class EhgOptparse
20
20
  EasyHtmlGenerator.start_server(host, port)
21
21
  end
22
22
 
23
- opts.on('-g', '--generate [PROJECT]', 'all', 'generate one or all projects') do |project|
24
- project ||= 'all'
25
-
26
- if project == 'all'
27
- EasyHtmlGenerator.generate_all
28
- else
29
- EasyHtmlGenerator.generate_project project
30
- end
23
+ opts.on('-g', '--generate [PROJECT]', '', 'generate one or all projects') do |project|
24
+ EasyHtmlGenerator::Workspace.clean_dist_folder project
25
+ EasyHtmlGenerator::Workspace.generate project
26
+ end
27
+
28
+ opts.on('--clean [PROJECT]', '', 'clean one or all projects dist folder') do |project|
29
+ EasyHtmlGenerator::Workspace.clean_dist_folder project
31
30
  end
32
31
 
33
32
  opts.on('-i', '--init', 'initialise ehg workspace') do
@@ -81,4 +81,6 @@ Note that the repetitive config will be merged with the configuration from root
81
81
 
82
82
  > "[Generators](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/GENERATORS.md)"
83
83
 
84
- >"[Contributing](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/CONTRIBUTING.md)"
84
+ > "[Haml-Templating](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/HAMLTEMPLATING.md)"
85
+
86
+ >"[Contributing](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/CONTRIBUTING.md)"
@@ -207,4 +207,6 @@
207
207
 
208
208
  > "[Configuration](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/CONFIGURATION.md)"
209
209
 
210
- >"[Contributing](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/CONTRIBUTING.md)"
210
+ > "[Haml-Templating](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/HAMLTEMPLATING.md)"
211
+
212
+ >"[Contributing](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/CONTRIBUTING.md)"
@@ -89,4 +89,6 @@ After a short time of generating you should see a directory listening in your br
89
89
 
90
90
  > "[Generators](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/GENERATORS.md)"
91
91
 
92
+ > "[Haml-Templating](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/HAMLTEMPLATING.md)"
93
+
92
94
  >"[Contributing](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/CONTRIBUTING.md)"
@@ -0,0 +1,111 @@
1
+ # Haml-Templating
2
+ Before the haml generator runs, all assets should be copied to dist folder, because the path_to_* methods are searching there for assets.
3
+
4
+
5
+ ### layouts
6
+ All `*.html.haml` files will be compiled from the haml generator. A `*.html.haml` file alway has a layout, the default layout can be configured in the `project.yml` and is mostly `layout.haml`. To set a specific layout add `-# ehg layout: layout/layout.webdesign` in the first line of your `*.html.haml` file.
7
+
8
+ ### content_for
9
+ Use it like described in the (actionview docs)[http://apidock.com/rails/ActionView/Helpers/CaptureHelper/content_for]
10
+ ```ruby
11
+ - content_for(:body)
12
+ This is the body content
13
+
14
+ - #and later in your haml-files:
15
+
16
+ = content_for(:body)
17
+ ```
18
+
19
+
20
+ If you want to use `content_for` you have to remember that there is no output buffer used by ehg for performance reasons. If you want to access `content_for` blocks in your layout.haml you have todo something like this:
21
+ ```ruby
22
+ - body = yield
23
+ !!!
24
+ %html{lang: content_for(:language)}
25
+ %head
26
+ = content_for :javascripts
27
+ = content_for :stylesheets
28
+
29
+ %body{class: [body_class, 'loading']}
30
+ = body
31
+ ```
32
+
33
+
34
+ ### partials
35
+ Partials are reusable haml files. Per naming convention they start with a underline. The file `src/views/partials/_stylesheets.haml` can be rendered like:
36
+ ```ruby
37
+ = render_partial 'partials/_stylesheets.haml'
38
+ ```
39
+
40
+ You can also pass parameters to partials:
41
+ ```ruby
42
+ = render_partial 'partials/_stylesheets.haml', {my_variable: 'my content'}
43
+ ```
44
+
45
+ Inside `src/views/partials/_stylesheets.haml` you can access the parameter:
46
+ ```ruby
47
+ = my_variable
48
+ ```
49
+
50
+
51
+ ### inline coffee and sass
52
+ We have made the usage of coffee and sass available to all project parts. Use inline coffee and sass as follow:
53
+ ```ruby
54
+ = with_coffee do
55
+ :plain
56
+ window.head_conf =
57
+ screens: [
58
+ 300
59
+ 480
60
+ 650
61
+ 768
62
+ 992
63
+ 1200
64
+ ]
65
+ ```
66
+
67
+ For inline sass do:
68
+ ```ruby
69
+ = with_sass do
70
+ :plain
71
+ body
72
+ color: green
73
+ ```
74
+
75
+ You can also inline javascript and css files from the dist folder:
76
+ ```ruby
77
+ = inline_javascript_include_tag 'lib/headjs/dist/1.0.0/head.min.js'
78
+
79
+ /[if lt IE 9]
80
+ = javascript_include_tag 'https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js'
81
+ = javascript_include_tag 'https://oss.maxcdn.com/respond/1.4.2/respond.min.js'
82
+
83
+ = inline_stylesheet_link_tag 'lib/bootstrap/dist/css/bootstrap.min.css'
84
+ = inline_stylesheet_link_tag 'webdesign.css'
85
+ ```
86
+
87
+ ### ActionView::Helper
88
+ You can use nearly all helpers included in (ActionView::Helpers)[http://api.rubyonrails.org/classes/ActionView/Helpers.html]. Note that the path will be resolved to the dist folder, take care that all generators that produce assets run befor the haml generator. If EHG can not resolve a path in the dist folder, it leaves the path as is. So you can use external paths.
89
+ ```ruby
90
+ %span
91
+ = image_tag('my_image.png', alt: 'my image', class: 'my-image')
92
+
93
+ = meta_tag_http 'Content-Type', 'text/html; charset=utf-8'
94
+ = meta_tag 'description', (content_for(:description) || '')
95
+ = link_tag 'favicon.ico', 'icon', 'image/x-icon'
96
+
97
+ - content_for :footer_menu_links do
98
+ %ul
99
+ %li.link
100
+ = link_to 'my page', 'my_page.html'
101
+ ```
102
+
103
+ # Resources
104
+
105
+ > "[Getting started](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/GETSTARTED.md)"
106
+
107
+ > "[Configuration](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/CONFIGURATION.md)"
108
+
109
+ > "[Generators](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/GENERATORS.md)"
110
+
111
+ >"[Contributing](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/CONTRIBUTING.md)"
@@ -10,9 +10,9 @@ Gem::Specification.new do |spec|
10
10
  spec.licenses = 'MIT'
11
11
  spec.authors = ["Tom Hanoldt", "Alex Illmayer"]
12
12
 
13
- spec.summary = "This gem is a powerful and easy to use web development tool that helps developing modern web sites by generating static html pagespec."
14
- spec.description = "This gem is a powerful and easy to use web development tool that helps developing modern web sites by generating static html pagespec.
15
- It uses CoffeScript, Sass, Haml, Bootstrap, HeadJs, Bower, Grunt, Google Anlaytics and minimizes coffee-, javascript-, sass-, css-, png- and image-filespec."
13
+ spec.summary = "This gem is a powerful and easy to use web development tool that helps developing modern web sites by generating static html pages."
14
+ spec.description = "This gem is a powerful and easy to use web development tool that helps developing modern web sites by generating static html pages.
15
+ It uses CoffeScript, Sass, Haml, Bootstrap, HeadJs, Bower, Grunt, Google Anlaytics and minimizes coffee-, javascript-, sass-, css-, png- and image-files."
16
16
 
17
17
  spec.email = ['monotom@gmail.com']
18
18
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
@@ -42,10 +42,6 @@ module EasyHtmlGenerator
42
42
  Dir[File.dirname(__FILE__) + '/easy_html_generator/*.rb']
43
43
  .each { |file| require file }
44
44
 
45
- def self.projects
46
- Workspace.projects
47
- end
48
-
49
45
  def self.dispatch(request)
50
46
  path = request.env['REQUEST_PATH'] || request.env['PATH_INFO']
51
47
  cleaned_path = clean_path path
@@ -73,14 +69,6 @@ module EasyHtmlGenerator
73
69
  path
74
70
  end
75
71
 
76
- def self.generate_all
77
- Workspace.projects.each { |_name, project| project.generate }
78
- end
79
-
80
- def self.generate_project(project)
81
- Workspace.projects[project].generate
82
- end
83
-
84
72
  def self.rack_app
85
73
  Rack::Builder.new do
86
74
  use Rack::ShowExceptions
@@ -10,9 +10,17 @@ class EasyHtmlGenerator::Checksum
10
10
  end
11
11
 
12
12
  def self.file_checksum(file)
13
+ return array_checksum(file) if file.is_a? Array
14
+ return array_checksum(Dir["#{folder}/**/*"]) if File.directory? file
13
15
  checksum(File.read(file))
14
16
  end
15
17
 
18
+ def self.array_checksum(files)
19
+ tmp = ''
20
+ files.each { |file| tmp += File.read(file) if File.file? file }
21
+ checksum(tmp)
22
+ end
23
+
16
24
  def self.file_changed?(file, context = '')
17
25
  key = build_key(file, context)
18
26
 
@@ -21,6 +29,14 @@ class EasyHtmlGenerator::Checksum
21
29
  @file_checksums[key] != file_checksum(file)
22
30
  end
23
31
 
32
+ def self.folder_changed?(folder, context = '')
33
+ key = build_key(folder, context)
34
+
35
+ return true unless @file_checksums.key? key
36
+
37
+ @file_checksums[key] != folder_checksum(folder)
38
+ end
39
+
24
40
  def self.store_file(file, context = '')
25
41
  key = build_key(file, context)
26
42
 
@@ -8,7 +8,6 @@ class EasyHtmlGenerator::Generator::Compile::Base <
8
8
  def generate!(config)
9
9
  walk_files(config) do |input_file, output_file|
10
10
  next unless file_changed? input_file
11
-
12
11
  do_file(input_file, output_file, config)
13
12
  end
14
13
  end
@@ -23,6 +22,10 @@ class EasyHtmlGenerator::Generator::Compile::Base <
23
22
  end
24
23
  end
25
24
 
25
+ def watch_files(config)
26
+ Dir["#{config.source}/**/*"]
27
+ end
28
+
26
29
  def input_to_output_file(input_file, config)
27
30
  input_file.sub(config.source, config.target)
28
31
  end
@@ -15,7 +15,7 @@ class EasyHtmlGenerator::Generator::Compile::Haml <
15
15
  scope = file_name.split('.').first
16
16
  context = Context.new(@project, @config, scope)
17
17
  layout = Layout.layout_from_file(@project.src_path_to(:views),
18
- input_file, @config.renderer)
18
+ input_file, @config)
19
19
 
20
20
  do_input(input, layout, context, scope)
21
21
 
@@ -2,16 +2,14 @@
2
2
  require 'action_view'
3
3
 
4
4
  helper_path = 'easy_html_generator/generator/compile/haml/helper'
5
- require "#{helper_path}/activesupport_override.rb"
5
+ require "#{helper_path}/activesupport.rb"
6
6
  require "#{helper_path}/asset_helper.rb"
7
7
 
8
8
  # this class represents the render context for a haml file
9
9
  class EasyHtmlGenerator::Generator::Compile::Haml::Context
10
10
  # Any properties of this object are available in the Haml templates.
11
11
  attr_reader :project
12
-
13
- include ActionView::Helpers
14
- include ActivesupportOverride
12
+ include Activesupport
15
13
  include AssetHelper
16
14
 
17
15
  def initialize(project, config, scope)
@@ -20,6 +18,8 @@ class EasyHtmlGenerator::Generator::Compile::Haml::Context
20
18
  @scope = scope
21
19
  @input_folder = @project.src_path_to :views
22
20
 
21
+ _prepare_context # ActionView::Context
22
+
23
23
  load_helper EasyHtmlGenerator::SHARED_HELPER_PATH
24
24
  load_helper @project.src_path_to :helper
25
25
  end
@@ -34,16 +34,16 @@ class EasyHtmlGenerator::Generator::Compile::Haml::Context
34
34
  end
35
35
  end
36
36
 
37
- def render_partial(file_name)
37
+ def render_partial(file_name, locals={})
38
38
  file_to_render = "#{@input_folder}/#{file_name}.haml"
39
39
  if @scope
40
40
  # Look for a partial prefixed with the current "scope"
41
41
  # (which is just the name of the primary template being rendered).
42
- scope_file = "#{@input_folder}/#{@scope}_#{file_name}.haml"
42
+ scope_file = "#{@input_folder}/#{@scope}.#{file_name}.haml"
43
43
  # Use it if it's there.
44
44
  file_to_render = scope_file if File.exist? scope_file
45
45
  end
46
- Haml::Engine.new(File.read(file_to_render), @config).render self
46
+ Haml::Engine.new(File.read(file_to_render), @config).render(self, locals)
47
47
  rescue StandardError => e
48
48
  raise e, "#{e.message} in #{file_name} ", e.backtrace
49
49
  end
@@ -0,0 +1,36 @@
1
+ # encoding: utf-8
2
+
3
+ # this module overrides some active support methods for working paths etc.
4
+ module Activesupport
5
+ include ActionView::Context
6
+ include ActionView::Helpers
7
+
8
+ def path_to_stylesheet(path, _options = {})
9
+ return path if external_path?(path)
10
+ append_asset_version @project.uri_path_to(:styles, path)
11
+ end
12
+
13
+ def path_to_javascript(path, path_options={})
14
+ return path if external_path? path
15
+ append_asset_version @project.uri_path_to(:scripts, path)
16
+ end
17
+
18
+ def path_to_image(path)
19
+ return path if external_path? path
20
+ append_asset_version @project.uri_path_to(:images, path)
21
+ end
22
+
23
+ def append_asset_version(input)
24
+ time = Time.now.to_i
25
+ input.include?('?') ? "#{input}&t=#{time}" : "#{input}?t=#{time}"
26
+ end
27
+
28
+ alias_method :orig_content_for, :content_for
29
+ def content_for(name, content = nil, options = {}, &block)
30
+ if block_given?
31
+ options = content if content
32
+ content = capture_haml(&block).html_safe
33
+ end
34
+ orig_content_for(name, content , options)
35
+ end
36
+ end
@@ -1,10 +1,19 @@
1
1
  # encoding: utf-8
2
- require 'coffee-script'
3
- require 'uglifier'
4
2
 
5
3
  # this module exposes additional features for haml files
6
4
  module AssetHelper
7
- include ActionView::Context
5
+ def meta_tag(type, content)
6
+ '<meta name="' + type + '" content="' + content + '" />'
7
+ end
8
+
9
+ def meta_tag_http(type, content)
10
+ '<meta http-equiv="' + type + '" content="' + content + '" />'
11
+ end
12
+
13
+ def link_tag(source, relation, type = '')
14
+ type = " type='#{type}'" if type
15
+ '<link rel="' + relation + '" href="' + source + '"' + type + '/>'
16
+ end
8
17
 
9
18
  def external_path?(path)
10
19
  path.start_with?('//') || path.start_with?('http')
@@ -38,7 +47,7 @@ module AssetHelper
38
47
 
39
48
  def headjs_javascript_include_tag(tag, path)
40
49
  content_tag :script do
41
- raw "head.load({'#{tag}': '#{path_to_js(path)}'});"
50
+ raw "head.load({'#{tag}': '#{path_to_javascript(path)}'});"
42
51
  end
43
52
  end
44
53
 
@@ -4,7 +4,7 @@
4
4
  class EasyHtmlGenerator::Generator::Compile::Haml::Layout
5
5
  @layouts = {}
6
6
 
7
- def self.layout_from_file(haml_folder, template, haml_config)
7
+ def self.layout_from_file(haml_folder, template, config)
8
8
  first_line = File.readlines(template).first
9
9
 
10
10
  if first_line.include? '-# ehg layout:'
@@ -14,9 +14,9 @@ class EasyHtmlGenerator::Generator::Compile::Haml::Layout
14
14
  end
15
15
 
16
16
  path = "#{haml_folder}#{name}.haml"
17
- path = "#{haml_folder}layout.haml" unless File.exist? path
17
+ path = "#{haml_folder}#{config.default_layout}.haml" unless File.exist? path
18
18
 
19
- load_from_file(path, haml_config) if should_load_from_file path
19
+ load_from_file(path, config.renderer) if should_load_from_file path
20
20
 
21
21
  @layouts[path]
22
22
  end
@@ -27,7 +27,7 @@ class EasyHtmlGenerator::Generator::Compile::Haml::Layout
27
27
  end
28
28
 
29
29
  def self.load_from_file(layout_file, haml_config)
30
- fail "layout not found '#{path}'" unless File.exist? layout_file
30
+ fail "layout not found '#{layout_file}'" unless File.exist? layout_file
31
31
  @layouts[layout_file] = Haml::Engine.new(File.read(layout_file),
32
32
  haml_config)
33
33
  EasyHtmlGenerator::Checksum.store_file(layout_file)
@@ -12,7 +12,7 @@ class EasyHtmlGenerator::Generator::Minimize::Css <
12
12
  end
13
13
 
14
14
  def input_to_output_file(input_file, config)
15
- super(input_file, config).gsub('.css', "#{config.prefix_extension}.css")
15
+ super(input_file, config).gsub(/\.css$/, "#{config.prefix_extension}.css")
16
16
  end
17
17
 
18
18
  def self.compress(input)
@@ -12,7 +12,7 @@ class EasyHtmlGenerator::Generator::Minimize::Html <
12
12
  end
13
13
 
14
14
  def input_to_output_file(input_file, config)
15
- super(input_file, config).gsub('.html', "#{config.prefix_extension}.html")
15
+ super(input_file, config).gsub(/\.html$/, "#{config.prefix_extension}.html")
16
16
  end
17
17
 
18
18
  def self.compressor
@@ -12,7 +12,7 @@ class EasyHtmlGenerator::Generator::Minimize::Js <
12
12
  end
13
13
 
14
14
  def input_to_output_file(input_file, config)
15
- super(input_file, config).gsub('.js', "#{config.prefix_extension}.js")
15
+ super(input_file, config).gsub(/\.js$/, "#{config.prefix_extension}.js")
16
16
  end
17
17
 
18
18
  def self.compress(input)
@@ -31,4 +31,8 @@ class EasyHtmlGenerator::Generator::Service::Analytics <
31
31
 
32
32
  "#{begin_marker(config)} #{content} #{end_marker(config)}"
33
33
  end
34
+
35
+ def watch_files(config)
36
+ Dir[File.join(config.source, config.selector)]
37
+ end
34
38
  end
@@ -22,6 +22,11 @@ class EasyHtmlGenerator::Project
22
22
  File.join(@dist_path, @config.paths.dist[type.to_sym], relative_path)
23
23
  end
24
24
 
25
+ def clean_dist_path
26
+ FileUtils.rm_rf Dir["#{@dist_path}/**/*"]
27
+ EasyHtmlGenerator::Checksum.invalidate_all
28
+ end
29
+
25
30
  def uri_path_to(type, relative_path = '')
26
31
  uri_path = File.join(@config.paths.dist[type.to_sym], relative_path)
27
32
  local_path = File.join(@dist_path, uri_path)
@@ -37,7 +37,7 @@ class EasyHtmlGenerator::RackDispatcher
37
37
 
38
38
  def create_directory_listening_index_file
39
39
  content = ''
40
- EasyHtmlGenerator.projects.each do |_name, project|
40
+ EasyHtmlGenerator::Workspace.projects.each do |_name, project|
41
41
  content += "<h3>#{project.name}</h3>"
42
42
  project.list_dir.each do |file|
43
43
  content += build_list_dir_row(file)
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module EasyHtmlGenerator
3
- VERSION = '1.0.5'
3
+ VERSION = '1.0.6'
4
4
  end
@@ -39,6 +39,29 @@ class EasyHtmlGenerator::Workspace
39
39
  end
40
40
  end
41
41
 
42
+ def self.clean_dist_folder(project=nil)
43
+ if project.nil?
44
+ paths = Dir["#{EasyHtmlGenerator::DIST_PATH}/*"]
45
+ else
46
+ project_instance = project_by_name project
47
+ raise LoadError "no such project to load -- #{project}"
48
+ paths = project_instance.dist_path
49
+ end
50
+ FileUtils.rm_rf paths
51
+ end
52
+
53
+ def self.generate(project=nil)
54
+ if project.nil?
55
+ projects_to_generate = projects
56
+ else
57
+ project_instance = project_by_name project
58
+ raise LoadError "no such project to load -- #{project}"
59
+ projects_to_generate = {project => project_instance}
60
+ end
61
+
62
+ projects_to_generate.each { |_name, project| project.generate }
63
+ end
64
+
42
65
  def self.project_instance_from_path(path)
43
66
  name = path.split('/').last.sub('/', '')
44
67
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_html_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Hanoldt
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-08-13 00:00:00.000000000 Z
12
+ date: 2015-09-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -320,8 +320,8 @@ dependencies:
320
320
  - !ruby/object:Gem::Version
321
321
  version: '0'
322
322
  description: |-
323
- This gem is a powerful and easy to use web development tool that helps developing modern web sites by generating static html pagespec.
324
- It uses CoffeScript, Sass, Haml, Bootstrap, HeadJs, Bower, Grunt, Google Anlaytics and minimizes coffee-, javascript-, sass-, css-, png- and image-filespec.
323
+ This gem is a powerful and easy to use web development tool that helps developing modern web sites by generating static html pages.
324
+ It uses CoffeScript, Sass, Haml, Bootstrap, HeadJs, Bower, Grunt, Google Anlaytics and minimizes coffee-, javascript-, sass-, css-, png- and image-files.
325
325
  email:
326
326
  - monotom@gmail.com
327
327
  executables:
@@ -343,6 +343,7 @@ files:
343
343
  - docs/CONTRIBUTING.md
344
344
  - docs/GENERATORS.md
345
345
  - docs/GETSTARTED.md
346
+ - docs/HAMLTEMPLATING.md
346
347
  - easy_html_generator.gemspec
347
348
  - lib/easy_html_generator.rb
348
349
  - lib/easy_html_generator/checksum.rb
@@ -354,7 +355,7 @@ files:
354
355
  - lib/easy_html_generator/generator/compile/coffee.rb
355
356
  - lib/easy_html_generator/generator/compile/haml.rb
356
357
  - lib/easy_html_generator/generator/compile/haml/context.rb
357
- - lib/easy_html_generator/generator/compile/haml/helper/activesupport_override.rb
358
+ - lib/easy_html_generator/generator/compile/haml/helper/activesupport.rb
358
359
  - lib/easy_html_generator/generator/compile/haml/helper/asset_helper.rb
359
360
  - lib/easy_html_generator/generator/compile/haml/layout.rb
360
361
  - lib/easy_html_generator/generator/compile/sass.rb
@@ -446,5 +447,5 @@ rubygems_version: 2.4.6
446
447
  signing_key:
447
448
  specification_version: 4
448
449
  summary: This gem is a powerful and easy to use web development tool that helps developing
449
- modern web sites by generating static html pagespec.
450
+ modern web sites by generating static html pages.
450
451
  test_files: []
@@ -1,36 +0,0 @@
1
- # encoding: utf-8
2
-
3
- # this module overrides some active support methods for working paths etc.
4
- module ActivesupportOverride
5
- def javascript_include_tag(path)
6
- '<script src="' + path_to_js(path) + '"></script>'
7
- end
8
-
9
- def meta_tag(type, content)
10
- '<meta name="' + type + '" content="' + content + '" />'
11
- end
12
-
13
- def meta_tag_http(type, content)
14
- '<meta http-equiv="' + type + '" content="' + content + '" />'
15
- end
16
-
17
- def link_tag(source, relation, type = '')
18
- type = " type='#{type}'" if type
19
- '<link rel="' + relation + '" href="' + source + '"' + type + '/>'
20
- end
21
-
22
- def path_to_stylesheet(path, _options = {})
23
- return path if external_path?(path)
24
- @project.uri_path_to(:styles, path)
25
- end
26
-
27
- def path_to_js(path)
28
- return path if external_path? path
29
- @project.uri_path_to(:scripts, path)
30
- end
31
-
32
- def path_to_image(path)
33
- return path if external_path? path
34
- @project.uri_path_to(:images, path)
35
- end
36
- end