Skip to content

Commit

Permalink
Merge branch 'release-3.6.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdefreyne committed Apr 24, 2013
2 parents fc36901 + 9c91dfb commit 7a4d5b0
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 15 deletions.
29 changes: 19 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ GEM
excon (0.20.1)
execjs (1.4.0)
multi_json (~> 1.0)
ffi (1.8.1)
fog (1.10.1)
builder
excon (~> 0.20)
Expand All @@ -43,53 +44,61 @@ GEM
therubyracer (~> 0.11.1)
json (1.7.7)
kramdown (1.0.1)
less (2.3.1)
less (2.3.2)
commonjs (~> 0.2.6)
libv8 (3.11.8.17)
listen (0.7.3)
listen (1.0.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
rb-kqueue (>= 0.2)
markaby (0.7.2)
builder (>= 2.0.0)
maruku (0.6.1)
syntax (>= 1.0.0)
metaclass (0.0.1)
method_source (0.8.1)
mime-types (1.22)
minitest (4.7.1)
mime-types (1.23)
minitest (4.7.3)
mocha (0.13.3)
metaclass (~> 0.0.1)
multi_json (1.7.2)
mustache (0.99.4)
net-scp (1.1.0)
net-ssh (>= 2.6.5)
net-ssh (2.6.6)
net-ssh (2.6.7)
nokogiri (1.5.9)
pandoc-ruby (0.6.1)
posix-spawn (0.3.6)
pry (0.9.12)
pry (0.9.12.1)
coderay (~> 1.0.5)
method_source (~> 0.8)
slop (~> 3.4)
pygments.rb (0.4.2)
pygments.rb (0.5.0)
posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.1.0)
rack (1.5.2)
rainpress (1.0)
rake (10.0.4)
rb-fsevent (0.9.3)
rb-inotify (0.9.0)
ffi (>= 0.5.0)
rb-kqueue (0.2.0)
ffi (>= 0.5.0)
rdiscount (2.0.7.2)
rdoc (4.0.1)
json (~> 1.4)
redcarpet (2.2.2)
ref (1.0.4)
ruby-hmac (0.4.0)
rubypants (0.2.0)
sass (3.2.7)
sass (3.2.8)
slim (1.3.8)
temple (~> 0.6.3)
tilt (~> 1.3.3)
slop (3.4.4)
syntax (1.0.0)
systemu (2.5.2)
temple (0.6.3)
temple (0.6.4)
therubyracer (0.11.4)
libv8 (~> 3.11.8.12)
ref
Expand All @@ -103,7 +112,7 @@ GEM
json
nokogiri
yajl-ruby (1.1.0)
yard (0.8.5.2)
yard (0.8.6.1)
yuicompressor (1.2.1)

PLATFORMS
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Fixes:
* Silenced "Could not find files for the given pattern(s)" message on Windows (#298)
* Fixed issue which could cause `output.diff` not to be generated correctly (#255, #301)
* Let filesystem and static data sources follow symlinks (#299, #302)
* Added compatibility with Listen 1.0 (#309)
* Let `#passthrough` in Rules work well with the static data source (#251)

## 3.6.2 (2013-03-23)

Expand Down
6 changes: 5 additions & 1 deletion lib/nanoc/base/compilation/compiler_dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,11 @@ def passthrough(identifier, params={})

# Create routing rule
routing_block = proc do
item[:extension].nil? ? item.identifier.chop : item.identifier.chop + '.' + item[:extension]
# This is a temporary solution until an item can map back to its data
# source.
# ATM item[:content_filename] is nil for items coming from the static
# data source.
item[:extension].nil? || (item[:content_filename].nil? && item.identifier =~ %r{#{item[:extension]}/$}) ? item.identifier.chop : item.identifier.chop + '.' + item[:extension]
end
routing_rule = Rule.new(identifier_to_regex(identifier), rep_name, routing_block, :snapshot_name => :last)
@rules_collection.add_item_routing_rule(routing_rule)
Expand Down
8 changes: 4 additions & 4 deletions lib/nanoc/cli/commands/watch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ def run
rebuilder.call(removed[0]) if removed[0]
end

listener = Listen::MultiListener.new(*dirs_to_watch).change(&callback)
listener_root = Listen::MultiListener.new('', :filter => files_to_watch, :ignore => ignore_dir).change(&callback)
listener = Listen::Listener.new(*dirs_to_watch).change(&callback)
listener_root = Listen::Listener.new('.', :filter => files_to_watch, :ignore => ignore_dir).change(&callback)

begin
listener_root.start(false)
listener.start
listener_root.start
listener.start!
rescue Interrupt
listener.stop
listener_root.stop
Expand Down
30 changes: 30 additions & 0 deletions test/base/test_compiler_dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,36 @@ def test_passthrough_no_ext
end
end

def test_passthrough_with_ext_from_static_data_source
with_site do
# Create config
File.open('nanoc.yaml', 'w') do |io|
io.write "data_sources:\n"
io.write " - type: static\n"
end

# Create rules
File.open('Rules', 'w') do |io|
io.write <<EOS
passthrough "/foo.txt/"
EOS
end

# Create items
FileUtils.mkdir_p('static')
File.open('static/foo.txt', 'w') do |io|
io.write "Hello I am foo"
end

# Compile
site = Nanoc::Site.new('.')
site.compile

# Check paths
assert_equal [ 'output/foo.txt' ], Dir['output/*']
end
end

def test_passthrough_priority
with_site do
# Create rules
Expand Down

0 comments on commit 7a4d5b0

Please sign in to comment.