Решение на Пета задача от Слави Боянов

Обратно към всички решения

Към профила на Слави Боянов

Резултати

  • 2 точки от тестове
  • 0 бонус точки
  • 2 точки общо
  • 11 успешни тест(а)
  • 19 неуспешни тест(а)

Код

require 'digest/sha1'
class Commit
attr_reader :content, :message, :date, :hash
def initialize(content = {}, message = "")
@content = content
@message = message
@date = Time.now
@hash = Digest::SHA1.hexdigest(message + @date.to_s)
end
def objects
@content.values
end
def to_s
"Commit #{@hash}\nDate: #{@date}\n\n\t#{@message}"
end
end
class Information
attr_reader :message, :result
def initialize(message, success = true, result = nil)
@message = message
@success = success
@result = result
end
def success?
@success
end
def error?
not @success
end
end
class Branch
attr_accessor :added, :removed, :commited
def initialize(commited, added = {}, removed = [])
@added = added
@removed = removed
@commited = commited
end
end
class BranchManager
def initialize
@branches = {master: Branch.new([Commit.new])}
@current = :master
end
def name
@current.to_s
end
def current
@branches[@current]
end
def create(name)
if @branches.has_key(name.to_sym)
Information.new("Branch #{name} already exists.", false)
else
@branches[name.to_sym] = @branches[@current]
Information.new("Creat branch #{name}.")
end
end
def checkout(branch_name)
if @branches.has_key?(branch_name.to_sym)
@current = branch_name.to_sym
Information.new("Switched to branch #{@current}")
else
Information.new("Branch #{branch_name} does not exist", false)
end
end
def remove(branch_name)
if branch_name.to_sym == @current
Information.new("Can't remove current branch.", false)
elsif @branches.has_key(branch_name.to_sym)
Information.new("Branch #{branch_name} does not exist.", false)
else
Information.new("Removed branch #{branch_name}", true)
end
end
def list
message = @branches.keys.sort { |first, second| first <=> second }
.map do |item|
if item == @current
"* #{item}"
else
item.to_s
end
end
.join("\n")
Information.new(message)
end
end
class ContentManager
attr_accessor :branch
def initialize
@branch = BranchManager.new
end
def add(name, object)
added[name.to_sym] = object
Information.new("Added #{name} to stage.", true, object)
end
def commit(message)
if added.empty?
Information.new("Nothing to commit, working directory clean.", false)
else
count = added.size + removed.size
new_content = commited[-1].content.merge(added)
.delete_if { |key, _| removed.member?(key) }
commited.push(Commit.new(new_content,message))
added, removed = {}, []
Information.new("#{message}\n\t#{count} objects changed",
true,
commited[-1])
end
end
def remove(name)
if commited[-1].content.hash_key(name.to_sym)
removed.push(name.to_sym)
Information.new("Added #{name} for removal.",
true,
@commited[-1].content[name.to_sym])
else
Information.new("Object #{name} is not committed.", false)
end
end
def checkout(hash)
index = commited.find_index { |item| item.hash == hash }
if index
@branch.current.commited = commited[0..index]
Information.new("HEAD is now at #{hash}", true, commited[-1])
else
Information.new("Commit #{hash} does not exist.", false)
end
end
def head
if commited.size > 1
Information.new("#{commited[-1].message}", true, commited[-1])
else
Information.new("Branch #{@branch.name} does not have any commits yet.",
false)
end
end
def log
if commited.size == 1
Information.new("Branch #{@branch.name} does not have any commits yet.",
false)
else
message = commited[1..-1].map { |item| item.to_s }.join("\n\n")
Information.new(message)
end
end
def get(name)
if commited[-1].content.has_key?(name.to_sym)
Information.new("Found object #{name}.",
true,
commited[-1].content[name.to_sym])
else
Information.new("Object #{name} is not commited.", false)
end
end
def execute
yield
end
private
def added
@branch.current.added
end
def commited
@branch.current.commited
end
def removed
@branch.current.removed
end
end
class ObjectStore
def ObjectStore.init(&block)
if block_given?
container = ContentManager.new
container.instance_eval(&block)
container
else
ContentManager.new
end
end
end

