nanoc 3.6.7 → 3.6.8

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.
Files changed (144) hide show
  1. checksums.yaml +8 -8
  2. data/CONTRIBUTING.md +9 -13
  3. data/Gemfile +5 -1
  4. data/Gemfile.lock +70 -45
  5. data/NEWS.md +15 -1
  6. data/README.md +12 -119
  7. data/doc/yardoc_handlers/identifier.rb +34 -0
  8. data/lib/nanoc/base/compilation/checksum_store.rb +2 -2
  9. data/lib/nanoc/base/compilation/compiler.rb +3 -3
  10. data/lib/nanoc/base/compilation/compiler_dsl.rb +20 -15
  11. data/lib/nanoc/base/compilation/dependency_tracker.rb +4 -4
  12. data/lib/nanoc/base/compilation/filter.rb +5 -5
  13. data/lib/nanoc/base/compilation/item_rep_proxy.rb +2 -2
  14. data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +3 -3
  15. data/lib/nanoc/base/compilation/outdatedness_checker.rb +49 -46
  16. data/lib/nanoc/base/compilation/rule.rb +6 -4
  17. data/lib/nanoc/base/compilation/rule_context.rb +10 -4
  18. data/lib/nanoc/base/compilation/rule_memory_calculator.rb +8 -7
  19. data/lib/nanoc/base/compilation/rule_memory_store.rb +2 -2
  20. data/lib/nanoc/base/compilation/rules_collection.rb +2 -2
  21. data/lib/nanoc/base/core_ext/array.rb +2 -2
  22. data/lib/nanoc/base/core_ext/date.rb +4 -2
  23. data/lib/nanoc/base/core_ext/hash.rb +3 -3
  24. data/lib/nanoc/base/core_ext/pathname.rb +1 -1
  25. data/lib/nanoc/base/directed_graph.rb +6 -6
  26. data/lib/nanoc/base/errors.rb +1 -1
  27. data/lib/nanoc/base/memoization.rb +4 -4
  28. data/lib/nanoc/base/notification_center.rb +1 -1
  29. data/lib/nanoc/base/ordered_hash.rb +207 -179
  30. data/lib/nanoc/base/plugin_registry.rb +7 -7
  31. data/lib/nanoc/base/result_data/item_rep.rb +25 -26
  32. data/lib/nanoc/base/source_data/code_snippet.rb +2 -2
  33. data/lib/nanoc/base/source_data/configuration.rb +1 -1
  34. data/lib/nanoc/base/source_data/data_source.rb +2 -2
  35. data/lib/nanoc/base/source_data/item.rb +16 -15
  36. data/lib/nanoc/base/source_data/item_array.rb +4 -4
  37. data/lib/nanoc/base/source_data/layout.rb +5 -5
  38. data/lib/nanoc/base/source_data/site.rb +6 -6
  39. data/lib/nanoc/base/store.rb +8 -8
  40. data/lib/nanoc/cli/cleaning_stream.rb +11 -12
  41. data/lib/nanoc/cli/command_runner.rb +8 -8
  42. data/lib/nanoc/cli/commands/autocompile.rb +5 -4
  43. data/lib/nanoc/cli/commands/check.rb +12 -11
  44. data/lib/nanoc/cli/commands/compile.rb +50 -52
  45. data/lib/nanoc/cli/commands/create-item.rb +6 -6
  46. data/lib/nanoc/cli/commands/create-layout.rb +6 -6
  47. data/lib/nanoc/cli/commands/create-site.rb +10 -13
  48. data/lib/nanoc/cli/commands/deploy.rb +11 -11
  49. data/lib/nanoc/cli/commands/prune.rb +10 -10
  50. data/lib/nanoc/cli/commands/shell.rb +7 -7
  51. data/lib/nanoc/cli/commands/show-data.rb +22 -23
  52. data/lib/nanoc/cli/commands/show-plugins.rb +3 -3
  53. data/lib/nanoc/cli/commands/show-rules.rb +8 -8
  54. data/lib/nanoc/cli/commands/sync.rb +4 -2
  55. data/lib/nanoc/cli/commands/update.rb +4 -4
  56. data/lib/nanoc/cli/commands/validate-css.rb +3 -3
  57. data/lib/nanoc/cli/commands/validate-html.rb +3 -3
  58. data/lib/nanoc/cli/commands/validate-links.rb +3 -3
  59. data/lib/nanoc/cli/commands/view.rb +5 -3
  60. data/lib/nanoc/cli/commands/watch.rb +12 -12
  61. data/lib/nanoc/cli/error_handler.rb +58 -58
  62. data/lib/nanoc/cli/logger.rb +6 -6
  63. data/lib/nanoc/cli/stream_cleaners/abstract.rb +1 -1
  64. data/lib/nanoc/cli/stream_cleaners.rb +0 -1
  65. data/lib/nanoc/cli.rb +24 -22
  66. data/lib/nanoc/data_sources/deprecated/delicious.rb +1 -1
  67. data/lib/nanoc/data_sources/deprecated/last_fm.rb +16 -14
  68. data/lib/nanoc/data_sources/deprecated/twitter.rb +1 -1
  69. data/lib/nanoc/data_sources/filesystem.rb +22 -20
  70. data/lib/nanoc/data_sources/filesystem_unified.rb +4 -5
  71. data/lib/nanoc/data_sources/filesystem_verbose.rb +2 -3
  72. data/lib/nanoc/data_sources/static.rb +2 -2
  73. data/lib/nanoc/extra/auto_compiler.rb +3 -3
  74. data/lib/nanoc/extra/checking/check.rb +3 -3
  75. data/lib/nanoc/extra/checking/checks/css.rb +2 -2
  76. data/lib/nanoc/extra/checking/checks/external_links.rb +9 -9
  77. data/lib/nanoc/extra/checking/checks/html.rb +2 -3
  78. data/lib/nanoc/extra/checking/checks/internal_links.rb +6 -7
  79. data/lib/nanoc/extra/checking/checks/stale.rb +6 -6
  80. data/lib/nanoc/extra/checking/dsl.rb +1 -1
  81. data/lib/nanoc/extra/checking/runner.rb +19 -19
  82. data/lib/nanoc/extra/chick.rb +11 -9
  83. data/lib/nanoc/extra/core_ext/pathname.rb +1 -2
  84. data/lib/nanoc/extra/core_ext/time.rb +2 -2
  85. data/lib/nanoc/extra/core_ext.rb +0 -1
  86. data/lib/nanoc/extra/deployer.rb +2 -2
  87. data/lib/nanoc/extra/deployers/fog.rb +12 -12
  88. data/lib/nanoc/extra/deployers/rsync.rb +6 -6
  89. data/lib/nanoc/extra/file_proxy.rb +1 -1
  90. data/lib/nanoc/extra/filesystem_tools.rb +5 -5
  91. data/lib/nanoc/extra/link_collector.rb +4 -3
  92. data/lib/nanoc/extra/pruner.rb +5 -5
  93. data/lib/nanoc/extra/validators/links.rb +3 -3
  94. data/lib/nanoc/extra/vcs.rb +1 -1
  95. data/lib/nanoc/filters/asciidoc.rb +3 -3
  96. data/lib/nanoc/filters/bluecloth.rb +1 -1
  97. data/lib/nanoc/filters/coderay.rb +2 -2
  98. data/lib/nanoc/filters/coffeescript.rb +2 -0
  99. data/lib/nanoc/filters/colorize_syntax.rb +16 -16
  100. data/lib/nanoc/filters/erb.rb +5 -5
  101. data/lib/nanoc/filters/erubis.rb +1 -1
  102. data/lib/nanoc/filters/haml.rb +1 -1
  103. data/lib/nanoc/filters/handlebars.rb +2 -2
  104. data/lib/nanoc/filters/kramdown.rb +1 -1
  105. data/lib/nanoc/filters/less.rb +1 -1
  106. data/lib/nanoc/filters/markaby.rb +1 -1
  107. data/lib/nanoc/filters/maruku.rb +1 -1
  108. data/lib/nanoc/filters/mustache.rb +1 -1
  109. data/lib/nanoc/filters/pandoc.rb +1 -1
  110. data/lib/nanoc/filters/rainpress.rb +1 -1
  111. data/lib/nanoc/filters/rdiscount.rb +1 -1
  112. data/lib/nanoc/filters/rdoc.rb +1 -1
  113. data/lib/nanoc/filters/redcarpet.rb +2 -2
  114. data/lib/nanoc/filters/redcloth.rb +9 -9
  115. data/lib/nanoc/filters/relativize_paths.rb +7 -8
  116. data/lib/nanoc/filters/rubypants.rb +1 -1
  117. data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +1 -1
  118. data/lib/nanoc/filters/sass.rb +1 -1
  119. data/lib/nanoc/filters/slim.rb +1 -1
  120. data/lib/nanoc/filters/typogruby.rb +1 -1
  121. data/lib/nanoc/filters/uglify_js.rb +1 -1
  122. data/lib/nanoc/filters/xsl.rb +9 -7
  123. data/lib/nanoc/filters/yui_compressor.rb +2 -0
  124. data/lib/nanoc/helpers/blogging.rb +6 -6
  125. data/lib/nanoc/helpers/breadcrumbs.rb +1 -1
  126. data/lib/nanoc/helpers/capturing.rb +2 -2
  127. data/lib/nanoc/helpers/filtering.rb +1 -1
  128. data/lib/nanoc/helpers/html_escape.rb +3 -3
  129. data/lib/nanoc/helpers/link_to.rb +6 -6
  130. data/lib/nanoc/helpers/rendering.rb +2 -2
  131. data/lib/nanoc/helpers/tagging.rb +2 -2
  132. data/lib/nanoc/helpers/text.rb +1 -1
  133. data/lib/nanoc/helpers/xml_sitemap.rb +2 -2
  134. data/lib/nanoc/version.rb +1 -1
  135. data/lib/nanoc.rb +3 -2
  136. data/nanoc.gemspec +2 -6
  137. data/tasks/rubocop.rake +5 -0
  138. data/test/base/test_compiler_dsl.rb +20 -1
  139. data/test/cli/commands/test_compile.rb +4 -3
  140. data/test/cli/test_error_handler.rb +32 -0
  141. data/test/filters/test_erb.rb +1 -1
  142. data/test/filters/test_less.rb +1 -1
  143. data/test/filters/test_xsl.rb +95 -8
  144. metadata +30 -84
