nanoc 4.1.1 → 4.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +16 -20
  3. data/LICENSE +1 -1
  4. data/NEWS.md +11 -0
  5. data/lib/nanoc.rb +1 -1
  6. data/lib/nanoc/base/compilation/compiler.rb +6 -5
  7. data/lib/nanoc/base/compilation/filter.rb +1 -1
  8. data/lib/nanoc/base/compilation/outdatedness_checker.rb +10 -2
  9. data/lib/nanoc/base/core_ext/array.rb +1 -1
  10. data/lib/nanoc/base/core_ext/hash.rb +1 -1
  11. data/lib/nanoc/base/entities/configuration.rb +5 -4
  12. data/lib/nanoc/base/entities/document.rb +1 -1
  13. data/lib/nanoc/base/entities/identifiable_collection.rb +2 -1
  14. data/lib/nanoc/base/entities/identifier.rb +1 -1
  15. data/lib/nanoc/base/entities/item_rep.rb +5 -5
  16. data/lib/nanoc/base/entities/rule_memory_action.rb +1 -1
  17. data/lib/nanoc/base/entities/rule_memory_actions/snapshot.rb +1 -1
  18. data/lib/nanoc/base/entities/site.rb +4 -3
  19. data/lib/nanoc/base/repos/site_loader.rb +5 -5
  20. data/lib/nanoc/base/services/executor.rb +6 -5
  21. data/lib/nanoc/base/services/item_rep_writer.rb +1 -1
  22. data/lib/nanoc/base/views/config_view.rb +1 -1
  23. data/lib/nanoc/base/views/item_rep_view.rb +1 -1
  24. data/lib/nanoc/base/views/item_without_reps_view.rb +1 -1
  25. data/lib/nanoc/base/views/mixins/document_view_mixin.rb +7 -9
  26. data/lib/nanoc/base/views/view.rb +14 -0
  27. data/lib/nanoc/cli.rb +2 -2
  28. data/lib/nanoc/cli/ansi_string_colorizer.rb +1 -1
  29. data/lib/nanoc/cli/cleaning_stream.rb +1 -1
  30. data/lib/nanoc/cli/command_runner.rb +7 -14
  31. data/lib/nanoc/cli/commands/check.rb +1 -1
  32. data/lib/nanoc/cli/commands/create-site.rb +5 -5
  33. data/lib/nanoc/cli/commands/shell.rb +1 -1
  34. data/lib/nanoc/cli/commands/show-plugins.rb +2 -2
  35. data/lib/nanoc/cli/commands/show-rules.rb +1 -1
  36. data/lib/nanoc/cli/commands/view.rb +1 -1
  37. data/lib/nanoc/cli/error_handler.rb +3 -11
  38. data/lib/nanoc/cli/logger.rb +2 -2
  39. data/lib/nanoc/data_sources/filesystem_unified.rb +6 -5
  40. data/lib/nanoc/extra/checking/checks/external_links.rb +7 -6
  41. data/lib/nanoc/extra/checking/checks/internal_links.rb +7 -6
  42. data/lib/nanoc/extra/checking/checks/mixed_content.rb +1 -1
  43. data/lib/nanoc/extra/checking/runner.rb +8 -7
  44. data/lib/nanoc/extra/deployer.rb +1 -1
  45. data/lib/nanoc/extra/deployers/fog.rb +2 -2
  46. data/lib/nanoc/extra/deployers/rsync.rb +1 -1
  47. data/lib/nanoc/extra/jruby_nokogiri_warner.rb +1 -1
  48. data/lib/nanoc/extra/link_collector.rb +1 -1
  49. data/lib/nanoc/filters/colorize_syntax.rb +3 -3
  50. data/lib/nanoc/filters/less.rb +1 -1
  51. data/lib/nanoc/filters/redcarpet.rb +6 -5
  52. data/lib/nanoc/filters/relativize_paths.rb +2 -2
  53. data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +1 -1
  54. data/lib/nanoc/helpers/capturing.rb +1 -1
  55. data/lib/nanoc/helpers/html_escape.rb +3 -2
  56. data/lib/nanoc/helpers/link_to.rb +7 -6
  57. data/lib/nanoc/rule_dsl/compiler_dsl.rb +1 -1
  58. data/lib/nanoc/version.rb +1 -1
  59. data/nanoc.gemspec +3 -3
  60. data/tasks/test.rake +1 -1
  61. data/test/cli/test_cli.rb +2 -2
  62. data/test/extra/checking/checks/test_mixed_content.rb +7 -7
  63. data/test/filters/test_colorize_syntax.rb +2 -2
  64. data/test/filters/test_redcarpet.rb +6 -5
  65. data/test/filters/test_redcloth.rb +1 -1
  66. data/test/filters/test_xsl.rb +6 -6
  67. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3e14d0707707719b3f4d5d8e7df33084eb0d507
