nanoc 4.11.2 → 4.11.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/NEWS.md +15 -8
  3. data/README.md +1 -1
  4. data/lib/nanoc.rb +4 -1
  5. data/lib/nanoc/base/entities.rb +0 -2
  6. data/lib/nanoc/base/entities/site.rb +8 -1
  7. data/lib/nanoc/base/errors.rb +0 -19
  8. data/lib/nanoc/base/services.rb +0 -3
  9. data/lib/nanoc/base/services/compiler/stage.rb +1 -1
  10. data/lib/nanoc/base/services/compiler/stages/calculate_checksums.rb +1 -1
  11. data/lib/nanoc/base/services/compiler/stages/load_stores.rb +1 -1
  12. data/lib/nanoc/base/services/compiler/stages/store_pre_compilation_state.rb +1 -1
  13. data/lib/nanoc/base/services/compiler_loader.rb +1 -1
  14. data/lib/nanoc/base/services/executor.rb +1 -1
  15. data/lib/nanoc/base/services/item_rep_builder.rb +22 -1
  16. data/lib/nanoc/base/services/outdatedness_checker.rb +2 -2
  17. data/lib/nanoc/base/services/outdatedness_rule.rb +1 -1
  18. data/lib/nanoc/checking/check.rb +1 -1
  19. data/lib/nanoc/checking/checks/external_links.rb +5 -0
  20. data/lib/nanoc/cli/commands/compile_listeners/diff_generator.rb +2 -8
  21. data/lib/nanoc/cli/commands/create-site.rb +3 -3
  22. data/lib/nanoc/cli/commands/shell.rb +1 -1
  23. data/lib/nanoc/cli/commands/show-rules.rb +1 -1
  24. data/lib/nanoc/deploying/deployers.rb +2 -0
  25. data/lib/nanoc/deploying/deployers/git.rb +8 -16
  26. data/lib/nanoc/deploying/deployers/rsync.rb +1 -2
  27. data/lib/nanoc/extra.rb +0 -1
  28. data/lib/nanoc/filters/asciidoc.rb +1 -5
  29. data/lib/nanoc/filters/colorize_syntax/colorizers.rb +3 -14
  30. data/lib/nanoc/filters/kramdown.rb +1 -1
  31. data/lib/nanoc/filters/mustache.rb +1 -1
  32. data/lib/nanoc/filters/rainpress.rb +1 -1
  33. data/lib/nanoc/filters/rdiscount.rb +1 -1
  34. data/lib/nanoc/helpers/blogging.rb +4 -4
  35. data/lib/nanoc/helpers/breadcrumbs.rb +2 -2
  36. data/lib/nanoc/helpers/capturing.rb +1 -1
  37. data/lib/nanoc/helpers/child_parent.rb +1 -1
  38. data/lib/nanoc/helpers/filtering.rb +1 -1
  39. data/lib/nanoc/helpers/html_escape.rb +1 -1
  40. data/lib/nanoc/helpers/link_to.rb +1 -1
  41. data/lib/nanoc/helpers/rendering.rb +1 -1
  42. data/lib/nanoc/helpers/tagging.rb +1 -1
  43. data/lib/nanoc/helpers/text.rb +1 -1
  44. data/lib/nanoc/helpers/xml_sitemap.rb +1 -1
  45. data/lib/nanoc/rule_dsl/action_provider.rb +1 -1
  46. data/lib/nanoc/rule_dsl/action_recorder.rb +2 -2
  47. data/lib/nanoc/rule_dsl/action_sequence_calculator.rb +4 -4
  48. data/lib/nanoc/spec.rb +2 -7
  49. data/lib/nanoc/version.rb +1 -1
  50. metadata +62 -12
  51. data/lib/nanoc/base/entities/action_sequence.rb +0 -80
  52. data/lib/nanoc/base/entities/checksum_collection.rb +0 -34
  53. data/lib/nanoc/base/services/action_provider.rb +0 -34
  54. data/lib/nanoc/base/services/action_sequence_builder.rb +0 -55
  55. data/lib/nanoc/base/services/instrumentor.rb +0 -17
  56. data/lib/nanoc/extra/piper.rb +0 -47
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c038b8ba7dfde390ca7151a64421060d91173371c080b1de0e8cf2b44cea073f
4
- data.tar.gz: aef94fe2c56a0c01506d933fe68497b9e930b8b3b81933f5140dc15b9307b024
3
+ metadata.gz: 7e5efc6d26dd09a85227e75e05633aa88a5af1fad6a141831e7958d22777c457
4
+ data.tar.gz: 53db1fb790e25df48988c9aa3c4ce08806bfd6e57217ffb44c6d35cabf6626d5
5
5
  SHA512:
6
- metadata.gz: a9687e4103a49256b1065f92107f0659f204e5b65b975af71f0240f9eb2857086b096081282a3038a25e1595a7af5c18077b44fbe4c6ce0ed388eca142369eae
7
- data.tar.gz: ed741694c5373b8d8770211695dd7e6a53e2fe393ed1dfd96a6464e2ffd030e754a6c4e7eeb0cc04e0fe26bc09e4395849071967c8d0e0539a91affe01302fa3
6
+ metadata.gz: 84eada303df7cef2126c6cf0c655e4bb1053ea50162827bf14f21b308e72ab4107e90c39530c73414db9c8bf0ec2ef5d46bb872dcc650f2bef337db59ffae6fd
7
+ data.tar.gz: 4db294481349814d49966c8612e780a9a789dc2c1cf74a0b92ffe9cafa42ad3db0fd3403f090043bef806d7778e33639efa64efe98af1d221b894020cd3225d9
data/NEWS.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Nanoc news
2
2
 
3
+ ## 4.11.3 (2019-04-27)
4
+
5
+ Enhancements:
6
+
7
+ * Set a User-Agent for HTTP requests made by the `external_links` check (#1417) [Daniel Aleksandersen]
8
+ * Added `atom:link[type]` attributes (#1415) [Daniel Aleksandersen]
9
+
3
10
  ## 4.11.2 (2019-02-16)
4
11
 
5
12
  Fixes:
@@ -1013,11 +1020,11 @@ Enhancements:
1013
1020
 
1014
1021
  * Added several convenience methods to view classes (#570, #572)
1015
1022
 
1016
- See the [nanoc 4 upgrade guide](http://nanoc.ws/doc/nanoc-4-upgrade-guide/) for details.
1023
+ See the [nanoc 4 upgrade guide](https://nanoc.ws/doc/nanoc-4-upgrade-guide/) for details.
1017
1024
 
1018
1025
  ## 4.0.0a1 (2015-05-09)
1019
1026
 
1020
- This is a major upgrade. For details on upgrading, see the [nanoc 4 upgrade guide](http://nanoc.ws/doc/nanoc-4-upgrade-guide/).
1027
+ This is a major upgrade. For details on upgrading, see the [nanoc 4 upgrade guide](https://nanoc.ws/doc/nanoc-4-upgrade-guide/).
1021
1028
 
1022
1029
  This release provides no new features, but streamlines the API and functionality, in order to easen future development, both for features and for optimisations.
1023
1030
 
@@ -1183,7 +1190,7 @@ Enhancements:
1183
1190
 
1184
1191
  * Reduced number of dependencies generated by Sass filter (#306) [Gregory Pakosz]
1185
1192
  * Recognised lowercase `utf` in language value (e.g. `en_US.utf8`) as being UTF-8 (#335, #338)
1186
- * Set [Thin](http://code.macournoyer.com/thin/) as the default server for `nanoc view` (#342, #345)
1193
+ * Set [Thin](https://github.com/macournoyer/thin) as the default server for `nanoc view` (#342, #345)
1187
1194
  * Removed watcher section from the default configuration file (#343, #344)
1188
1195
 
1189
1196
  Fixes:
@@ -1201,7 +1208,7 @@ Fixes:
1201
1208
 
1202
1209
  Enhancements:
1203
1210
 
1204
- * Deprecated `watch` and `autocompile` commands in favour of [`guard-nanoc`](https://github.com/nanoc/guard-nanoc)
1211
+ * Deprecated `watch` and `autocompile` commands in favour of [`guard-nanoc`](https://github.com/guard/guard-nanoc)
1205
1212
 
1206
1213
  Fixes:
1207
1214
 
@@ -1548,7 +1555,7 @@ New:
1548
1555
  * A new “+” wildcard in rule patterns that matches one or more characters
1549
1556
  * A `view` command that starts a web server in the output directory
1550
1557
  * A `debug` command that shows information about the items, reps and layouts
1551
- * A `kramdown` filter ([kramdown site](http://kramdown.gettalong.org/))
1558
+ * A `kramdown` filter ([kramdown site](https://kramdown.gettalong.org/))
1552
1559
  * A diff between the previously compiled content and the last compiled content is now written to `output.diff` if the `enable_output_diff` site configuration attribute is true
1553
1560
  * Assigns, such as `@items`, `@layouts`, `@item`, … are accessible without `@`
1554
1561
  * Support for binary items
@@ -1676,7 +1683,7 @@ New:
1676
1683
  * `--no-color` command-line option
1677
1684
  * `Filtering` helper
1678
1685
  * `#relative_path_to` function in `LinkTo` helper
1679
- * `rainpress` filter ([Rainpress site](http://code.google.com/p/rainpress/))
1686
+ * `rainpress` filter ([Rainpress site](https://github.com/ddfreyne/rainpress))
1680
1687
  * `relativize_paths` filter
1681
1688
  * The current layout is now accessible through the `@layout` variable
1682
1689
  * Much more informative stack traces when something goes wrong
@@ -1730,12 +1737,12 @@ Removed:
1730
1737
  ## 2.1 (2008-08-17)
1731
1738
 
1732
1739
  This is only a short summary of all changes in 2.1. For details, see the
1733
- [nanoc web site](http://nanoc.stoneship.org/). Especially the blog and the
1740
+ [nanoc web site](https://nanoc.ws/). Especially the blog and the
1734
1741
  updated manual will be useful.
1735
1742
 
1736
1743
  New:
1737
1744
 
1738
- * New `rdiscount` filter ([RDiscount site](http://github.com/rtomayko/rdiscount))
1745
+ * New `rdiscount` filter ([RDiscount site](https://github.com/davidfstr/rdiscount))
1739
1746
  * New `maruku` filter ([Maruku site](https://github.com/bhollis/maruku/))
1740
1747
  * New `erubis` filter ([Erubis site](http://www.kuwata-lab.com/erubis/))
1741
1748
  * A better command-line frontend
data/README.md CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  # Nanoc
4
4
 
5
- Nanoc is a flexible static-site generator written in Ruby. See the [Nanoc web site](http://nanoc.ws) for more information.
5
+ Nanoc is a flexible static-site generator written in Ruby. See the [Nanoc web site](https://nanoc.ws) for more information.
@@ -21,7 +21,7 @@ module Nanoc
21
21
  #
22
22
  # @api private
23
23
  def self.on_windows?
24
- RUBY_PLATFORM =~ /windows|bccwin|cygwin|djgpp|mingw|mswin|wince/i
24
+ @_on_windows ||= TTY::Platform.new.windows?
25
25
  end
26
26
 
27
27
  # Similar to `nil` except that it can only be compared against using
@@ -53,6 +53,9 @@ require 'time'
53
53
  require 'timeout'
54
54
  require 'tomlrb'
55
55
  require 'tmpdir'
56
+ require 'tty-file'
57
+ require 'tty-platform'
58
+ require 'tty-which'
56
59
  require 'uri'
57
60
  require 'yaml'
58
61
 
@@ -4,10 +4,8 @@
4
4
  Nanoc::Identifier = Nanoc::Core::Identifier
5
5
 
6
6
  require_relative 'entities/props'
7
- require_relative 'entities/action_sequence'
8
7
  require_relative 'entities/site'
9
8
 
10
- require_relative 'entities/checksum_collection'
11
9
  require_relative 'entities/outdatedness_status'
12
10
  require_relative 'entities/outdatedness_reasons'
13
11
  require_relative 'entities/dependency'
@@ -4,6 +4,13 @@ module Nanoc
4
4
  module Int
5
5
  # @api private
6
6
  class Site
7
+ # Error that is raised when multiple items or layouts with the same identifier exist.
8
+ class DuplicateIdentifierError < ::Nanoc::Error
9
+ def initialize(identifier, type)
10
+ super("There are multiple #{type}s with the #{identifier} identifier.")
11
+ end
12
+ end
13
+
7
14
  include Nanoc::Core::ContractsSupport
8
15
 
9
16
  attr_reader :code_snippets
@@ -52,7 +59,7 @@ module Nanoc
52
59
  seen = Set.new
53
60
  objects.each do |obj|
54
61
  if seen.include?(obj.identifier)
55
- raise Nanoc::Int::Errors::DuplicateIdentifier.new(obj.identifier, type)
62
+ raise DuplicateIdentifierError.new(obj.identifier, type)
56
63
  end
57
64
 
58
65
  seen << obj.identifier
@@ -180,18 +180,6 @@ module Nanoc
180
180
  end
181
181
  end
182
182
 
183
- # Error that is raised when a snapshot with an existing name is made.
184
- class CannotCreateMultipleSnapshotsWithSameName < Generic
185
- # @param [Nanoc::Core::ItemRep] rep The item representation for which a
186
- # snapshot was attempted to be made
187
- #
188
- # @param [Symbol] snapshot The name of the snapshot that was attempted to
189
- # be made
190
- def initialize(rep, snapshot)
191
- super("Attempted to create a snapshot with a duplicate name #{snapshot.inspect} for the item rep #{rep}")
192
- end
193
- end
194
-
195
183
  # Error that is raised when the compiled content of a binary item is attempted to be accessed.
196
184
  class CannotGetCompiledContentOfBinaryItem < Generic
197
185
  # @param [Nanoc::Core::ItemRep] rep The binary item representation whose compiled content was attempted to be accessed
@@ -200,13 +188,6 @@ module Nanoc
200
188
  end
201
189
  end
202
190
 
203
- # Error that is raised when multiple items or layouts with the same identifier exist.
204
- class DuplicateIdentifier < Generic
205
- def initialize(identifier, type)
206
- super("There are multiple #{type}s with the #{identifier} identifier.")
207
- end
208
- end
209
-
210
191
  # Error that is raised when attempting to call #parent or #children on an item with a legacy identifier.
211
192
  class CannotGetParentOrChildrenOfNonLegacyItem < Generic
212
193
  def initialize(identifier)
@@ -1,14 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'services/action_provider'
4
- require_relative 'services/action_sequence_builder'
5
3
  require_relative 'services/compilation_context'
6
4
  require_relative 'services/compiler'
7
5
  require_relative 'services/compiler_loader'
8
6
  require_relative 'services/dependency_tracker'
9
7
  require_relative 'services/executor'
10
8
  require_relative 'services/filter'
11
- require_relative 'services/instrumentor'
12
9
  require_relative 'services/item_rep_builder'
13
10
  require_relative 'services/item_rep_router'
14
11
  require_relative 'services/item_rep_selector'
@@ -6,7 +6,7 @@ module Nanoc
6
6
  class Stage
7
7
  def call(*args)
8
8
  notify(:stage_started)
9
- res = Nanoc::Int::Instrumentor.call(:stage_ran, self.class) do
9
+ res = Nanoc::Core::Instrumentor.call(:stage_ran, self.class) do
10
10
  run(*args)
11
11
  end
12
12
  notify(:stage_ended)
@@ -35,7 +35,7 @@ module Nanoc
35
35
  checksums[[@config.reference, :each_attribute]] =
36
36
  Nanoc::Core::Checksummer.calc_for_each_attribute_of(@config)
37
37
 
38
- Nanoc::Int::ChecksumCollection.new(checksums)
38
+ Nanoc::Core::ChecksumCollection.new(checksums)
39
39
  end
40
40
  end
41
41
  end
@@ -26,7 +26,7 @@ module Nanoc
26
26
 
27
27
  contract Nanoc::Int::Store => C::Any
28
28
  def load_store(store)
29
- Nanoc::Int::Instrumentor.call(:store_loaded, store.class) do
29
+ Nanoc::Core::Instrumentor.call(:store_loaded, store.class) do
30
30
  store.load
31
31
  end
32
32
  end
@@ -15,7 +15,7 @@ module Nanoc
15
15
  @action_sequences = action_sequences
16
16
  end
17
17
 
18
- contract Nanoc::Int::ChecksumCollection => C::Any
18
+ contract Nanoc::Core::ChecksumCollection => C::Any
19
19
  def run(checksums)
20
20
  # Calculate action sequence
21
21
  (@reps.to_a + @layouts.to_a).each do |obj|
@@ -15,7 +15,7 @@ module Nanoc
15
15
  checksum_store =
16
16
  Nanoc::Int::ChecksumStore.new(config: site.config, objects: objects)
17
17
 
18
- action_provider ||= Nanoc::Int::ActionProvider.named(site.config.action_provider).for(site)
18
+ action_provider ||= Nanoc::Core::ActionProvider.named(site.config.action_provider).for(site)
19
19
 
20
20
  outdatedness_store =
21
21
  Nanoc::Int::OutdatednessStore.new(config: site.config)
@@ -38,7 +38,7 @@ module Nanoc
38
38
  layout = find_layout(layout_identifier)
39
39
  filter_name, filter_args = *@compilation_context.filter_name_and_args_for_layout(layout)
40
40
  if filter_name.nil?
41
- raise Nanoc::Int::Errors::Generic, "Cannot find rule for layout matching #{layout_identifier}"
41
+ raise ::Nanoc::Core::Error, "Cannot find rule for layout matching #{layout_identifier}"
42
42
  end
43
43
 
44
44
  filter_args = filter_args.merge(extra_filter_args || {})
@@ -4,6 +4,8 @@ module Nanoc
4
4
  module Int
5
5
  # @api private
6
6
  class ItemRepBuilder
7
+ include Nanoc::Core::ContractsSupport
8
+
7
9
  attr_reader :reps
8
10
 
9
11
  def initialize(site, action_provider, reps)
@@ -22,11 +24,30 @@ module Nanoc
22
24
  action_sequences = Nanoc::Int::ItemRepRouter.new(@reps, @action_provider, @site).run
23
25
 
24
26
  @reps.each do |rep|
25
- rep.snapshot_defs = action_sequences[rep].snapshots_defs
27
+ rep.snapshot_defs = self.class.snapshot_defs_for(action_sequences[rep])
26
28
  end
27
29
 
28
30
  action_sequences
29
31
  end
32
+
33
+ contract Nanoc::Core::ActionSequence => C::ArrayOf[Nanoc::Core::SnapshotDef]
34
+ def self.snapshot_defs_for(action_sequence)
35
+ is_binary = action_sequence.item_rep.item.content.binary?
36
+ snapshot_defs = []
37
+
38
+ action_sequence.each do |action|
39
+ case action
40
+ when Nanoc::Core::ProcessingActions::Snapshot
41
+ action.snapshot_names.each do |snapshot_name|
42
+ snapshot_defs << Nanoc::Core::SnapshotDef.new(snapshot_name, binary: is_binary)
43
+ end
44
+ when Nanoc::Core::ProcessingActions::Filter
45
+ is_binary = Nanoc::Filter.named!(action.filter_name).to_binary?
46
+ end
47
+ end
48
+
49
+ snapshot_defs
50
+ end
30
51
  end
31
52
  end
32
53
  end
@@ -113,9 +113,9 @@ module Nanoc
113
113
 
114
114
  C_OBJ = C::Or[Nanoc::Core::Item, Nanoc::Core::ItemRep, Nanoc::Core::Configuration, Nanoc::Core::Layout, Nanoc::Core::ItemCollection]
115
115
  C_ITEM_OR_REP = C::Or[Nanoc::Core::Item, Nanoc::Core::ItemRep]
116
- C_ACTION_SEQUENCES = C::HashOf[C_OBJ => Nanoc::Int::ActionSequence]
116
+ C_ACTION_SEQUENCES = C::HashOf[C_OBJ => Nanoc::Core::ActionSequence]
117
117
 
118
- contract C::KeywordArgs[site: Nanoc::Int::Site, checksum_store: Nanoc::Int::ChecksumStore, checksums: Nanoc::Int::ChecksumCollection, dependency_store: Nanoc::Int::DependencyStore, action_sequence_store: Nanoc::Int::ActionSequenceStore, action_sequences: C_ACTION_SEQUENCES, reps: Nanoc::Int::ItemRepRepo] => C::Any
118
+ contract C::KeywordArgs[site: Nanoc::Int::Site, checksum_store: Nanoc::Int::ChecksumStore, checksums: Nanoc::Core::ChecksumCollection, dependency_store: Nanoc::Int::DependencyStore, action_sequence_store: Nanoc::Int::ActionSequenceStore, action_sequences: C_ACTION_SEQUENCES, reps: Nanoc::Int::ItemRepRepo] => C::Any
119
119
  def initialize(site:, checksum_store:, checksums:, dependency_store:, action_sequence_store:, action_sequences:, reps:)
120
120
  @site = site
121
121
  @checksum_store = checksum_store
@@ -8,7 +8,7 @@ module Nanoc
8
8
  include Singleton
9
9
 
10
10
  def call(obj, outdatedness_checker)
11
- Nanoc::Int::Instrumentor.call(:outdatedness_rule_ran, self.class) do
11
+ Nanoc::Core::Instrumentor.call(:outdatedness_rule_ran, self.class) do
12
12
  apply(obj, outdatedness_checker)
13
13
  end
14
14
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Nanoc::Checking
4
4
  # @api private
5
- class OutputDirNotFoundError < Nanoc::Int::Errors::Generic
5
+ class OutputDirNotFoundError < ::Nanoc::Core::Error
6
6
  def initialize(directory_path)
7
7
  super("Unable to run check against output directory at “#{directory_path}”: directory does not exist.")
8
8
  end
@@ -77,6 +77,10 @@ module ::Nanoc::Checking::Checks
77
77
  location = extract_location(res, url)
78
78
  return Result.new(href, 'redirection without a target location') if location.nil?
79
79
 
80
+ if /^30[18]$/.match?(res.code)
81
+ return Result.new(href, "link have moved permanently to '#{location}'")
82
+ end
83
+
80
84
  url = URI.parse(location)
81
85
  elsif res.code == '200'
82
86
  return nil
@@ -125,6 +129,7 @@ module ::Nanoc::Checking::Checks
125
129
 
126
130
  def request_url_once(url)
127
131
  req = Net::HTTP::Get.new(path_for_url(url))
132
+ req['User-Agent'] = "Mozilla/5.0 Nanoc/#{Nanoc::VERSION} (link rot checker)"
128
133
  http = Net::HTTP.new(url.host, url.port)
129
134
  if url.instance_of? URI::HTTPS
130
135
  http.use_ssl = true
@@ -55,9 +55,7 @@ module Nanoc::CLI::Commands::CompileListeners
55
55
  end
56
56
 
57
57
  # Generate diff
58
- diff = diff_strings(old_content, new_content)
59
- diff.sub!(/^--- .*/, '--- ' + path)
60
- diff.sub!(/^\+\+\+ .*/, '+++ ' + path)
58
+ diff = ['--- ' + path, '+++ ' + path, diff_strings(old_content, new_content)].join("\n")
61
59
 
62
60
  # Write diff
63
61
  @diff_lock.synchronize do
@@ -77,11 +75,7 @@ module Nanoc::CLI::Commands::CompileListeners
77
75
  new_file.flush
78
76
 
79
77
  # Diff
80
- cmd = ['diff', '-u', old_file.path, new_file.path]
81
- Open3.popen3(*cmd) do |_stdin, stdout, _stderr|
82
- result = stdout.read
83
- return (result == '' ? nil : result)
84
- end
78
+ TTY::File.diff_files(old_file.path, new_file.path, verbose: false)
85
79
  end
86
80
  end
87
81
  rescue Errno::ENOENT
@@ -201,14 +201,14 @@ module Nanoc::CLI::Commands
201
201
  <div id="sidebar">
202
202
  <h2>Documentation</h2>
203
203
  <ul>
204
- <li><a href="http://nanoc.ws/doc/">Documentation</a></li>
205
- <li><a href="http://nanoc.ws/doc/tutorial/">Tutorial</a></li>
204
+ <li><a href="https://nanoc.ws/doc/">Documentation</a></li>
205
+ <li><a href="https://nanoc.ws/doc/tutorial/">Tutorial</a></li>
206
206
  </ul>
207
207
  <h2>Community</h2>
208
208
  <ul>
209
209
  <li><a href="http://groups.google.com/group/nanoc/">Discussion group</a></li>
210
210
  <li><a href="https://gitter.im/nanoc/nanoc">Gitter channel</a></li>
211
- <li><a href="http://nanoc.ws/contributing/">Contributing</a></li>
211
+ <li><a href="https://nanoc.ws/contributing/">Contributing</a></li>
212
212
  </ul>
213
213
  </div>
214
214
  </body>
@@ -29,7 +29,7 @@ module Nanoc::CLI::Commands
29
29
 
30
30
  def self.reps_for(site)
31
31
  Nanoc::Int::ItemRepRepo.new.tap do |reps|
32
- action_provider = Nanoc::Int::ActionProvider.named(site.config.action_provider).for(site)
32
+ action_provider = Nanoc::Core::ActionProvider.named(site.config.action_provider).for(site)
33
33
  builder = Nanoc::Int::ItemRepBuilder.new(site, action_provider, reps)
34
34
  builder.run
35
35
  end
@@ -16,7 +16,7 @@ module Nanoc::CLI::Commands
16
16
  res = Nanoc::Int::Compiler.new_for(site).run_until_reps_built
17
17
  reps = res.fetch(:reps)
18
18
 
19
- action_provider = Nanoc::Int::ActionProvider.named(site.config.action_provider).for(site)
19
+ action_provider = Nanoc::Core::ActionProvider.named(site.config.action_provider).for(site)
20
20
  rules = action_provider.rules_collection
21
21
 
22
22
  items = site.items.sort_by(&:identifier)
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'tty-command'
4
+
3
5
  # @api private
4
6
  module Nanoc::Deploying::Deployers
5
7
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nanoc::Deploying::Deployers
4
- # A deployer that deploys a site using [Git](http://git-scm.com).
4
+ # A deployer that deploys a site using [Git](https://git-scm.com).
5
5
  #
6
6
  # @example A deployment configuration for GitHub Pages:
7
7
  #
@@ -16,7 +16,7 @@ module Nanoc::Deploying::Deployers
16
16
  identifier :git
17
17
 
18
18
  module Errors
19
- class Generic < ::Nanoc::Error
19
+ class Generic < ::Nanoc::Core::Error
20
20
  end
21
21
 
22
22
  class OutputDirDoesNotExist < Generic
@@ -64,7 +64,7 @@ module Nanoc::Deploying::Deployers
64
64
  if remote_is_name?(remote)
65
65
  begin
66
66
  run_cmd(%W[git config --get remote.#{remote}.url])
67
- rescue Nanoc::Extra::Piper::Error
67
+ rescue TTY::Command::ExitError
68
68
  raise Errors::RemoteDoesNotExist.new(remote)
69
69
  end
70
70
  end
@@ -72,7 +72,7 @@ module Nanoc::Deploying::Deployers
72
72
  # If the branch exists then switch to it, otherwise prompt the user to create one.
73
73
  begin
74
74
  run_cmd_unless_dry(%W[git checkout #{branch}])
75
- rescue Nanoc::Extra::Piper::Error
75
+ rescue TTY::Command::ExitError
76
76
  raise Errors::BranchDoesNotExist.new(branch)
77
77
  end
78
78
 
@@ -97,24 +97,16 @@ module Nanoc::Deploying::Deployers
97
97
  remote !~ /:\/\/|@.+:/
98
98
  end
99
99
 
100
- def run_cmd(cmd)
101
- piper = Nanoc::Extra::Piper.new(stdout: $stdout, stderr: $stderr)
102
- piper.run(cmd, nil)
100
+ def run_cmd(cmd, dry_run: false)
101
+ TTY::Command.new(printer: :null).run(*cmd, dry_run: dry_run)
103
102
  end
104
103
 
105
104
  def run_cmd_unless_dry(cmd)
106
- if dry_run
107
- puts cmd.join(' ')
108
- else
109
- run_cmd(cmd)
110
- end
105
+ run_cmd(cmd, dry_run: dry_run)
111
106
  end
112
107
 
113
108
  def clean_repo?
114
- stdout = StringIO.new
115
- piper = Nanoc::Extra::Piper.new(stdout: stdout, stderr: $stderr)
116
- piper.run(%w[git status --porcelain], nil)
117
- stdout.string.empty?
109
+ TTY::Command.new(printer: :null).run('git status --porcelain').out.empty?
118
110
  end
119
111
  end
120
112
  end