nanoc 4.1.0 → 4.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a25f62d7d0cba592a2fac26511e3a33c8b23568e
4
- data.tar.gz: 58ebd91d32f0188962896e11e58f619cf71c30eb
3
+ metadata.gz: a3e14d0707707719b3f4d5d8e7df33084eb0d507
4
+ data.tar.gz: 2c8e065ee1515381e157a0720f18c25824abe980
5
5
  SHA512:
6
- metadata.gz: 20f2f9e77c44f4bb357c03e32dd2c63573f07d6284b6e3ba5cbea1af13c9b64524366ec3171dbc12d9394e743490e6d18ec98efafddc0a173f9ca064c36aabfc
7
- data.tar.gz: 03083d54d98bf95205a30c378d00c2eb714eb526b460022c87d6ec5c20406dbcdef965361b4dac165f7c1014892fc2480f958c369d6b9a04425bc502b2d21afc
6
+ metadata.gz: b4c7b4c384739c7f9163344701e78341f54c101987d52e955ff012ea45f383fbe37587b44967817436dea59c35c10ba3270cc31104f4203474c7bd3869af6406
7
+ data.tar.gz: 0e1fa2d68b5db87fe2ef2e71b63dbebc496bc5c038ccdeed17bb03b6236b26822e307013ddb9b4a8032220a34e495d952a42d55cdfa1c602b246746e6ec6b864
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nanoc (4.1.0rc2)
4
+ nanoc (4.1.1)
5
5
  cri (~> 2.3)
6
6
 
7
7
  GEM
@@ -12,7 +12,7 @@ GEM
12
12
  addressable (2.4.0)
13
13
  adsf (1.2.0)
14
14
  rack (>= 1.0.0)
15
- ast (2.1.0)
15
+ ast (2.2.0)
16
16
  astrolabe (1.3.1)
17
17
  parser (~> 2.2)
18
18
  bluecloth (2.2.0)
@@ -58,7 +58,7 @@ GEM
58
58
  ffi (1.9.10)
59
59
  fission (0.5.0)
60
60
  CFPropertyList (~> 2.2)
61
- fog (1.36.0)
61
+ fog (1.37.0)
62
62
  fog-aliyun (>= 0.1.0)
63
63
  fog-atmos
64
64
  fog-aws (>= 0.6.0)
@@ -80,10 +80,10 @@ GEM
80
80
  fog-terremark
81
81
  fog-vmfusion
82
82
  fog-voxel
83
+ fog-vsphere (>= 0.4.0)
83
84
  fog-xenserver
84
85
  fog-xml (~> 0.1.1)
85
86
  ipaddress (~> 0.5)
86
- nokogiri (~> 1.5, >= 1.5.11)
87
87
  fog-aliyun (0.1.0)
88
88
  fog-core (~> 1.27)
89
89
  fog-json (~> 1.0)
@@ -137,7 +137,7 @@ GEM
137
137
  fog-core
138
138
  fog-json
139
139
  fog-xml
140
- fog-sakuracloud (1.5.0)
140
+ fog-sakuracloud (1.7.5)
141
141
  fog-core
142
142
  fog-json
143
143
  fog-serverlove (0.1.2)
@@ -158,6 +158,9 @@ GEM
158
158
  fog-voxel (0.1.0)
159
159
  fog-core
160
160
  fog-xml
161
+ fog-vsphere (0.4.0)
162
+ fog-core
163
+ rbvmomi (~> 1.8)
161
164
  fog-xenserver (0.2.2)
162
165
  fog-core
163
166
  fog-xml
@@ -211,7 +214,7 @@ GEM
211
214
  mustache (1.0.2)
212
215
  nenv (0.2.0)
213
216
  netrc (0.11.0)
214
- nokogiri (1.6.7)
217
+ nokogiri (1.6.7.1)
215
218
  mini_portile2 (~> 2.0.0.rc2)
216
219
  notiffany (0.0.8)
217
220
  nenv (~> 0.1)
