Skip to content

Commit

Permalink
Added rename level and updated to 0.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Gary Rennie committed Mar 16, 2012
2 parents 1e0c438 + 9ec368e commit 374349f
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
18 changes: 18 additions & 0 deletions levels/rename.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
difficulty 3

description "We have a file called oldfile.txt. We want to rename it to newfile.txt and stage this change."

setup do
repo.init
FileUtils.touch("oldfile.txt")
repo.add("oldfile.txt")
repo.commit_all("Commited oldfile.txt")
end

solution do
repo.status["oldfile.txt"].type == "D" && repo.status["newfile.txt"].type == "A" && repo.status["oldfile.txt"].stage.nil?
end

hint do
puts "Take a look at `git mv`"
end
5 changes: 5 additions & 0 deletions lib/githug/game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ def play_level
end
end

def dry_run(level)
level = Level.load(level)

end

def level_bump
profile.level_bump
if level = Level.load(profile.level)
Expand Down
8 changes: 4 additions & 4 deletions lib/githug/level.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ class Level
include UI

LEVELS = [nil, "init", "add", "commit", "config", "clone",
"clone_to_folder", "ignore", "status", "rm", "rm_cached", "log",
"commit_ammend", "reset", "checkout_file", "remote", "remote_url",
"remote_add", "diff", "blame", "branch", "checkout", "merge",
"squash", "contribute"]
"clone_to_folder", "ignore", "status", "rm", "rm_cached", "rename",
"log", "commit_ammend", "reset", "checkout_file", "remote",
"remote_url", "remote_add", "diff", "blame", "branch", "checkout",
"merge", "squash", "contribute"]

attr_accessor :level_no, :level_path

Expand Down
2 changes: 1 addition & 1 deletion lib/githug/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Githug
VERSION = "0.1.4"
VERSION = "0.1.5"
end
7 changes: 7 additions & 0 deletions spec/githug/game_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@

end


describe "dry run" do
it "should play the game without altering the profile" do
pending
end
end

it "should output the description of the next level" do
@level.should_receive(:full_description)
@profile.stub(:level=)
Expand Down

0 comments on commit 374349f

Please sign in to comment.