githug 0.4.8 → 0.5.0
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 +4 -4
- data/githug.gemspec +1 -1
- data/levels/ignore.rb +1 -1
- data/levels/rebase_onto.rb +45 -0
- data/levels/submodule.rb +1 -1
- data/lib/githug/cli.rb +7 -1
- data/lib/githug/level.rb +1 -1
- data/lib/githug/version.rb +1 -1
- data/spec/githug/cli_spec.rb +12 -0
- data/spec/githug/profile_spec.rb +1 -1
- data/spec/githug_spec.rb +6 -0
- metadata +19 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 902c5775d724ae3be89e0c52eb01907288680b00
|
4
|
+
data.tar.gz: 9f6a93e66437b2fc9c2ba49bd1bd32bb504b2900
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0f50cad99ed1fd09263a1c7e54d711c4d98d0adfc5d166c27050d743f1203974384d67b2a45b7be8cfbc0600467503f239dc56ebafddaa2e45962610d8460b3
|
7
|
+
data.tar.gz: 3a931fcdfc57acdd9500917f554c9dd3c134b31755378cc50d278bb09332706a5e4407f1399a532b9788ca90754d1e0afe873d04be2b9ecb0c0e90a4871fc6af
|
data/githug.gemspec
CHANGED
data/levels/ignore.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
difficulty 2
|
2
|
-
description "The text editor 'vim' creates files ending in `.swp` (swap files) for all files that are currently open. We don't want them creeping into the repository. Make this repository ignore `.swp
|
2
|
+
description "The text editor 'vim' creates files ending in `.swp` (swap files) for all files that are currently open. We don't want them creeping into the repository. Make this repository ignore those swap files which are ending in `.swp`."
|
3
3
|
|
4
4
|
setup do
|
5
5
|
repo.init
|
@@ -0,0 +1,45 @@
|
|
1
|
+
difficulty 2
|
2
|
+
|
3
|
+
description "You have created your branch from `wrong_branch` and already made some commits, \
|
4
|
+
and you realise that you needed to create your branch from `master`. \
|
5
|
+
Rebase your commits onto `master` branch so that you don't have `wrong_branch` commits."
|
6
|
+
|
7
|
+
setup do
|
8
|
+
readme_file = "README.md"
|
9
|
+
authors_file = "authors.md"
|
10
|
+
|
11
|
+
repo.init
|
12
|
+
FileUtils.touch(authors_file)
|
13
|
+
File.open(authors_file, "w") { |f| f << "https://github.com/janis-vitols\n" }
|
14
|
+
repo.add(authors_file)
|
15
|
+
repo.commit_all("Create authors file")
|
16
|
+
|
17
|
+
repo.git.native :checkout, { "b" => true }, "wrong_branch"
|
18
|
+
File.open(authors_file, "w") { |f| f << "None\n" }
|
19
|
+
repo.add(authors_file)
|
20
|
+
repo.commit_all("Wrong changes")
|
21
|
+
|
22
|
+
repo.git.native :checkout, { "b" => true }, "readme-update"
|
23
|
+
FileUtils.touch(readme_file)
|
24
|
+
File.open(readme_file, "a") { |f| f << "# SuperApp\n" }
|
25
|
+
repo.add(readme_file)
|
26
|
+
repo.commit_all("Add app name in readme")
|
27
|
+
File.open(readme_file, "a") { |f| f << "## About\n" }
|
28
|
+
repo.add(readme_file)
|
29
|
+
repo.commit_all("Add `About` header in readme")
|
30
|
+
File.open(readme_file, "a") { |f| f << "## Install\n" }
|
31
|
+
repo.add(readme_file)
|
32
|
+
repo.commit_all("Add `Install` header in readme")
|
33
|
+
end
|
34
|
+
|
35
|
+
solution do
|
36
|
+
repo.commits("readme-update").each { |commit| return false if commit.message == "Wrong changes" }
|
37
|
+
return false unless repo.commits("readme-update").length == 4
|
38
|
+
return false unless File.readlines("authors.md").include?("https://github.com/janis-vitols\n")
|
39
|
+
|
40
|
+
true
|
41
|
+
end
|
42
|
+
|
43
|
+
hint do
|
44
|
+
puts "You want to research the `git rebase` commands `--onto` argument"
|
45
|
+
end
|
data/levels/submodule.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
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."
|
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 manually cloning the repo or copying the files from the repo into this repo."
|
3
3
|
|
4
4
|
setup do
|
5
5
|
repo.init
|
data/lib/githug/cli.rb
CHANGED
@@ -38,7 +38,7 @@ module Githug
|
|
38
38
|
LEVEL parameter which will reset the game to a specific level. For
|
39
39
|
example:
|
40
40
|
|
41
|
-
> $ githug reset merge_squash
|
41
|
+
> $ githug reset merge_squash # or $ githug reset 45
|
42
42
|
|
43
43
|
Will reset githug to level '#45: merge_squash'
|
44
44
|
LONGDESC
|
@@ -67,10 +67,16 @@ module Githug
|
|
67
67
|
|
68
68
|
def load_level(path = nil)
|
69
69
|
return load_level_from_profile unless path
|
70
|
+
return load_level_from_number(path.to_i) if path.to_i.to_s == path
|
70
71
|
return load_level_from_name(path) if Level.list.include?(path)
|
71
72
|
Level.load_from_file(path)
|
72
73
|
end
|
73
74
|
|
75
|
+
def load_level_from_number(number)
|
76
|
+
level_name = number >= 1 ? Level.list[number - 1] : nil
|
77
|
+
return load_level_from_name(level_name)
|
78
|
+
end
|
79
|
+
|
74
80
|
def load_level_from_name(name)
|
75
81
|
profile = Profile.load
|
76
82
|
profile.set_level(name)
|
data/lib/githug/level.rb
CHANGED
@@ -9,7 +9,7 @@ module Githug
|
|
9
9
|
"commit_in_future", "reset", "reset_soft", "checkout_file", "remote",
|
10
10
|
"remote_url", "pull", "remote_add", "push", "diff", "blame", "branch",
|
11
11
|
"checkout", "checkout_tag", "checkout_tag_over_branch", "branch_at",
|
12
|
-
"delete_branch", "push_branch", "merge", "fetch", "rebase", "repack", "cherry-pick",
|
12
|
+
"delete_branch", "push_branch", "merge", "fetch", "rebase", "rebase_onto", "repack", "cherry-pick",
|
13
13
|
"grep", "rename_commit", "squash", "merge_squash", "reorder", "bisect",
|
14
14
|
"stage_lines", "find_old_branch", "revert", "restore", "conflict",
|
15
15
|
"submodule","contribute"]
|
data/lib/githug/version.rb
CHANGED
data/spec/githug/cli_spec.rb
CHANGED
@@ -98,6 +98,18 @@ describe Githug::CLI do
|
|
98
98
|
subject.reset("add")
|
99
99
|
end
|
100
100
|
|
101
|
+
it "resets the level with a level number" do
|
102
|
+
level.should_receive(:setup_level)
|
103
|
+
level.should_receive(:full_description)
|
104
|
+
profile = mock
|
105
|
+
Githug::Profile.stub(:load).and_return(profile)
|
106
|
+
profile.should_receive(:set_level).with("rename_commit")
|
107
|
+
Githug::Level.should_receive(:load).with("rename_commit").and_return(level)
|
108
|
+
Githug::UI.should_receive(:word_box).with("Githug")
|
109
|
+
Githug::UI.should_receive(:puts).with("resetting level")
|
110
|
+
subject.reset("45")
|
111
|
+
end
|
112
|
+
|
101
113
|
it "resets the level with a path" do
|
102
114
|
level.should_receive(:setup_level)
|
103
115
|
level.should_receive(:full_description)
|
data/spec/githug/profile_spec.rb
CHANGED
data/spec/githug_spec.rb
CHANGED
@@ -237,6 +237,12 @@ describe "The Game" do
|
|
237
237
|
`githug`.should be_solved
|
238
238
|
end
|
239
239
|
|
240
|
+
it "solves the rebase_onto level" do
|
241
|
+
`git checkout readme-update`
|
242
|
+
`git rebase --onto master wrong_branch readme-update`
|
243
|
+
`githug`.should be_solved
|
244
|
+
end
|
245
|
+
|
240
246
|
it "solves the repack level" do
|
241
247
|
`git repack -d`
|
242
248
|
`githug`.should be_solved
|
metadata
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: githug
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gary Rennie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 2.8.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.8.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: grit
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 2.3.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 2.3.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: thor
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.14.6
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.14.6
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - "<"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '11'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - "<"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '11'
|
69
69
|
description: An interactive way to learn git.
|
70
70
|
email:
|
71
71
|
- webmaster@gazler.com
|
@@ -74,9 +74,9 @@ executables:
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
-
- .gitignore
|
78
|
-
- .rspec
|
79
|
-
- .travis.yml
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".travis.yml"
|
80
80
|
- Gemfile
|
81
81
|
- LICENCE.txt
|
82
82
|
- README.md
|
@@ -425,6 +425,7 @@ files:
|
|
425
425
|
- levels/rebase/.githug/refs/heads/feature
|
426
426
|
- levels/rebase/.githug/refs/heads/master
|
427
427
|
- levels/rebase/README
|
428
|
+
- levels/rebase_onto.rb
|
428
429
|
- levels/remote.rb
|
429
430
|
- levels/remote_add.rb
|
430
431
|
- levels/remote_url.rb
|
@@ -494,17 +495,17 @@ require_paths:
|
|
494
495
|
- lib
|
495
496
|
required_ruby_version: !ruby/object:Gem::Requirement
|
496
497
|
requirements:
|
497
|
-
- -
|
498
|
+
- - ">="
|
498
499
|
- !ruby/object:Gem::Version
|
499
500
|
version: '0'
|
500
501
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
501
502
|
requirements:
|
502
|
-
- -
|
503
|
+
- - ">="
|
503
504
|
- !ruby/object:Gem::Version
|
504
505
|
version: '0'
|
505
506
|
requirements: []
|
506
507
|
rubyforge_project: githug
|
507
|
-
rubygems_version: 2.
|
508
|
+
rubygems_version: 2.1.11
|
508
509
|
signing_key:
|
509
510
|
specification_version: 4
|
510
511
|
summary: An interactive way to learn git.
|