Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store temp data per output dir #1071

Merged
merged 12 commits into from Jan 19, 2017

Refactor: Pass site, not env_name, to stores

  • Loading branch information...
ddfreyne committed Jan 17, 2017
commit aba40d92559d557d5265490d51e1f2cd68ef732f
@@ -6,9 +6,9 @@ module Nanoc::Int
class CompiledContentCache < ::Nanoc::Int::Store
include Nanoc::Int::ContractsSupport

contract C::KeywordArgs[env_name: C::Maybe[String], items: C::IterOf[Nanoc::Int::Item]] => C::Any
def initialize(env_name: nil, items:)
super(Nanoc::Int::Store.tmp_path_for(env_name: env_name, store_name: 'compiled_content'), 2)
contract C::KeywordArgs[site: C::Maybe[Nanoc::Int::Site], items: C::IterOf[Nanoc::Int::Item]] => C::Any
def initialize(site: nil, items:)
super(Nanoc::Int::Store.tmp_path_for(site: site, store_name: 'compiled_content'), 2)

@items = items
@cache = {}
@@ -7,8 +7,8 @@ class DependencyStore < ::Nanoc::Int::Store
attr_accessor :objects

# @param [Array<Nanoc::Int::Item, Nanoc::Int::Layout>] objects
def initialize(objects, env_name: nil)
super(Nanoc::Int::Store.tmp_path_for(env_name: env_name, store_name: 'dependencies'), 4)
def initialize(objects, site: nil)
super(Nanoc::Int::Store.tmp_path_for(site: site, store_name: 'dependencies'), 4)

@objects = objects
@new_objects = []
@@ -4,8 +4,8 @@ module Nanoc::Int
#
# @api private
class RuleMemoryStore < ::Nanoc::Int::Store
def initialize(env_name: nil)
super(Nanoc::Int::Store.tmp_path_for(env_name: env_name, store_name: 'rule_memory'), 1)
def initialize(site: nil)
super(Nanoc::Int::Store.tmp_path_for(site: site, store_name: 'rule_memory'), 1)

@rule_memories = {}
end
@@ -2,10 +2,10 @@ module Nanoc::Int
# @api private
class CompilerLoader
def load(site, action_provider: nil)
rule_memory_store = Nanoc::Int::RuleMemoryStore.new(env_name: site.config.env_name)
rule_memory_store = Nanoc::Int::RuleMemoryStore.new(site: site)

dependency_store =
Nanoc::Int::DependencyStore.new(site.items.to_a + site.layouts.to_a, env_name: site.config.env_name)
Nanoc::Int::DependencyStore.new(site.items.to_a + site.layouts.to_a, site: site)

objects = site.items.to_a + site.layouts.to_a + site.code_snippets + [site.config]

@@ -31,7 +31,7 @@ def load(site, action_provider: nil)

compiled_content_cache =
Nanoc::Int::CompiledContentCache.new(
env_name: site.config.env_name,
site: site,
items: site.items,
)

@@ -8,7 +8,7 @@
end

let(:compiled_content_cache) do
Nanoc::Int::CompiledContentCache.new(env_name: nil, items: [item])
Nanoc::Int::CompiledContentCache.new(items: [item])
end

let(:snapshot_repo) { Nanoc::Int::SnapshotRepo.new }
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.