bunch 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ foo
@@ -0,0 +1 @@
1
+ foo;
@@ -21,6 +21,7 @@ require 'bunch/directory_node'
21
21
  require 'bunch/file_node'
22
22
  require 'bunch/coffee_node'
23
23
  require 'bunch/sass_node'
24
+ require 'bunch/null_node'
24
25
 
25
26
  module Bunch
26
27
  class CompileError < StandardError
@@ -36,12 +37,24 @@ module Bunch
36
37
  end
37
38
 
38
39
  class << Bunch
40
+ IGNORED_PATTERNS = []
41
+
42
+ def load_ignores(path='.')
43
+ fn = File.join(path, '.bunchignore')
44
+ if File.exist?(fn)
45
+ IGNORED_PATTERNS.concat File.readlines(fn).map { |f| Regexp.new(f.chomp) }
46
+ IGNORED_PATTERNS.uniq!
47
+ end
48
+ end
49
+
39
50
  def content_for(path)
40
51
  tree_for(normalized_path(path)).content
41
52
  end
42
53
 
43
54
  def tree_for(path)
44
55
  case
56
+ when IGNORED_PATTERNS.any? { |p| File.basename(path) =~ p }
57
+ Bunch::NullNode.new(path)
45
58
  when File.directory?(path)
46
59
  Bunch::DirectoryNode.new(path)
47
60
  when path =~ /\.coffee$/
@@ -69,3 +82,5 @@ class << Bunch
69
82
  end
70
83
  end
71
84
  end
85
+
86
+ Bunch.load_ignores
@@ -21,6 +21,7 @@ module Bunch
21
21
  end
22
22
 
23
23
  def generate_files
24
+ Bunch.load_ignores(@input)
24
25
  tree = Bunch.tree_for(@input.to_s)
25
26
 
26
27
  if @output
@@ -0,0 +1,11 @@
1
+ module Bunch
2
+ class NullNode < FileNode
3
+ def content
4
+ ''
5
+ end
6
+
7
+ def target_extension
8
+ nil
9
+ end
10
+ end
11
+ end
@@ -9,6 +9,8 @@ module Bunch
9
9
  @headers['Pragma'] = 'no-cache'
10
10
  @headers['Expires'] = 'Thu, 01 Dec 1994 16:00:00 GMT'
11
11
  end
12
+
13
+ Bunch.load_ignores(@root)
12
14
  end
13
15
 
14
16
  def call(env)
@@ -1,3 +1,3 @@
1
1
  module Bunch
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: bunch
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.10
5
+ version: 0.0.11
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ryan Fitzgerald
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-01-24 00:00:00 Z
13
+ date: 2012-01-31 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: mime-types
@@ -89,8 +89,10 @@ files:
89
89
  - example/css/test1.css
90
90
  - example/css/test2/test2a.scss
91
91
  - example/css/test2/test2b.css
92
+ - example/js/.bunchignore
92
93
  - example/js/test1.js
93
94
  - example/js/test2/_.yml
95
+ - example/js/test2/foo.js
94
96
  - example/js/test2/test2a.js
95
97
  - example/js/test2/test2b.js
96
98
  - example/js/test2/test2c.js
@@ -110,6 +112,7 @@ files:
110
112
  - lib/bunch/directory_node.rb
111
113
  - lib/bunch/file_node.rb
112
114
  - lib/bunch/middleware.rb
115
+ - lib/bunch/null_node.rb
113
116
  - lib/bunch/rack.rb
114
117
  - lib/bunch/sass_node.rb
115
118
  - lib/bunch/version.rb