githug 0.2.9 → 0.2.10
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/levels/reset_soft.rb +22 -0
- data/lib/githug/level.rb +1 -1
- data/lib/githug/version.rb +1 -1
- metadata +3 -2
| @@ -0,0 +1,22 @@ | |
| 1 | 
            +
            difficulty 2
         | 
| 2 | 
            +
            description "You committed too soon. Now you want to undo the last commit, while keeping the index."
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            setup do
         | 
| 5 | 
            +
              repo.init
         | 
| 6 | 
            +
              FileUtils.touch("README")
         | 
| 7 | 
            +
              repo.add("README")
         | 
| 8 | 
            +
              repo.commit_all("Initial commit")
         | 
| 9 | 
            +
              FileUtils.touch("newfile.rb")
         | 
| 10 | 
            +
              repo.add("newfile.rb")
         | 
| 11 | 
            +
              repo.commit_all("Premature commit")
         | 
| 12 | 
            +
            end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            solution do
         | 
| 15 | 
            +
              return false unless File.exists?("newfile.rb") && repo.status.files.keys.include?("newfile.rb")
         | 
| 16 | 
            +
              return false if repo.status.files["newfile.rb"].untracked || repo.commit_count > 1
         | 
| 17 | 
            +
              true
         | 
| 18 | 
            +
            end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
            hint do
         | 
| 21 | 
            +
              puts "What are some options you can use with 'git reset'?"
         | 
| 22 | 
            +
            end
         | 
    
        data/lib/githug/level.rb
    CHANGED
    
    | @@ -4,7 +4,7 @@ module Githug | |
| 4 4 |  | 
| 5 5 | 
             
                LEVELS = [nil, "init", "add", "commit", "config", "clone",
         | 
| 6 6 | 
             
                          "clone_to_folder", "ignore", "status", "rm", "rm_cached",
         | 
| 7 | 
            -
                          "rename", "log", "tag",  "commit_amend", "reset",
         | 
| 7 | 
            +
                          "rename", "log", "tag",  "commit_amend", "reset", "reset_soft",
         | 
| 8 8 | 
             
                          "checkout_file", "remote", "remote_url", "pull", "remote_add",
         | 
| 9 9 | 
             
                          "push", "diff", "blame", "branch", "checkout", "branch_at", "merge",
         | 
| 10 10 | 
             
                          "cherry-pick", "rename_commit", "squash", "merge_squash", "reorder",
         | 
    
        data/lib/githug/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -2,7 +2,7 @@ | |
| 2 2 | 
             
            name: githug
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 4 | 
             
              prerelease: 
         | 
| 5 | 
            -
              version: 0.2. | 
| 5 | 
            +
              version: 0.2.10
         | 
| 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-10- | 
| 13 | 
            +
            date: 2012-10-25 00:00:00 Z
         | 
| 14 14 | 
             
            dependencies: 
         | 
| 15 15 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 16 16 | 
             
              name: rspec
         | 
| @@ -301,6 +301,7 @@ files: | |
| 301 301 | 
             
            - levels/rename_commit.rb
         | 
| 302 302 | 
             
            - levels/reorder.rb
         | 
| 303 303 | 
             
            - levels/reset.rb
         | 
| 304 | 
            +
            - levels/reset_soft.rb
         | 
| 304 305 | 
             
            - levels/restore.rb
         | 
| 305 306 | 
             
            - levels/revert.rb
         | 
| 306 307 | 
             
            - levels/rm.rb
         |