jake 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
data/bin/jake CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/ruby
2
2
  require 'rubygems'
3
3
  require 'oyster'
4
- require 'jake'
4
+ require File.dirname(__FILE__) + '/../lib/jake'
5
5
 
6
6
  spec = Oyster.spec do
7
7
  name 'jake -- automated build tool for JavaScript projects'
@@ -27,5 +27,5 @@ begin; opts = spec.parse
27
27
  rescue Oyster::HelpRendered; exit
28
28
  end
29
29
 
30
- Jake.build(File.expand_path(opts[:unclaimed].first || '.'), opts[:force])
30
+ Jake.build(File.expand_path(opts[:unclaimed].first || '.'), opts)
31
31
 
@@ -1,12 +1,12 @@
1
1
  module Jake
2
- VERSION = '0.9.2'
2
+ VERSION = '0.9.3'
3
3
 
4
4
  CONFIG_FILE = 'jake.yml'
5
5
  HELPER_FILE = 'Jakefile'
6
6
 
7
- def self.build(path, force = false)
8
- build = Build.new(path)
9
- build.force! if force
7
+ def self.build(path, options = {})
8
+ build = Build.new(path, nil, options)
9
+ build.force! if options[:force]
10
10
  build.run!
11
11
  end
12
12
 
@@ -26,6 +26,12 @@ module Jake
26
26
 
27
27
  class Helper
28
28
  attr_accessor :build
29
+ attr_reader :options
30
+
31
+ def initialize(options = {})
32
+ @options = options
33
+ end
34
+
29
35
  def scope; binding; end
30
36
  end
31
37
  end
@@ -9,9 +9,9 @@ module Jake
9
9
  include Enumerable
10
10
  attr_reader :helper
11
11
 
12
- def initialize(dir, config = nil)
12
+ def initialize(dir, config = nil, options = {})
13
13
  @dir = File.expand_path(dir)
14
- @helper = Helper.new
14
+ @helper = Helper.new(options)
15
15
 
16
16
  path = "#{dir}/#{CONFIG_FILE}"
17
17
  yaml = File.read(path)
@@ -16,7 +16,14 @@ module Jake
16
16
  @code = {}
17
17
  end
18
18
 
19
+ def parent
20
+ return nil unless @config[:extends]
21
+ @parent ||= @build.package(@config[:extends])
22
+ end
23
+
19
24
  def directory
25
+ dir = @config[:directory]
26
+ return parent.directory if parent && !dir
20
27
  "#{ @build.source_directory }/#{ @config[:directory] }"
21
28
  end
22
29
 
@@ -38,13 +45,14 @@ module Jake
38
45
  def header
39
46
  content = @config[:header] ?
40
47
  Jake.read("#{ directory }/#{ @config[:header] }") :
41
- @build.header
48
+ (parent ? parent.header : @build.header)
42
49
  ERB.new(content).result(@build.helper.scope).strip
43
50
  end
44
51
 
45
52
  def packer_settings(build_name)
46
53
  global = @build.packer_settings(build_name)
47
54
  local = @config[:packer]
55
+ return parent.packer_settings(build_name) if parent && !local
48
56
  return false if global == false or local == false
49
57
  {}.merge(global || {}).merge(local || {})
50
58
  end
@@ -2,7 +2,8 @@ module Jake
2
2
  class Bundle < Buildable
3
3
 
4
4
  def files
5
- @config[:files].map { |pkg| @build.package(pkg).files }.flatten
5
+ base = parent ? parent.files : []
6
+ base + @config[:files].map { |pkg| @build.package(pkg).files }.flatten
6
7
  end
7
8
 
8
9
  def source
@@ -2,7 +2,8 @@ module Jake
2
2
  class Package < Buildable
3
3
 
4
4
  def files
5
- @config[:files].map do |path|
5
+ base = parent ? parent.files : []
6
+ base + @config[:files].map do |path|
6
7
  path = "#{ directory }/#{ path }"
7
8
  File.file?(path) ? path : "#{ path }.js"
8
9
  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: 0.9.2
4
+ version: 0.9.3
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: 2008-11-14 00:00:00 +00:00
12
+ date: 2009-05-10 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: 1.7.0
43
+ version: 1.12.1
44
44
  version:
45
45
  description: Jake is a tool for building JavaScript library packages from source code. It allows builds to be specified using simple YAML files, and provides a command-line tool for generating package files. It also allows ERB to be embedded in JavaScript source code so that build data or new code can be generated during the build process.
46
46
  email:
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  requirements: []
89
89
 
90
90
  rubyforge_project: jake
91
- rubygems_version: 1.2.0
91
+ rubygems_version: 1.3.1
92
92
  signing_key:
93
93
  specification_version: 2
94
94
  summary: Jake is a tool for building JavaScript library packages from source code