4
- data.tar.gz: 2c8e065ee1515381e157a0720f18c25824abe980
3
+ metadata.gz: fd86fc55ceec9ba602815f93e624bd54c07d40fe
4
+ data.tar.gz: 112408b4eeb610c80a18acecd4ed9c2216cbb084
5
5
  SHA512:
6
- metadata.gz: b4c7b4c384739c7f9163344701e78341f54c101987d52e955ff012ea45f383fbe37587b44967817436dea59c35c10ba3270cc31104f4203474c7bd3869af6406
7
- data.tar.gz: 0e1fa2d68b5db87fe2ef2e71b63dbebc496bc5c038ccdeed17bb03b6236b26822e307013ddb9b4a8032220a34e495d952a42d55cdfa1c602b246746e6ec6b864
6
+ metadata.gz: 00c8461d90463a7c21225138a56f3a5ef2bd8f682f105a0319353cdea1d021a4c8b04116011ea865cf1847b4a26870e1d67f84b51fc7786e561c5ddfc124a580
7
+ data.tar.gz: 3a82634d317ddd970232ba19460e5c48d2046e41ab61925990b0e833cdc736c8b1dada7d0e8dcf183e1cfe6a2fa54933ff826d7d58f77c673fe2e59521773fcd
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nanoc (4.1.1)
4
+ nanoc (4.1.2)
5
5
  cri (~> 2.3)
6
6
 
7
7
  GEM
@@ -13,8 +13,6 @@ GEM
13
13
  adsf (1.2.0)
14
14
  rack (>= 1.0.0)
15
15
  ast (2.2.0)
16
- astrolabe (1.3.1)
17
- parser (~> 2.2)
18
16
  bluecloth (2.2.0)
19
17
  builder (3.2.2)
20
18
  chunky_png (1.3.5)
@@ -92,7 +90,7 @@ GEM
92
90
  fog-atmos (0.1.0)
93
91
  fog-core
94
92
  fog-xml
95
- fog-aws (0.7.6)
93
+ fog-aws (0.8.1)
96
94
  fog-core (~> 1.27)
97
95
  fog-json (~> 1.0)
98
96
  fog-xml (~> 0.1)
@@ -129,7 +127,7 @@ GEM
129
127
  fog-core
130
128
  fog-xml
131
129
  nokogiri
132
- fog-radosgw (0.0.4)
130
+ fog-radosgw (0.0.5)
133
131
  fog-core (>= 1.21.0)
134
132
  fog-json
135
133
  fog-xml (>= 0.0.1)
@@ -143,7 +141,7 @@ GEM
143
141
  fog-serverlove (0.1.2)
144
142
  fog-core
145
143
  fog-json
146
- fog-softlayer (1.0.2)
144
+ fog-softlayer (1.0.3)
147
145
  fog-core
148
146
  fog-json
149
147
  fog-storm_on_demand (0.1.1)
@@ -161,7 +159,7 @@ GEM
161
159
  fog-vsphere (0.4.0)
162
160
  fog-core
163
161
  rbvmomi (~> 1.8)
164
- fog-xenserver (0.2.2)
162
+ fog-xenserver (0.2.3)
165
163
  fog-core
166
164
  fog-xml
167
165
  fog-xml (0.1.2)
@@ -190,7 +188,7 @@ GEM
190
188
  http-cookie (1.0.2)
191
189
  domain_name (~> 0.5)
192
190
  inflecto (0.0.2)
193
- ipaddress (0.8.0)
191
+ ipaddress (0.8.2)
194
192
  json (1.8.3)
195
193
  kramdown (1.9.0)
196
194
  less (2.6.0)
@@ -199,7 +197,7 @@ GEM
199
197
  listen (3.0.5)
200
198
  rb-fsevent (>= 0.9.3)
201
199
  rb-inotify (>= 0.9)
202
- lumberjack (1.0.9)
200
+ lumberjack (1.0.10)
203
201
  markaby (0.8.0)
204
202
  builder
205
203
  maruku (0.7.2)
@@ -220,8 +218,8 @@ GEM
220
218
  nenv (~> 0.1)
221
219
  shellany (~> 0.0)
222
220
  pandoc-ruby (1.0.0)
223
- parser (2.2.3.0)
224
- ast (>= 1.1, < 3.0)
221
+ parser (2.3.0.1)
222
+ ast (~> 2.2)
225
223
  posix-spawn (0.3.11)
226
224
  powerpack (0.1.1)
227
225
  pry (0.10.3)
@@ -234,7 +232,7 @@ GEM
234
232
  rack (1.6.4)
235
233
  rainbow (2.0.0)
236
234
  rainpress (1.0)
237
- rake (10.4.2)
235
+ rake (10.5.0)
238
236
  rb-fsevent (0.9.7)
239
237
  rb-inotify (0.9.5)
240
238
  ffi (>= 0.5.0)
@@ -260,21 +258,19 @@ GEM
260
258
  rspec-expectations (3.4.0)
261
259
  diff-lcs (>= 1.2.0, < 2.0)
262
260
  rspec-support (~> 3.4.0)
263
- rspec-mocks (3.4.0)
261
+ rspec-mocks (3.4.1)
264
262
  diff-lcs (>= 1.2.0, < 2.0)
265
263
  rspec-support (~> 3.4.0)
266
264
  rspec-support (3.4.1)
267
- rubocop (0.35.1)
268
- astrolabe (~> 1.3)
269
- parser (>= 2.2.3.0, < 3.0)
265
+ rubocop (0.36.0)
266
+ parser (>= 2.3.0.0, < 3.0)
270
267
  powerpack (~> 0.1)
271
268
  rainbow (>= 1.99.1, < 3.0)
272
269
  ruby-progressbar (~> 1.7)
273
- tins (<= 1.6.0)
274
270
  ruby-progressbar (1.7.5)
275
271
  rubypants (0.2.0)
276
272
  safe_yaml (1.0.4)
277
- sass (3.4.20)
273
+ sass (3.4.21)
278
274
  shellany (0.0.1)
279
275
  simplecov (0.11.1)
280
276
  docile (~> 1.1.0)
@@ -292,7 +288,7 @@ GEM
292
288
  libv8 (~> 3.16.14.0)
293
289
  ref
294
290
  thor (0.19.1)
295
- tilt (2.0.1)
291
+ tilt (2.0.2)
296
292
  tins (1.6.0)
297
293
  trollop (2.1.2)
298
294
  typogruby (1.0.18)
@@ -307,7 +303,7 @@ GEM
307
303
  w3c_validators (1.2)
308
304
  json
309
305
  nokogiri
310
- webmock (1.22.3)
306
+ webmock (1.22.6)
311
307
  addressable (>= 2.3.6)
312
308
  crack (>= 0.3.2)
313
309
  hashdiff
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2007-2015 Denis Defreyne and contributors
1
+ Copyright (c) 2007-2016 Denis Defreyne and contributors
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
data/NEWS.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Nanoc news
2
2
 
3
+ ## 4.1.2 (2016-01-16)
4
+
5
+ Fixes:
6
+
7
+ * Made @-variables (e.g. `@items`) report their frozenness properly, so that optimisations based on frozenness work once again (#795, #797)
8
+ * Removed environment from `crash.log` to prevent leaking sensitive information (#798, #800)
9
+
10
+ Enhancements:
11
+
12
+ * Removed redundant checksum calculation (#789) [Ruben Verborgh]
13
+
3
14
  ## 4.1.1 (2015-12-30)
4
15
 
5
16
  Fixes:
@@ -7,7 +7,7 @@ module Nanoc
7
7
  gem_info = defined?(Gem) ? "with RubyGems #{Gem::VERSION}" : 'without RubyGems'
8
8
  engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
9
9
  res = ''
10
- res << "Nanoc #{Nanoc::VERSION} © 2007-2015 Denis Defreyne.\n"
10
+ res << "Nanoc #{Nanoc::VERSION} © 2007-2016 Denis Defreyne.\n"
11
11
  res << "Running #{engine} #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) on #{RUBY_PLATFORM} #{gem_info}.\n"
12
12
  res
13
13
  end
@@ -148,11 +148,12 @@ module Nanoc::Int
148
148
  #
149
149
  # @api private
150
150
  def assigns_for(rep)
151
- if rep.binary?
152
- content_or_filename_assigns = { filename: rep.snapshot_contents[:last].filename }
153
- else
154
- content_or_filename_assigns = { content: rep.snapshot_contents[:last].string }
155
- end
151
+ content_or_filename_assigns =
152
+ if rep.binary?
153
+ { filename: rep.snapshot_contents[:last].filename }
154
+ else
155
+ { content: rep.snapshot_contents[:last].string }
156
+ end
156
157
 
157
158
  view_context = create_view_context
158
159
 
@@ -25,7 +25,7 @@ module Nanoc
25
25
  # @abstract Subclass and override {#run} to implement a custom filter.
26
26
  class Filter < Nanoc::Int::Context
27
27
  # @api private
28
- TMP_BINARY_ITEMS_DIR = 'binary_items'
28
+ TMP_BINARY_ITEMS_DIR = 'binary_items'.freeze
29
29
 
30
30
  # A hash containing variables that will be made available during
31
31
  # filtering.
@@ -172,12 +172,20 @@ module Nanoc::Int
172
172
  end
173
173
  memoize :rule_memory_differs_for
174
174
 
175
+ # @param obj The object to create a checksum for
176
+ #
177
+ # @return [String] The digest
178
+ def calc_checksum(obj)
179
+ Nanoc::Int::Checksummer.calc(obj)
180
+ end
181
+ memoize :calc_checksum
182
+
175
183
  # @param obj
176
184
  #
177
185
  # @return [Boolean] false if either the new or the old checksum for the
178
186
  # given object is not available, true if both checksums are available
179
187
  def checksums_available?(obj)
180
- checksum_store[obj] && Nanoc::Int::Checksummer.calc(obj)
188
+ checksum_store[obj] && calc_checksum(obj)
181
189
  end
182
190
  memoize :checksums_available?
183
191
 
@@ -186,7 +194,7 @@ module Nanoc::Int
186
194
  # @return [Boolean] false if the old and new checksums for the given
187
195
  # object differ, true if they are identical
188
196
  def checksums_identical?(obj)
189
- checksum_store[obj] == Nanoc::Int::Checksummer.calc(obj)
197
+ checksum_store[obj] == calc_checksum(obj)
190
198
  end
191
199
  memoize :checksums_identical?
192
200
 
@@ -23,7 +23,7 @@ module Nanoc::ArrayExtensions
23
23
  #
24
24
  # @since 3.2.0
25
25
  def __nanoc_freeze_recursively
26
- return if self.frozen?
26
+ return if frozen?
27
27
  freeze
28
28
  each do |value|
29
29
  if value.respond_to?(:__nanoc_freeze_recursively)
@@ -25,7 +25,7 @@ module Nanoc::HashExtensions
25
25
  #
26
26
  # @since 3.2.0
27
27
  def __nanoc_freeze_recursively
28
- return if self.frozen?
28
+ return if frozen?
29
29
  freeze
30
30
  each_pair do |_key, value|
31
31
  if value.respond_to?(:__nanoc_freeze_recursively)
@@ -3,7 +3,7 @@ module Nanoc::Int
3
3
  #
4
4
  # @api private
5
5
  class Configuration
6
- NONE = Object.new
6
+ NONE = Object.new.freeze
7
7
 
8
8
  # The default configuration for a data source. A data source's
9
9
  # configuration overrides these options.
@@ -13,7 +13,7 @@ module Nanoc::Int
13
13
  layouts_root: '/',
14
14
  config: {},
15
15
  identifier_type: 'full',
16
- }
16
+ }.freeze
17
17
 
18
18
  # The default configuration for a site. A site's configuration overrides
19
19
  # these options: when a {Nanoc::Int::Site} is created with a configuration
@@ -29,7 +29,7 @@ module Nanoc::Int
29
29
  enable_output_diff: false,
30
30
  prune: { auto_prune: false, exclude: ['.git', '.hg', '.svn', 'CVS'] },
31
31
  string_pattern_type: 'glob',
32
- }
32
+ }.freeze
33
33
 
34
34
  # Creates a new configuration with the given hash.
35
35
  #
@@ -88,7 +88,8 @@ module Nanoc::Int
88
88
  self
89
89
  end
90
90
 
91
- def __nanoc_freeze_recursively
91
+ def freeze
92
+ super
92
93
  @wrapped.__nanoc_freeze_recursively
93
94
  end
94
95
 
@@ -47,7 +47,7 @@ module Nanoc
47
47
  def ==(other)
48
48
  other.respond_to?(:identifier) && identifier == other.identifier
49
49
  end
50
- alias_method :eql?, :==
50
+ alias eql? ==
51
51
  end
52
52
  end
53
53
  end
@@ -18,6 +18,7 @@ module Nanoc::Int
18
18
 
19
19
  def freeze
20
20
  @objects.freeze
21
+ @objects.each(&:freeze)
21
22
  build_mapping
22
23
  super
23
24
  end
@@ -50,7 +51,7 @@ module Nanoc::Int
50
51
  protected
51
52
 
52
53
  def object_with_identifier(identifier)
53
- if self.frozen?
54
+ if frozen?
54
55
  @mapping[identifier.to_s]
55
56
  else
56
57
  @objects.find { |i| i.identifier == identifier }
@@ -72,7 +72,7 @@ module Nanoc
72
72
  false
73
73
  end
74
74
  end
75
- alias_method :eql?, :==
75
+ alias eql? ==
76
76
 
77
77
  def hash
78
78
  self.class.hash ^ to_s.hash
@@ -6,7 +6,7 @@ module Nanoc::Int
6
6
 
7
7
  # @return [Boolean]
8
8
  attr_accessor :compiled
9
- alias_method :compiled?, :compiled
9
+ alias compiled? compiled
10
10
 
11
11
  # @return [Hash<Symbol,String>]
12
12
  attr_accessor :raw_paths
@@ -25,7 +25,7 @@ module Nanoc::Int
25
25
 
26
26
  # @return [Boolean]
27
27
  attr_accessor :modified
28
- alias_method :modified?, :modified
28
+ alias modified? modified
29
29
 
30
30
  # @param [Nanoc::Int::Item] item
31
31
  #
@@ -82,7 +82,7 @@ module Nanoc::Int
82
82
  when :pre
83
83
  snapshot_def.nil? || !snapshot_def.final?
84
84
  end
85
- is_usable_snapshot = @snapshot_contents[snapshot_name] && (self.compiled? || !is_still_moving)
85
+ is_usable_snapshot = @snapshot_contents[snapshot_name] && (compiled? || !is_still_moving)
86
86
  unless is_usable_snapshot
87
87
  raise Nanoc::Int::Errors::UnmetDependency.new(self)
88
88
  end
@@ -99,7 +99,7 @@ module Nanoc::Int
99
99
  def snapshot?(snapshot_name)
100
100
  !@snapshot_contents[snapshot_name].nil?
101
101
  end
102
- alias_method :has_snapshot?, :snapshot?
102
+ alias has_snapshot? snapshot?
103
103
 
104
104
  # Returns the item rep’s raw path. It includes the path to the output
105
105
  # directory and the full filename.
@@ -145,7 +145,7 @@ module Nanoc::Int
145
145
  end
146
146
 
147
147
  def inspect
148
- "<#{self.class} name=\"#{name}\" binary=#{self.binary?} raw_path=\"#{raw_path}\" item.identifier=\"#{item.identifier}\">"
148
+ "<#{self.class} name=\"#{name}\" binary=#{binary?} raw_path=\"#{raw_path}\" item.identifier=\"#{item.identifier}\">"
149
149
  end
150
150
 
151
151
  private
@@ -12,7 +12,7 @@ module Nanoc::Int
12
12
  format(
13
13
  '<%s %s>',
14
14
  self.class.to_s,
15
- serialize[1..-1].map(&:inspect).join(', ')
15
+ serialize[1..-1].map(&:inspect).join(', '),
16
16
  )
17
17
  end
18
18
  end
@@ -7,7 +7,7 @@ module Nanoc::Int::RuleMemoryActions
7
7
  attr_reader :snapshot_name
8
8
  attr_reader :final
9
9
  attr_reader :path
10
- alias_method :final?, :final
10
+ alias final? final
11
11
 
12
12
  def initialize(snapshot_name, final, path)
13
13
  @snapshot_name = snapshot_name
@@ -41,9 +41,10 @@ module Nanoc::Int
41
41
  #
42
42
  # @return [void]
43
43
  def freeze
44
- config.__nanoc_freeze_recursively
45
- items.each(&:freeze)
46
- layouts.each(&:freeze)
44
+ config.freeze
45
+ items.freeze
46
+ layouts.freeze
47
+ code_snippets.__nanoc_freeze_recursively
47
48
  end
48
49
 
49
50
  def ensure_identifier_uniqueness(objects, type)
@@ -12,6 +12,11 @@ module Nanoc::Int
12
12
  site_from_config(Nanoc::Int::ConfigLoader.new.new_from_cwd)
13
13
  end
14
14
 
15
+ # @return [Boolean]
16
+ def self.cwd_is_nanoc_site?
17
+ Nanoc::Int::ConfigLoader.cwd_is_nanoc_site?
18
+ end
19
+
15
20
  private
16
21
 
17
22
  def site_from_config(config)
@@ -42,11 +47,6 @@ module Nanoc::Int
42
47
  )
43
48
  end
44
49
 
45
- # @return [Boolean]
46
- def self.cwd_is_nanoc_site?
47
- Nanoc::Int::ConfigLoader.cwd_is_nanoc_site?
48
- end
49
-
50
50
  def with_data_sources(config, &_block)
51
51
  data_sources = create_data_sources(config)
52
52
 
@@ -34,11 +34,12 @@ module Nanoc
34
34
  last = rep.snapshot_contents[:last]
35
35
  source = rep.binary? ? last.filename : last.string
36
36
  result = filter.setup_and_run(source, filter_args)
37
- if klass.to_binary?
38
- rep.snapshot_contents[:last] = Nanoc::Int::BinaryContent.new(filter.output_filename).tap(&:freeze)
39
- else
40
- rep.snapshot_contents[:last] = Nanoc::Int::TextualContent.new(result).tap(&:freeze)
41
- end
37
+ rep.snapshot_contents[:last] =
38
+ if klass.to_binary?
39
+ Nanoc::Int::BinaryContent.new(filter.output_filename).tap(&:freeze)
40
+ else
41
+ Nanoc::Int::TextualContent.new(result).tap(&:freeze)
42
+ end
42
43
 
43
44
  # Check whether file was written
44
45
  if klass.to_binary? && !File.file?(filter.output_filename)