@@ -232,12 +235,16 @@ GEM
232
235
  rainbow (2.0.0)
233
236
  rainpress (1.0)
234
237
  rake (10.4.2)
235
- rb-fsevent (0.9.6)
238
+ rb-fsevent (0.9.7)
236
239
  rb-inotify (0.9.5)
237
240
  ffi (>= 0.5.0)
241
+ rbvmomi (1.8.2)
242
+ builder
243
+ nokogiri (>= 1.4.1)
244
+ trollop
238
245
  rdiscount (2.1.8)
239
- rdoc (4.2.0)
240
- redcarpet (3.3.3)
246
+ rdoc (4.2.1)
247
+ redcarpet (3.3.4)
241
248
  ref (2.0.0)
242
249
  rest-client (1.8.0)
243
250
  http-cookie (>= 1.0.2, < 2.0)
@@ -287,6 +294,7 @@ GEM
287
294
  thor (0.19.1)
288
295
  tilt (2.0.1)
289
296
  tins (1.6.0)
297
+ trollop (2.1.2)
290
298
  typogruby (1.0.18)
291
299
  rubypants
292
300
  uglifier (2.7.2)
@@ -295,7 +303,7 @@ GEM
295
303
  unf (0.1.4)
296
304
  unf_ext
297
305
  unf_ext (0.0.7.1)
298
- vcr (3.0.0)
306
+ vcr (3.0.1)
299
307
  w3c_validators (1.2)
300
308
  json
301
309
  nokogiri
data/NEWS.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Nanoc news
2
2
 