@@ -67,11 +67,11 @@ module Nanoc
67
67
  #
68
68
  # @option params [Symbol, nil] :binary (true) Whether or not this item is
69
69
  # binary
70
- def initialize(raw_content_or_raw_filename, attributes, identifier, params=nil)
70
+ def initialize(raw_content_or_raw_filename, attributes, identifier, params = nil)
71
71
  # Parse params
72
72
  params ||= {}
73
73
  params = { :mtime => params } if params.is_a?(Time)
74
- params[:binary] = false unless params.has_key?(:binary)
74
+ params[:binary] = false unless params.key?(:binary)
75
75
 
76
76
  if raw_content_or_raw_filename.nil?
77
77
  raise "attempted to create an item with no content/filename (identifier #{identifier})"
@@ -126,7 +126,7 @@ module Nanoc
126
126
  # snapshot if no snapshot is specified)
127
127
  #
128
128
  # @see ItemRep#compiled_content
129
- def compiled_content(params={})
129
+ def compiled_content(params = {})
130
130
  # Get rep
131
131
  rep_name = params[:rep] || :default
132
132
  rep = reps.find { |r| r.name == rep_name }
@@ -148,7 +148,7 @@ module Nanoc
148
148
  #
149
149
  # @return [String] The path of the given rep ( or the default rep if no
