githug 0.4.3 → 0.4.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90475cdbf217159f69447674586c43346ec23bca
4
- data.tar.gz: 3f6ae08fcf6e630fe0ff4e15734481660b5c3de0
3
+ metadata.gz: e8d94eb08289627d4acc9a7af8b5fcfdd2994501
4
+ data.tar.gz: 4be2995f158cee6c89acbce3e9a6414a7df071d5
5
5
  SHA512:
6
- metadata.gz: 921a1e7f8e9bec2f4b26ae4a7530fac8e0e3cce43ba4dec7aae6dbf7ed593835e2b2c48ada93c3ed3dfda806d5388e8280fef4b999acb4715e0fc053d8443f80
7
- data.tar.gz: 17b1d9dc8d7f5c2c82dfabdf946fc7664048f36a1c5049eddc2484e5a0631273ec209f2c3edbd7541a9a394d9198c61ae8a20889bd22d07818fca67bc2e5810e
6
+ metadata.gz: 7891476804389f2a977ed64fab255f8623ae9aa7777e7f71ccb2111e5b9b111fb639c5c0d4ee72a110d2313f54a5acb49ec5536384f997f18269301b4e5c002b
7
+ data.tar.gz: 604b7ae4993d21505ae5851335103334d1a6d390ca035c65cca3322833853e649c87deb506385c83d6310937834e039dfb77ff8c63af86b4134436a31c779911
data/levels/fetch.rb CHANGED
@@ -52,13 +52,13 @@ solution do
52
52
  # after a git fetch command, each branch will be stored in in the .git/FETCH_HEAD file. Each branch is on its own line
53
53
  # This command will count the number of lines, which will give the number of branches
54
54
  if File.file?('.git/FETCH_HEAD') #checks for file existance
55
- num_remote = `wc -l < .git/FETCH_HEAD`
55
+ num_remote = File.read(".git/FETCH_HEAD").split("\n").count
56
56
  else
57
- num_remote = '0'
57
+ num_remote = 0
58
58
  end
59
59
 
60
60
  # there should be 1 local branch and 2 remote branches for a success condition
61
- if local_branches == 1 and num_remote.to_i == 2
61
+ if local_branches == 1 and num_remote == 2
62
62
  result = true
63
63
  else
64
64
  result = false
@@ -39,6 +39,7 @@ solution do
39
39
  result = false unless file.readline =~ /some feature/
40
40
  result = false unless file.readline =~ /getting awesomer/
41
41
  result = false unless file.readline =~ /and awesomer!/
42
+ file.close
42
43
 
43
44
  result
44
45
  end
@@ -60,7 +60,7 @@ solution do
60
60
 
61
61
  #each branch consits of one line, `wc -l counts the number of lines in order to get the number of remote branches`
62
62
  #At the moment Grit doesn't support remote branch references but is on the ToDo list. This should be revisited when Grit implements the change
63
- num_remote_branches = `git branch -r | wc -l`.to_i
63
+ num_remote_branches = `git branch -r`.split("\n").count
64
64
 
65
65
  # counts the number of commits in the remote master branch'
66
66
  remote_master_commits = repo.commits('origin/master').count
data/levels/rebase.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  difficulty 2
2
2
 
3
- description "We are using a git rebase workflow and the feature branch is ready to go into master. Let's rebase the master branch into our feature branch."
3
+ description "We are using a git rebase workflow and the feature branch is ready to go into master. Let's rebase the feature branch onto our master branch."
4
4
 
5
5
  setup do
6
6
  init_from_level
data/levels/squash.rb CHANGED
@@ -4,7 +4,7 @@ description "You have committed several times but would like all those changes t
4
4
  setup do
5
5
  repo.init
6
6
  FileUtils.touch(".hidden")
7
- repo.add("hidden")
7
+ repo.add(".hidden")
8
8
  repo.commit_all("Initial Commit")
9
9
  FileUtils.touch("README")
10
10
  repo.add("README")
@@ -0,0 +1,20 @@
1
+ difficulty 2
2
+ description "You want to include the files from the following repo: `https://github.com/jackmaney/githug-include-me` into a the folder `./githug-include-me`. Do this without cloning the repo or copying the files from the repo into this repo."
3
+
4
+ setup do
5
+ repo.init
6
+ end
7
+
8
+ solution do
9
+ return false if not File.directory?("./githug-include-me")
10
+ return false if not File.exist?("./githug-include-me/README.md")
11
+ return false if not File.exist?("./githug-include-me/.git")
12
+ return false if File.directory?("./githug-include-me/.git")
13
+ return false if not File.exist?(".gitmodules")
14
+
15
+ return true
16
+ end
17
+
18
+ hint do
19
+ puts "Take a look at `git submodule`."
20
+ end
data/lib/githug/level.rb CHANGED
@@ -11,7 +11,8 @@ module Githug
11
11
  "checkout", "checkout_tag", "checkout_tag_over_branch", "branch_at",
12
12
  "delete_branch", "push_branch", "merge", "fetch", "rebase", "repack", "cherry-pick",
13
13
  "grep", "rename_commit", "squash", "merge_squash", "reorder", "bisect",
14
- "stage_lines", "find_old_branch", "revert", "restore", "conflict", "contribute"]
14
+ "stage_lines", "find_old_branch", "revert", "restore", "conflict",
15
+ "submodule","contribute"]
15
16
 
16
17
  attr_accessor :level_no, :level_path, :level_name
17
18
 
@@ -1,3 +1,3 @@
1
1
  module Githug
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
3
3
  end
data/spec/githug_spec.rb CHANGED
@@ -298,6 +298,11 @@ describe "The Game" do
298
298
  skip_level
299
299
  end
300
300
 
301
+ it "solves the submodule level" do
302
+ `git submodule add https://github.com/jackmaney/githug-include-me`
303
+ `githug`.should be_solved
304
+ end
305
+
301
306
  it "solves the contribute level" do
302
307
  skip_level
303
308
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: githug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gary Rennie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-15 00:00:00.000000000 Z
11
+ date: 2015-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -465,6 +465,7 @@ files:
465
465
  - levels/stash/.githug/refs/heads/master
466
466
  - levels/stash/lyrics.txt
467
467
  - levels/status.rb
468
+ - levels/submodule.rb
468
469
  - levels/tag.rb
469
470
  - lib/githug.rb
470
471
  - lib/githug/cli.rb