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

Only treat :last snapshot as movable #1041

Merged
merged 6 commits into from Dec 25, 2016

Remove final arg from SnapshotDef.new

  • Loading branch information...
ddfreyne committed Dec 25, 2016
commit 23cb20d5ff86c9f4a76e37b0a023a972b5ec4b1b
@@ -5,15 +5,9 @@ class SnapshotDef

attr_reader :name

contract Symbol, C::Bool => C::Any
def initialize(name, is_final)
contract Symbol => C::Any
def initialize(name)
@name = name
@is_final = is_final
end

contract C::None => C::Bool
def final?
@is_final
end
end
end
@@ -194,9 +194,7 @@ def run(rep, is_outdated:)
@wrapped.run(rep, is_outdated: is_outdated)

rep.snapshot_defs.each do |sdef|
if sdef.final?
ItemRepWriter.new.write(rep, sdef.name)
end
ItemRepWriter.new.write(rep, sdef.name)
end
end
end
@@ -62,7 +62,7 @@ def [](obj)
# a Boolean indicating whether the snapshot is final or not
def snapshots_defs_for(rep)
self[rep].snapshot_actions.map do |a|
Nanoc::Int::SnapshotDef.new(a.snapshot_name, true)
Nanoc::Int::SnapshotDef.new(a.snapshot_name)
end
end

Copy path View file
@@ -141,7 +141,7 @@ def memory_for(obj)
end

def snapshots_defs_for(_rep)
[Nanoc::Int::SnapshotDef.new(:last, false)]
[Nanoc::Int::SnapshotDef.new(:last)]
end
end.new(self)
end
@@ -61,7 +61,7 @@
reps << other_rep

reps.each do |rep|
rep.snapshot_defs << Nanoc::Int::SnapshotDef.new(:last, true)
rep.snapshot_defs << Nanoc::Int::SnapshotDef.new(:last)
end

allow(outdatedness_checker).to receive(:outdated?).with(rep).and_return(true)
@@ -80,11 +80,11 @@
end

let(:snapshot_defs_for_rep) do
[Nanoc::Int::SnapshotDef.new(:last, true)]
[Nanoc::Int::SnapshotDef.new(:last)]
end

let(:snapshot_defs_for_other_rep) do
[Nanoc::Int::SnapshotDef.new(:last, true)]
[Nanoc::Int::SnapshotDef.new(:last)]
end

it 'compiles individual reps' do
@@ -15,7 +15,7 @@

context 'snapshot def exists' do
before do
rep.snapshot_defs = [Nanoc::Int::SnapshotDef.new(snapshot_name, true)]
rep.snapshot_defs = [Nanoc::Int::SnapshotDef.new(snapshot_name)]
rep.snapshot_contents = { snapshot_name => content }
end

@@ -40,7 +40,7 @@

context 'snapshot def exists, but not content' do
before do
rep.snapshot_defs = [Nanoc::Int::SnapshotDef.new(snapshot_name, true)]
rep.snapshot_defs = [Nanoc::Int::SnapshotDef.new(snapshot_name)]
rep.snapshot_contents = {}
end

@@ -60,7 +60,7 @@
context 'snapshot exists' do
context 'snapshot is not final' do
before do
rep.snapshot_defs = [Nanoc::Int::SnapshotDef.new(snapshot_name, false)]
rep.snapshot_defs = [Nanoc::Int::SnapshotDef.new(snapshot_name)]
end

context 'snapshot content does not exist' do
@@ -121,7 +121,7 @@

context 'snapshot is final' do
before do
rep.snapshot_defs = [Nanoc::Int::SnapshotDef.new(snapshot_name, true)]
rep.snapshot_defs = [Nanoc::Int::SnapshotDef.new(snapshot_name)]
end

context 'snapshot content does not exist' do
@@ -281,7 +281,7 @@ def run(_content, params = {})
end

before do
rep.snapshot_defs = [Nanoc::Int::SnapshotDef.new(:pre, true)]
rep.snapshot_defs = [Nanoc::Int::SnapshotDef.new(:pre)]

allow(compilation_context).to receive(:site) { site }
allow(compilation_context).to receive(:assigns_for).with(rep, dependency_tracker) { assigns }
@@ -137,7 +137,7 @@
Nanoc::Int::ItemRep.new(item, :default).tap do |ir|
ir.compiled = true
ir.snapshot_defs = [
Nanoc::Int::SnapshotDef.new(:last, true),
Nanoc::Int::SnapshotDef.new(:last),
]
ir.snapshot_contents = {
last: Nanoc::Int::TextualContent.new('Hallo'),
@@ -198,10 +198,10 @@
Nanoc::Int::ItemRep.new(item, :default).tap do |ir|
ir.compiled = true
ir.snapshot_defs = [
Nanoc::Int::SnapshotDef.new(:last, false),
Nanoc::Int::SnapshotDef.new(:pre, true),
Nanoc::Int::SnapshotDef.new(:post, false),
Nanoc::Int::SnapshotDef.new(:specific, true),
Nanoc::Int::SnapshotDef.new(:last),
Nanoc::Int::SnapshotDef.new(:pre),
Nanoc::Int::SnapshotDef.new(:post),
Nanoc::Int::SnapshotDef.new(:specific),
]
ir.snapshot_contents = {
last: Nanoc::Int::TextualContent.new('Last Hallo'),
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.