Лог от изпълнението

...FFF..FFFF.FFFFFFFF..FFF...F

Failures:

  1) ObjectStore can remove objects
     Failure/Error: expect(repo.remove("object1")).to be_success("Added object1 for removal.", "content1")
     NoMethodError:
       undefined method `hash_key' for {:object1=>"content1", :object2=>"content2"}:Hash
     # /tmp/d20160111-5693-11arrvw/solution.rb:134:in `remove'
     # /tmp/d20160111-5693-11arrvw/spec.rb:43:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  2) ObjectStore can commit changes which include only removed objects
     Failure/Error: repo.remove("object2")
     NoMethodError:
       undefined method `hash_key' for {:object1=>"content1", :object2=>"content2"}:Hash
     # /tmp/d20160111-5693-11arrvw/solution.rb:134:in `remove'
     # /tmp/d20160111-5693-11arrvw/spec.rb:52:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  3) ObjectStore cannot remove objects that are not committed
     Failure/Error: expect(repo.remove("object2")).to be_error("Object object2 is not committed.")
     NoMethodError:
       undefined method `hash_key' for {:object1=>"content1"}:Hash
     # /tmp/d20160111-5693-11arrvw/solution.rb:134:in `remove'
     # /tmp/d20160111-5693-11arrvw/spec.rb:60:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  4) ObjectStore can show log of changes for a single commit
     Failure/Error: expect(repo.log).to be_success("Commit #{commit_hash}\nDate: #{Time.now.strftime("%a %b %d %H:%M %Y %z")}\n\n\tSo cool!")
       expected #<Information:0x007f18046cc2f8 @message="Commit 6daacf9f2001f9d36ed38e3354379bc218a2ee10\nDate: 2016-01-11 11:54:44 +0200\n\n\tSo cool!", @success=true, @result=nil> to be success "Commit 381573fc6aa4a6bb947e617a74fc4e0a5e152245\nDate: Mon Jan 11 11:54 2016 +0200\n\n\tSo cool!"
     # /tmp/d20160111-5693-11arrvw/spec.rb:83:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  5) ObjectStore can show log of changes for a single commit
     Failure/Error: expect(repo.log).to be_success("Commit #{commit_hash}\nDate: #{Time.now.strftime("%a %b %d %H:%M %Y %z")}\n\n\tSo cool!")
       expected #<Information:0x007f18046a9050 @message="Commit 6daacf9f2001f9d36ed38e3354379bc218a2ee10\nDate: 2016-01-11 11:54:44 +0200\n\n\tSo cool!", @success=true, @result=nil> to be success "Commit 381573fc6aa4a6bb947e617a74fc4e0a5e152245\nDate: Mon Jan 11 11:54 2016 +0200\n\n\tSo cool!"
     # /tmp/d20160111-5693-11arrvw/spec.rb:92:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  6) ObjectStore can show log of changes for multiple commits
     Failure/Error: expect(repo.log).to be_success("Commit #{commit2_hash}\nDate: #{current_time}\n\n\tSecond commit\n\nCommit #{commit1_hash}\nDate: #{current_time}\n\n\tFirst commit")
       expected #<Information:0x007f18046a2b38 @message="Commit dace301d434cc5bd6021cccd7f8b90dda9f0fbd9\nDate: 2016-01-11 11:54:44 +0200\n\n\tFirst commit\n\nCommit 70ed96640b3f6e95bf5b3335cc014c16b9216896\nDate: 2016-01-11 11:54:44 +0200\n\n\tSecond commit", @success=true, @result=nil> to be success "Commit ffeb5391d1ec154dd4a821a1aeed876cad514a0d\nDate: Mon Jan 11 11:54 2016 +0200\n\n\tSecond commit\n\nCommit 48bd765d675f355375408e84d12573236b16ddc2\nDate: Mon Jan 11 11:54 2016 +0200\n\n\tFirst commit"
     # /tmp/d20160111-5693-11arrvw/spec.rb:108:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  7) ObjectStore shows the log for the current branch only
     Failure/Error: repo.branch.create("develop")
     NoMethodError:
       undefined method `has_key' for #<Hash:0x007f180469ccd8>
     # /tmp/d20160111-5693-11arrvw/solution.rb:65:in `create'
     # /tmp/d20160111-5693-11arrvw/spec.rb:116:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  8) ObjectStore can list branches
     Failure/Error: repo.branch.create("develop")
     NoMethodError:
       undefined method `has_key' for #<Hash:0x007f180468c7e8>
     # /tmp/d20160111-5693-11arrvw/solution.rb:65:in `create'
     # /tmp/d20160111-5693-11arrvw/spec.rb:138:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  9) ObjectStore can create branches
     Failure/Error: expect(repo.branch.create("develop")).to be_success("Created branch develop.")
     NoMethodError:
       undefined method `has_key' for #<Hash:0x007f18046895c0>
     # /tmp/d20160111-5693-11arrvw/solution.rb:65:in `create'
     # /tmp/d20160111-5693-11arrvw/spec.rb:145:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  10) ObjectStore cannot create branch if already exists
     Failure/Error: expect(repo.branch.create("master")).to be_error("Branch master already exists.")
     NoMethodError:
       undefined method `has_key' for #<Hash:0x007f18046626a0>
     # /tmp/d20160111-5693-11arrvw/solution.rb:65:in `create'
     # /tmp/d20160111-5693-11arrvw/spec.rb:150:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  11) ObjectStore can switch branches
     Failure/Error: repo.branch.create("develop")
     NoMethodError:
       undefined method `has_key' for #<Hash:0x007f180465f6f8>
     # /tmp/d20160111-5693-11arrvw/solution.rb:65:in `create'
     # /tmp/d20160111-5693-11arrvw/spec.rb:157:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  12) ObjectStore cannot switch to nonexisting branch
     Failure/Error: expect(repo.branch.checkout("develop")).to be_error("Branch develop does not exist.")
       expected #<Information:0x007f180465d2b8 @message="Branch develop does not exist", @success=false, @result=nil> to be error "Branch develop does not exist."
     # /tmp/d20160111-5693-11arrvw/spec.rb:168:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  13) ObjectStore can remove branch
     Failure/Error: repo.branch.create("develop")
     NoMethodError:
       undefined method `has_key' for #<Hash:0x007f1804329128>
     # /tmp/d20160111-5693-11arrvw/solution.rb:65:in `create'
     # /tmp/d20160111-5693-11arrvw/spec.rb:173:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  14) ObjectStore cannot remove current branch
     Failure/Error: expect(repo.branch.remove("master")).to be_error("Cannot remove current branch.")
       expected #<Information:0x007f1804125098 @message="Can't remove current branch.", @success=false, @result=nil> to be error "Cannot remove current branch."
     # /tmp/d20160111-5693-11arrvw/spec.rb:179:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  15) ObjectStore cannot remove nonexisting branch
     Failure/Error: expect(repo.branch.remove("develop")).to be_error("Branch develop does not exist.")
     NoMethodError:
       undefined method `has_key' for #<Hash:0x007f1804314110>
     # /tmp/d20160111-5693-11arrvw/solution.rb:85:in `remove'
     # /tmp/d20160111-5693-11arrvw/spec.rb:184:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  16) ObjectStore cannot return not committed objects
     Failure/Error: expect(repo.get("string")).to be_error("Object string is not committed.")
       expected #<Information:0x007f18042bdb30 @message="Object string is not commited.", @success=false, @result=nil> to be error "Object string is not committed."
     # /tmp/d20160111-5693-11arrvw/spec.rb:209:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  17) ObjectStore cannot return objects when no commits
     Failure/Error: expect(repo.get("string")).to be_error("Object string is not committed.")
       expected #<Information:0x007f18042a03f0 @message="Object string is not commited.", @success=false, @result=nil> to be error "Object string is not committed."
     # /tmp/d20160111-5693-11arrvw/spec.rb:214:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  18) ObjectStore can checkout commits
     Failure/Error: expect(repo.checkout(first_commit.hash)).to be_success("HEAD is now at #{first_commit.hash}.", first_commit)
       expected #<Information:0x007f1804256d40 @message="HEAD is now at dace301d434cc5bd6021cccd7f8b90dda9f0fbd9", @success=true, @result=#<Commit:0x007f1804268158 @content={:number=>42}, @message="First commit", @date=2016-01-11 11:54:44 +0200, @hash="dace301d434cc5bd6021cccd7f8b90dda9f0fbd9">> to be success "HEAD is now at dace301d434cc5bd6021cccd7f8b90dda9f0fbd9." and #<Commit:0x007f1804268158 @content={:number=>42}, @message="First commit", @date=2016-01-11 11:54:44 +0200, @hash="dace301d434cc5bd6021cccd7f8b90dda9f0fbd9">
     # /tmp/d20160111-5693-11arrvw/spec.rb:223:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  19) ObjectStore can show the objects of a repo after removing an object
     Failure/Error: repo.remove("object2")
     NoMethodError:
       undefined method `hash_key' for #<Hash:0x007f180418a9c0>
     # /tmp/d20160111-5693-11arrvw/solution.rb:134:in `remove'
     # /tmp/d20160111-5693-11arrvw/spec.rb:261:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