150
150
  # rep is specified)
151
- def path(params={})
151
+ def path(params = {})
152
152
  rep_name = params[:rep] || :default
153
153
 
154
154
  # Get rep
@@ -226,7 +226,7 @@ module Nanoc
226
226
  #
227
227
  # @return [Object] An unique reference to this object
228
228
  def reference
229
- [ type, self.identifier ]
229
+ [ type, identifier ]
230
230
  end
231
231
 
232
232
  # Prevents all further modifications to its attributes.
@@ -241,21 +241,22 @@ module Nanoc
241
241
  end
242
242
 
243
243
  def inspect
244
- "<#{self.class} identifier=\"#{self.identifier}\" binary?=#{self.binary?}>"
244
+ "<#{self.class} identifier=\"#{identifier}\" binary?=#{self.binary?}>"
245
245
  end
246
246
 
247
247
  # @return [String] The checksum for this object. If its contents change,
248
248
  # the checksum will change as well.
249
249
  def checksum
250
- content_checksum = if binary?
251
- if File.exist?(raw_filename)
252
- Pathname.new(raw_filename).checksum
250
+ content_checksum =
251
+ if binary?
252
+ if File.exist?(raw_filename)
253
+ Pathname.new(raw_filename).checksum
254
+ else
255
+ ''.checksum
256
+ end
253
257
  else
254
- ''.checksum
258
+ @raw_content.checksum
255
259
  end
256
- else
257
- @raw_content.checksum
258
- end
259
260
 
260
261
  attributes = @attributes.dup
261
262
  attributes.delete(:file)
@@ -266,11 +267,11 @@ module Nanoc
266
267
  memoize :checksum
267
268
 
268
269
  def hash
269
- self.class.hash ^ self.identifier.hash
270
+ self.class.hash ^ identifier.hash
270
271
  end
271
272
 
272
273
  def eql?(other)
273
- self.class == other.class && self.identifier == other.identifier
274
+ self.class == other.class && identifier == other.identifier
274
275
  end
275
276
 
276
277
  def ==(other)
@@ -27,13 +27,13 @@ module Nanoc
27
27
 
28
28
  def freeze
29
29
  @items.freeze
30
- self.build_mapping
30
+ build_mapping
31
31
  super
32
32
  end
33
33
 
34
34
  def [](*args)
35
35
  if 1 == args.size && args.first.is_a?(String)
36
- self.item_with_identifier(args.first)
36
+ item_with_identifier(args.first)
37
37
  else
38
38
  @items[*args]
39
39
  end
@@ -42,13 +42,13 @@ module Nanoc
42
42
 
43
43
  def at(arg)
44
44
  if arg.is_a?(String)
45
- self.item_with_identifier(arg)
45
+ item_with_identifier(arg)
46
46
  else
47
47
  @items[arg]
48
48
  end
49
49
  end
50
50
 
51
- protected
51
+ protected
52
52
 
53
53
  def item_with_identifier(identifier)
54
54
  if self.frozen?
@@ -33,7 +33,7 @@ module Nanoc
33
33
  # @option params [Time, nil] :mtime (nil) The time when this layout was
34
34
  # last modified. Deprecated; pass the modification time as the `:mtime`
35
35
  # attribute instead.
36
- def initialize(raw_content, attributes, identifier, params=nil)
36
+ def initialize(raw_content, attributes, identifier, params = nil)
37
37
  @raw_content = raw_content
38
38
  @attributes = attributes.symbolize_keys_recursively
39
39
  @identifier = identifier.cleaned_identifier.freeze
@@ -78,11 +78,11 @@ module Nanoc
78
78
  #
79
79
  # @return [Object] An unique reference to this object
80
80
  def reference
81
- [ type, self.identifier ]
81
+ [ type, identifier ]
82
82
  end
83
83
 
84
84
  def inspect
85
- "<#{self.class} identifier=\"#{self.identifier}\">"
85
+ "<#{self.class} identifier=\"#{identifier}\">"
86
86
  end
87
87
 
88
88
  # @return [String] The checksum for this object. If its contents change,
@@ -95,11 +95,11 @@ module Nanoc
95
95
  memoize :checksum
96
96
 
97
97
  def hash
98
- self.class.hash ^ self.identifier.hash
98
+ self.class.hash ^ identifier.hash
99
99
  end
100
100
 
101
101
  def eql?(other)
102
- self.class == other.class && self.identifier == other.identifier
102
+ self.class == other.class && identifier == other.identifier
103
103
  end
104
104
 
105
105
  def ==(other)
@@ -86,10 +86,10 @@ module Nanoc
86
86
  # Warn about deprecated data sources
