html_mockup 0.6.2 → 0.6.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.
@@ -0,0 +1,2 @@
1
+ # Ignore apple specific files
2
+ .DS_Store
File without changes
@@ -5,9 +5,16 @@ module HtmlMockup
5
5
 
6
6
  attr_reader :project, :target_path
7
7
 
8
- def initialize(project, target_path)
8
+ def initialize(project, target_path, options={})
9
9
  @project = project
10
10
  @target_path = Pathname.new(target_path)
11
+
12
+ @options = {
13
+ :url_attributes => %w{src href action}
14
+ }
15
+
16
+ @options.update(options) if options
17
+
11
18
  end
12
19
 
13
20
  def run!
@@ -30,7 +37,7 @@ module HtmlMockup
30
37
  cur_dir = Pathname.new(file_name).dirname
31
38
  up_to_root = File.join([".."] * (file_name.split("/").size - 1))
32
39
  doc = Hpricot(source)
33
- %w{src href action}.each do |attribute|
40
+ @options[:url_attributes].each do |attribute|
34
41
  (doc/"*[@#{attribute}]").each do |tag|
35
42
  converted_url = convert_relative_url_to_absolute_url(tag[attribute], cur_dir, up_to_root)
36
43
 
@@ -3,6 +3,7 @@ module HtmlMockup
3
3
  def initialize(pattern)
4
4
  @pattern = pattern
5
5
  end
6
+
6
7
  def call(release, options = {})
7
8
  # We switch to the build path and append the globbed files for safety, so even if you manage to sneak in a
8
9
  # pattern like "/**/*" it won't do you any good as it will be reappended to the path
@@ -5,16 +5,16 @@ require 'fileutils'
5
5
  # The directory name will have the format PREFIX-VERSION
6
6
  #
7
7
  module HtmlMockup::Release::Finalizers
8
- class Dir < Base
9
- def initialize(options = {})
10
- @options = options
11
- end
12
-
8
+ class Dir < Base
13
9
  # @option options :prefix Prefix to put before the version (default = "html")
14
10
  def call(release, options = {})
15
- @options.update(options)
11
+ if options
12
+ options = @options.dup.update(options)
13
+ else
14
+ options = @options
15
+ end
16
16
 
17
- name = [(@options[:prefix] || "html"), release.scm.version].join("-")
17
+ name = [(options[:prefix] || "html"), release.scm.version].join("-")
18
18
  release.log(self, "Finalizing release to #{release.target_path + name}")
19
19
 
20
20
  if File.exist?(release.target_path + name)
@@ -1,5 +1,11 @@
1
1
  module HtmlMockup::Release::Finalizers
2
2
  class Base
3
+
4
+ def initialize(options = {})
5
+ @options = {}
6
+ @options.update(options) if options
7
+ end
8
+
3
9
  def call(release, options = {})
4
10
  raise ArgumentError, "Implement in subclass"
5
11
  end
@@ -17,12 +17,10 @@ module HtmlMockup::Release::Processors
17
17
  def call(release, options={})
18
18
  @options.update(options)
19
19
 
20
- puts @options.inspect
21
-
22
20
  begin
23
21
  `#{@options[:node]} -v`
24
22
  rescue Errno::ENOENT
25
- raise RuntimeError, "Could not find node in #{node.inspect}"
23
+ raise RuntimeError, "Could not find node in #{@options[:node].inspect}"
26
24
  end
27
25
 
28
26
  rjs_command = rjs_check()
@@ -1,5 +1,12 @@
1
1
  module HtmlMockup::Release::Processors
2
- class Base
2
+ class Base
3
+
4
+ def initialize(options = {})
5
+ @options = {}
6
+ @options.update(options) if options
7
+ end
8
+
9
+
3
10
  def call(release, options = {})
4
11
  raise ArgumentError, "Implement in subclass"
5
12
  end
@@ -135,7 +135,7 @@ module HtmlMockup
135
135
  # @examples
136
136
  # release.finalize :zip
137
137
  def finalize(finalizer, options = {})
138
- @finalize << [self.class.get_callable(finalizer, HtmlMockup::Release::Finalizers), options]
138
+ @finalizers << [self.class.get_callable(finalizer, HtmlMockup::Release::Finalizers), options]
139
139
  end
140
140
 
141
141
  # Files to clean up in the build directory just before finalization happens
@@ -187,13 +187,23 @@ module HtmlMockup
187
187
  end
188
188
  end
189
189
 
190
+ # Extract the mockup, this will happen anyway, and will always happen first
191
+ # This method gives you a way to pass options to the extractor.
192
+ #
193
+ # @param Hash options Options hash passed to extractor
194
+ #
195
+ # @see HtmlMockup::Extractor for more information
196
+ def extract(options = {})
197
+ @extractor_options = options
198
+ end
199
+
190
200
  # Actually perform the release
191
201
  def run!
192
202
  # Validate paths
193
203
  validate_paths!
194
204
 
195
205
  # Extract valid mockup
196
- extract!
206
+ run_extractor!
197
207
 
198
208
  # Run stack
199
209
  run_stack!
@@ -235,8 +245,8 @@ module HtmlMockup
235
245
  raise ArgumentError, "Target path \"#{self.target_path}\" does not exist" if !self.target_path.exist?
236
246
  end
237
247
 
238
- def extract!
239
- extractor = Extractor.new(self.project, self.build_path)
248
+ def run_extractor!
249
+ extractor = Extractor.new(self.project, self.build_path, @extractor_options)
240
250
  extractor.run!
241
251
  end
242
252
 
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.6.2
4
+ version: 0.6.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-11-21 00:00:00.000000000 Z
13
+ date: 2012-11-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: thor
17
- requirement: &70236893702460 !ruby/object:Gem::Requirement
17
+ requirement: &70100536874920 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 0.16.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70236893702460
25
+ version_requirements: *70100536874920
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rack
28
- requirement: &70236893701860 !ruby/object:Gem::Requirement
28
+ requirement: &70100536873660 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 1.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70236893701860
36
+ version_requirements: *70100536873660
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: tilt
39
- requirement: &70236893701080 !ruby/object:Gem::Requirement
39
+ requirement: &70100536872460 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70236893701080
47
+ version_requirements: *70100536872460
48
48
  description:
49
49
  email: flurin@digitpaint.nl
50
50
  executables:
@@ -54,9 +54,12 @@ extra_rdoc_files:
54
54
  - README.rdoc
55
55
  files:
56
56
  - bin/mockup
57
+ - examples/default_template/.gitignore
57
58
  - examples/default_template/CHANGELOG
58
59
  - examples/default_template/Gemfile
59
60
  - examples/default_template/Mockupfile
61
+ - examples/default_template/html/.empty_directory
62
+ - examples/default_template/partials/.empty_directory
60
63
  - lib/html_mockup/cli.rb
61
64
  - lib/html_mockup/extractor.rb
62
65
  - lib/html_mockup/generators.rb
@@ -83,7 +86,8 @@ files:
83
86
  - lib/html_mockup/w3c_validator.rb
84
87
  - README.rdoc
85
88
  homepage: http://github.com/digitpaint/html_mockup
86
- licenses: []
89
+ licenses:
90
+ - MIT
87
91
  post_install_message:
88
92
  rdoc_options:
89
93
  - --charset=UTF-8