nanoc 4.3.4 → 4.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -10
- data/NEWS.md +15 -4
- data/README.md +1 -1
- data/lib/nanoc/base/compilation/outdatedness_checker.rb +2 -2
- data/lib/nanoc/base/entities/configuration.rb +27 -5
- data/lib/nanoc/base/feature.rb +61 -3
- data/lib/nanoc/base/repos/checksum_store.rb +1 -1
- data/lib/nanoc/base/repos/compiled_content_cache.rb +2 -2
- data/lib/nanoc/base/repos/config_loader.rb +13 -5
- data/lib/nanoc/base/repos/dependency_store.rb +2 -2
- data/lib/nanoc/base/repos/rule_memory_store.rb +2 -2
- data/lib/nanoc/base/repos/site_loader.rb +1 -1
- data/lib/nanoc/base/repos/store.rb +9 -0
- data/lib/nanoc/base/services/compiler_loader.rb +3 -3
- data/lib/nanoc/cli/commands/nanoc.rb +6 -0
- data/lib/nanoc/filters/relativize_paths.rb +1 -1
- data/lib/nanoc/version.rb +1 -1
- data/test/base/test_store.rb +22 -0
- data/test/filters/test_relativize_paths.rb +26 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3606c2a092c56bb20b1b07bc680d99a631114fce
|
4
|
+
data.tar.gz: 9e38476033f294ca4acc3e90eaf3b5ce1449294d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 712a908ab06b6f2a1242d078f81ead6130370205ecd6eac2e21d9b5618bdd06ec1024e520e0bc15cb6242aca73fc5029ff5fbd3470c835536dd65128d25c1b46
|
7
|
+
data.tar.gz: 68cff4e9694008e4af025714a4a4ce4b06cd57564c7573e0da3ec051ee7925aca7451cb355c8b0f86e5660f3d2799b27c83323452418dca135e14d8fae884836
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nanoc (4.3.
|
4
|
+
nanoc (4.3.5)
|
5
5
|
cri (~> 2.3)
|
6
6
|
hamster (~> 3.0)
|
7
7
|
ref (~> 2.0)
|
@@ -128,7 +128,7 @@ GEM
|
|
128
128
|
multi_json (~> 1.10)
|
129
129
|
fog-local (0.3.0)
|
130
130
|
fog-core (~> 1.27)
|
131
|
-
fog-openstack (0.1.
|
131
|
+
fog-openstack (0.1.15)
|
132
132
|
fog-core (>= 1.40)
|
133
133
|
fog-json (>= 1.0)
|
134
134
|
ipaddress (>= 0.8)
|
@@ -173,7 +173,7 @@ GEM
|
|
173
173
|
fog-voxel (0.1.0)
|
174
174
|
fog-core
|
175
175
|
fog-xml
|
176
|
-
fog-vsphere (1.2.
|
176
|
+
fog-vsphere (1.2.1)
|
177
177
|
fog-core
|
178
178
|
rbvmomi (~> 1.8.0)
|
179
179
|
fog-xenserver (0.2.3)
|
@@ -229,21 +229,19 @@ GEM
|
|
229
229
|
mime-types-data (3.2016.0521)
|
230
230
|
mini_portile2 (2.1.0)
|
231
231
|
minitest (5.9.1)
|
232
|
-
mocha (1.
|
232
|
+
mocha (1.2.0)
|
233
233
|
metaclass (~> 0.0.1)
|
234
234
|
multi_json (1.12.1)
|
235
235
|
mustache (1.0.3)
|
236
236
|
nenv (0.3.0)
|
237
|
-
nokogiri (1.6.8)
|
237
|
+
nokogiri (1.6.8.1)
|
238
238
|
mini_portile2 (~> 2.1.0)
|
239
|
-
pkg-config (~> 1.1.7)
|
240
239
|
notiffany (0.1.1)
|
241
240
|
nenv (~> 0.1)
|
242
241
|
shellany (~> 0.0)
|
243
242
|
pandoc-ruby (2.0.1)
|
244
243
|
parser (2.3.1.4)
|
245
244
|
ast (~> 2.2)
|
246
|
-
pkg-config (1.1.7)
|
247
245
|
posix-spawn (0.3.11)
|
248
246
|
powerpack (0.1.1)
|
249
247
|
pry (0.10.4)
|
@@ -282,14 +280,14 @@ GEM
|
|
282
280
|
diff-lcs (>= 1.2.0, < 2.0)
|
283
281
|
rspec-support (~> 3.5.0)
|
284
282
|
rspec-support (3.5.0)
|
285
|
-
rubocop (0.
|
283
|
+
rubocop (0.44.1)
|
286
284
|
parser (>= 2.3.1.1, < 3.0)
|
287
285
|
powerpack (~> 0.1)
|
288
286
|
rainbow (>= 1.99.1, < 3.0)
|
289
287
|
ruby-progressbar (~> 1.7)
|
290
288
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
291
289
|
ruby-progressbar (1.8.1)
|
292
|
-
ruby_dep (1.
|
290
|
+
ruby_dep (1.5.0)
|
293
291
|
rubypants (0.5.1)
|
294
292
|
safe_yaml (1.0.4)
|
295
293
|
sass (3.4.22)
|
@@ -389,4 +387,4 @@ DEPENDENCIES
|
|
389
387
|
yuicompressor
|
390
388
|
|
391
389
|
BUNDLED WITH
|
392
|
-
1.13.
|
390
|
+
1.13.3
|
data/NEWS.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# Nanoc news
|
2
2
|
|
3
|
+
## 4.3.5 (2016-10-14)
|
4
|
+
|
5
|
+
Fixes:
|
6
|
+
|
7
|
+
* Handle `form/@action` in `relativize_paths` filter [Lorin Werthen] (#950)
|
8
|
+
|
9
|
+
Experimental features:
|
10
|
+
|
11
|
+
* `profiler`: adds `--profile` option to the `compile` command to profile compilation (#903)
|
12
|
+
* `environments`: adds support for Nanoc environments (#859)
|
13
|
+
|
3
14
|
## 4.3.4 (2016-10-02)
|
4
15
|
|
5
16
|
Fixes:
|
@@ -635,7 +646,7 @@ Fixes:
|
|
635
646
|
|
636
647
|
* Updated references to old web site and old repository
|
637
648
|
* Made `require` errors mention Bundler if appropriate
|
638
|
-
* Fixed bug which caused pruner not to delete directories in some cases [
|
649
|
+
* Fixed bug which caused pruner not to delete directories in some cases [Matthias Reitinger]
|
639
650
|
* Made `check` command exit with the proper exit status
|
640
651
|
* Added support for the `HTML_TOC` Redcarpet renderer
|
641
652
|
* Made `stale` check honor files excluded by the pruner
|
@@ -689,7 +700,7 @@ Fixes:
|
|
689
700
|
|
690
701
|
* Made passthrough rules be inserted in the right place [Gregory Pakosz]
|
691
702
|
* Fixed crashes in the progress indicator when compiling
|
692
|
-
* Made auto-pruning honor excluded files [
|
703
|
+
* Made auto-pruning honor excluded files [Grégory Karékinian]
|
693
704
|
* Made lack of which/where not crash watch command
|
694
705
|
|
695
706
|
Improvements:
|
@@ -933,7 +944,7 @@ Changed:
|
|
933
944
|
* The `filesystem` data source is now known as `filesystem_verbose`
|
934
945
|
* Meta files and content files are now optional
|
935
946
|
* The `filesystem_compact` and `filesystem_combined` data sources have been merged into a new `filesystem_unified` data source
|
936
|
-
* The metadata section in `filesystem_unified` is now optional [
|
947
|
+
* The metadata section in `filesystem_unified` is now optional [Chris Eppstein]
|
937
948
|
* The `--server` autocompile option is now known as `--handler`
|
938
949
|
* Assigns in filters are now available as instance variables and methods
|
939
950
|
* The `#breadcrumbs_trail` function now allows missing parents
|
@@ -1210,7 +1221,7 @@ Removed:
|
|
1210
1221
|
|
1211
1222
|
## 1.2 (2007-06-05)
|
1212
1223
|
|
1213
|
-
* Sites now have an `assets` directory, whose contents are copied to the `output` directory when compiling [
|
1224
|
+
* Sites now have an `assets` directory, whose contents are copied to the `output` directory when compiling [Stanley Rost]
|
1214
1225
|
* Added support for non-eRuby layouts (Markaby, Haml, Liquid, …)
|
1215
1226
|
* Added more filters (Markaby, Haml, Liquid, RDoc [Dmitry Bilunov])
|
1216
1227
|
* Improved error reporting
|
data/README.md
CHANGED
@@ -19,4 +19,4 @@ Contributions are greatly appreciated! Consult the [Development guidelines](http
|
|
19
19
|
|
20
20
|
Many thanks to everyone who has contributed to Nanoc in one way or another:
|
21
21
|
|
22
|
-
Ale Muñoz, Alexander Mankuta, Arnau Siches, Ben Armston, Bil Bas, Brian Candler, Bruno Dufour, Chris Eppstein, Christian Plessl, Colin Barrett, Colin Seymour, Croath Liu, Damien Pollet, Dan Callahan, Daniel Hofstetter, Daniel Mendler, Daniel Wollschlaeger, David Alexander, David Everitt, Denis Defreyne, Dennis Sutch, Devon Luke Buchanan, Dmitry Bilunov, Eric Sunshine, Erik Hollensbe, Fabian Buch, Felix Hanley, Garen Torikian, Go Maeda,
|
22
|
+
Ale Muñoz, Alexander Mankuta, Andy Drop, Arnau Siches, Ben Armston, Bil Bas, Brian Candler, Bruno Dufour, Chris Eppstein, Christian Plessl, Colin Barrett, Colin Seymour, Croath Liu, Damien Pollet, Dan Callahan, Daniel Hofstetter, Daniel Mendler, Daniel Wollschlaeger, David Alexander, David Everitt, Denis Defreyne, Dennis Sutch, Devon Luke Buchanan, Dmitry Bilunov, Eric Sunshine, Erik Hollensbe, Fabian Buch, Felix Hanley, Garen Torikian, Go Maeda, Grégory Karékinian, Gregory Pakosz, Guilherme Garnier, Jack Chu, Jake Benilov, Jasper Van der Jeugt, Jeff Forcier, Jim Mendenhall, John Nishinaga, Justin Clift, Justin Hileman, Kevin Lynagh, Lorin Werthen, Louis T., Lucas Vuotto, Mathias Bynens, Matt Keveney, Matthew Frazier, Matthias Beyer, Matthias Reitinger, Matthias Vallentin, Micha Rosenbaum, Michal Cichra, Michal Papis, Mike Pennisi, Nelson Chen, Nicky Peeters, Nikhil Marathe, Oliver Byford, Paul Boone, Peter Aronoff, Raphael von der Grün, Rémi Barraquand, Remko Tronçon, Riley Goodside, Ruben Verborgh, Scott Vokes, Šime Ramov, Simon South, Spencer Whitt, Stanley Rost, Starr Horne, Stefan Bühler, Stuart Montgomery, Takashi Uchibe, Toon Willems, Tuomas Kareinen, Ursula Kallio, Vincent Driessen, Vlatko Kosturjak, whitequark, Xavier Shay, Yannick Ihmels, Zaiste de Grengolada
|
@@ -105,7 +105,7 @@ module Nanoc::Int
|
|
105
105
|
return Reasons::ConfigurationModified if object_modified?(site.config)
|
106
106
|
|
107
107
|
# Not outdated
|
108
|
-
|
108
|
+
nil
|
109
109
|
when Nanoc::Int::Item
|
110
110
|
@reps[obj].find { |rep| basic_outdatedness_reason_for(rep) }
|
111
111
|
when Nanoc::Int::Layout
|
@@ -118,7 +118,7 @@ module Nanoc::Int
|
|
118
118
|
return Reasons::SourceModified unless checksums_identical?(obj)
|
119
119
|
|
120
120
|
# Not outdated
|
121
|
-
|
121
|
+
nil
|
122
122
|
else
|
123
123
|
raise "do not know how to check outdatedness of #{obj.inspect}"
|
124
124
|
end
|
@@ -33,11 +33,21 @@ module Nanoc::Int
|
|
33
33
|
string_pattern_type: 'glob',
|
34
34
|
}.freeze
|
35
35
|
|
36
|
-
|
36
|
+
# @return [String, nil] The active environment for the configuration
|
37
|
+
attr_reader :env_name
|
38
|
+
|
39
|
+
# Configuration environments property key
|
40
|
+
ENVIRONMENTS_CONFIG_KEY = :environments
|
41
|
+
NANOC_ENV = 'NANOC_ENV'.freeze
|
42
|
+
NANOC_ENV_DEFAULT = 'default'.freeze
|
43
|
+
|
44
|
+
contract C::KeywordArgs[hash: C::Optional[Hash], env_name: C::Maybe[String]] => C::Any
|
37
45
|
# Creates a new configuration with the given hash.
|
38
46
|
#
|
39
47
|
# @param [Hash] hash The actual configuration hash
|
40
|
-
|
48
|
+
# @param [String, nil] env_name The active environment for this configuration
|
49
|
+
def initialize(hash: {}, env_name: nil)
|
50
|
+
@env_name = env_name
|
41
51
|
@wrapped = hash.__nanoc_symbolize_keys_recursively
|
42
52
|
end
|
43
53
|
|
@@ -48,7 +58,19 @@ module Nanoc::Int
|
|
48
58
|
DEFAULT_DATA_SOURCE_CONFIG.merge(ds)
|
49
59
|
end
|
50
60
|
|
51
|
-
self.class.new(new_wrapped)
|
61
|
+
self.class.new(hash: new_wrapped)
|
62
|
+
end
|
63
|
+
|
64
|
+
def with_environment
|
65
|
+
return self unless @wrapped.key?(ENVIRONMENTS_CONFIG_KEY)
|
66
|
+
|
67
|
+
# Set active environment
|
68
|
+
env_name = @env_name || ENV.fetch(NANOC_ENV, NANOC_ENV_DEFAULT)
|
69
|
+
|
70
|
+
# Load given environment configuration
|
71
|
+
env_config = @wrapped[ENVIRONMENTS_CONFIG_KEY].fetch(env_name.to_sym, {})
|
72
|
+
|
73
|
+
self.class.new(hash: @wrapped, env_name: env_name).merge(env_config)
|
52
74
|
end
|
53
75
|
|
54
76
|
contract C::None => Hash
|
@@ -86,12 +108,12 @@ module Nanoc::Int
|
|
86
108
|
|
87
109
|
contract C::Or[Hash, self] => self
|
88
110
|
def merge(hash)
|
89
|
-
self.class.new(@wrapped.merge(hash.to_h))
|
111
|
+
self.class.new(hash: @wrapped.merge(hash.to_h), env_name: @env_name)
|
90
112
|
end
|
91
113
|
|
92
114
|
contract C::Any => self
|
93
115
|
def without(key)
|
94
|
-
self.class.new(@wrapped.reject { |k, _v| k == key })
|
116
|
+
self.class.new(hash: @wrapped.reject { |k, _v| k == key }, env_name: @env_name)
|
95
117
|
end
|
96
118
|
|
97
119
|
contract C::Any => self
|
data/lib/nanoc/base/feature.rb
CHANGED
@@ -1,19 +1,77 @@
|
|
1
1
|
module Nanoc
|
2
2
|
# @api private
|
3
|
+
#
|
4
|
+
# @example Defining a feature and checking its enabledness
|
5
|
+
#
|
6
|
+
# Nanoc::Feature.define('environments', version: '4.3')
|
7
|
+
# Nanoc::Feaure.enabled?(Nanoc::Feature::ENVIRONMENTS)
|
8
|
+
#
|
3
9
|
module Feature
|
4
|
-
|
10
|
+
# Defines a new feature with the given name, experimental in the given
|
11
|
+
# version. The feature will be made available as a constant with the same
|
12
|
+
# name, in uppercase, on the Nanoc::Feature module.
|
13
|
+
#
|
14
|
+
# @example Defining Nanoc::Feature::ENVIRONMENTS
|
15
|
+
#
|
16
|
+
# Nanoc::Feature.define('environments', version: '4.3')
|
17
|
+
#
|
18
|
+
# @param name The name of the feature
|
19
|
+
#
|
20
|
+
# @param version The minor version in which the feature is considered
|
21
|
+
# experimental.
|
22
|
+
#
|
23
|
+
# @return [void]
|
24
|
+
def self.define(name, version:)
|
25
|
+
repo[name] = version
|
26
|
+
const_set(name.upcase, name)
|
27
|
+
end
|
5
28
|
|
6
|
-
|
7
|
-
|
29
|
+
# Undefines the feature with the given name. For testing purposes only.
|
30
|
+
#
|
31
|
+
# @param name The name of the feature
|
32
|
+
#
|
33
|
+
# @return [void]
|
34
|
+
#
|
35
|
+
# @private
|
36
|
+
def self.undefine(name)
|
37
|
+
repo.delete(name)
|
38
|
+
remove_const(name.upcase)
|
8
39
|
end
|
9
40
|
|
41
|
+
# @param [String] feature_name
|
42
|
+
#
|
43
|
+
# @return [Boolean] Whether or not the feature with the given name is enabled
|
10
44
|
def self.enabled?(feature_name)
|
11
45
|
enabled_features.include?(feature_name) ||
|
12
46
|
enabled_features.include?('all')
|
13
47
|
end
|
14
48
|
|
49
|
+
# @api private
|
15
50
|
def self.reset_caches
|
16
51
|
@enabled_features = nil
|
17
52
|
end
|
53
|
+
|
54
|
+
# @api private
|
55
|
+
def self.enabled_features
|
56
|
+
@enabled_features ||= Set.new(ENV.fetch('NANOC_FEATURES', '').split(','))
|
57
|
+
end
|
58
|
+
|
59
|
+
# @api private
|
60
|
+
def self.repo
|
61
|
+
@repo ||= {}
|
62
|
+
end
|
63
|
+
|
64
|
+
# @return [Enumerable<String>] Names of features that still exist, but
|
65
|
+
# should not be considered as experimental in the current version of
|
66
|
+
# Nanoc.
|
67
|
+
def self.all_outdated
|
68
|
+
repo.keys.reject do |name|
|
69
|
+
version = repo[name]
|
70
|
+
Nanoc::VERSION.start_with?(version)
|
71
|
+
end
|
72
|
+
end
|
18
73
|
end
|
19
74
|
end
|
75
|
+
|
76
|
+
Nanoc::Feature.define('profiler', version: '4.3')
|
77
|
+
Nanoc::Feature.define('environments', version: '4.3')
|
@@ -6,7 +6,7 @@ module Nanoc::Int
|
|
6
6
|
class ChecksumStore < ::Nanoc::Int::Store
|
7
7
|
# @param [Nanoc::Int::Site] site
|
8
8
|
def initialize(site: nil)
|
9
|
-
super('
|
9
|
+
super(Nanoc::Int::Store.tmp_path_for(env_name: (site.config.env_name if site), store_name: 'checksums'), 1)
|
10
10
|
|
11
11
|
@site = site
|
12
12
|
|
@@ -4,8 +4,8 @@ module Nanoc::Int
|
|
4
4
|
#
|
5
5
|
# @api private
|
6
6
|
class CompiledContentCache < ::Nanoc::Int::Store
|
7
|
-
def initialize
|
8
|
-
super('
|
7
|
+
def initialize(env_name: nil)
|
8
|
+
super(Nanoc::Int::Store.tmp_path_for(env_name: env_name, store_name: 'compiled_content'), 2)
|
9
9
|
|
10
10
|
@cache = {}
|
11
11
|
end
|
@@ -37,10 +37,18 @@ module Nanoc::Int
|
|
37
37
|
raise NoConfigFileFoundError if filename.nil?
|
38
38
|
|
39
39
|
# Read
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
config =
|
41
|
+
apply_parent_config(
|
42
|
+
Nanoc::Int::Configuration.new(hash: YAML.load_file(filename)),
|
43
|
+
[filename],
|
44
|
+
).with_defaults
|
45
|
+
|
46
|
+
# Load environment
|
47
|
+
if Nanoc::Feature.enabled?(Nanoc::Feature::ENVIRONMENTS)
|
48
|
+
config.with_environment
|
49
|
+
else
|
50
|
+
config
|
51
|
+
end
|
44
52
|
end
|
45
53
|
|
46
54
|
# @api private
|
@@ -60,7 +68,7 @@ module Nanoc::Int
|
|
60
68
|
end
|
61
69
|
|
62
70
|
# Load
|
63
|
-
parent_config = Nanoc::Int::Configuration.new(YAML.load_file(parent_path))
|
71
|
+
parent_config = Nanoc::Int::Configuration.new(hash: YAML.load_file(parent_path))
|
64
72
|
full_parent_config = apply_parent_config(parent_config, processed_paths + [parent_path])
|
65
73
|
full_parent_config.merge(config.without(:parent_config_file))
|
66
74
|
end
|
@@ -5,8 +5,8 @@ module Nanoc::Int
|
|
5
5
|
attr_accessor :objects
|
6
6
|
|
7
7
|
# @param [Array<Nanoc::Int::Item, Nanoc::Int::Layout>] objects
|
8
|
-
def initialize(objects)
|
9
|
-
super('
|
8
|
+
def initialize(objects, env_name: nil)
|
9
|
+
super(Nanoc::Int::Store.tmp_path_for(env_name: env_name, store_name: 'dependencies'), 4)
|
10
10
|
|
11
11
|
@objects = objects
|
12
12
|
@graph = Nanoc::Int::DirectedGraph.new([nil] + @objects)
|
@@ -4,8 +4,8 @@ module Nanoc::Int
|
|
4
4
|
#
|
5
5
|
# @api private
|
6
6
|
class RuleMemoryStore < ::Nanoc::Int::Store
|
7
|
-
def initialize
|
8
|
-
super('
|
7
|
+
def initialize(env_name: nil)
|
8
|
+
super(Nanoc::Int::Store.tmp_path_for(env_name: env_name, store_name: 'rule_memory'), 1)
|
9
9
|
|
10
10
|
@rule_memories = {}
|
11
11
|
end
|
@@ -12,6 +12,8 @@ module Nanoc::Int
|
|
12
12
|
#
|
13
13
|
# @api private
|
14
14
|
class Store
|
15
|
+
include Nanoc::Int::ContractsSupport
|
16
|
+
|
15
17
|
# @return [String] The name of the file where data will be loaded from and
|
16
18
|
# stored to.
|
17
19
|
attr_reader :filename
|
@@ -34,6 +36,13 @@ module Nanoc::Int
|
|
34
36
|
@version = version
|
35
37
|
end
|
36
38
|
|
39
|
+
# Logic for building tmp path from active environment and store name
|
40
|
+
# @api private
|
41
|
+
contract C::KeywordArgs[env_name: C::Maybe[String], store_name: String] => String
|
42
|
+
def self.tmp_path_for(env_name:, store_name:)
|
43
|
+
File.join('tmp', env_name.to_s, store_name)
|
44
|
+
end
|
45
|
+
|
37
46
|
# @group Loading and storing data
|
38
47
|
|
39
48
|
# @return The data that should be written to the disk
|
@@ -2,10 +2,10 @@ module Nanoc::Int
|
|
2
2
|
# @api private
|
3
3
|
class CompilerLoader
|
4
4
|
def load(site)
|
5
|
-
rule_memory_store = Nanoc::Int::RuleMemoryStore.new
|
5
|
+
rule_memory_store = Nanoc::Int::RuleMemoryStore.new(env_name: site.config.env_name)
|
6
6
|
|
7
7
|
dependency_store =
|
8
|
-
Nanoc::Int::DependencyStore.new(site.items.to_a + site.layouts.to_a)
|
8
|
+
Nanoc::Int::DependencyStore.new(site.items.to_a + site.layouts.to_a, env_name: site.config.env_name)
|
9
9
|
|
10
10
|
checksum_store =
|
11
11
|
Nanoc::Int::ChecksumStore.new(site: site)
|
@@ -25,7 +25,7 @@ module Nanoc::Int
|
|
25
25
|
)
|
26
26
|
|
27
27
|
params = {
|
28
|
-
compiled_content_cache: Nanoc::Int::CompiledContentCache.new,
|
28
|
+
compiled_content_cache: Nanoc::Int::CompiledContentCache.new(env_name: site.config.env_name),
|
29
29
|
checksum_store: checksum_store,
|
30
30
|
rule_memory_store: rule_memory_store,
|
31
31
|
dependency_store: dependency_store,
|
@@ -10,6 +10,12 @@ opt :d, :debug, 'enable debugging' do
|
|
10
10
|
Nanoc::CLI.debug = true
|
11
11
|
end
|
12
12
|
|
13
|
+
if Nanoc::Feature.enabled?(Nanoc::Feature::ENVIRONMENTS)
|
14
|
+
opt :e, :env, 'set environment', argument: :required do |value|
|
15
|
+
ENV.store('NANOC_ENV', value)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
13
19
|
opt :h, :help, 'show the help message and quit' do |_value, cmd|
|
14
20
|
puts cmd.help
|
15
21
|
exit 0
|
@@ -4,7 +4,7 @@ module Nanoc::Filters
|
|
4
4
|
require 'nanoc/helpers/link_to'
|
5
5
|
include Nanoc::Helpers::LinkTo
|
6
6
|
|
7
|
-
SELECTORS = ['*/@href', '*/@src', 'object/@data', 'param[@name="movie"]/@content', 'comment()'].freeze
|
7
|
+
SELECTORS = ['*/@href', '*/@src', 'object/@data', 'param[@name="movie"]/@content', 'form/@action', 'comment()'].freeze
|
8
8
|
|
9
9
|
# Relativizes all paths in the given content, which can be HTML, XHTML, XML
|
10
10
|
# or CSS. This filter is quite useful if a site needs to be hosted in a
|
data/lib/nanoc/version.rb
CHANGED
data/test/base/test_store.rb
CHANGED
@@ -32,4 +32,26 @@ class Nanoc::Int::StoreTest < Nanoc::TestCase
|
|
32
32
|
store.load
|
33
33
|
assert_equal(nil, store.data)
|
34
34
|
end
|
35
|
+
|
36
|
+
def test_tmp_path_with_nil_env
|
37
|
+
tmp_path_for_checksum = Nanoc::Int::Store.tmp_path_for(env_name: nil, store_name: 'checksum')
|
38
|
+
tmp_path_for_rule_memory = Nanoc::Int::Store.tmp_path_for(env_name: nil, store_name: 'rule_memory')
|
39
|
+
tmp_path_for_dependencies = Nanoc::Int::Store.tmp_path_for(env_name: nil, store_name: 'dependencies')
|
40
|
+
tmp_path_for_compiled_content = Nanoc::Int::Store.tmp_path_for(env_name: nil, store_name: 'compiled_content')
|
41
|
+
assert_equal('tmp/checksum', tmp_path_for_checksum)
|
42
|
+
assert_equal('tmp/rule_memory', tmp_path_for_rule_memory)
|
43
|
+
assert_equal('tmp/dependencies', tmp_path_for_dependencies)
|
44
|
+
assert_equal('tmp/compiled_content', tmp_path_for_compiled_content)
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_tmp_path_with_test_env
|
48
|
+
tmp_path_for_checksum = Nanoc::Int::Store.tmp_path_for(env_name: 'test', store_name: 'checksum')
|
49
|
+
tmp_path_for_rule_memory = Nanoc::Int::Store.tmp_path_for(env_name: 'test', store_name: 'rule_memory')
|
50
|
+
tmp_path_for_dependencies = Nanoc::Int::Store.tmp_path_for(env_name: 'test', store_name: 'dependencies')
|
51
|
+
tmp_path_for_compiled_content = Nanoc::Int::Store.tmp_path_for(env_name: 'test', store_name: 'compiled_content')
|
52
|
+
assert_equal('tmp/test/checksum', tmp_path_for_checksum)
|
53
|
+
assert_equal('tmp/test/rule_memory', tmp_path_for_rule_memory)
|
54
|
+
assert_equal('tmp/test/dependencies', tmp_path_for_dependencies)
|
55
|
+
assert_equal('tmp/test/compiled_content', tmp_path_for_compiled_content)
|
56
|
+
end
|
35
57
|
end
|
@@ -347,6 +347,32 @@ EOS
|
|
347
347
|
assert_match(/<param (name="movie" )?content="..\/..\/example"/, actual_content)
|
348
348
|
end
|
349
349
|
|
350
|
+
def test_filter_form
|
351
|
+
# Create filter with mock item
|
352
|
+
filter = Nanoc::Filters::RelativizePaths.new
|
353
|
+
|
354
|
+
# Mock item
|
355
|
+
filter.instance_eval do
|
356
|
+
@item_rep = Nanoc::Int::ItemRep.new(
|
357
|
+
Nanoc::Int::Item.new(
|
358
|
+
'content',
|
359
|
+
{},
|
360
|
+
'/foo/bar/baz/',
|
361
|
+
),
|
362
|
+
:blah,
|
363
|
+
)
|
364
|
+
@item_rep.paths[:last] = '/foo/bar/baz/'
|
365
|
+
end
|
366
|
+
|
367
|
+
# Set content
|
368
|
+
raw_content = %(<form action="/example"></form>)
|
369
|
+
expected_content = %(<form action="../../../example"></form>)
|
370
|
+
|
371
|
+
# Test
|
372
|
+
actual_content = filter.setup_and_run(raw_content, type: :html)
|
373
|
+
assert_equal(expected_content, actual_content)
|
374
|
+
end
|
375
|
+
|
350
376
|
def test_filter_implicit
|
351
377
|
# Create filter with mock item
|
352
378
|
filter = Nanoc::Filters::RelativizePaths.new
|
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.3.
|
4
|
+
version: 4.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cri
|