87
87
  # TODO [in nanoc 4.0] remove me
88
88
  case data_source_hash[:type]
89
- when 'filesystem'
90
- warn "Warning: the 'filesystem' data source has been renamed to 'filesystem_verbose'. Using 'filesystem' will work in nanoc 3.1.x, but it will likely not work anymore in a future release of nanoc. Please update your data source configuration and replace 'filesystem' with 'filesystem_verbose'."
91
- when 'filesystem_combined', 'filesystem_compact'
92
- warn "Warning: the 'filesystem_combined' and 'filesystem_compact' data source has been merged into the new 'filesystem_unified' data source. Using 'filesystem_combined' and 'filesystem_compact' will work in nanoc 3.1.x, but it will likely not work anymore in a future release of nanoc. Please update your data source configuration and replace 'filesystem_combined' and 'filesystem_compact with 'filesystem_unified'."
89
+ when 'filesystem'
90
+ warn "Warning: the 'filesystem' data source has been renamed to 'filesystem_verbose'. Using 'filesystem' will work in nanoc 3.1.x, but it will likely not work anymore in a future release of nanoc. Please update your data source configuration and replace 'filesystem' with 'filesystem_verbose'."
91
+ when 'filesystem_combined', 'filesystem_compact'
92
+ warn "Warning: the 'filesystem_combined' and 'filesystem_compact' data source has been merged into the new 'filesystem_unified' data source. Using 'filesystem_combined' and 'filesystem_compact' will work in nanoc 3.1.x, but it will likely not work anymore in a future release of nanoc. Please update your data source configuration and replace 'filesystem_combined' and 'filesystem_compact with 'filesystem_unified'."
93
93
  end
94
94
 
95
95
  # Create data source
@@ -223,7 +223,7 @@ module Nanoc
223
223
 
224
224
  # @deprecated It is no longer necessary to explicitly load site data. It
225
225
  # is safe to remove all {#load_data} calls.
226
- def load_data(force=false)
226
+ def load_data(force = false)
227
227
  warn 'It is no longer necessary to call Nanoc::Site#load_data. This method no longer has any effect. All calls to this method can be safely removed.'
228
228
  end
229
229
 
@@ -281,7 +281,7 @@ module Nanoc
281
281
  #
282
282
  # @api private
283
283
  def self.cwd_is_nanoc_site?
284
- !self.config_filename_for_cwd.nil?
284
+ !config_filename_for_cwd.nil?
285
285
  end
286
286
 
287
287
  # @return [String] filename of the nanoc config file in the current working directory, or nil if there is none
@@ -44,7 +44,7 @@ module Nanoc
44
44
  #
45
45
  # @abstract This method must be implemented by the subclass.
46
46
  def data
47
- raise NotImplementedError.new("Nanoc::Store subclasses must implement #data and #data=")
47
+ raise NotImplementedError.new('Nanoc::Store subclasses must implement #data and #data=')
48
48
  end
49
49
 
50
50
  # @param new_data The data that has been loaded from the disk
@@ -53,7 +53,7 @@ module Nanoc
53
53
  #
54
54
  # @return [void]
55
55
  def data=(new_data)
56
- raise NotImplementedError.new("Nanoc::Store subclasses must implement #data and #data=")
56
+ raise NotImplementedError.new('Nanoc::Store subclasses must implement #data and #data=')
57
57
  end
58
58
 
59
59
  # Loads the data from the filesystem into memory. This method will set the
@@ -67,7 +67,7 @@ module Nanoc
67
67
  end
68
68
 
69
69
  # Check file existance
70
- if !File.file?(self.filename)
70
+ if !File.file?(filename)
71
71
  no_data_found
72
72
  @loaded = true
73
73
  return
@@ -75,7 +75,7 @@ module Nanoc
75
75
 
76
76
  pstore.transaction do
77
77
  # Check version
78
- if pstore[:version] != self.version
78
+ if pstore[:version] != version
79
79
  version_mismatch_detected
80
80
  @loaded = true
81
81
  return
@@ -98,11 +98,11 @@ module Nanoc
98
98
  #
99
99
  # @return [void]
100
100
  def store