Finished in 0.02839 seconds
30 examples, 19 failures

Failed examples:

rspec /tmp/d20160111-5693-11arrvw/spec.rb:38 # ObjectStore can remove objects
rspec /tmp/d20160111-5693-11arrvw/spec.rb:46 # ObjectStore can commit changes which include only removed objects
rspec /tmp/d20160111-5693-11arrvw/spec.rb:56 # ObjectStore cannot remove objects that are not committed
rspec /tmp/d20160111-5693-11arrvw/spec.rb:77 # ObjectStore can show log of changes for a single commit
rspec /tmp/d20160111-5693-11arrvw/spec.rb:86 # ObjectStore can show log of changes for a single commit
rspec /tmp/d20160111-5693-11arrvw/spec.rb:95 # ObjectStore can show log of changes for multiple commits
rspec /tmp/d20160111-5693-11arrvw/spec.rb:111 # ObjectStore shows the log for the current branch only
rspec /tmp/d20160111-5693-11arrvw/spec.rb:136 # ObjectStore can list branches
rspec /tmp/d20160111-5693-11arrvw/spec.rb:143 # ObjectStore can create branches
rspec /tmp/d20160111-5693-11arrvw/spec.rb:148 # ObjectStore cannot create branch if already exists
rspec /tmp/d20160111-5693-11arrvw/spec.rb:153 # ObjectStore can switch branches
rspec /tmp/d20160111-5693-11arrvw/spec.rb:166 # ObjectStore cannot switch to nonexisting branch
rspec /tmp/d20160111-5693-11arrvw/spec.rb:171 # ObjectStore can remove branch
rspec /tmp/d20160111-5693-11arrvw/spec.rb:177 # ObjectStore cannot remove current branch
rspec /tmp/d20160111-5693-11arrvw/spec.rb:182 # ObjectStore cannot remove nonexisting branch
rspec /tmp/d20160111-5693-11arrvw/spec.rb:205 # ObjectStore cannot return not committed objects
rspec /tmp/d20160111-5693-11arrvw/spec.rb:212 # ObjectStore cannot return objects when no commits
rspec /tmp/d20160111-5693-11arrvw/spec.rb:217 # ObjectStore can checkout commits
rspec /tmp/d20160111-5693-11arrvw/spec.rb:253 # ObjectStore can show the objects of a repo after removing an object

