distil 0.11.0 → 0.11.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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.0
1
+ 0.11.1
data/distil.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{distil}
8
- s.version = "0.11.0"
8
+ s.version = "0.11.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jeff Watkins"]
12
- s.date = %q{2010-06-06}
12
+ s.date = %q{2010-06-08}
13
13
  s.default_executable = %q{distil}
14
14
  s.description = %q{A build tool for Javascript and CSS that takes advantage of best-of-breed helper applications Javascript Lint and JSDoc Toolkit}
15
15
  s.executables = ["distil"]
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
35
35
  "lib/distil/product/javascript-doc-product.rb",
36
36
  "lib/distil/product/javascript-product.rb",
37
37
  "lib/distil/product/minified.rb",
38
+ "lib/distil/product/page-product.rb",
38
39
  "lib/distil/project.rb",
39
40
  "lib/distil/project/distil-project.rb",
40
41
  "lib/distil/project/external-project.rb",
@@ -95,3 +95,4 @@ require 'distil/product/css-product'
95
95
  require 'distil/product/javascript-base-product'
96
96
  require 'distil/product/javascript-product'
97
97
  require 'distil/product/javascript-doc-product'
98
+ require 'distil/product/page-product'
@@ -0,0 +1,27 @@
1
+ module Distil
2
+
3
+ class PageProduct < Product
4
+ extension "html"
5
+
6
+ def filename
7
+ File.join(target.project.output_folder, "index.html")
8
+ end
9
+
10
+ def write_output
11
+ output_folder= target.project.output_folder
12
+ mode= target.project.mode
13
+
14
+ files.each { |f|
15
+ if (RELEASE_MODE==mode)
16
+ FileUtils.cp f, output_folder
17
+ else
18
+ product_path= File.join(output_folder, File.basename(f))
19
+ FileUtils.rm product_path if File.exists? product_path
20
+ File.symlink f.relative_to_folder(output_folder), product_path
21
+ end
22
+ }
23
+ end
24
+
25
+ end
26
+
27
+ end
@@ -13,19 +13,70 @@ module Distil
13
13
 
14
14
  def build
15
15
  end
16
+
17
+ def self.fetch_project_using_git(options = {})
18
+ uri= options["repository"]
19
+ path= options["path"]
20
+
21
+ FileUtils.mkdir_p(path)
22
+ Dir.chdir path do
23
+ init_cmd = "git init"
24
+ init_cmd+= " -q"
25
+ # init_cmd += " -q" if options[:quiet] and not $verbose
26
+ # puts init_cmd if $verbose
27
+ system(init_cmd)
28
+ base_cmd = "git pull --depth 1 #{uri}"
29
+ base_cmd+= " -q"
30
+ # base_cmd += " -q" if options[:quiet] and not $verbose
31
+ base_cmd += " #{options[:version]}" if options[:version]
32
+ # puts base_cmd if $verbose
33
+ if system(base_cmd)
34
+ # puts "removing: .git .gitignore" if $verbose
35
+ # FileUtils.rm_rf %w(.git .gitignore)
36
+ else
37
+ rm_rf path
38
+ end
39
+ end
40
+ end
16
41
 
17
42
  def self.from_config(config, parent=nil)
18
43
 
19
44
  if config.is_a?(String)
20
45
  string= config
46
+ uri= URI.parse(string)
47
+
21
48
  config= { "name" => File.basename(config, ".*") }
22
- full_path= File.expand_path(string)
49
+ if uri.scheme
50
+ config["repository"]= uri.to_s
51
+ else
52
+ config["path"]= uri.to_s
53
+ end
54
+
55
+ full_path= File.expand_path(config["path"])
56
+
23
57
  if File.exist?(full_path) && File.file?(full_path)
24
58
  config["path"]= File.dirname(full_path)
25
59
  else
26
60
  config["path"]= full_path
27
61
  end
28
62
  end
63
+
64
+ if !config["name"]
65
+ case when config["repository"]
66
+ uri= URI.parse(config["repository"])
67
+ config["name"]= File.basename(uri.path, ".*")
68
+ when config["path"]
69
+ config["name"]= File.basename(config["path"], ".*")
70
+ else
71
+ raise ValidationError.new("External project has neither name, path nor repository")
72
+ end
73
+ end
74
+
75
+ config["path"]||= "ext/#{config["name"]}"
76
+
77
+ if config["repository"] && !File.directory?(config["path"])
78
+ fetch_project_using_git(config)
79
+ end
29
80
 
30
81
  config["mode"]||= parent.mode if parent
31
82
 
@@ -46,12 +46,16 @@ module Distil
46
46
 
47
47
  def load_external_projects
48
48
  return if !external_projects
49
-
50
- self.external_projects= external_projects.map { |config|
49
+ projects= []
50
+
51
+ external_projects.each { |config|
51
52
  project= Project.from_config(config, self)
52
53
  next if !project
54
+ projects << project
53
55
  @projects_by_name[project.name]= project
54
56
  }
57
+
58
+ self.external_projects= projects
55
59
  end
56
60
 
57
61
  def external_project_with_name(name)
data/lib/distil/target.rb CHANGED
@@ -79,6 +79,12 @@ module Distil
79
79
  @products << product if !product.files.empty?
80
80
  }
81
81
 
82
+ if APP_TYPE==target_type
83
+ product= PageProduct.new(@extras.clone, self)
84
+ product.files= files
85
+ @products << product if !product.files.empty?
86
+ end
87
+
82
88
  @products
83
89
  end
84
90
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 11
8
- - 0
9
- version: 0.11.0
8
+ - 1
9
+ version: 0.11.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jeff Watkins
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-06 00:00:00 -07:00
17
+ date: 2010-06-08 00:00:00 -07:00
18
18
  default_executable: distil
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -60,6 +60,7 @@ files:
60
60
  - lib/distil/product/javascript-doc-product.rb
61
61
  - lib/distil/product/javascript-product.rb
62
62
  - lib/distil/product/minified.rb
63
+ - lib/distil/product/page-product.rb
63
64
  - lib/distil/project.rb
64
65
  - lib/distil/project/distil-project.rb
65
66
  - lib/distil/project/external-project.rb