html_mockup 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,7 +33,7 @@ module HtmlMockup
33
33
  if File.exist?(@path) && !self.loaded?
34
34
  @source = File.read(@path)
35
35
  context = Context.new(self)
36
- eval @source, context.binding
36
+ eval @source, context.binding, @path.to_s, 1
37
37
  @loaded = true
38
38
  end
39
39
  end
@@ -10,9 +10,23 @@ module HtmlMockup
10
10
  Dir.glob(@pattern).each do |file|
11
11
  path = File.join(release.build_path.to_s, file)
12
12
  release.log(self, "Cleaning up \"#{path}\" in build")
13
- rm(path)
13
+ if inside_build_path release.build_path, path
14
+ rm_rf(path)
15
+ end
14
16
  end
15
17
  end
16
18
  end
19
+
20
+ protected
21
+
22
+ def inside_build_path(build_path, pattern)
23
+ build_path = Pathname.new(build_path).realpath.to_s
24
+ path = Pathname.new(File.join(build_path.to_s, pattern)).realpath.to_s
25
+ if path[build_path]
26
+ return true
27
+ else
28
+ raise RuntimeError, "Cleaning pattern is not inside build directory"
29
+ end
30
+ end
17
31
  end
18
32
  end
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.0
4
+ version: 0.6.1
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-13 00:00:00.000000000 Z
13
+ date: 2012-11-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: thor
17
- requirement: &70177258865640 !ruby/object:Gem::Requirement
17
+ requirement: &70093234338100 !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: *70177258865640
25
+ version_requirements: *70093234338100
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rack
28
- requirement: &70177258864880 !ruby/object:Gem::Requirement
28
+ requirement: &70093234337420 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,7 +33,18 @@ dependencies:
33
33
  version: 1.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70177258864880
36
+ version_requirements: *70093234337420
37
+ - !ruby/object:Gem::Dependency
38
+ name: tilt
39
+ requirement: &70093234336780 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ type: :runtime
46
+ prerelease: false
47
+ version_requirements: *70093234336780
37
48
  description:
38
49
  email: flurin@digitpaint.nl
39
50
  executables: