nanoc 4.5.3 → 4.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/NEWS.md +6 -0
- data/lib/nanoc/base/repos/checksum_store.rb +3 -3
- data/lib/nanoc/base/repos/compiled_content_cache.rb +3 -3
- data/lib/nanoc/base/repos/dependency_store.rb +2 -2
- data/lib/nanoc/base/repos/outdatedness_store.rb +2 -2
- data/lib/nanoc/base/repos/rule_memory_store.rb +2 -2
- data/lib/nanoc/base/repos/store.rb +0 -7
- data/lib/nanoc/base/services/compiler_loader.rb +5 -8
- data/lib/nanoc/version.rb +1 -1
- data/spec/nanoc/base/compiler_spec.rb +1 -1
- data/spec/nanoc/base/repos/outdatedness_store_spec.rb +1 -1
- data/spec/nanoc/base/services/compiler/phases/cache_spec.rb +1 -1
- data/spec/nanoc/regressions/gh_1067_spec.rb +34 -0
- data/test/base/test_compiler.rb +2 -2
- data/test/base/test_store.rb +0 -22
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a383a3d98b256b56a7e6590371884c6f189b14dc
|
4
|
+
data.tar.gz: a5564e313aff3b6a2a1fad8eb6378ebb7ea58136
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd7789992a7d9ee85236ab87fc1ce6fcd7a134713a60a86528abce3d28d0700d5b687cb182170e5afcda5dd9eaac5b0d32c3f5a20b44e8671c2b6351c59447c2
|
7
|
+
data.tar.gz: 440ebab06d975006331704bf5d72e775ec65aa668bea50557163f1e3af033e0e27ca9b71347b24f6c79941efb7fb333fa841e82babe8f47d860982fa83ca3582
|
data/Gemfile.lock
CHANGED
data/NEWS.md
CHANGED
@@ -10,9 +10,9 @@ module Nanoc::Int
|
|
10
10
|
|
11
11
|
c_obj = C::Or[Nanoc::Int::Item, Nanoc::Int::Layout, Nanoc::Int::Configuration, Nanoc::Int::CodeSnippet]
|
12
12
|
|
13
|
-
contract C::KeywordArgs[
|
14
|
-
def initialize(
|
15
|
-
super(
|
13
|
+
contract C::KeywordArgs[objects: C::IterOf[c_obj]] => C::Any
|
14
|
+
def initialize(objects:)
|
15
|
+
super('tmp/checksums', 1)
|
16
16
|
|
17
17
|
@objects = objects
|
18
18
|
|
@@ -6,9 +6,9 @@ module Nanoc::Int
|
|
6
6
|
class CompiledContentCache < ::Nanoc::Int::Store
|
7
7
|
include Nanoc::Int::ContractsSupport
|
8
8
|
|
9
|
-
contract C::KeywordArgs[
|
10
|
-
def initialize(
|
11
|
-
super(
|
9
|
+
contract C::KeywordArgs[items: C::IterOf[Nanoc::Int::Item]] => C::Any
|
10
|
+
def initialize(items:)
|
11
|
+
super('tmp/compiled_content', 2)
|
12
12
|
|
13
13
|
@items = items
|
14
14
|
@cache = {}
|
@@ -7,8 +7,8 @@ module Nanoc::Int
|
|
7
7
|
attr_accessor :objects
|
8
8
|
|
9
9
|
# @param [Array<Nanoc::Int::Item, Nanoc::Int::Layout>] objects
|
10
|
-
def initialize(objects
|
11
|
-
super(
|
10
|
+
def initialize(objects)
|
11
|
+
super('tmp/dependencies', 4)
|
12
12
|
|
13
13
|
@objects = objects
|
14
14
|
@new_objects = []
|
@@ -4,8 +4,8 @@ module Nanoc::Int
|
|
4
4
|
include Nanoc::Int::ContractsSupport
|
5
5
|
|
6
6
|
contract C::KeywordArgs[site: C::Maybe[Nanoc::Int::Site], reps: Nanoc::Int::ItemRepRepo] => C::Any
|
7
|
-
def initialize(
|
8
|
-
super(
|
7
|
+
def initialize(reps:)
|
8
|
+
super('tmp/outdatedness', 1)
|
9
9
|
|
10
10
|
@outdated_reps = Set.new
|
11
11
|
@all_reps = reps
|
@@ -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
|
8
|
+
super('tmp/rule_memory', 1)
|
9
9
|
|
10
10
|
@rule_memories = {}
|
11
11
|
end
|
@@ -36,13 +36,6 @@ module Nanoc::Int
|
|
36
36
|
@version = version
|
37
37
|
end
|
38
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
|
-
|
46
39
|
# @group Loading and storing data
|
47
40
|
|
48
41
|
# @return The data that should be written to the disk
|
@@ -2,22 +2,22 @@ module Nanoc::Int
|
|
2
2
|
# @api private
|
3
3
|
class CompilerLoader
|
4
4
|
def load(site, action_provider: nil)
|
5
|
-
rule_memory_store = Nanoc::Int::RuleMemoryStore.new
|
5
|
+
rule_memory_store = Nanoc::Int::RuleMemoryStore.new
|
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)
|
9
9
|
|
10
10
|
objects = site.items.to_a + site.layouts.to_a + site.code_snippets + [site.config]
|
11
11
|
|
12
12
|
checksum_store =
|
13
|
-
Nanoc::Int::ChecksumStore.new(
|
13
|
+
Nanoc::Int::ChecksumStore.new(objects: objects)
|
14
14
|
|
15
15
|
item_rep_repo = Nanoc::Int::ItemRepRepo.new
|
16
16
|
|
17
17
|
action_provider ||= Nanoc::Int::ActionProvider.named(:rule_dsl).for(site)
|
18
18
|
|
19
19
|
outdatedness_store =
|
20
|
-
Nanoc::Int::OutdatednessStore.new(
|
20
|
+
Nanoc::Int::OutdatednessStore.new(reps: item_rep_repo)
|
21
21
|
|
22
22
|
outdatedness_checker =
|
23
23
|
Nanoc::Int::OutdatednessChecker.new(
|
@@ -30,10 +30,7 @@ module Nanoc::Int
|
|
30
30
|
)
|
31
31
|
|
32
32
|
compiled_content_cache =
|
33
|
-
Nanoc::Int::CompiledContentCache.new(
|
34
|
-
env_name: site.config.env_name,
|
35
|
-
items: site.items,
|
36
|
-
)
|
33
|
+
Nanoc::Int::CompiledContentCache.new(items: site.items)
|
37
34
|
|
38
35
|
params = {
|
39
36
|
compiled_content_cache: compiled_content_cache,
|
data/lib/nanoc/version.rb
CHANGED
@@ -20,7 +20,7 @@ describe Nanoc::Int::Compiler do
|
|
20
20
|
let(:reps) { Nanoc::Int::ItemRepRepo.new }
|
21
21
|
|
22
22
|
let(:outdatedness_checker) { double(:outdatedness_checker) }
|
23
|
-
let(:outdatedness_store) { Nanoc::Int::OutdatednessStore.new(
|
23
|
+
let(:outdatedness_store) { Nanoc::Int::OutdatednessStore.new(reps: reps) }
|
24
24
|
let(:action_provider) { double(:action_provider) }
|
25
25
|
|
26
26
|
let(:compiled_content_cache) { Nanoc::Int::CompiledContentCache.new(items: items) }
|
@@ -8,7 +8,7 @@ describe Nanoc::Int::Compiler::Phases::Cache do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
let(:compiled_content_cache) do
|
11
|
-
Nanoc::Int::CompiledContentCache.new(
|
11
|
+
Nanoc::Int::CompiledContentCache.new(items: [item])
|
12
12
|
end
|
13
13
|
|
14
14
|
let(:snapshot_repo) { Nanoc::Int::SnapshotRepo.new }
|
@@ -0,0 +1,34 @@
|
|
1
|
+
describe 'GH-1067', site: true, stdio: true do
|
2
|
+
before do
|
3
|
+
File.write('nanoc.yaml', <<EOS)
|
4
|
+
environments:
|
5
|
+
default:
|
6
|
+
build: dev
|
7
|
+
prod:
|
8
|
+
build: prod
|
9
|
+
EOS
|
10
|
+
|
11
|
+
File.write('content/foo.erb', 'build=<%= @config[:build] %>')
|
12
|
+
|
13
|
+
File.write('Rules', <<EOS)
|
14
|
+
compile '/*' do
|
15
|
+
filter :erb
|
16
|
+
write item.identifier
|
17
|
+
end
|
18
|
+
EOS
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'recompiles when env changes' do
|
22
|
+
ENV['NANOC_ENV'] = nil
|
23
|
+
Nanoc::CLI.run(%w(compile))
|
24
|
+
expect(File.read('output/foo.erb')).to eql('build=dev')
|
25
|
+
|
26
|
+
ENV['NANOC_ENV'] = nil
|
27
|
+
Nanoc::CLI.run(%w(compile -e prod))
|
28
|
+
expect(File.read('output/foo.erb')).to eql('build=prod')
|
29
|
+
|
30
|
+
ENV['NANOC_ENV'] = nil
|
31
|
+
Nanoc::CLI.run(%w(compile))
|
32
|
+
expect(File.read('output/foo.erb')).to eql('build=dev')
|
33
|
+
end
|
34
|
+
end
|
data/test/base/test_compiler.rb
CHANGED
@@ -17,14 +17,14 @@ class Nanoc::Int::CompilerTest < Nanoc::TestCase
|
|
17
17
|
|
18
18
|
params = {
|
19
19
|
compiled_content_cache: Nanoc::Int::CompiledContentCache.new(items: site.items),
|
20
|
-
checksum_store: Nanoc::Int::ChecksumStore.new(
|
20
|
+
checksum_store: Nanoc::Int::ChecksumStore.new(objects: objects),
|
21
21
|
rule_memory_store: Nanoc::Int::RuleMemoryStore.new,
|
22
22
|
dependency_store: Nanoc::Int::DependencyStore.new(
|
23
23
|
site.items.to_a + site.layouts.to_a,
|
24
24
|
),
|
25
25
|
action_provider: action_provider,
|
26
26
|
reps: reps,
|
27
|
-
outdatedness_store: Nanoc::Int::OutdatednessStore.new(
|
27
|
+
outdatedness_store: Nanoc::Int::OutdatednessStore.new(reps: reps),
|
28
28
|
}
|
29
29
|
|
30
30
|
params[:outdatedness_checker] =
|
data/test/base/test_store.rb
CHANGED
@@ -34,26 +34,4 @@ class Nanoc::Int::StoreTest < Nanoc::TestCase
|
|
34
34
|
store.load
|
35
35
|
assert_equal(nil, store.data)
|
36
36
|
end
|
37
|
-
|
38
|
-
def test_tmp_path_with_nil_env
|
39
|
-
tmp_path_for_checksum = Nanoc::Int::Store.tmp_path_for(env_name: nil, store_name: 'checksum')
|
40
|
-
tmp_path_for_rule_memory = Nanoc::Int::Store.tmp_path_for(env_name: nil, store_name: 'rule_memory')
|
41
|
-
tmp_path_for_dependencies = Nanoc::Int::Store.tmp_path_for(env_name: nil, store_name: 'dependencies')
|
42
|
-
tmp_path_for_compiled_content = Nanoc::Int::Store.tmp_path_for(env_name: nil, store_name: 'compiled_content')
|
43
|
-
assert_equal('tmp/checksum', tmp_path_for_checksum)
|
44
|
-
assert_equal('tmp/rule_memory', tmp_path_for_rule_memory)
|
45
|
-
assert_equal('tmp/dependencies', tmp_path_for_dependencies)
|
46
|
-
assert_equal('tmp/compiled_content', tmp_path_for_compiled_content)
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_tmp_path_with_test_env
|
50
|
-
tmp_path_for_checksum = Nanoc::Int::Store.tmp_path_for(env_name: 'test', store_name: 'checksum')
|
51
|
-
tmp_path_for_rule_memory = Nanoc::Int::Store.tmp_path_for(env_name: 'test', store_name: 'rule_memory')
|
52
|
-
tmp_path_for_dependencies = Nanoc::Int::Store.tmp_path_for(env_name: 'test', store_name: 'dependencies')
|
53
|
-
tmp_path_for_compiled_content = Nanoc::Int::Store.tmp_path_for(env_name: 'test', store_name: 'compiled_content')
|
54
|
-
assert_equal('tmp/test/checksum', tmp_path_for_checksum)
|
55
|
-
assert_equal('tmp/test/rule_memory', tmp_path_for_rule_memory)
|
56
|
-
assert_equal('tmp/test/dependencies', tmp_path_for_dependencies)
|
57
|
-
assert_equal('tmp/test/compiled_content', tmp_path_for_compiled_content)
|
58
|
-
end
|
59
37
|
end
|
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.5.
|
4
|
+
version: 4.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cri
|
@@ -415,6 +415,7 @@ files:
|
|
415
415
|
- spec/nanoc/regressions/gh_1045_spec.rb
|
416
416
|
- spec/nanoc/regressions/gh_1047_spec.rb
|
417
417
|
- spec/nanoc/regressions/gh_1064_spec.rb
|
418
|
+
- spec/nanoc/regressions/gh_1067_spec.rb
|
418
419
|
- spec/nanoc/regressions/gh_761_spec.rb
|
419
420
|
- spec/nanoc/regressions/gh_767_spec.rb
|
420
421
|
- spec/nanoc/regressions/gh_769_spec.rb
|