nanoc 3.6.3 → 3.6.4

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjM0ODgwYzY2M2ZkNGUwMDljMGIyNWU3NDRiMDkwNzViMjk1OTI3Zg==
4
+ NzhlOGM4MmEyNTNlMTNmZGU1Y2MzN2E1MzBjNzE2ZTdmNjgxYTQ2OA==
5
5
  data.tar.gz: !binary |-
6
- YTlhMTJiY2Q5MWQ5MThjOGY0M2YwNmVlNTgwMzU4Y2MzOGJjYjY5Ng==
6
+ ZmY2MDVlNjQyMGViOTdlZDg4NDA3YWUzN2E4YjcwODI3YjUwOTZhMg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NmM0MWE2NmMxNDgwOTJmYmY1YjQ1ZGYzMDY4ODRlMTBiMDFkZmM3ODM0ODVm
10
- NzM2YmI5MmVlNzQ0YTE1ODNjNTIyNWQ1M2RmNjBhZTdkMTMxOTBlNDlmZGVk
11
- YjEzZjA4NjI5Y2MyODIyNTYwY2ViMDNlOWFiYTJhYTBiZGVhZGI=
9
+ YzU3ZGNlMTcwOGExMTgzNGQzNmFhNzc2OTc2ZmU2NDJlMDFhZjc0YzMxNGQz
10
+ NTRiNzk3OWU4ZWIyNTRjMTU2MzRjZDg5YmFmNzQ3MGFkZWNlYmQ1NjYzNzM4
11
+ ZTY1MjhlN2EzZmQyMTFlOWNkZmFiNDNiNWVlNGU1ZWNiYjcwZTg=
12
12
  data.tar.gz: !binary |-
13
- Y2Q3ZjJkM2EzNTdmOWUxNjBmNGQ4NGZhODYwZjJjMjhhNzAzY2RiMzMzYjc2
14
- ZWQ3OWY4YTIwMzI1NWY1NzUxZGNiNTc2NDE1NTEyMmM0Y2ZiNWI3MWNjOTY4
15
- YTdlYjY4MTdiM2UwYWU5NDY2MGUyYmRhODkyOGExODZjZTE0YmM=
13
+ NzNiMjNjOTA0NTI5NTc0ZjhlOGYwNGIxNTgzZTZkOTNiMGNmMjZhM2MzYmM3
14
+ ODQwMmQ3NTYwMThhN2QzZTUzMTQ5MmY3MmVmMDAwODEyOWQwMTg4MWNhZDll
15
+ YjRiMzA3MmJhMTIzMjZiNzYzNTczMGNhNDQ1ZDA5MDhhYmFlNmE=
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nanoc (3.6.3)
4
+ nanoc (3.6.4)
5
5
  cri (~> 2.3)
6
6
 
7
7
  GEM
data/NEWS.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # nanoc news
2
2
 
