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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 313d3c808d70b4205249d9c65a62bacb56ed63d6
4
- data.tar.gz: d583fb40f3264a55ba3bc283a4db921d65c488f4
3
+ metadata.gz: a383a3d98b256b56a7e6590371884c6f189b14dc
4
+ data.tar.gz: a5564e313aff3b6a2a1fad8eb6378ebb7ea58136
5
5
  SHA512:
6
- metadata.gz: e521ca2081dd8fe9377ab40e09d31b603f08cc6100ec875fee3cd0f629d982a8d142f94877f0f7335998737ad860bb8bb62ad16f26edf3c5b10a798325e15021
7
- data.tar.gz: f64f51bfa27c7e6db9ef29a3266e5bc6a52797dfdc69e442fbedee9665afcc8a2216fea8b647f7513490745afc42a2babeeeaf8d9e5d69ad79f69217d142ce4b
6
+ metadata.gz: cd7789992a7d9ee85236ab87fc1ce6fcd7a134713a60a86528abce3d28d0700d5b687cb182170e5afcda5dd9eaac5b0d32c3f5a20b44e8671c2b6351c59447c2
7
+ data.tar.gz: 440ebab06d975006331704bf5d72e775ec65aa668bea50557163f1e3af033e0e27ca9b71347b24f6c79941efb7fb333fa841e82babe8f47d860982fa83ca3582
data/Gemfile.lock CHANGED
@@ -27,7 +27,7 @@ GIT
27
27
  PATH
28
28
  remote: .
29
29
  specs:
30
- nanoc (4.5.2)
30
+ nanoc (4.5.4)
31
31
  cri (~> 2.3)
32
32
  ddplugin (~> 1.0)
33
33
  hamster (~> 3.0)
data/NEWS.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Nanoc news
2
2
 
3
+ ## 4.5.4 (2017-01-16)
4
+
5
+ Fixes:
6
+
7
+ * Fixed issue with site not being recompiled fully when switching between environments (#1067, #1069)
8
+
3
9
  ## 4.5.3 (2017-01-15)
4
10
 
5
11
  Fixes:
@@ -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[site: C::Maybe[Nanoc::Int::Site], objects: C::IterOf[c_obj]] => C::Any
14
- def initialize(site: nil, objects:)
15
- super(Nanoc::Int::Store.tmp_path_for(env_name: (site.config.env_name if site), store_name: 'checksums'), 1)
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[env_name: C::Maybe[String], items: C::IterOf[Nanoc::Int::Item]] => C::Any
10
- def initialize(env_name: nil, items:)
11
- super(Nanoc::Int::Store.tmp_path_for(env_name: env_name, store_name: 'compiled_content'), 2)
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, env_name: nil)
11
- super(Nanoc::Int::Store.tmp_path_for(env_name: env_name, store_name: 'dependencies'), 4)
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(site: nil, reps:)
8
- super(Nanoc::Int::Store.tmp_path_for(env_name: (site.config.env_name if site), store_name: 'outdatedness'), 1)
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(env_name: nil)
8
- super(Nanoc::Int::Store.tmp_path_for(env_name: env_name, store_name: 'rule_memory'), 1)
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(env_name: site.config.env_name)
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, env_name: site.config.env_name)
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(site: site, objects: objects)
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(site: site, reps: item_rep_repo)
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
@@ -1,4 +1,4 @@
1
1
  module Nanoc
2
2
  # The current Nanoc version.
3
- VERSION = '4.5.3'.freeze
3
+ VERSION = '4.5.4'.freeze
4
4
  end
@@ -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(site: site, reps: reps) }
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) }
@@ -1,5 +1,5 @@
1
1
  describe Nanoc::Int::OutdatednessStore do
2
- subject(:store) { described_class.new(site: site, reps: reps) }
2
+ subject(:store) { described_class.new(reps: reps) }
3
3
 
4
4
  let(:site) { double(:site) }
5
5
  let(:reps) { Nanoc::Int::ItemRepRepo.new }
@@ -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(env_name: nil, items: [item])
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
@@ -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(site: site, objects: objects),
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(site: site, reps: reps),
27
+ outdatedness_store: Nanoc::Int::OutdatednessStore.new(reps: reps),
28
28
  }
29
29
 
30
30
  params[:outdatedness_checker] =
@@ -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.3
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-15 00:00:00.000000000 Z
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