gitscrub 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -54,6 +54,15 @@ An example level:
54
54
 
55
55
  `difficulty`, `description` and `solution` are required.
56
56
 
57
+ **note** Because `solution` is a Proc, you cannot prematurely return out of it and as a result, must put an implicit return on the last line of the solution block.
58
+
59
+
60
+ solution do
61
+ solved = false
62
+ solved = true if repo.valid?
63
+ solved
64
+ end
65
+
57
66
  By default, `setup` will remove all files from the game folder. You do not need to include a setup method if you don't want an initial git repository (if you are testing `git init` or only checking an answer.)
58
67
 
59
68
  You can call `repo.init` to initialize an empty repository with a .gitignore file. It takes a single parameter of false if you want to skip the initial commit of the .gitignore file.
data/levels/blame.rb CHANGED
@@ -10,7 +10,7 @@ solution do
10
10
  solved = false
11
11
 
12
12
  offender = repo.commit("97bdd0cccf9f4b8730f78cb53a81a74f205dbcc2").author.name
13
- solved = true if request("Who made the commit with the password?") == offender
13
+ solved = true if request("Who made the commit with the password?").downcase == offender.downcase
14
14
 
15
15
  solved
16
16
  end
data/levels/clone.rb ADDED
@@ -0,0 +1,10 @@
1
+ difficulty 1
2
+ description "Clone the repository at https://github.com/Gazler/cloneme"
3
+
4
+ solution do
5
+ repo("cloneme").commit("157b2b61f29ab9df45f31c7cd9cb5d8ff06ecde4")
6
+ end
7
+
8
+ hint do
9
+ puts "You should have a look at this site: https://github.com/Gazler/cloneme"
10
+ end
@@ -2,7 +2,7 @@ module Gitscrub
2
2
  class Level
3
3
  include UI
4
4
 
5
- LEVELS = [nil, "init", "add", "commit", "config", "blame", "contribute"]
5
+ LEVELS = [nil, "init", "add", "commit", "config", "clone", "blame", "contribute"]
6
6
 
7
7
  attr_accessor :level_no, :level_path
8
8
 
@@ -60,8 +60,8 @@ module Gitscrub
60
60
  @setup.call if @setup
61
61
  end
62
62
 
63
- def repo
64
- @repo ||= Repository.new
63
+ def repo(location = "")
64
+ @repo ||= Repository.new(location)
65
65
  end
66
66
 
67
67
  def solve
@@ -3,8 +3,8 @@ module Gitscrub
3
3
 
4
4
  attr_accessor :grit
5
5
 
6
- def initialize
7
- @grit = Grit::Repo.new(".")
6
+ def initialize(location = ".")
7
+ @grit = Grit::Repo.new(location)
8
8
  rescue Grit::InvalidGitRepositoryError
9
9
  @grit = nil
10
10
  end
@@ -1,3 +1,3 @@
1
1
  module Gitscrub
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -11,7 +11,7 @@ describe Gitscrub::Repository do
11
11
  describe "initialize" do
12
12
 
13
13
  it "should call grit on initialize" do
14
- Grit::Repo.should_receive(:new).and_return(@grit)
14
+ Grit::Repo.should_receive(:new).with(".").and_return(@grit)
15
15
  repo = Gitscrub::Repository.new
16
16
  repo.grit.should equal(@grit)
17
17
  end
@@ -22,6 +22,11 @@ describe Gitscrub::Repository do
22
22
  repo.grit.should equal(nil)
23
23
  end
24
24
 
25
+ it "should initialize with a location" do
26
+ Grit::Repo.should_receive(:new).with("test").and_return(@grit)
27
+ repo = Gitscrub::Repository.new("test")
28
+ end
29
+
25
30
  end
26
31
 
27
32
  describe "reset" do
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gitscrub
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.6
5
+ version: 0.0.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Gary Rennie
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-03-08 00:00:00 +00:00
13
+ date: 2012-03-09 00:00:00 +00:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -100,6 +100,7 @@ files:
100
100
  - levels/blame/.gitscrub/objects/ff/d39c2dbfd94bdbca06d48686e0cbda642f3de7
101
101
  - levels/blame/.gitscrub/refs/heads/master
102
102
  - levels/blame/config.rb
103
+ - levels/clone.rb
103
104
  - levels/commit.rb
104
105
  - levels/config.rb
105
106
  - levels/contribute.rb