jake 1.0.0 → 1.0.1

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.
@@ -12,7 +12,7 @@ rescue LoadError
12
12
  end
13
13
 
14
14
  module Jake
15
- VERSION = '1.0.0'
15
+ VERSION = '1.0.1'
16
16
 
17
17
  CONFIG_FILE = 'jake.yml'
18
18
  HELPER_FILE = 'Jakefile'
@@ -30,6 +30,13 @@ module Jake
30
30
  Build.delete_observers
31
31
  end
32
32
 
33
+ # Returns a path made by joining the given pieces and removing unnecessary
34
+ # /. sections using expand_path.
35
+ def self.path(*parts)
36
+ parts = parts.compact.map { |p| p.to_s }
37
+ File.expand_path(File.join(*parts))
38
+ end
39
+
33
40
  # Returns the contents of the given path, which may be missing a .js extension.
34
41
  def self.read(path)
35
42
  path = File.expand_path(path)
@@ -18,12 +18,12 @@ module Jake
18
18
  @helper = Helper.new(options)
19
19
  force! if options[:force]
20
20
 
21
- path = "#{dir}/#{CONFIG_FILE}"
21
+ path = Jake.path(dir, CONFIG_FILE)
22
22
  yaml = File.read(path)
23
23
 
24
24
  @config = Jake.symbolize_hash( YAML.load(Jake.erb(yaml).result(@helper.scope)) )
25
25
 
26
- helpers = "#{dir}/#{HELPER_FILE}"
26
+ helpers = Jake.path(dir, HELPER_FILE)
27
27
  load helpers if File.file?(helpers)
28
28
 
29
29
  @builds = @config[:builds] || {:src => false, :min => @config[:packer]}
@@ -78,13 +78,13 @@ module Jake
78
78
 
79
79
  # Returns the path to the build directory, where generated files appear.
80
80
  def build_directory
81
- "#{ @dir }/#{ @config[:build_directory] || '.' }"
81
+ Jake.path(@dir, @config[:build_directory] || '.')
82
82
  end
83
83
  alias :build_dir :build_directory
84
84
 
85
85
  # Returns the path to the source directory, where source code is read from.
86
86
  def source_directory
87
- "#{ @dir }/#{ @config[:source_directory] || '.' }"
87
+ Jake.path(@dir, @config[:source_directory] || '.')
88
88
  end
89
89
  alias :source_dir :source_directory
90
90
 
@@ -92,7 +92,7 @@ module Jake
92
92
  # header file has been set.
93
93
  def header
94
94
  @config[:header] ?
95
- Jake.read("#{ source_directory }/#{ @config[:header] }") :
95
+ Jake.read(Jake.path(source_directory, @config[:header])) :
96
96
  ""
97
97
  end
98
98
 
@@ -31,15 +31,15 @@ module Jake
31
31
  def directory
32
32
  dir = @config[:directory]
33
33
  return parent.directory if parent && !dir
34
- "#{ @build.source_directory }/#{ @config[:directory] }"
34
+ Jake.path(@build.source_directory, @config[:directory])
35
35
  end
36
36
 
37
37
  # Returns the path to the output file from this package for the given build name.
38
38
  def build_path(build_name)
39
39
  suffix = @build.use_suffix?(build_name) ? "-#{ build_name }" : ""
40
40
  @build.layout == 'together' ?
41
- "#{ @build.build_directory }/#{ @name }#{ suffix }.js" :
42
- "#{ @build.build_directory }/#{ build_name }/#{ @name }.js"
41
+ Jake.path(@build.build_directory, "#{ @name }#{ suffix }.js") :
42
+ Jake.path(@build.build_directory, build_name, "#{ @name }.js")
43
43
  end
44
44
 
45
45
  # Returns +true+ if the build file for the given build name is out of date and
@@ -55,7 +55,7 @@ module Jake
55
55
  # Returns the header string being used for this package.
56
56
  def header
57
57
  content = @config[:header] ?
58
- Jake.read("#{ directory }/#{ @config[:header] }") :
58
+ Jake.read(Jake.path( directory, @config[:header])) :
59
59
  (parent ? parent.header : @build.header)
60
60
  Jake.erb(content).result(@build.helper.scope).strip
61
61
  end
@@ -5,7 +5,7 @@ module Jake
5
5
  def files
6
6
  base = parent ? parent.files : []
7
7
  base + @config[:files].map do |path|
8
- path = "#{ directory }/#{ path }"
8
+ path = Jake.path( directory, path)
9
9
  File.file?(path) ? path : "#{ path }.js"
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jake
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Coglan
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-06 00:00:00 +01:00
12
+ date: 2009-09-21 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: 2.0.0
53
+ version: 2.3.3
54
54
  version:
55
55
  description: ""
56
56
  email: