From 1621f85e9c12df251ae0e800a5a289fc1d0f8acb Mon Sep 17 00:00:00 2001 From: Gary Rennie Date: Wed, 14 Mar 2012 19:20:18 +0000 Subject: [PATCH] Renamed from gitscrub to githug --- README.md | 20 ++++----- bin/githug | 4 ++ bin/gitscrub | 4 -- gitscrub.gemspec => githug.gemspec | 8 ++-- .../{.gitscrub => .githug}/COMMIT_EDITMSG | 0 levels/blame/{.gitscrub => .githug}/HEAD | 0 levels/blame/{.gitscrub => .githug}/config | 0 .../blame/{.gitscrub => .githug}/description | 0 .../hooks/applypatch-msg.sample | 0 .../hooks/commit-msg.sample | 0 .../hooks/post-commit.sample | 0 .../hooks/post-receive.sample | 0 .../hooks/post-update.sample | 0 .../hooks/pre-applypatch.sample | 0 .../hooks/pre-commit.sample | 0 .../hooks/pre-rebase.sample | 0 .../hooks/prepare-commit-msg.sample | 0 .../hooks/update.sample | 0 levels/blame/{.gitscrub => .githug}/index | Bin .../blame/{.gitscrub => .githug}/info/exclude | 0 levels/blame/{.gitscrub => .githug}/logs/HEAD | 0 .../logs/refs/heads/master | 0 .../00/d6bf5341b263ccaf32e7973be55126eb30a343 | Bin .../05/07c26fed4d111a8344763be9af68af90f0ecf2 | Bin .../09/4094808dc6dc336c93c8602190a9e5f7bd6a11 | 0 .../21/15d78864000292628872941b14521f90187eed | Bin .../31/11dda1f5b08d50ac44b99acabfa54f1e6e72b0 | 0 .../50/8db115ba34a0e4e8667653aebe0265bb4f7e80 | Bin .../5e/8863df752e3b7f2150df7c78f12bef6f1ff00e | Bin .../67/788a4b90180c7588d7bd0ad8032957b0f429ba | Bin .../70/d00535a3a25b0ac1736dd3d306d6271e5427ed | Bin .../97/bdd0cccf9f4b8730f78cb53a81a74f205dbcc2 | 0 .../ab/08819ba3ffaeba17d4f870dc3a458a904519f4 | Bin .../be/96fe46de646f6a5c728f90cc884aef96fa1d6f | Bin .../cd/9c6b9ab1a6f56cccc69b6aa661f1d67ba5fb46 | Bin .../dd/df1d8ebd60eec169c15a5b23cb49a58d2ed5a0 | 0 .../ff/d39c2dbfd94bdbca06d48686e0cbda642f3de7 | 0 .../{.gitscrub => .githug}/refs/heads/master | 0 levels/contribute.rb | 4 +- .../{.gitscrub => .githug}/COMMIT_EDITMSG | 0 levels/diff/{.gitscrub => .githug}/HEAD | 0 levels/diff/{.gitscrub => .githug}/config | 0 .../diff/{.gitscrub => .githug}/description | 0 .../hooks/applypatch-msg.sample | 0 .../hooks/commit-msg.sample | 0 .../hooks/post-commit.sample | 0 .../hooks/post-receive.sample | 0 .../hooks/post-update.sample | 0 .../hooks/pre-applypatch.sample | 0 .../hooks/pre-commit.sample | 0 .../hooks/pre-rebase.sample | 0 .../hooks/prepare-commit-msg.sample | 0 .../hooks/update.sample | 0 levels/diff/{.gitscrub => .githug}/index | Bin .../diff/{.gitscrub => .githug}/info/exclude | 0 levels/diff/{.gitscrub => .githug}/logs/HEAD | 0 .../logs/refs/heads/master | 0 .../1b/6582364621c92707b587409cedbc4f77fc0cee | Bin .../4f/703ca9bd25781b6758eeb3c42ed5348610ba6d | 0 .../dc/aa55e97af34402e84d5336da37abcccc23cba6 | 0 .../{.gitscrub => .githug}/refs/heads/master | 0 lib/githug.rb | 11 +++++ lib/{gitscrub => githug}/cli.rb | 20 ++++----- lib/{gitscrub => githug}/game.rb | 4 +- lib/{gitscrub => githug}/level.rb | 6 +-- lib/{gitscrub => githug}/profile.rb | 2 +- lib/{gitscrub => githug}/repository.rb | 4 +- lib/{gitscrub => githug}/ui.rb | 2 +- lib/githug/version.rb | 3 ++ lib/gitscrub.rb | 11 ----- lib/gitscrub/version.rb | 3 -- spec/{gitscrub => githug}/cli_spec.rb | 38 +++++++++--------- spec/{gitscrub => githug}/game_spec.rb | 16 ++++---- spec/{gitscrub => githug}/level_spec.rb | 30 +++++++------- spec/githug/profile_spec.rb | 36 +++++++++++++++++ spec/{gitscrub => githug}/repository_spec.rb | 15 ++++--- spec/{gitscrub => githug}/ui_spec.rb | 8 ++-- spec/gitscrub/profile_spec.rb | 36 ----------------- spec/spec_helper.rb | 2 +- 79 files changed, 143 insertions(+), 144 deletions(-) create mode 100755 bin/githug delete mode 100755 bin/gitscrub rename gitscrub.gemspec => githug.gemspec (85%) rename levels/blame/{.gitscrub => .githug}/COMMIT_EDITMSG (100%) rename levels/blame/{.gitscrub => .githug}/HEAD (100%) rename levels/blame/{.gitscrub => .githug}/config (100%) rename levels/blame/{.gitscrub => .githug}/description (100%) rename levels/blame/{.gitscrub => .githug}/hooks/applypatch-msg.sample (100%) rename levels/blame/{.gitscrub => .githug}/hooks/commit-msg.sample (100%) rename levels/blame/{.gitscrub => .githug}/hooks/post-commit.sample (100%) rename levels/blame/{.gitscrub => .githug}/hooks/post-receive.sample (100%) rename levels/blame/{.gitscrub => .githug}/hooks/post-update.sample (100%) rename levels/blame/{.gitscrub => .githug}/hooks/pre-applypatch.sample (100%) rename levels/blame/{.gitscrub => .githug}/hooks/pre-commit.sample (100%) rename levels/blame/{.gitscrub => .githug}/hooks/pre-rebase.sample (100%) rename levels/blame/{.gitscrub => .githug}/hooks/prepare-commit-msg.sample (100%) rename levels/blame/{.gitscrub => .githug}/hooks/update.sample (100%) rename levels/blame/{.gitscrub => .githug}/index (100%) rename levels/blame/{.gitscrub => .githug}/info/exclude (100%) rename levels/blame/{.gitscrub => .githug}/logs/HEAD (100%) rename levels/blame/{.gitscrub => .githug}/logs/refs/heads/master (100%) rename levels/blame/{.gitscrub => .githug}/objects/00/d6bf5341b263ccaf32e7973be55126eb30a343 (100%) rename levels/blame/{.gitscrub => .githug}/objects/05/07c26fed4d111a8344763be9af68af90f0ecf2 (100%) rename levels/blame/{.gitscrub => .githug}/objects/09/4094808dc6dc336c93c8602190a9e5f7bd6a11 (100%) rename levels/blame/{.gitscrub => .githug}/objects/21/15d78864000292628872941b14521f90187eed (100%) rename levels/blame/{.gitscrub => .githug}/objects/31/11dda1f5b08d50ac44b99acabfa54f1e6e72b0 (100%) rename levels/blame/{.gitscrub => .githug}/objects/50/8db115ba34a0e4e8667653aebe0265bb4f7e80 (100%) rename levels/blame/{.gitscrub => .githug}/objects/5e/8863df752e3b7f2150df7c78f12bef6f1ff00e (100%) rename levels/blame/{.gitscrub => .githug}/objects/67/788a4b90180c7588d7bd0ad8032957b0f429ba (100%) rename levels/blame/{.gitscrub => .githug}/objects/70/d00535a3a25b0ac1736dd3d306d6271e5427ed (100%) rename levels/blame/{.gitscrub => .githug}/objects/97/bdd0cccf9f4b8730f78cb53a81a74f205dbcc2 (100%) rename levels/blame/{.gitscrub => .githug}/objects/ab/08819ba3ffaeba17d4f870dc3a458a904519f4 (100%) rename levels/blame/{.gitscrub => .githug}/objects/be/96fe46de646f6a5c728f90cc884aef96fa1d6f (100%) rename levels/blame/{.gitscrub => .githug}/objects/cd/9c6b9ab1a6f56cccc69b6aa661f1d67ba5fb46 (100%) rename levels/blame/{.gitscrub => .githug}/objects/dd/df1d8ebd60eec169c15a5b23cb49a58d2ed5a0 (100%) rename levels/blame/{.gitscrub => .githug}/objects/ff/d39c2dbfd94bdbca06d48686e0cbda642f3de7 (100%) rename levels/blame/{.gitscrub => .githug}/refs/heads/master (100%) rename levels/diff/{.gitscrub => .githug}/COMMIT_EDITMSG (100%) rename levels/diff/{.gitscrub => .githug}/HEAD (100%) rename levels/diff/{.gitscrub => .githug}/config (100%) rename levels/diff/{.gitscrub => .githug}/description (100%) rename levels/diff/{.gitscrub => .githug}/hooks/applypatch-msg.sample (100%) rename levels/diff/{.gitscrub => .githug}/hooks/commit-msg.sample (100%) rename levels/diff/{.gitscrub => .githug}/hooks/post-commit.sample (100%) rename levels/diff/{.gitscrub => .githug}/hooks/post-receive.sample (100%) rename levels/diff/{.gitscrub => .githug}/hooks/post-update.sample (100%) rename levels/diff/{.gitscrub => .githug}/hooks/pre-applypatch.sample (100%) rename levels/diff/{.gitscrub => .githug}/hooks/pre-commit.sample (100%) rename levels/diff/{.gitscrub => .githug}/hooks/pre-rebase.sample (100%) rename levels/diff/{.gitscrub => .githug}/hooks/prepare-commit-msg.sample (100%) rename levels/diff/{.gitscrub => .githug}/hooks/update.sample (100%) rename levels/diff/{.gitscrub => .githug}/index (100%) rename levels/diff/{.gitscrub => .githug}/info/exclude (100%) rename levels/diff/{.gitscrub => .githug}/logs/HEAD (100%) rename levels/diff/{.gitscrub => .githug}/logs/refs/heads/master (100%) rename levels/diff/{.gitscrub => .githug}/objects/1b/6582364621c92707b587409cedbc4f77fc0cee (100%) rename levels/diff/{.gitscrub => .githug}/objects/4f/703ca9bd25781b6758eeb3c42ed5348610ba6d (100%) rename levels/diff/{.gitscrub => .githug}/objects/dc/aa55e97af34402e84d5336da37abcccc23cba6 (100%) rename levels/diff/{.gitscrub => .githug}/refs/heads/master (100%) create mode 100644 lib/githug.rb rename lib/{gitscrub => githug}/cli.rb (69%) rename lib/{gitscrub => githug}/game.rb (93%) rename lib/{gitscrub => githug}/level.rb (94%) rename lib/{gitscrub => githug}/profile.rb (98%) rename lib/{gitscrub => githug}/repository.rb (92%) rename lib/{gitscrub => githug}/ui.rb (98%) create mode 100644 lib/githug/version.rb delete mode 100644 lib/gitscrub.rb delete mode 100644 lib/gitscrub/version.rb rename spec/{gitscrub => githug}/cli_spec.rb (58%) rename spec/{gitscrub => githug}/game_spec.rb (72%) rename spec/{gitscrub => githug}/level_spec.rb (77%) create mode 100644 spec/githug/profile_spec.rb rename spec/{gitscrub => githug}/repository_spec.rb (87%) rename spec/{gitscrub => githug}/ui_spec.rb (93%) delete mode 100644 spec/gitscrub/profile_spec.rb diff --git a/README.md b/README.md index e5758e43..e13d6a7b 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,19 @@ -#Gitscrub +#Githug Git Your Game On ##About -Gitscrub is designed to give you a practical way of learning git. It has a series of levels, each utilizing git commands to ensure a correct answer. +Githug is designed to give you a practical way of learning git. It has a series of levels, each utilizing git commands to ensure a correct answer. ##Installation -To install Gitscrub +To install Githug - gem install gitscrub + gem install githug -After the gem is installed, you can run `gitscrub` where you will be prompted to create a directory. +After the gem is installed, you can run `githug` where you will be prompted to create a directory. ##Commands -Gitscrub has 3 commands: +Githug has 3 commands: * play - This is the default command and it will check your solution for the current level. * hint - Gives you a hint (if available) for the current level * reset - Reset the current level @@ -21,17 +21,17 @@ Gitscrub has 3 commands: ##Contributing - Get yourself on the [contributors list](https://github.com/Gazler/gitscrub/contributors) by doing the following: + Get yourself on the [contributors list](https://github.com/Gazler/githug/contributors) by doing the following: * Fork the repository * Make a level using the DSL (covered below) - * Add your level to the LEVELS array inside `lib/gitscrub/level.rb` in a position that makes sense (the "commit" level after the "add" and "init" levels for example) + * Add your level to the LEVELS array inside `lib/githug/level.rb` in a position that makes sense (the "commit" level after the "add" and "init" levels for example) * Make sure your level works (covered below) * Submit a pull request ##DSL -Gitscrub has a DSL for writing levels +Githug has a DSL for writing levels An example level: @@ -83,7 +83,7 @@ This will copy the contents of a repository specified in the levels folder for y * cd "yourlevel" * git init * some git stuff - * **important** rename ".git" to ".gitscrub" so it does not get treated as a submodule + * **important** rename ".git" to ".githug" so it does not get treated as a submodule * cd "../" * git add "yourlevel" diff --git a/bin/githug b/bin/githug new file mode 100755 index 00000000..646dc0c5 --- /dev/null +++ b/bin/githug @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +require 'githug/cli' + +Githug::CLI.start diff --git a/bin/gitscrub b/bin/gitscrub deleted file mode 100755 index b864cf0a..00000000 --- a/bin/gitscrub +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env ruby -require 'gitscrub/cli' - -Gitscrub::CLI.start diff --git a/gitscrub.gemspec b/githug.gemspec similarity index 85% rename from gitscrub.gemspec rename to githug.gemspec index 684f5e18..bb75f75b 100644 --- a/gitscrub.gemspec +++ b/githug.gemspec @@ -1,17 +1,17 @@ # -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) -require "gitscrub/version" +require "githug/version" Gem::Specification.new do |s| - s.name = "gitscrub" - s.version = Gitscrub::VERSION + s.name = "githug" + s.version = Githug::VERSION s.authors = ["Gary Rennie"] s.email = ["webmaster@gazler.com"] s.homepage = "" s.summary = %q{An interactive way to learn git.} s.description = %q{An interactive way to learn git.} - s.rubyforge_project = "gitscrub" + s.rubyforge_project = "githug" s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") diff --git a/levels/blame/.gitscrub/COMMIT_EDITMSG b/levels/blame/.githug/COMMIT_EDITMSG similarity index 100% rename from levels/blame/.gitscrub/COMMIT_EDITMSG rename to levels/blame/.githug/COMMIT_EDITMSG diff --git a/levels/blame/.gitscrub/HEAD b/levels/blame/.githug/HEAD similarity index 100% rename from levels/blame/.gitscrub/HEAD rename to levels/blame/.githug/HEAD diff --git a/levels/blame/.gitscrub/config b/levels/blame/.githug/config similarity index 100% rename from levels/blame/.gitscrub/config rename to levels/blame/.githug/config diff --git a/levels/blame/.gitscrub/description b/levels/blame/.githug/description similarity index 100% rename from levels/blame/.gitscrub/description rename to levels/blame/.githug/description diff --git a/levels/blame/.gitscrub/hooks/applypatch-msg.sample b/levels/blame/.githug/hooks/applypatch-msg.sample similarity index 100% rename from levels/blame/.gitscrub/hooks/applypatch-msg.sample rename to levels/blame/.githug/hooks/applypatch-msg.sample diff --git a/levels/blame/.gitscrub/hooks/commit-msg.sample b/levels/blame/.githug/hooks/commit-msg.sample similarity index 100% rename from levels/blame/.gitscrub/hooks/commit-msg.sample rename to levels/blame/.githug/hooks/commit-msg.sample diff --git a/levels/blame/.gitscrub/hooks/post-commit.sample b/levels/blame/.githug/hooks/post-commit.sample similarity index 100% rename from levels/blame/.gitscrub/hooks/post-commit.sample rename to levels/blame/.githug/hooks/post-commit.sample diff --git a/levels/blame/.gitscrub/hooks/post-receive.sample b/levels/blame/.githug/hooks/post-receive.sample similarity index 100% rename from levels/blame/.gitscrub/hooks/post-receive.sample rename to levels/blame/.githug/hooks/post-receive.sample diff --git a/levels/blame/.gitscrub/hooks/post-update.sample b/levels/blame/.githug/hooks/post-update.sample similarity index 100% rename from levels/blame/.gitscrub/hooks/post-update.sample rename to levels/blame/.githug/hooks/post-update.sample diff --git a/levels/blame/.gitscrub/hooks/pre-applypatch.sample b/levels/blame/.githug/hooks/pre-applypatch.sample similarity index 100% rename from levels/blame/.gitscrub/hooks/pre-applypatch.sample rename to levels/blame/.githug/hooks/pre-applypatch.sample diff --git a/levels/blame/.gitscrub/hooks/pre-commit.sample b/levels/blame/.githug/hooks/pre-commit.sample similarity index 100% rename from levels/blame/.gitscrub/hooks/pre-commit.sample rename to levels/blame/.githug/hooks/pre-commit.sample diff --git a/levels/blame/.gitscrub/hooks/pre-rebase.sample b/levels/blame/.githug/hooks/pre-rebase.sample similarity index 100% rename from levels/blame/.gitscrub/hooks/pre-rebase.sample rename to levels/blame/.githug/hooks/pre-rebase.sample diff --git a/levels/blame/.gitscrub/hooks/prepare-commit-msg.sample b/levels/blame/.githug/hooks/prepare-commit-msg.sample similarity index 100% rename from levels/blame/.gitscrub/hooks/prepare-commit-msg.sample rename to levels/blame/.githug/hooks/prepare-commit-msg.sample diff --git a/levels/blame/.gitscrub/hooks/update.sample b/levels/blame/.githug/hooks/update.sample similarity index 100% rename from levels/blame/.gitscrub/hooks/update.sample rename to levels/blame/.githug/hooks/update.sample diff --git a/levels/blame/.gitscrub/index b/levels/blame/.githug/index similarity index 100% rename from levels/blame/.gitscrub/index rename to levels/blame/.githug/index diff --git a/levels/blame/.gitscrub/info/exclude b/levels/blame/.githug/info/exclude similarity index 100% rename from levels/blame/.gitscrub/info/exclude rename to levels/blame/.githug/info/exclude diff --git a/levels/blame/.gitscrub/logs/HEAD b/levels/blame/.githug/logs/HEAD similarity index 100% rename from levels/blame/.gitscrub/logs/HEAD rename to levels/blame/.githug/logs/HEAD diff --git a/levels/blame/.gitscrub/logs/refs/heads/master b/levels/blame/.githug/logs/refs/heads/master similarity index 100% rename from levels/blame/.gitscrub/logs/refs/heads/master rename to levels/blame/.githug/logs/refs/heads/master diff --git a/levels/blame/.gitscrub/objects/00/d6bf5341b263ccaf32e7973be55126eb30a343 b/levels/blame/.githug/objects/00/d6bf5341b263ccaf32e7973be55126eb30a343 similarity index 100% rename from levels/blame/.gitscrub/objects/00/d6bf5341b263ccaf32e7973be55126eb30a343 rename to levels/blame/.githug/objects/00/d6bf5341b263ccaf32e7973be55126eb30a343 diff --git a/levels/blame/.gitscrub/objects/05/07c26fed4d111a8344763be9af68af90f0ecf2 b/levels/blame/.githug/objects/05/07c26fed4d111a8344763be9af68af90f0ecf2 similarity index 100% rename from levels/blame/.gitscrub/objects/05/07c26fed4d111a8344763be9af68af90f0ecf2 rename to levels/blame/.githug/objects/05/07c26fed4d111a8344763be9af68af90f0ecf2 diff --git a/levels/blame/.gitscrub/objects/09/4094808dc6dc336c93c8602190a9e5f7bd6a11 b/levels/blame/.githug/objects/09/4094808dc6dc336c93c8602190a9e5f7bd6a11 similarity index 100% rename from levels/blame/.gitscrub/objects/09/4094808dc6dc336c93c8602190a9e5f7bd6a11 rename to levels/blame/.githug/objects/09/4094808dc6dc336c93c8602190a9e5f7bd6a11 diff --git a/levels/blame/.gitscrub/objects/21/15d78864000292628872941b14521f90187eed b/levels/blame/.githug/objects/21/15d78864000292628872941b14521f90187eed similarity index 100% rename from levels/blame/.gitscrub/objects/21/15d78864000292628872941b14521f90187eed rename to levels/blame/.githug/objects/21/15d78864000292628872941b14521f90187eed diff --git a/levels/blame/.gitscrub/objects/31/11dda1f5b08d50ac44b99acabfa54f1e6e72b0 b/levels/blame/.githug/objects/31/11dda1f5b08d50ac44b99acabfa54f1e6e72b0 similarity index 100% rename from levels/blame/.gitscrub/objects/31/11dda1f5b08d50ac44b99acabfa54f1e6e72b0 rename to levels/blame/.githug/objects/31/11dda1f5b08d50ac44b99acabfa54f1e6e72b0 diff --git a/levels/blame/.gitscrub/objects/50/8db115ba34a0e4e8667653aebe0265bb4f7e80 b/levels/blame/.githug/objects/50/8db115ba34a0e4e8667653aebe0265bb4f7e80 similarity index 100% rename from levels/blame/.gitscrub/objects/50/8db115ba34a0e4e8667653aebe0265bb4f7e80 rename to levels/blame/.githug/objects/50/8db115ba34a0e4e8667653aebe0265bb4f7e80 diff --git a/levels/blame/.gitscrub/objects/5e/8863df752e3b7f2150df7c78f12bef6f1ff00e b/levels/blame/.githug/objects/5e/8863df752e3b7f2150df7c78f12bef6f1ff00e similarity index 100% rename from levels/blame/.gitscrub/objects/5e/8863df752e3b7f2150df7c78f12bef6f1ff00e rename to levels/blame/.githug/objects/5e/8863df752e3b7f2150df7c78f12bef6f1ff00e diff --git a/levels/blame/.gitscrub/objects/67/788a4b90180c7588d7bd0ad8032957b0f429ba b/levels/blame/.githug/objects/67/788a4b90180c7588d7bd0ad8032957b0f429ba similarity index 100% rename from levels/blame/.gitscrub/objects/67/788a4b90180c7588d7bd0ad8032957b0f429ba rename to levels/blame/.githug/objects/67/788a4b90180c7588d7bd0ad8032957b0f429ba diff --git a/levels/blame/.gitscrub/objects/70/d00535a3a25b0ac1736dd3d306d6271e5427ed b/levels/blame/.githug/objects/70/d00535a3a25b0ac1736dd3d306d6271e5427ed similarity index 100% rename from levels/blame/.gitscrub/objects/70/d00535a3a25b0ac1736dd3d306d6271e5427ed rename to levels/blame/.githug/objects/70/d00535a3a25b0ac1736dd3d306d6271e5427ed diff --git a/levels/blame/.gitscrub/objects/97/bdd0cccf9f4b8730f78cb53a81a74f205dbcc2 b/levels/blame/.githug/objects/97/bdd0cccf9f4b8730f78cb53a81a74f205dbcc2 similarity index 100% rename from levels/blame/.gitscrub/objects/97/bdd0cccf9f4b8730f78cb53a81a74f205dbcc2 rename to levels/blame/.githug/objects/97/bdd0cccf9f4b8730f78cb53a81a74f205dbcc2 diff --git a/levels/blame/.gitscrub/objects/ab/08819ba3ffaeba17d4f870dc3a458a904519f4 b/levels/blame/.githug/objects/ab/08819ba3ffaeba17d4f870dc3a458a904519f4 similarity index 100% rename from levels/blame/.gitscrub/objects/ab/08819ba3ffaeba17d4f870dc3a458a904519f4 rename to levels/blame/.githug/objects/ab/08819ba3ffaeba17d4f870dc3a458a904519f4 diff --git a/levels/blame/.gitscrub/objects/be/96fe46de646f6a5c728f90cc884aef96fa1d6f b/levels/blame/.githug/objects/be/96fe46de646f6a5c728f90cc884aef96fa1d6f similarity index 100% rename from levels/blame/.gitscrub/objects/be/96fe46de646f6a5c728f90cc884aef96fa1d6f rename to levels/blame/.githug/objects/be/96fe46de646f6a5c728f90cc884aef96fa1d6f diff --git a/levels/blame/.gitscrub/objects/cd/9c6b9ab1a6f56cccc69b6aa661f1d67ba5fb46 b/levels/blame/.githug/objects/cd/9c6b9ab1a6f56cccc69b6aa661f1d67ba5fb46 similarity index 100% rename from levels/blame/.gitscrub/objects/cd/9c6b9ab1a6f56cccc69b6aa661f1d67ba5fb46 rename to levels/blame/.githug/objects/cd/9c6b9ab1a6f56cccc69b6aa661f1d67ba5fb46 diff --git a/levels/blame/.gitscrub/objects/dd/df1d8ebd60eec169c15a5b23cb49a58d2ed5a0 b/levels/blame/.githug/objects/dd/df1d8ebd60eec169c15a5b23cb49a58d2ed5a0 similarity index 100% rename from levels/blame/.gitscrub/objects/dd/df1d8ebd60eec169c15a5b23cb49a58d2ed5a0 rename to levels/blame/.githug/objects/dd/df1d8ebd60eec169c15a5b23cb49a58d2ed5a0 diff --git a/levels/blame/.gitscrub/objects/ff/d39c2dbfd94bdbca06d48686e0cbda642f3de7 b/levels/blame/.githug/objects/ff/d39c2dbfd94bdbca06d48686e0cbda642f3de7 similarity index 100% rename from levels/blame/.gitscrub/objects/ff/d39c2dbfd94bdbca06d48686e0cbda642f3de7 rename to levels/blame/.githug/objects/ff/d39c2dbfd94bdbca06d48686e0cbda642f3de7 diff --git a/levels/blame/.gitscrub/refs/heads/master b/levels/blame/.githug/refs/heads/master similarity index 100% rename from levels/blame/.gitscrub/refs/heads/master rename to levels/blame/.githug/refs/heads/master diff --git a/levels/contribute.rb b/levels/contribute.rb index 00a4c3b3..76efc5e5 100644 --- a/levels/contribute.rb +++ b/levels/contribute.rb @@ -2,10 +2,10 @@ description "Contribute to this repository by making a pull request on Github" solution do - location = "/tmp/gitscrub" + location = "/tmp/githug" FileUtils.rm_rf(location) puts "Cloning repository to #{location}" - `git clone git@github.com:Gazler/gitscrub.git #{location}` + `git clone git@github.com:Gazler/githug.git #{location}` contributor = false diff --git a/levels/diff/.gitscrub/COMMIT_EDITMSG b/levels/diff/.githug/COMMIT_EDITMSG similarity index 100% rename from levels/diff/.gitscrub/COMMIT_EDITMSG rename to levels/diff/.githug/COMMIT_EDITMSG diff --git a/levels/diff/.gitscrub/HEAD b/levels/diff/.githug/HEAD similarity index 100% rename from levels/diff/.gitscrub/HEAD rename to levels/diff/.githug/HEAD diff --git a/levels/diff/.gitscrub/config b/levels/diff/.githug/config similarity index 100% rename from levels/diff/.gitscrub/config rename to levels/diff/.githug/config diff --git a/levels/diff/.gitscrub/description b/levels/diff/.githug/description similarity index 100% rename from levels/diff/.gitscrub/description rename to levels/diff/.githug/description diff --git a/levels/diff/.gitscrub/hooks/applypatch-msg.sample b/levels/diff/.githug/hooks/applypatch-msg.sample similarity index 100% rename from levels/diff/.gitscrub/hooks/applypatch-msg.sample rename to levels/diff/.githug/hooks/applypatch-msg.sample diff --git a/levels/diff/.gitscrub/hooks/commit-msg.sample b/levels/diff/.githug/hooks/commit-msg.sample similarity index 100% rename from levels/diff/.gitscrub/hooks/commit-msg.sample rename to levels/diff/.githug/hooks/commit-msg.sample diff --git a/levels/diff/.gitscrub/hooks/post-commit.sample b/levels/diff/.githug/hooks/post-commit.sample similarity index 100% rename from levels/diff/.gitscrub/hooks/post-commit.sample rename to levels/diff/.githug/hooks/post-commit.sample diff --git a/levels/diff/.gitscrub/hooks/post-receive.sample b/levels/diff/.githug/hooks/post-receive.sample similarity index 100% rename from levels/diff/.gitscrub/hooks/post-receive.sample rename to levels/diff/.githug/hooks/post-receive.sample diff --git a/levels/diff/.gitscrub/hooks/post-update.sample b/levels/diff/.githug/hooks/post-update.sample similarity index 100% rename from levels/diff/.gitscrub/hooks/post-update.sample rename to levels/diff/.githug/hooks/post-update.sample diff --git a/levels/diff/.gitscrub/hooks/pre-applypatch.sample b/levels/diff/.githug/hooks/pre-applypatch.sample similarity index 100% rename from levels/diff/.gitscrub/hooks/pre-applypatch.sample rename to levels/diff/.githug/hooks/pre-applypatch.sample diff --git a/levels/diff/.gitscrub/hooks/pre-commit.sample b/levels/diff/.githug/hooks/pre-commit.sample similarity index 100% rename from levels/diff/.gitscrub/hooks/pre-commit.sample rename to levels/diff/.githug/hooks/pre-commit.sample diff --git a/levels/diff/.gitscrub/hooks/pre-rebase.sample b/levels/diff/.githug/hooks/pre-rebase.sample similarity index 100% rename from levels/diff/.gitscrub/hooks/pre-rebase.sample rename to levels/diff/.githug/hooks/pre-rebase.sample diff --git a/levels/diff/.gitscrub/hooks/prepare-commit-msg.sample b/levels/diff/.githug/hooks/prepare-commit-msg.sample similarity index 100% rename from levels/diff/.gitscrub/hooks/prepare-commit-msg.sample rename to levels/diff/.githug/hooks/prepare-commit-msg.sample diff --git a/levels/diff/.gitscrub/hooks/update.sample b/levels/diff/.githug/hooks/update.sample similarity index 100% rename from levels/diff/.gitscrub/hooks/update.sample rename to levels/diff/.githug/hooks/update.sample diff --git a/levels/diff/.gitscrub/index b/levels/diff/.githug/index similarity index 100% rename from levels/diff/.gitscrub/index rename to levels/diff/.githug/index diff --git a/levels/diff/.gitscrub/info/exclude b/levels/diff/.githug/info/exclude similarity index 100% rename from levels/diff/.gitscrub/info/exclude rename to levels/diff/.githug/info/exclude diff --git a/levels/diff/.gitscrub/logs/HEAD b/levels/diff/.githug/logs/HEAD similarity index 100% rename from levels/diff/.gitscrub/logs/HEAD rename to levels/diff/.githug/logs/HEAD diff --git a/levels/diff/.gitscrub/logs/refs/heads/master b/levels/diff/.githug/logs/refs/heads/master similarity index 100% rename from levels/diff/.gitscrub/logs/refs/heads/master rename to levels/diff/.githug/logs/refs/heads/master diff --git a/levels/diff/.gitscrub/objects/1b/6582364621c92707b587409cedbc4f77fc0cee b/levels/diff/.githug/objects/1b/6582364621c92707b587409cedbc4f77fc0cee similarity index 100% rename from levels/diff/.gitscrub/objects/1b/6582364621c92707b587409cedbc4f77fc0cee rename to levels/diff/.githug/objects/1b/6582364621c92707b587409cedbc4f77fc0cee diff --git a/levels/diff/.gitscrub/objects/4f/703ca9bd25781b6758eeb3c42ed5348610ba6d b/levels/diff/.githug/objects/4f/703ca9bd25781b6758eeb3c42ed5348610ba6d similarity index 100% rename from levels/diff/.gitscrub/objects/4f/703ca9bd25781b6758eeb3c42ed5348610ba6d rename to levels/diff/.githug/objects/4f/703ca9bd25781b6758eeb3c42ed5348610ba6d diff --git a/levels/diff/.gitscrub/objects/dc/aa55e97af34402e84d5336da37abcccc23cba6 b/levels/diff/.githug/objects/dc/aa55e97af34402e84d5336da37abcccc23cba6 similarity index 100% rename from levels/diff/.gitscrub/objects/dc/aa55e97af34402e84d5336da37abcccc23cba6 rename to levels/diff/.githug/objects/dc/aa55e97af34402e84d5336da37abcccc23cba6 diff --git a/levels/diff/.gitscrub/refs/heads/master b/levels/diff/.githug/refs/heads/master similarity index 100% rename from levels/diff/.gitscrub/refs/heads/master rename to levels/diff/.githug/refs/heads/master diff --git a/lib/githug.rb b/lib/githug.rb new file mode 100644 index 00000000..e78896a2 --- /dev/null +++ b/lib/githug.rb @@ -0,0 +1,11 @@ +require 'grit' +require "githug/version" + +require 'githug/ui' +require 'githug/game' +require 'githug/profile' +require 'githug/level' +require 'githug/repository' + +Githug::UI.in_stream = STDIN +Githug::UI.out_stream = STDOUT diff --git a/lib/gitscrub/cli.rb b/lib/githug/cli.rb similarity index 69% rename from lib/gitscrub/cli.rb rename to lib/githug/cli.rb index 19f7c6de..3ef22d6f 100644 --- a/lib/gitscrub/cli.rb +++ b/lib/githug/cli.rb @@ -1,6 +1,6 @@ require 'thor' -require 'gitscrub' -module Gitscrub +require 'githug' +module Githug class CLI < Thor @@ -9,7 +9,7 @@ class CLI < Thor desc :play, "Initialize the game" def play - UI.word_box("Gitscrub") + UI.word_box("Githug") make_directory game = Game.new game.play_level @@ -27,7 +27,7 @@ def hint def reset if level = load_level - UI.word_box("Gitscrub") + UI.word_box("Githug") UI.puts("resetting level") level.setup_level level.full_description @@ -43,15 +43,15 @@ def load_level def make_directory - if File.exists?("./git_scrub") - UI.puts "Please change into the git_scrub directory" + if File.exists?("./git_hug") + UI.puts "Please change into the git_hug directory" exit end - unless File.basename(Dir.pwd) == "git_scrub" - if UI.ask("No gitscrub directory found, do you wish to create one?") - Dir.mkdir("./git_scrub") - Dir.chdir("git_scrub") + unless File.basename(Dir.pwd) == "git_hug" + if UI.ask("No githug directory found, do you wish to create one?") + Dir.mkdir("./git_hug") + Dir.chdir("git_hug") File.open(".gitignore", "w") do |file| file.write(".profile.yml") end diff --git a/lib/gitscrub/game.rb b/lib/githug/game.rb similarity index 93% rename from lib/gitscrub/game.rb rename to lib/githug/game.rb index 66dfc152..1900547f 100644 --- a/lib/gitscrub/game.rb +++ b/lib/githug/game.rb @@ -1,4 +1,4 @@ -module Gitscrub +module Githug class Game attr_accessor :profile @@ -10,7 +10,7 @@ def initialize def play_level solve = true if profile.level == 0 - UI.puts("Welcome to Gitscrub") + UI.puts("Welcome to Githug") solve = false level_bump else diff --git a/lib/gitscrub/level.rb b/lib/githug/level.rb similarity index 94% rename from lib/gitscrub/level.rb rename to lib/githug/level.rb index bfc9daea..8b363f32 100644 --- a/lib/gitscrub/level.rb +++ b/lib/githug/level.rb @@ -1,4 +1,4 @@ -module Gitscrub +module Githug class Level include UI @@ -23,7 +23,7 @@ def load(level_no) def init_from_level FileUtils.cp_r("#{level_path}/.", ".") - FileUtils.mv(".gitscrub", ".git") + FileUtils.mv(".githug", ".git") end def difficulty(num) @@ -72,7 +72,7 @@ def solve def show_hint - UI.word_box("Gitscrub") + UI.word_box("Githug") if @hint @hint.call else diff --git a/lib/gitscrub/profile.rb b/lib/githug/profile.rb similarity index 98% rename from lib/gitscrub/profile.rb rename to lib/githug/profile.rb index 5dc5023b..ee35b3be 100644 --- a/lib/gitscrub/profile.rb +++ b/lib/githug/profile.rb @@ -1,5 +1,5 @@ require 'yaml' -module Gitscrub +module Githug class Profile PROFILE_FILE = ".profile.yml" diff --git a/lib/gitscrub/repository.rb b/lib/githug/repository.rb similarity index 92% rename from lib/gitscrub/repository.rb rename to lib/githug/repository.rb index c6b6f4e8..562d087c 100644 --- a/lib/gitscrub/repository.rb +++ b/lib/githug/repository.rb @@ -1,4 +1,4 @@ -module Gitscrub +module Githug class Repository attr_accessor :grit @@ -11,7 +11,7 @@ def initialize(location = ".") def reset dont_delete = ["..", ".", ".gitignore", ".profile.yml"] - if File.basename(Dir.pwd) == "git_scrub" + if File.basename(Dir.pwd) == "git_hug" Dir.entries(Dir.pwd).each do |file| FileUtils.rm_rf(file) unless dont_delete.include?(file) end diff --git a/lib/gitscrub/ui.rb b/lib/githug/ui.rb similarity index 98% rename from lib/gitscrub/ui.rb rename to lib/githug/ui.rb index db123b1f..5c13890b 100644 --- a/lib/gitscrub/ui.rb +++ b/lib/githug/ui.rb @@ -1,4 +1,4 @@ -module Gitscrub +module Githug module UI @@out_stream diff --git a/lib/githug/version.rb b/lib/githug/version.rb new file mode 100644 index 00000000..855f71bb --- /dev/null +++ b/lib/githug/version.rb @@ -0,0 +1,3 @@ +module Githug + VERSION = "0.0.9" +end diff --git a/lib/gitscrub.rb b/lib/gitscrub.rb deleted file mode 100644 index 7c5900a6..00000000 --- a/lib/gitscrub.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'grit' -require "gitscrub/version" - -require 'gitscrub/ui' -require 'gitscrub/game' -require 'gitscrub/profile' -require 'gitscrub/level' -require 'gitscrub/repository' - -Gitscrub::UI.in_stream = STDIN -Gitscrub::UI.out_stream = STDOUT diff --git a/lib/gitscrub/version.rb b/lib/gitscrub/version.rb deleted file mode 100644 index d0586cfd..00000000 --- a/lib/gitscrub/version.rb +++ /dev/null @@ -1,3 +0,0 @@ -module Gitscrub - VERSION = "0.0.8" -end diff --git a/spec/gitscrub/cli_spec.rb b/spec/githug/cli_spec.rb similarity index 58% rename from spec/gitscrub/cli_spec.rb rename to spec/githug/cli_spec.rb index b2b93c61..8639d5a8 100644 --- a/spec/gitscrub/cli_spec.rb +++ b/spec/githug/cli_spec.rb @@ -1,42 +1,42 @@ require 'spec_helper' -require 'gitscrub/cli' +require 'githug/cli' -describe Gitscrub::CLI do +describe Githug::CLI do before(:each) do game = mock.as_null_object - @cli = Gitscrub::CLI.new - Gitscrub::Game.stub(:new).and_return(game) + @cli = Githug::CLI.new + Githug::Game.stub(:new).and_return(game) end it "should print the logo" do - Gitscrub::UI.should_receive(:word_box).with("Gitscrub") + Githug::UI.should_receive(:word_box).with("Githug") @cli.stub(:make_directory) @cli.play end it "should create a directory if one does not exist" do - Gitscrub::UI.stub(:ask).and_return(true) - Dir.should_receive(:mkdir).with("./git_scrub") - Dir.should_receive(:chdir).with("git_scrub") + Githug::UI.stub(:ask).and_return(true) + Dir.should_receive(:mkdir).with("./git_hug") + Dir.should_receive(:chdir).with("git_hug") File.should_receive(:open).with(".gitignore", "w").and_return(true) @cli.make_directory end it "should not make a directory if you are in the game directory" do - Dir.stub(:pwd).and_return("/home/git_scrub") - Gitscrub::UI.should_not_receive(:ask) + Dir.stub(:pwd).and_return("/home/git_hug") + Githug::UI.should_not_receive(:ask) @cli.make_directory end it "should exit if the user selects no" do - Gitscrub::UI.stub(:ask).and_return(false) + Githug::UI.stub(:ask).and_return(false) lambda {@cli.make_directory}.should raise_error(SystemExit) end it "should prompt to change into the directory if it exists" do File.stub(:exists?).and_return(true) - Gitscrub::UI.should_receive(:puts).with("Please change into the git_scrub directory") + Githug::UI.should_receive(:puts).with("Please change into the git_hug directory") lambda {@cli.make_directory}.should raise_error(SystemExit) end @@ -45,8 +45,8 @@ @level = mock @profile = mock @profile.stub(:level).and_return(1) - Gitscrub::Profile.stub(:load).and_return(@profile) - Gitscrub::Level.stub(:load).and_return(@level) + Githug::Profile.stub(:load).and_return(@profile) + Githug::Level.stub(:load).and_return(@level) end it "should call the hint method on the level" do @@ -60,17 +60,17 @@ it "should reset the current level" do @level.should_receive(:setup_level) @level.should_receive(:full_description) - Gitscrub::UI.should_receive(:word_box).with("Gitscrub") - Gitscrub::UI.should_receive(:puts).with("resetting level") + Githug::UI.should_receive(:word_box).with("Githug") + Githug::UI.should_receive(:puts).with("resetting level") @cli.reset end it "should not reset if the level cannot be loaded" do - Gitscrub::Level.stub(:load).and_return(false) + Githug::Level.stub(:load).and_return(false) @level.should_not_receive(:setup_level) @level.should_not_receive(:full_description) - Gitscrub::UI.should_not_receive(:word_box).with("Gitscrub") - Gitscrub::UI.should_not_receive(:puts).with("resetting level") + Githug::UI.should_not_receive(:word_box).with("Githug") + Githug::UI.should_not_receive(:puts).with("resetting level") @cli.reset end end diff --git a/spec/gitscrub/game_spec.rb b/spec/githug/game_spec.rb similarity index 72% rename from spec/gitscrub/game_spec.rb rename to spec/githug/game_spec.rb index 2a5ba4d8..455b4826 100644 --- a/spec/gitscrub/game_spec.rb +++ b/spec/githug/game_spec.rb @@ -1,18 +1,18 @@ require 'spec_helper' -describe Gitscrub::Game do +describe Githug::Game do before(:each) do @profile = mock - Gitscrub::Profile.stub(:new).and_return(@profile) - @game = Gitscrub::Game.new + Githug::Profile.stub(:new).and_return(@profile) + @game = Githug::Game.new @profile.stub(:level).and_return(1) @profile.stub(:save) @level = mock @level.stub(:full_description) @level.stub(:setup_level) - Gitscrub::UI.stub(:puts) - Gitscrub::Level.stub(:load).and_return(@level) + Githug::UI.stub(:puts) + Githug::Level.stub(:load).and_return(@level) end it "should have a profile" do @@ -23,7 +23,7 @@ @level.should_not_receive(:solve) @profile.stub(:level).and_return(0) @profile.should_receive(:save) - Gitscrub::UI.should_receive(:puts).with("Welcome to Gitscrub") + Githug::UI.should_receive(:puts).with("Welcome to Githug") @profile.should_receive(:level=).with(1) @game.play_level end @@ -31,13 +31,13 @@ it "should echo congratulations if the level is solved" do @level.stub(:solve).and_return(true) @profile.should_receive(:level=).with(2) - Gitscrub::UI.should_receive(:success).with("Congratulations, you have solved the level") + Githug::UI.should_receive(:success).with("Congratulations, you have solved the level") @game.play_level end it "should echo congratulations if the level is solved" do @level.stub(:solve).and_return(false) - Gitscrub::UI.should_receive(:error).with("Sorry, this solution is not quite right!") + Githug::UI.should_receive(:error).with("Sorry, this solution is not quite right!") @game.play_level end diff --git a/spec/gitscrub/level_spec.rb b/spec/githug/level_spec.rb similarity index 77% rename from spec/gitscrub/level_spec.rb rename to spec/githug/level_spec.rb index 643f8262..69eefc26 100644 --- a/spec/gitscrub/level_spec.rb +++ b/spec/githug/level_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' require 'grit' -describe Gitscrub::Level do +describe Githug::Level do before(:each) do @file = <<-eof @@ -11,7 +11,7 @@ "test" end solution do - Grit::Repo.new("gitscrub/notadir") + Grit::Repo.new("githug/notadir") end hint do @@ -20,16 +20,16 @@ eof File.stub(:exists?).and_return(true) File.stub(:read).and_return(@file) - @level = Gitscrub::Level.load(1) + @level = Githug::Level.load(1) @repo = mock @repo.stub(:reset) - Gitscrub::Repository.stub(:new).and_return(@repo) - Gitscrub::UI.stub(:puts) - Gitscrub::UI.stub(:print) + Githug::Repository.stub(:new).and_return(@repo) + Githug::UI.stub(:puts) + Githug::UI.stub(:print) end it "should mixin UI" do - Gitscrub::Level.ancestors.should include(Gitscrub::UI) + Githug::Level.ancestors.should include(Githug::UI) end @@ -38,14 +38,14 @@ it "should load the level" do File.stub(:dirname).and_return("") File.should_receive(:read).with('/../../levels/init.rb').and_return(@file) - level = Gitscrub::Level.load(1) + level = Githug::Level.load(1) level.instance_variable_get("@difficulty").should eql(1) level.instance_variable_get("@description").should eql("A test description") end it "should return false if the level does not exist" do File.stub(:exists?).and_return(false) - Gitscrub::Level.load(1).should eql(false) + Githug::Level.load(1).should eql(false) end end @@ -68,10 +68,10 @@ describe "full_description" do it "should display a full description" do - Gitscrub::UI.stub(:puts) - Gitscrub::UI.should_receive(:puts).with("Level: 1") - Gitscrub::UI.should_receive(:puts).with("Difficulty: *") - Gitscrub::UI.should_receive(:puts).with("A test description") + Githug::UI.stub(:puts) + Githug::UI.should_receive(:puts).with("Level: 1") + Githug::UI.should_receive(:puts).with("Difficulty: *") + Githug::UI.should_receive(:puts).with("A test description") @level.full_description end @@ -95,7 +95,7 @@ it "should initialize a repository when repo is called" do @level.repo.should equal(@repo) - Gitscrub::Repository.should_not_receive(:new) + Githug::Repository.should_not_receive(:new) @level.repo.should equal(@repo) end @@ -121,7 +121,7 @@ describe "init_from_level" do it "should copy the files from the level folder" do FileUtils.should_receive(:cp_r).with("#{@level.level_path}/.", ".") - FileUtils.should_receive(:mv).with(".gitscrub", ".git") + FileUtils.should_receive(:mv).with(".githug", ".git") @level.init_from_level end end diff --git a/spec/githug/profile_spec.rb b/spec/githug/profile_spec.rb new file mode 100644 index 00000000..f897502b --- /dev/null +++ b/spec/githug/profile_spec.rb @@ -0,0 +1,36 @@ +require 'spec_helper' + +describe Githug::Profile do + + before(:each) do + end + + it "should load the profile" do + settings = {:level => 1} + File.should_receive(:exists?).with(Githug::Profile::PROFILE_FILE).and_return(true) + File.should_receive(:open).with(Githug::Profile::PROFILE_FILE).and_return("settings") + YAML.should_receive(:load).with("settings").and_return(settings) + Githug::Profile.should_receive(:new).with(settings) + Githug::Profile.load + end + + it "should load the defaults if the file does not exist" do + defaults = {:level => 0} + Githug::Profile.should_receive(:new).with(defaults) + Githug::Profile.load + end + + it "should allow method acces to getters and setters" do + profile = Githug::Profile.load + profile.level.should eql(0) + profile.level = 1 + profile.level.should eql(1) + end + + it "should save the file" do + profile = Githug::Profile.load + File.should_receive(:open).with(Githug::Profile::PROFILE_FILE, "w") + profile.save + end + +end diff --git a/spec/gitscrub/repository_spec.rb b/spec/githug/repository_spec.rb similarity index 87% rename from spec/gitscrub/repository_spec.rb rename to spec/githug/repository_spec.rb index ee7d08e4..bfb13a31 100644 --- a/spec/gitscrub/repository_spec.rb +++ b/spec/githug/repository_spec.rb @@ -1,30 +1,30 @@ require 'spec_helper' -describe Gitscrub::Repository do +describe Githug::Repository do before(:each) do @grit = mock Grit::Repo.stub(:new).and_return(@grit) - @repository = Gitscrub::Repository.new + @repository = Githug::Repository.new end describe "initialize" do it "should call grit on initialize" do Grit::Repo.should_receive(:new).with(".").and_return(@grit) - repo = Gitscrub::Repository.new + repo = Githug::Repository.new repo.grit.should equal(@grit) end it "should contain a nil grit if the repo is invalid" do Grit::Repo.should_receive(:new).and_raise(Grit::InvalidGitRepositoryError) - repo = Gitscrub::Repository.new + repo = Githug::Repository.new repo.grit.should equal(nil) end it "should initialize with a location" do Grit::Repo.should_receive(:new).with("test").and_return(@grit) - repo = Gitscrub::Repository.new("test") + repo = Githug::Repository.new("test") end end @@ -35,14 +35,14 @@ FileUtils.stub(:rm_rf) end - it "should do nothing if the current directory isn't git_scrub" do + it "should do nothing if the current directory isn't git_hug" do Dir.stub(:pwd).and_return("/tmp/foo") FileUtils.should_not_receive(:rm_rf) @repository.reset end it "should remove all the files except .gitignore and .profile.yml" do - Dir.stub(:pwd).and_return("/tmp/git_scrub") + Dir.stub(:pwd).and_return("/tmp/git_hug") Dir.stub(:entries).and_return([".profile.yml", ".gitignore", "..", ".", "README", ".git"]) FileUtils.should_receive(:rm_rf).with("README") FileUtils.should_receive(:rm_rf).with(".git") @@ -69,7 +69,6 @@ it "should initialize an empty repository and add .gitignore" do @repo.should_receive(:add).with(".gitignore") - @repo.should_receive(:add).with(".profile.yml") @repo.should_receive(:commit).with("added .gitignore") @repository.init end diff --git a/spec/gitscrub/ui_spec.rb b/spec/githug/ui_spec.rb similarity index 93% rename from spec/gitscrub/ui_spec.rb rename to spec/githug/ui_spec.rb index 027495fd..e20580f0 100644 --- a/spec/gitscrub/ui_spec.rb +++ b/spec/githug/ui_spec.rb @@ -2,10 +2,10 @@ require 'spec_helper' -describe Gitscrub::UI do +describe Githug::UI do before(:each) do - @ui = Gitscrub::UI + @ui = Githug::UI @out = StringIO.new @in = StringIO.new @ui.out_stream = @out @@ -41,10 +41,10 @@ it "should make a wordbox" do word_box = <<-eof ******************************************************************************** -* Gitscrub * +* Githug * ******************************************************************************** eof - @ui.word_box("Gitscrub") + @ui.word_box("Githug") @out.string.should eql(word_box) end diff --git a/spec/gitscrub/profile_spec.rb b/spec/gitscrub/profile_spec.rb deleted file mode 100644 index 1163b052..00000000 --- a/spec/gitscrub/profile_spec.rb +++ /dev/null @@ -1,36 +0,0 @@ -require 'spec_helper' - -describe Gitscrub::Profile do - - before(:each) do - end - - it "should load the profile" do - settings = {:level => 1} - File.should_receive(:exists?).with(Gitscrub::Profile::PROFILE_FILE).and_return(true) - File.should_receive(:open).with(Gitscrub::Profile::PROFILE_FILE).and_return("settings") - YAML.should_receive(:load).with("settings").and_return(settings) - Gitscrub::Profile.should_receive(:new).with(settings) - Gitscrub::Profile.load - end - - it "should load the defaults if the file does not exist" do - defaults = {:level => 0} - Gitscrub::Profile.should_receive(:new).with(defaults) - Gitscrub::Profile.load - end - - it "should allow method acces to getters and setters" do - profile = Gitscrub::Profile.load - profile.level.should eql(0) - profile.level = 1 - profile.level.should eql(1) - end - - it "should save the file" do - profile = Gitscrub::Profile.load - File.should_receive(:open).with(Gitscrub::Profile::PROFILE_FILE, "w") - profile.save - end - -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 17a78784..41c8999e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1 +1 @@ -require './lib/gitscrub.rb' +require './lib/githug.rb'