3
+ ## 4.1.1 (2015-12-30)
4
+
5
+ Fixes:
6
+
7
+ * Fixed preprocessor not being run before check/deploy/prune commands (#763, #784, #787, #788)
8
+
9
+ Enhancements:
10
+
11
+ * Made `#breadcrumbs_trail` explicitly fail when using full identifiers (#781, #783)
12
+
3
13
  ## 4.1.0 (2015-12-18)
4
14
 
5
15
  Fixes:
@@ -138,7 +138,7 @@ module Nanoc
138
138
  #
139
139
  # @param [String] identifier This item's identifier.
140
140
  #
141
- # @param [Boolean] :binary Whether or not this item is binary
141
+ # @param [Boolean] binary Whether or not this item is binary
142
142
  def new_item(content, attributes, identifier, binary: false)
143
143
  content = Nanoc::Int::Content.create(content, binary: binary)
144
144
  Nanoc::Int::Item.new(content, attributes, identifier)
@@ -14,6 +14,8 @@ module Nanoc::CLI::Commands
14
14
  class Deploy < ::Nanoc::CLI::CommandRunner
15
15
  def run
16
16
  load_site
17
+ # FIXME: ugly to preprocess here
18
+ site.compiler.action_provider.preprocess(site)
17
19
 
18
20
  # List deployers
19
21
  if options[:'list-deployers']
@@ -16,6 +16,8 @@ module Nanoc::CLI::Commands
16
16
  class Prune < ::Nanoc::CLI::CommandRunner
17
17
  def run
18
18
  load_site
19
+ # FIXME: ugly to preprocess here
20
+ site.compiler.action_provider.preprocess(site)
19
21
  site.compiler.build_reps
20
22
 
21
23
  if options.key?(:yes)
@@ -381,7 +381,7 @@ module Nanoc::Helpers
381
381
  # DateTime) into a Time. When given a Date instance or a string, the
382
382
  # argument is assumed to be in the local timezone.
383
383
  #
384
- # @param [String, Time, Date, DateTime] time Something that contains time
384
+ # @param [String, Time, Date, DateTime] arg Something that contains time
385
385
  # information but is not necessarily a Time instance yet
386
386
  #
387
387
  # @return [Time] The Time instance corresponding to the given input
@@ -2,6 +2,12 @@ module Nanoc::Helpers
2
2
  # Provides support for breadcrumbs, which allow the user to go up in the
3
3
  # page hierarchy.
4
4
  module Breadcrumbs
5
+ class CannotGetBreadcrumbsForNonLegacyItem < Nanoc::Int::Errors::Generic
6
+ def initialize(identifier)
7
+ super("You cannot build a breadcrumbs trail for an item that has a “full” identifier (#{identifier}). Doing so is only possible for items that have a legacy identifier.")
8
+ end
9
+ end
10
+
5
11
  # Creates a breadcrumb trail leading from the current item to its parent,
6
12
  # to its parent’s parent, etc, until the root item is reached. This
7
13
  # function does not require that each intermediate item exist; for
@@ -11,6 +17,10 @@ module Nanoc::Helpers
11
17
  # @return [Array] The breadcrumbs, starting with the root item and ending
12
18
  # with the item itself
13
19
  def breadcrumbs_trail
20
+ unless @item.identifier.legacy?
21
+ raise CannotGetBreadcrumbsForNonLegacyItem.new(@item.identifier)
22
+ end
23
+
14
24
  trail = []
15
25
  idx_start = 0
16
26
 
@@ -88,7 +88,9 @@ module Nanoc::RuleDSL
88
88
  # @param [String] identifier A pattern matching identifiers of items that
89
89
  # should be routed using this rule
90
90
  #
91
- # @param [Symbol] :rep The name of the representation
91
+ # @param [Symbol] rep The name of the representation
92
+ #
93
+ # @param [Symbol] snapshot The name of the snapshot
92
94
  #
93
95
  # @yield The block that will be executed when an item matching this
94
96
  # compilation rule needs to be routed
@@ -27,7 +27,7 @@ module Nanoc::RuleDSL
27
27
  # @param [Proc] block A block that will be called when matching items are
28
28
  # compiled
29
29
  #
30
- # @param [Symbol, nil] :snapshot The name of the snapshot this rule will
30
+ # @param [Symbol, nil] snapshot_name The name of the snapshot this rule will
31
31
  # apply to. Ignored for compilation rules, but used for routing rules.
32
32
  def initialize(pattern, rep_name, block, snapshot_name: nil)
33
33
  @pattern = pattern
@@ -75,7 +75,7 @@ module Nanoc::RuleDSL
75
75
  executor.rule_memory
76
76
  end
77
77
 
78
- # @param [Nanoc::Int::Layout]
78
+ # @param [Nanoc::Int::Layout] layout
79
79
  #
80
80
  # @return [Nanoc::Int::RuleMemory]
81
81
  def new_rule_memory_for_layout(layout)
data/lib/nanoc/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Nanoc
2
2
  # The current Nanoc version.
3
- VERSION = '4.1.0'
3
+ VERSION = '4.1.1'
4
4
  end
@@ -163,4 +163,29 @@ class Nanoc::CLI::Commands::DeployTest < Nanoc::TestCase
163
163
  assert File.file?('mydestination/blah.html')
164
164
  end
165
165
  end
166
+
167
+ def test_deploy_with_preprocessor
168
+ skip_unless_have_command 'rsync'
169
+ with_site do |_site|
170
+ File.open('nanoc.yaml', 'w') do |io|
171
+ io.write "deploy:\n"
172
+ io.write " default:\n"
173
+ io.write ' dst: mydestination'
174
+ end
175
+
176
+ FileUtils.mkdir_p('output')
177
+ File.open('output/blah.html', 'w') { |io| io.write 'moo' }
178
+
179
+ File.write('Rules', "preprocess do ; @config[:deploy][:default][:dst] = 'otherdestination' ; end\n\n" + File.read('Rules'))
180
+
181
+ capturing_stdio do
182
+ Nanoc::CLI.run %w( deploy )
183
+ end
184
+
185
+ refute File.directory?('mydestination')
186
+ refute File.file?('mydestination/blah.html')
187
+ assert File.directory?('otherdestination')
188
+ assert File.file?('otherdestination/blah.html')
189
+ end
190
+ end
166
191
  end
@@ -3,7 +3,7 @@ class Nanoc::Helpers::BreadcrumbsTest < Nanoc::TestCase
3
3
 
4
4
  def test_breadcrumbs_trail_at_root
5
5
  @items = Nanoc::Int::IdentifiableCollection.new({})
6
- item = Nanoc::Int::Item.new('root', {}, '/')
6
+ item = Nanoc::Int::Item.new('root', {}, Nanoc::Identifier.new('/', type: :legacy))
7
7
  @items << item
8
8
  @item = item
9
9
 
@@ -12,8 +12,8 @@ class Nanoc::Helpers::BreadcrumbsTest < Nanoc::TestCase
12
12
 
13
13
  def test_breadcrumbs_trail_with_1_parent
14
14
  @items = Nanoc::Int::IdentifiableCollection.new({})
15
- parent_item = Nanoc::Int::Item.new('parent', {}, '/')
16
- child_item = Nanoc::Int::Item.new('child', {}, '/foo/')
15
+ parent_item = Nanoc::Int::Item.new('parent', {}, Nanoc::Identifier.new('/', type: :legacy))
16
+ child_item = Nanoc::Int::Item.new('child', {}, Nanoc::Identifier.new('/foo/', type: :legacy))
17
17
  @items << parent_item
18
18
  @items << child_item
19
19
  @item = child_item
@@ -23,9 +23,9 @@ class Nanoc::Helpers::BreadcrumbsTest < Nanoc::TestCase
23
23
 
24
24
  def test_breadcrumbs_trail_with_many_parents
25
25
  @items = Nanoc::Int::IdentifiableCollection.new({})
26
- grandparent_item = Nanoc::Int::Item.new('grandparent', {}, '/')
27
- parent_item = Nanoc::Int::Item.new('parent', {}, '/foo/')
28
- child_item = Nanoc::Int::Item.new('child', {}, '/foo/bar/')
26
+ grandparent_item = Nanoc::Int::Item.new('grandparent', {}, Nanoc::Identifier.new('/', type: :legacy))
27
+ parent_item = Nanoc::Int::Item.new('parent', {}, Nanoc::Identifier.new('/foo/', type: :legacy))
28
+ child_item = Nanoc::Int::Item.new('child', {}, Nanoc::Identifier.new('/foo/bar/', type: :legacy))
29
29
  @items << grandparent_item
30
30
  @items << parent_item
31
31
  @items << child_item
@@ -36,12 +36,25 @@ class Nanoc::Helpers::BreadcrumbsTest < Nanoc::TestCase
36
36
 
37
37
  def test_breadcrumbs_trail_with_nils
38
38
  @items = Nanoc::Int::IdentifiableCollection.new({})
39
- grandparent_item = Nanoc::Int::Item.new('grandparent', {}, '/')
40
- child_item = Nanoc::Int::Item.new('child', {}, '/foo/bar/')
39
+ grandparent_item = Nanoc::Int::Item.new('grandparent', {}, Nanoc::Identifier.new('/', type: :legacy))
40
+ child_item = Nanoc::Int::Item.new('child', {}, Nanoc::Identifier.new('/foo/bar/', type: :legacy))
41
41
  @items << grandparent_item
42
42
  @items << child_item
43
43
  @item = child_item
44
44
 
45
45
  assert_equal [grandparent_item, nil, child_item], breadcrumbs_trail
46
46
  end
47
+
48
+ def test_breadcrumbs_trail_with_non_legacy_identifiers
49
+ @items = Nanoc::Int::IdentifiableCollection.new({})
50
+ parent_item = Nanoc::Int::Item.new('parent', {}, '/')
51
+ child_item = Nanoc::Int::Item.new('child', {}, '/foo/')
52
+ @items << parent_item
53
+ @items << child_item
54
+ @item = child_item
55
+
56
+ assert_raises Nanoc::Helpers::Breadcrumbs::CannotGetBreadcrumbsForNonLegacyItem do
57
+ breadcrumbs_trail
58
+ end
59
+ end
47
60
  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: 4.1.0
4
+ version: 4.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-18 00:00:00.000000000 Z
11
+ date: 2015-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cri
@@ -68,7 +68,6 @@ files:
68
68
  - README.md
69
69
  - Rakefile
70
70
  - bin/nanoc
71
- - do-release
72
71
  - doc/yardoc_handlers/identifier.rb
73
72
  - doc/yardoc_templates/default/layout/html/footer.erb
74
73
  - lib/nanoc.rb
@@ -254,7 +253,6 @@ files:
254
253
  - lib/nanoc/rule_dsl/rules_loader.rb
255
254
  - lib/nanoc/version.rb
256
255
  - nanoc.gemspec
257
- - tags
258
256
  - tasks/doc.rake
259
257
  - tasks/rubocop.rake
260
258
  - tasks/test.rake
@@ -380,7 +378,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
380
378
  version: '0'
381
379
  requirements: []
382
380
  rubyforge_project:
383
- rubygems_version: 2.4.5.1
381
+ rubygems_version: 2.5.1
384
382
  signing_key:
385
383
  specification_version: 4
386
384
  summary: A static-site generator with a focus on flexibility.
data/do-release DELETED
@@ -1,83 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- require 'fileutils'
5
- require 'octokit'
6
-
7
- def run(*args)
8
- puts "I will execute the following:"
9
- puts ' ' + args.map { |a| a =~ /\s/ ? a.inspect : a }.join(' ')
10
- print "Is this correct? [y/N] "
11
- res = gets
12
- unless res.strip.downcase == 'y'
13
- $stderr.puts "Answer was not Y; release aborted."
14
- exit 1
15
- end
16
-
17
- system('echo', *args)
18
- system(*args)
19
- end
20
-
21
-
22
-
23
- puts "=== Logging in to GitHub’s API…"
24
- client = Octokit::Client.new(netrc: true)
25
- puts
26
-
27
- puts "=== Deleting old *.gem files…"
28
- Dir['*.gem'].each do |fn|
29
- puts " #{fn}…"
30
- FileUtils.rm_f(fn)
31
- end
32
- puts
33
-
34
- puts "=== Building new gem…"
35
- run('gem', 'build', 'nanoc.gemspec')
36
- puts
37
-
38
- puts "=== Reading version…"
39
- require_relative 'lib/nanoc/version'
40
- puts "Version = #{Nanoc::VERSION}"
41
- puts
42
-
43
- puts "=== Verifying that release does not yet exist…"
44
- releases = client.releases('nanoc/nanoc')
45
- release = releases.find { |r| r.tag_name == Nanoc::VERSION }
46
- if release
47
- $stderr.puts "Release already exists!"
48
- $stderr.puts "ABORTED!"
49
- exit 1
50
- end
51
- puts
52
-
53
- puts "=== Creating Git tag…"
54
- run('git', 'tag', '--sign', '--annotate', Nanoc::VERSION, '--message', "Version #{Nanoc::VERSION}")
55
- puts
56
-
57
- puts "=== Pushing Git data…"
58
- run('git', 'push', 'origin')
59
- run('git', 'push', 'origin', '--tags')
60
- puts
61
-
62
- puts "=== Pushing gem…"
63
- run('gem', 'push', "nanoc-#{Nanoc::VERSION}.gem")
64
- puts
65
-
66
- puts "=== Reading release notes…"
67
- release_notes = File.readlines('NEWS.md')
68
- .drop(4)
69
- .take_while { |l| l !~ /^## / }
70
- .join
71
- puts
72
-
73
- puts "=== Creating release on GitHub…"
74
- sleep 3 # Give GitHub some time to detect the new tag
75
- is_prerelease = !Nanoc::VERSION =~ /a|b|rc/ || Nanoc::VERSION =~ /^0/
76
- client.create_release(
77
- 'nanoc/nanoc', Nanoc::VERSION,
78
- prerelease: !!is_prerelease,
79
- body: release_notes,
80
- )
81
- puts
82
-
83
- puts "DONE!"