nanoc 4.11.2 → 4.11.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +15 -8
- data/README.md +1 -1
- data/lib/nanoc.rb +4 -1
- data/lib/nanoc/base/entities.rb +0 -2
- data/lib/nanoc/base/entities/site.rb +8 -1
- data/lib/nanoc/base/errors.rb +0 -19
- data/lib/nanoc/base/services.rb +0 -3
- data/lib/nanoc/base/services/compiler/stage.rb +1 -1
- data/lib/nanoc/base/services/compiler/stages/calculate_checksums.rb +1 -1
- data/lib/nanoc/base/services/compiler/stages/load_stores.rb +1 -1
- data/lib/nanoc/base/services/compiler/stages/store_pre_compilation_state.rb +1 -1
- data/lib/nanoc/base/services/compiler_loader.rb +1 -1
- data/lib/nanoc/base/services/executor.rb +1 -1
- data/lib/nanoc/base/services/item_rep_builder.rb +22 -1
- data/lib/nanoc/base/services/outdatedness_checker.rb +2 -2
- data/lib/nanoc/base/services/outdatedness_rule.rb +1 -1
- data/lib/nanoc/checking/check.rb +1 -1
- data/lib/nanoc/checking/checks/external_links.rb +5 -0
- data/lib/nanoc/cli/commands/compile_listeners/diff_generator.rb +2 -8
- data/lib/nanoc/cli/commands/create-site.rb +3 -3
- data/lib/nanoc/cli/commands/shell.rb +1 -1
- data/lib/nanoc/cli/commands/show-rules.rb +1 -1
- data/lib/nanoc/deploying/deployers.rb +2 -0
- data/lib/nanoc/deploying/deployers/git.rb +8 -16
- data/lib/nanoc/deploying/deployers/rsync.rb +1 -2
- data/lib/nanoc/extra.rb +0 -1
- data/lib/nanoc/filters/asciidoc.rb +1 -5
- data/lib/nanoc/filters/colorize_syntax/colorizers.rb +3 -14
- data/lib/nanoc/filters/kramdown.rb +1 -1
- data/lib/nanoc/filters/mustache.rb +1 -1
- data/lib/nanoc/filters/rainpress.rb +1 -1
- data/lib/nanoc/filters/rdiscount.rb +1 -1
- data/lib/nanoc/helpers/blogging.rb +4 -4
- data/lib/nanoc/helpers/breadcrumbs.rb +2 -2
- data/lib/nanoc/helpers/capturing.rb +1 -1
- data/lib/nanoc/helpers/child_parent.rb +1 -1
- data/lib/nanoc/helpers/filtering.rb +1 -1
- data/lib/nanoc/helpers/html_escape.rb +1 -1
- data/lib/nanoc/helpers/link_to.rb +1 -1
- data/lib/nanoc/helpers/rendering.rb +1 -1
- data/lib/nanoc/helpers/tagging.rb +1 -1
- data/lib/nanoc/helpers/text.rb +1 -1
- data/lib/nanoc/helpers/xml_sitemap.rb +1 -1
- data/lib/nanoc/rule_dsl/action_provider.rb +1 -1
- data/lib/nanoc/rule_dsl/action_recorder.rb +2 -2
- data/lib/nanoc/rule_dsl/action_sequence_calculator.rb +4 -4
- data/lib/nanoc/spec.rb +2 -7
- data/lib/nanoc/version.rb +1 -1
- metadata +62 -12
- data/lib/nanoc/base/entities/action_sequence.rb +0 -80
- data/lib/nanoc/base/entities/checksum_collection.rb +0 -34
- data/lib/nanoc/base/services/action_provider.rb +0 -34
- data/lib/nanoc/base/services/action_sequence_builder.rb +0 -55
- data/lib/nanoc/base/services/instrumentor.rb +0 -17
- data/lib/nanoc/extra/piper.rb +0 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e5efc6d26dd09a85227e75e05633aa88a5af1fad6a141831e7958d22777c457
|
4
|
+
data.tar.gz: 53db1fb790e25df48988c9aa3c4ce08806bfd6e57217ffb44c6d35cabf6626d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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](
|
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](
|
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](
|
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/
|
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](
|
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](
|
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](
|
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](
|
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
data/lib/nanoc.rb
CHANGED
@@ -21,7 +21,7 @@ module Nanoc
|
|
21
21
|
#
|
22
22
|
# @api private
|
23
23
|
def self.on_windows?
|
24
|
-
|
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
|
|
data/lib/nanoc/base/entities.rb
CHANGED
@@ -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
|
62
|
+
raise DuplicateIdentifierError.new(obj.identifier, type)
|
56
63
|
end
|
57
64
|
|
58
65
|
seen << obj.identifier
|
data/lib/nanoc/base/errors.rb
CHANGED
@@ -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)
|
data/lib/nanoc/base/services.rb
CHANGED
@@ -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'
|
@@ -15,7 +15,7 @@ module Nanoc
|
|
15
15
|
@action_sequences = action_sequences
|
16
16
|
end
|
17
17
|
|
18
|
-
contract Nanoc::
|
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::
|
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::
|
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]
|
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::
|
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::
|
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::
|
11
|
+
Nanoc::Core::Instrumentor.call(:outdatedness_rule_ran, self.class) do
|
12
12
|
apply(obj, outdatedness_checker)
|
13
13
|
end
|
14
14
|
end
|
data/lib/nanoc/checking/check.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Nanoc::Checking
|
4
4
|
# @api private
|
5
|
-
class OutputDirNotFoundError < Nanoc::
|
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
|
-
|
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="
|
205
|
-
<li><a href="
|
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="
|
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::
|
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::
|
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,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](
|
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
|
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
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|