101
- FileUtils.mkdir_p(File.dirname(self.filename))
101
+ FileUtils.mkdir_p(File.dirname(filename))
102
102
 
103
103
  pstore.transaction do
104
- pstore[:data] = self.data
105
- pstore[:version] = self.version
104
+ pstore[:data] = data
105
+ pstore[:version] = version
106
106
  end
107
107
  end
108
108
 
@@ -127,7 +127,7 @@ module Nanoc
127
127
  private
128
128
 
129
129
  def pstore
130
- @pstore ||= PStore.new(self.filename)
130
+ @pstore ||= PStore.new(filename)
131
131
  end
132
132
 
133
133
  end
@@ -41,15 +41,15 @@ module Nanoc::CLI
41
41
 
42
42
  # @see IO#write
43
43
  def write(s)
44
- self._nanoc_swallow_broken_pipe_errors_while do
45
- @stream.write(self._nanoc_clean(s))
44
+ _nanoc_swallow_broken_pipe_errors_while do
45
+ @stream.write(_nanoc_clean(s))
46
46
  end
47
47
  end
48
48
 
49
49
  # @see IO#<<
50
50
  def <<(s)
51
- self._nanoc_swallow_broken_pipe_errors_while do
52
- @stream.<<(self._nanoc_clean(s))
51
+ _nanoc_swallow_broken_pipe_errors_while do
52
+ @stream.<<(_nanoc_clean(s))
53
53
  end
54
54
  end
55
55
 
@@ -60,7 +60,7 @@ module Nanoc::CLI
60
60
 
61
61
  # @see IO#flush
62
62
  def flush
63
- self._nanoc_swallow_broken_pipe_errors_while do
63
+ _nanoc_swallow_broken_pipe_errors_while do
64
64
  @stream.flush
65
65
  end
66
66
  end
@@ -72,15 +72,15 @@ module Nanoc::CLI
72
72
 
73
73
  # @see IO#print
74
74
  def print(s)
75
- self._nanoc_swallow_broken_pipe_errors_while do
76
- @stream.print(self._nanoc_clean(s))
75
+ _nanoc_swallow_broken_pipe_errors_while do
76
+ @stream.print(_nanoc_clean(s))
77
77
  end
78
78
  end
79
79
 
80
80
  # @see IO#puts
81
81
  def puts(*s)
82
- self._nanoc_swallow_broken_pipe_errors_while do
83
- @stream.puts(*s.map { |ss| self._nanoc_clean(ss) })
82
+ _nanoc_swallow_broken_pipe_errors_while do
83
+ @stream.puts(*s.map { |ss| _nanoc_clean(ss) })
84
84
  end
85
85
  end
86
86
 
@@ -116,13 +116,13 @@ module Nanoc::CLI
116
116
 
117
117
  # @see IO.winsize=
118
118
  def winsize=(arg)
119
- @stream.winsize=(arg)
119
+ @stream.winsize = (arg)
120
120
  end
121
121
 
122
122
  protected
123
123
 
124
124
  def _nanoc_clean(s)
125
- @stream_cleaners.inject(s) { |m,c| c.clean(m) }
125
+ @stream_cleaners.reduce(s) { |m, c| c.clean(m) }
126
126
  end
127
127
 
128
128
  def _nanoc_swallow_broken_pipe_errors_while
@@ -133,4 +133,3 @@ module Nanoc::CLI
133
133
  end
134
134
 
135
135
  end
136
-
@@ -11,7 +11,7 @@ module Nanoc::CLI
11
11
  # @return [void]
12
12
  def call
13
13
  Nanoc::CLI::ErrorHandler.handle_while(:command => self) do
14
- self.run
14
+ run
15
15
  end
16
16
  end
17
17
 
@@ -33,7 +33,7 @@ module Nanoc::CLI
33
33
  #
34
34
  # @see http://rubydoc.info/gems/cri/Cri/CommandDSL#runner-instance_method
35
35
  def self.call(opts, args, cmd)
36
- self.new(opts, args, cmd).call
36
+ new(opts, args, cmd).call
37
37
  end
38
38
 
39
39
  # @return [Boolean] true if the current working directory is a nanoc site