История (1 версия и 0 коментара)

Слави обнови решението на 23.11.2015 16:04 (преди над 8 години)

+require 'digest/sha1'
+
+class Commit
+ attr_reader :content, :message, :date, :hash
+
+ def initialize(content = {}, message = "")
+ @content = content
+ @message = message
+ @date = Time.now
+ @hash = Digest::SHA1.hexdigest(message + @date.to_s)
+ end
+
+ def objects
+ @content.values
+ end
+
+ def to_s
+ "Commit #{@hash}\nDate: #{@date}\n\n\t#{@message}"
+ end
+end
+
+class Information
+ attr_reader :message, :result
+
+ def initialize(message, success = true, result = nil)
+ @message = message
+ @success = success
+ @result = result
+ end
+
+ def success?
+ @success
+ end
+
+ def error?
+ not @success
+ end
+end
+
+class Branch
+ attr_accessor :added, :removed, :commited
+
+ def initialize(commited, added = {}, removed = [])
+ @added = added
+ @removed = removed
+ @commited = commited
+ end
+end
+
+class BranchManager
+ def initialize
+ @branches = {master: Branch.new([Commit.new])}
+ @current = :master
+ end
+
+ def name
+ @current.to_s
+ end
+
+ def current
+ @branches[@current]
+ end
+
+ def create(name)
+ if @branches.has_key(name.to_sym)
+ Information.new("Branch #{name} already exists.", false)
+ else
+ @branches[name.to_sym] = @branches[@current]
+ Information.new("Creat branch #{name}.")
+ end
+ end
+
+ def checkout(branch_name)
+ if @branches.has_key?(branch_name.to_sym)
+ @current = branch_name.to_sym
+ Information.new("Switched to branch #{@current}")
+ else
+ Information.new("Branch #{branch_name} does not exist", false)
+ end
+ end
+
+ def remove(branch_name)
+ if branch_name.to_sym == @current
+ Information.new("Can't remove current branch.", false)
+ elsif @branches.has_key(branch_name.to_sym)
+ Information.new("Branch #{branch_name} does not exist.", false)
+ else
+ Information.new("Removed branch #{branch_name}", true)
+ end
+ end
+
+ def list
+ message = @branches.keys.sort { |first, second| first <=> second }
+ .map do |item|
+ if item == @current
+ "* #{item}"
+ else
+ item.to_s
+ end
+ end
+ .join("\n")
+ Information.new(message)
+ end
+end
+
+class ContentManager
+ attr_accessor :branch
+
+ def initialize
+ @branch = BranchManager.new
+ end
+
+ def add(name, object)
+ added[name.to_sym] = object
+ Information.new("Added #{name} to stage.", true, object)
+ end
+
+ def commit(message)
+ if added.empty?
+ Information.new("Nothing to commit, working directory clean.", false)
+ else
+ count = added.size + removed.size
+ new_content = commited[-1].content.merge(added)
+ .delete_if { |key, _| removed.member?(key) }
+ commited.push(Commit.new(new_content,message))
+ added, removed = {}, []
+ Information.new("#{message}\n\t#{count} objects changed",
+ true,
+ commited[-1])
+ end
+ end
+
+ def remove(name)
+ if commited[-1].content.hash_key(name.to_sym)
+ removed.push(name.to_sym)
+ Information.new("Added #{name} for removal.",
+ true,
+ @commited[-1].content[name.to_sym])
+ else
+ Information.new("Object #{name} is not committed.", false)
+ end
+ end
+
+ def checkout(hash)
+ index = commited.find_index { |item| item.hash == hash }
+ if index
+ @branch.current.commited = commited[0..index]
+ Information.new("HEAD is now at #{hash}", true, commited[-1])
+ else
+ Information.new("Commit #{hash} does not exist.", false)
+ end
+ end
+
+ def head
+ if commited.size > 1
+ Information.new("#{commited[-1].message}", true, commited[-1])
+ else
+ Information.new("Branch #{@branch.name} does not have any commits yet.",
+ false)
+ end
+ end
+
+ def log
+ if commited.size == 1
+ Information.new("Branch #{@branch.name} does not have any commits yet.",
+ false)
+ else
+ message = commited[1..-1].map { |item| item.to_s }.join("\n\n")
+ Information.new(message)
+ end
+ end
+
+ def get(name)
+ if commited[-1].content.has_key?(name.to_sym)
+ Information.new("Found object #{name}.",
+ true,
+ commited[-1].content[name.to_sym])
+ else
+ Information.new("Object #{name} is not commited.", false)
+ end
+ end
+
+ def execute
+ yield
+ end
+
+ private
+
+ def added
+ @branch.current.added
+ end
+
+ def commited
+ @branch.current.commited
+ end
+
+ def removed
+ @branch.current.removed
+ end
+end
+
+class ObjectStore
+ def ObjectStore.init(&block)
+ if block_given?
+ container = ContentManager.new
+ container.instance_eval(&block)
+ container
+ else
+ ContentManager.new
+ end
+ end
+end