3
+ ## 3.6.4 (2013-05-29)
4
+
5
+ Enhancements:
6
+
7
+ * Deprecated `watch` and `autocompile` commands in favour of [`guard-nanoc`](https://github.com/nanoc/guard-nanoc)
8
+
9
+ Fixes:
10
+
11
+ * Fixed bug which could cause the `tmp/` dir to blow up in size
12
+ * Unescaped URLs when checking internal links
13
+
3
14
  ## 3.6.3 (2013-04-24)
4
15
 
5
16
  Fixes:
data/TODO.md CHANGED
@@ -5,10 +5,29 @@ New
5
5
  ---
6
6
 
7
7
  * [3.x] assert that textual filter must return string
8
- * Get rid of notification center
8
+ * Get rid of notification center (use delegation)
9
9
  * Get rid of core ext
10
10
  * Don't recursively clean attributes
11
11
  * All stores should be pluggable
12
+ * filters should accept content, not a string
13
+ * Layouts could be binary too! (maybe not super useful)
14
+
15
+ Proxies
16
+ -------
17
+
18
+ Item should not contain a list of item reps
19
+ Instead, there should be an ItemRepsCollection that you can query
20
+ item_reps_for(item)
21
+
22
+ Item-per-item compilation
23
+ -------------------------
24
+
25
+ There should be a transaction around each item compilation, instead of around the entire site.
26
+
27
+ True partials?
28
+ --------------
29
+
30
+ Rendering layouts is ugly! What about partial layouts though? (render box do ... end)
12
31
 
13
32
  Populate in data sources
14
33
  ------------------------
@@ -22,16 +41,16 @@ Finding modified items
22
41
 
23
42
  Data sources should be queried to find out removed, added and changed items.
24
43
 
25
- Abstractions
26
- ------------
27
-
28
- ItemRepWriter
29
-
30
44
  Item proxies
31
45
  ------------
32
46
 
33
47
  Maybe this can be implemented as decorators.
34
48
 
49
+ * core
50
+ * proxies
51
+ * while in rules
52
+ * while being filtered
53
+
35
54
  ### Core
36
55
 
37
56
  Nanoc::Core::Item
@@ -92,6 +92,7 @@ module Nanoc
92
92
  ensure
93
93
  # Cleanup
94
94
  FileUtils.rm_rf(Nanoc::Filter::TMP_BINARY_ITEMS_DIR)
95
+ FileUtils.rm_rf(Nanoc::ItemRep::TMP_TEXT_ITEMS_DIR)
95
96
  end
96
97
 
97
98
  # @group Private instance methods
@@ -8,9 +8,11 @@ module Nanoc::ArrayExtensions
8
8
  #
9
9
  # @return [Array] The converted array
10
10
  def symbolize_keys_recursively
11
- inject([]) do |array, element|
12
- array + [ element.respond_to?(:symbolize_keys_recursively) ? element.symbolize_keys_recursively : element ]
11
+ array = []
12
+ self.each do |element|
13
+ array << (element.respond_to?(:symbolize_keys_recursively) ? element.symbolize_keys_recursively : element)
13
14
  end
15
+ array
14
16
  end
15
17
 
16
18
  # @deprecated Renamed to {#symbolize_keys_recursively}
@@ -8,9 +8,13 @@ module Nanoc::HashExtensions
8
8
  #
9
9
  # @return [Hash] The converted hash
10
10
  def symbolize_keys_recursively
11
- inject({}) do |hash, (key, value)|
12
- hash.merge(key.to_sym => value.respond_to?(:symbolize_keys_recursively) ? value.symbolize_keys_recursively : value)
11
+ hash = {}
12
+ self.each_pair do |key, value|
13
+ new_key = key.respond_to?(:to_sym) ? key.to_sym : key
14
+ new_value = value.respond_to?(:symbolize_keys_recursively) ? value.symbolize_keys_recursively : value
15
+ hash[new_key] = new_value
13
16
  end
17
+ hash
14
18
  end
15
19
 
16
20
  # @deprecated Renamed to {#symbolize_keys_recursively}
@@ -27,6 +27,8 @@ module Nanoc::CLI::Commands
27
27
  class AutoCompile < ::Nanoc::CLI::CommandRunner
28
28
 
29
29
  def run
30
+ warn 'WARNING: The `autocompile` command is deprecated. Please consider using `guard-nanoc` instead (see https://github.com/nanoc/guard-nanoc).'
31
+
30
32
  require 'rack'
31
33
 
32
34
  # Make sure we are in a nanoc site directory
@@ -11,6 +11,8 @@ module Nanoc::CLI::Commands
11
11
  class Watch < ::Nanoc::CLI::CommandRunner
12
12
 
13
13
  def run
14
+ warn 'WARNING: The `watch` command is deprecated. Please consider using `guard-nanoc` instead (see https://github.com/nanoc/guard-nanoc).'
15
+
14
16
  require 'listen'
15
17
  require 'pathname'
16
18
 
@@ -66,30 +68,30 @@ module Nanoc::CLI::Commands
66
68
  rebuilder.call(nil)
67
69
 
68
70
  # Get directories to watch
69
- dirs_to_watch = watcher_config[:dirs_to_watch] || ['content', 'layouts', 'lib']
70
- files_to_watch = watcher_config[:files_to_watch] || ['nanoc.yaml', 'config.yaml', 'Rules', 'rules', 'Rules.rb', 'rules.rb']
71
- files_to_watch = Regexp.new(files_to_watch.map { |name| "#{Regexp.quote(name)}$"}.join("|"))
72
- ignore_dir = Regexp.new(Dir.glob("*").map{|dir| dir if File::ftype(dir) == "directory" }.compact.join("|"))
71
+ dirs_to_watch = watcher_config[:dirs_to_watch] || [ 'content', 'layouts', 'lib' ]
72
+ files_to_watch = watcher_config[:files_to_watch] || [ 'nanoc.yaml', 'config.yaml', 'Rules', 'rules', 'Rules.rb', 'rules.rb' ]
73
+ files_to_watch = Regexp.new(files_to_watch.map { |name| Regexp.quote(name) + '$' }.join('|'))
74
+ ignore_dir = Regexp.new(Dir.glob('*').map { |dir| dir if File.dir?(dir) }.compact.join('|'))
73
75
 
74
76
  # Watch
75
77
  puts "Watching for changes…"
76
78
 
77
- callback = Proc.new do |modified, added, removed|
78
- rebuilder.call(modified[0]) if modified[0]
79
- rebuilder.call(added[0]) if added[0]
80
- rebuilder.call(removed[0]) if removed[0]
81
- end
79
+ callback = Proc.new do |modified, added, removed|
80
+ rebuilder.call(modified[0]) if modified[0]
81
+ rebuilder.call(added[0]) if added[0]
82
+ rebuilder.call(removed[0]) if removed[0]
83
+ end
82
84
 
83
- listener = Listen::Listener.new(*dirs_to_watch).change(&callback)
84
- listener_root = Listen::Listener.new('.', :filter => files_to_watch, :ignore => ignore_dir).change(&callback)
85
+ listener = Listen::Listener.new(*dirs_to_watch).change(&callback)
86
+ listener_root = Listen::Listener.new('.', :filter => files_to_watch, :ignore => ignore_dir).change(&callback)
85
87
 
86
- begin
87
- listener_root.start
88
- listener.start!
89
- rescue Interrupt
90
- listener.stop
91
- listener_root.stop
92
- end
88
+ begin
89
+ listener_root.start
90
+ listener.start!
91
+ rescue Interrupt
92
+ listener.stop
93
+ listener_root.stop
94
+ end
93
95
  end
94
96
 
95
97
  # Allows sending user notifications in a cross-platform way.
@@ -111,7 +113,7 @@ module Nanoc::CLI::Commands
111
113
  end
112
114
  end
113
115
 
114
- protected
116
+ protected
115
117
 
116
118
  def have_tool_nix?(tool)
117
119
  !`which #{tool}`.empty?
@@ -1,5 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
+ require 'uri'
4
+
3
5
  module Nanoc::Extra::Checking::Checks
4
6
 
5
7
  # A check that verifies that all internal links point to a location that exists.
@@ -38,6 +40,9 @@ module Nanoc::Extra::Checking::Checks
38
40
  path = path.sub(/\?.*$/, '')
39
41
  return true if path.empty?
40
42
 
43
+ # Decode URL (e.g. '%20' -> ' ')
44
+ path = URI.unescape(path)
45
+
41
46
  # Make absolute
42
47
  if path[0, 1] == '/'
43
48
  path = @site.config[:output_dir] + path
@@ -3,7 +3,7 @@ module Nanoc::Filters
3
3
  # @since 3.3.0
4
4
  class CoffeeScript < Nanoc::Filter
5
5
 
6
- require 'coffee-script'
6
+ requires 'coffee-script'
7
7
 
8
8
  # Runs the content through [CoffeeScript](http://coffeescript.org/).
9
9
  # This method takes no options.
data/lib/nanoc.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  module Nanoc
4
4
 
5
5
  # The current nanoc version.
6
- VERSION = '3.6.3'
6
+ VERSION = '3.6.4'
7
7
 
8
8
  # @return [String] A string containing information about this nanoc version
9
9
  # and its environment (Ruby engine and version, Rubygems version if any).
@@ -8,6 +8,12 @@ describe 'Hash#symbolize_keys_recursively' do
8
8
  hash_old.symbolize_keys_recursively.must_equal hash_new
9
9
  end
10
10
 
11
+ it 'should not require string keys' do
12
+ hash_old = { Time.now => 'abc' }
13
+ hash_new = hash_old
14
+ hash_old.symbolize_keys_recursively.must_equal hash_new
15
+ end
16
+
11
17
  end
12
18
 
13
19
  describe 'Hash#stringify_keys_recursively' do
@@ -540,4 +540,20 @@ class Nanoc::CompilerTest < Nanoc::TestCase
540
540
  end
541
541
  end
542
542
 
543
+ def test_tmp_text_items_are_removed_after_compilation
544
+ with_site do |site|
545
+ # Create item
546
+ File.open('content/index.html', 'w') do |io|
547
+ io.write('stuff')
548
+ end
549
+
550
+ # Compile
551
+ site = Nanoc::Site.new('.')
552
+ site.compile
553
+
554
+ # Check
555
+ assert Dir['tmp/text_items/*'].empty?
556
+ end
557
+ end
558
+
543
559
  end
@@ -18,30 +18,6 @@ class Nanoc::CLI::Commands::WatchTest < Nanoc::TestCase
18
18
  end
19
19
  end
20
20
 
21
- def test_change_nanoc_dot_yaml
22
- Nanoc::CLI.run %w( create-site bleh )
23
- Dir.chdir('bleh') do
24
- File.open('Rules', 'w') do |io|
25
- io.write("compile '*' do ; filter :erb ; end\n")
26
- io.write("route '*' do ; item.identifier + 'index.html' ; end\n")
27
- end
28
-
29
- config_contents = File.read('nanoc.yaml')
30
-
31
- watch_thread = Thread.new do
32
- Nanoc::CLI.run %w( watch )
33
- end
34
-
35
- File.open('content/index.html', 'w') { |io| io.write('<%= @config[:blah].inspect %>!!!') }
36
- self.wait_until_content_equals('output/index.html', 'nil!!!')
37
-
38
- File.open('nanoc.yaml', 'w') { |io| io.write(config_contents + "\nblah: 456\n") }
39
- self.wait_until_content_equals('output/index.html', '456!!!')
40
-
41
- watch_thread.kill
42
- end
43
- end
44
-
45
21
  def test_notify
46
22
  with_site do |s|
47
23
  watch_thread = Thread.new do
@@ -53,4 +53,15 @@ class Nanoc::Extra::Checking::Checks::InternalLinksTest < Nanoc::TestCase
53
53
  end
54
54
  end
55
55
 
56
+ def test_unescape_url
57
+ with_site do |site|
58
+ FileUtils.mkdir_p('output/stuff')
59
+ File.open('output/stuff/right foo', 'w') { |io| io.write('hi') }
60
+
61
+ check = Nanoc::Extra::Checking::Checks::InternalLinks.new(site)
62
+
63
+ assert check.send(:valid?, 'stuff/right%20foo', 'output/origin')
64
+ refute check.send(:valid?, 'stuff/wrong%20foo', 'output/origin')
65
+ end
66
+ end
56
67
  end
@@ -19,10 +19,10 @@ class Nanoc::Filters::UglifyJSTest < Nanoc::TestCase
19
19
  filter = ::Nanoc::Filters::UglifyJS.new
20
20
  input = "if(donkey) alert('It is a donkey!');"
21
21
 
22
- result = filter.setup_and_run(input, output: { beautify: false })
22
+ result = filter.setup_and_run(input, :output => { :beautify => false })
23
23
  assert_equal 'donkey&&alert("It is a donkey!");', result
24
24
 
25
- result = filter.setup_and_run(input, output: { beautify: true })
25
+ result = filter.setup_and_run(input, :output => { :beautify => true })
26
26
  assert_equal 'donkey && alert("It is a donkey!");', result
27
27
  end
28
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.3
4
+ version: 3.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-24 00:00:00.000000000 Z
11
+ date: 2013-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cri