@@ -49,7 +49,7 @@ module Nanoc::CLI
49
49
  # @return [void]
50
50
  def require_site
51
51
  if site.nil?
52
- raise ::Nanoc::Errors::GenericTrivial, "The current working directory does not seem to be a nanoc site."
52
+ raise ::Nanoc::Errors::GenericTrivial, 'The current working directory does not seem to be a nanoc site.'
53
53
  end
54
54
  end
55
55
 
@@ -58,10 +58,10 @@ module Nanoc::CLI
58
58
  #
59
59
  # @return [void]
60
60
  def load_site
61
- self.require_site
62
- print "Loading site data… "
63
- self.site.load
64
- puts "done"
61
+ require_site
62
+ print 'Loading site data… '
63
+ site.load
64
+ puts 'done'
65
65
  end
66
66
 
67
67
  # @return [Boolean] true if debug output is enabled, false if not
@@ -101,7 +101,7 @@ module Nanoc::CLI
101
101
 
102
102
  # @return [Array] The compilation stack.
103
103
  def stack
104
- (self.site && self.site.compiler.stack) || []
104
+ (site && site.compiler.stack) || []
105
105
  end
106
106
 
107
107
  end
@@ -33,8 +33,8 @@ module Nanoc::CLI::Commands
33
33
  require 'rack'
34
34
 
35
35
  # Make sure we are in a nanoc site directory
36
- self.require_site
37
- autocompile_config = self.site.config[:autocompile] || {}
36
+ require_site
37
+ autocompile_config = site.config[:autocompile] || {}
38
38
 
39
39
  # Set options
40
40
  options_for_rack = {
@@ -44,10 +44,11 @@ module Nanoc::CLI::Commands
44
44
 
45
45
  # Guess which handler we should use
46
46
  handler_option = options[:handler] || autocompile_config[:handler]
47
- unless handler = Rack::Handler.get(handler_option)
47
+ handler = Rack::Handler.get(handler_option)
48
+ unless handler
48
49
  begin
49
50
  handler = Rack::Handler::Mongrel
50
- rescue LoadError => e
51
+ rescue LoadError
51
52
  handler = Rack::Handler::WEBrick
52
53
  end
53
54
  end
@@ -2,9 +2,9 @@
2
2
 
3
3
  usage 'check [options] [names]'
4
4
  summary 'run issue checks'
5
- description <<-EOS
5
+ description "
6
6
  Run issue checks on the current site. If the `--all` option is passed, all available issue checks will be run. If the `--deploy` option is passed, the issue checks marked for deployment will be run.
7
- EOS
7
+ "
8
8
 
9
9
  flag :a, :all, 'run all checks'
10
10
  flag :L, :list, 'list all checks'
@@ -16,7 +16,7 @@ module Nanoc::CLI::Commands
16
16
 
17
17
  def run
18
18
  validate_options_and_arguments
19
- self.require_site
19
+ require_site
20
20
 
21
21
  runner = Nanoc::Extra::Checking::Runner.new(site)
22
22
 
@@ -25,13 +25,14 @@ module Nanoc::CLI::Commands
25
25
  return
26
26
  end
27
27
 
28
- success = if options[:all]
29
- runner.run_all
30
- elsif options[:deploy]
31
- runner.run_for_deploy
32
- else
33
- runner.run_specific(arguments)
34
- end
28
+ success =
29
+ if options[:all]
30
+ runner.run_all
31
+ elsif options[:deploy]
32
+ runner.run_for_deploy
33
+ else
34
+ runner.run_specific(arguments)
35
+ end
35
36
 
36
37
  unless success
37
38
  raise Nanoc::Errors::GenericTrivial, 'One or more checks failed'
@@ -43,7 +44,7 @@ module Nanoc::CLI::Commands
43
44
  def validate_options_and_arguments
44
45
  if arguments.empty? && !options[:all] && !options[:deploy] && !options[:list]
45
46
  raise Nanoc::Errors::GenericTrivial,
46
- "nothing to do (pass either --all, --deploy or --list or a list of checks)"
47
+ 'nothing to do (pass either --all, --deploy or --list or a list of checks)'
47
48
  end
48
49
  end
49
50