git-duet 0.4.1 → 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/.rubocop.yml +5 -0
- data/.ruby-version +1 -1
- data/.travis.yml +11 -17
- data/LICENSE +1 -1
- data/README.md +69 -48
- data/Rakefile +2 -4
- data/bin/rubymine-git-wrapper +8 -0
- data/file.txt +0 -0
- data/git-duet.gemspec +11 -9
- data/lib/git/duet/version.rb +1 -1
- data/spec/lib/git/duet/author_mapper_spec.rb +39 -51
- data/spec/lib/git/duet/cli_spec.rb +12 -12
- data/spec/lib/git/duet/command_methods_spec.rb +10 -10
- data/spec/lib/git/duet/duet_command_spec.rb +28 -26
- data/spec/lib/git/duet/pre_commit_command_spec.rb +6 -6
- data/spec/lib/git/duet/solo_command_spec.rb +49 -43
- metadata +10 -8
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 50d7af1c799d72430af337f3ebce7f5594628022
         | 
| 4 | 
            +
              data.tar.gz: 8efc2502e7dbcf5048c208dc38dffef004b10ae8
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: e36a169a110dbef6344c8f4c58dce163c4e83c432be772136a07095f84ba2ba80037da6bf2f8ba016c9211e92d23341ccae7209c502dc808aa3fd6063e0a1862
         | 
| 7 | 
            +
              data.tar.gz: c579fc838fe6616f768cf28a25e29a6d7e6c9a56ef050dc56f20d014305e4af3f289062718b0b7d8d3247337d5bf7bc73574cf8a70105d25b6ea372add205c85
         | 
    
        data/.rubocop.yml
    CHANGED
    
    
    
        data/.ruby-version
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            2.1. | 
| 1 | 
            +
            2.1.3
         | 
    
        data/.travis.yml
    CHANGED
    
    | @@ -1,3 +1,4 @@ | |
| 1 | 
            +
            ---
         | 
| 1 2 | 
             
            language: ruby
         | 
| 2 3 | 
             
            env:
         | 
| 3 4 | 
             
              global:
         | 
| @@ -8,25 +9,18 @@ matrix: | |
| 8 9 | 
             
            rvm:
         | 
| 9 10 | 
             
            - 1.9.3
         | 
| 10 11 | 
             
            - 2.0.0
         | 
| 11 | 
            -
            - 2.1. | 
| 12 | 
            +
            - 2.1.3
         | 
| 12 13 | 
             
            - jruby-19mode
         | 
| 13 14 | 
             
            before_script:
         | 
| 14 | 
            -
            - git clone https://github.com/sstephenson/bats.git
         | 
| 15 | 
            -
            - cd bats && sudo ./install.sh /usr/local
         | 
| 15 | 
            +
            - "git clone https://github.com/sstephenson/bats.git"
         | 
| 16 | 
            +
            - "cd bats && sudo ./install.sh /usr/local"
         | 
| 16 17 | 
             
            script:
         | 
| 17 18 | 
             
            - bundle exec rake
         | 
| 18 | 
            -
            - bats test
         | 
| 19 | 
            +
            - bundle exec bats test
         | 
| 19 20 | 
             
            notifications:
         | 
| 20 | 
            -
              email: | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
                 | 
| 25 | 
            -
             | 
| 26 | 
            -
              on:
         | 
| 27 | 
            -
                tags: true
         | 
| 28 | 
            -
                repo: modcloth/git-duet
         | 
| 29 | 
            -
            addons:
         | 
| 30 | 
            -
              code_climate:
         | 
| 31 | 
            -
                repo_token:
         | 
| 32 | 
            -
                  secure: A/K+dw6//V8WkB4PapKa1BqEGbwxWbhvHSCFKe+CnHSJ19vDbij2C1x8uzh3NpYTI+B9a5/p9r0B8AmVFI2hKU5CIdGiqMd+sEMM/OzSBeMTIO8d0NKJRfJEGH9yRSlka3cpwLMKmbdPorYnI0iKdVvWLabPhzneK8qYCgHMSWw=
         | 
| 21 | 
            +
              email:
         | 
| 22 | 
            +
                recipients:
         | 
| 23 | 
            +
                - dan@meatballhat.com
         | 
| 24 | 
            +
                - jesse.szwedko@gmail.com
         | 
| 25 | 
            +
                - rafael.colton@gmail.com
         | 
| 26 | 
            +
                - sheenathejunglegirl@gmail.com
         | 
    
        data/LICENSE
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -1,10 +1,10 @@ | |
| 1 1 | 
             
            # Git Duet
         | 
| 2 2 |  | 
| 3 3 | 
             
            [](http://badge.fury.io/rb/git-duet)
         | 
| 4 | 
            -
            [](https://travis-ci.org/meatballhat/git-duet)
         | 
| 5 5 | 
             
            [](https://codeclimate.com/repos/52b6ea7089af7e2ddc0b1f3c/feed)
         | 
| 6 6 | 
             
            [](https://gemnasium.com/meatballhat/git-duet)
         | 
| 8 8 |  | 
| 9 9 | 
             
            Pair harmoniously!  Working in a pair doesn't mean you've both lost your
         | 
| 10 10 | 
             
            identity.  Git Duet helps with blaming/praising by using stuff that's
         | 
| @@ -15,9 +15,9 @@ identities. | |
| 15 15 |  | 
| 16 16 | 
             
            Install it with `gem`:
         | 
| 17 17 |  | 
| 18 | 
            -
             | 
| 18 | 
            +
            ``` bash
         | 
| 19 19 | 
             
            gem install git-duet
         | 
| 20 | 
            -
             | 
| 20 | 
            +
            ```
         | 
| 21 21 |  | 
| 22 22 | 
             
            ## Usage
         | 
| 23 23 |  | 
| @@ -27,55 +27,57 @@ Make an authors file with email domain, or if you're already using | |
| 27 27 | 
             
            [git pair](https://github.com/pivotal/git_scripts), just symlink your
         | 
| 28 28 | 
             
            `~/.pairs` file over to `~/.git-authors`.
         | 
| 29 29 |  | 
| 30 | 
            -
             | 
| 30 | 
            +
            ``` yaml
         | 
| 31 31 | 
             
            authors:
         | 
| 32 32 | 
             
              jd: Jane Doe; jane
         | 
| 33 33 | 
             
              fb: Frances Bar
         | 
| 34 34 | 
             
            email:
         | 
| 35 35 | 
             
              domain: awesometown.local
         | 
| 36 | 
            -
             | 
| 36 | 
            +
            ```
         | 
| 37 37 |  | 
| 38 38 | 
             
            `git duet` will use the `git pair` YAML structure if it has to (the
         | 
| 39 39 | 
             
            difference is the top-level key being `pairs` instead of `authors`,) e.g.:
         | 
| 40 40 |  | 
| 41 | 
            -
             | 
| 41 | 
            +
            ``` yaml
         | 
| 42 42 | 
             
            pairs:
         | 
| 43 43 | 
             
              jd: Jane Doe; jane
         | 
| 44 44 | 
             
              fb: Frances Bar
         | 
| 45 45 | 
             
            email:
         | 
| 46 46 | 
             
              domain: awesometown.local
         | 
| 47 | 
            -
             | 
| 47 | 
            +
            ```
         | 
| 48 48 |  | 
| 49 49 | 
             
            If you want your authors file to live somwhere else, just tell
         | 
| 50 50 | 
             
            Git Duet about it via the `GIT_DUET_AUTHORS_FILE` environmental
         | 
| 51 51 | 
             
            variable, e.g.:
         | 
| 52 52 |  | 
| 53 | 
            -
             | 
| 53 | 
            +
            ``` bash
         | 
| 54 54 | 
             
            export GIT_DUET_AUTHORS_FILE=$HOME/.secret-squirrel/git-authors
         | 
| 55 55 | 
             
            # ...
         | 
| 56 56 | 
             
            git duet jd am
         | 
| 57 | 
            -
             | 
| 57 | 
            +
            ```
         | 
| 58 58 |  | 
| 59 59 | 
             
            ### Workflow stuff
         | 
| 60 60 |  | 
| 61 61 | 
             
            Set the author and committer via `git duet`:
         | 
| 62 62 |  | 
| 63 | 
            -
             | 
| 63 | 
            +
            ``` bash
         | 
| 64 64 | 
             
            git duet jd fb
         | 
| 65 | 
            -
             | 
| 65 | 
            +
            ```
         | 
| 66 66 |  | 
| 67 67 | 
             
            When you're ready to commit, use `git duet-commit` (or add an alias like
         | 
| 68 68 | 
             
            a normal person.  Something like `dci = duet-commit` should work.)
         | 
| 69 69 |  | 
| 70 | 
            -
             | 
| 70 | 
            +
            ``` bash
         | 
| 71 71 | 
             
            git duet-commit -v [any other git options]
         | 
| 72 | 
            -
             | 
| 72 | 
            +
            # or...
         | 
| 73 | 
            +
            git dci -v [any other git options]
         | 
| 74 | 
            +
            ```
         | 
| 73 75 |  | 
| 74 76 | 
             
            When you're done pairing, set the author back to yourself with `git solo`:
         | 
| 75 77 |  | 
| 76 | 
            -
             | 
| 78 | 
            +
            ``` bash
         | 
| 77 79 | 
             
            git solo jd
         | 
| 78 | 
            -
             | 
| 80 | 
            +
            ```
         | 
| 79 81 |  | 
| 80 82 | 
             
            ### Global Config Support
         | 
| 81 83 |  | 
| @@ -83,13 +85,13 @@ If you're jumping between projects and don't want to think about | |
| 83 85 | 
             
            managing them all individually, you can operate on the global git
         | 
| 84 86 | 
             
            config:
         | 
| 85 87 |  | 
| 86 | 
            -
             | 
| 88 | 
            +
            ``` bash
         | 
| 87 89 | 
             
            git solo -g jd
         | 
| 88 | 
            -
             | 
| 90 | 
            +
            ```
         | 
| 89 91 |  | 
| 90 | 
            -
             | 
| 92 | 
            +
            ``` bash
         | 
| 91 93 | 
             
            git duet --global jd fb
         | 
| 92 | 
            -
             | 
| 94 | 
            +
            ```
         | 
| 93 95 |  | 
| 94 96 | 
             
            ### Email Configuration
         | 
| 95 97 |  | 
| @@ -97,30 +99,30 @@ By default, email addresses are constructed from the first initial and | |
| 97 99 | 
             
            last name ( *or* optional username after a `;`) plus email domain, e.g.
         | 
| 98 100 | 
             
            with the following authors file:
         | 
| 99 101 |  | 
| 100 | 
            -
             | 
| 102 | 
            +
            ``` yaml
         | 
| 101 103 | 
             
            pairs:
         | 
| 102 104 | 
             
              jd: Jane Doe; jane
         | 
| 103 105 | 
             
              fb: Frances Bar
         | 
| 104 106 | 
             
            email:
         | 
| 105 107 | 
             
              domain: eternalstench.bog.local
         | 
| 106 | 
            -
             | 
| 108 | 
            +
            ```
         | 
| 107 109 |  | 
| 108 110 | 
             
            After invoking:
         | 
| 109 111 |  | 
| 110 | 
            -
             | 
| 112 | 
            +
            ``` bash
         | 
| 111 113 | 
             
            git duet jd fb
         | 
| 112 | 
            -
             | 
| 114 | 
            +
            ```
         | 
| 113 115 |  | 
| 114 116 | 
             
            Then the configured email addresses will show up like this:
         | 
| 115 117 |  | 
| 116 | 
            -
             | 
| 118 | 
            +
            ``` bash
         | 
| 117 119 | 
             
            git config user.email
         | 
| 118 120 | 
             
            # -> jane@eternalstench.bog.local
         | 
| 119 121 | 
             
            git config duet.env.git-author-email
         | 
| 120 122 | 
             
            # -> jane@eternalstench.bog.local
         | 
| 121 123 | 
             
            git config duet.env.git-committer-email
         | 
| 122 124 | 
             
            # -> f.bar@eternalstench.bog.local
         | 
| 123 | 
            -
             | 
| 125 | 
            +
            ```
         | 
| 124 126 |  | 
| 125 127 | 
             
            A custom email template may be provided via the `email_template` config
         | 
| 126 128 | 
             
            variable.  The template should be a valid ERB string and the variables
         | 
| @@ -128,35 +130,35 @@ available are `author` which is the full first and last name value | |
| 128 130 | 
             
            associated with each set of initials, `initials` which are the initials
         | 
| 129 131 | 
             
            key, and `username` which is the part following `;` in the author value.
         | 
| 130 132 |  | 
| 131 | 
            -
             | 
| 133 | 
            +
            ``` yaml
         | 
| 132 134 | 
             
            pairs:
         | 
| 133 135 | 
             
              jd: Jane Doe
         | 
| 134 136 | 
             
              fb: Frances Bar
         | 
| 135 137 | 
             
            email_template: '<%= "#{author.gsub(/ /, "-").downcase}@hamster.local" =%>'
         | 
| 136 | 
            -
             | 
| 138 | 
            +
            ```
         | 
| 137 139 |  | 
| 138 140 | 
             
            After invoking:
         | 
| 139 141 |  | 
| 140 | 
            -
             | 
| 142 | 
            +
            ``` bash
         | 
| 141 143 | 
             
            git duet jd fb
         | 
| 142 | 
            -
             | 
| 144 | 
            +
            ```
         | 
| 143 145 |  | 
| 144 146 | 
             
            Then the configured email addresses will show up like this:
         | 
| 145 147 |  | 
| 146 | 
            -
             | 
| 148 | 
            +
            ``` bash
         | 
| 147 149 | 
             
            git config user.email
         | 
| 148 150 | 
             
            # -> jane-doe@hamster.local
         | 
| 149 151 | 
             
            git config duet.env.git-author-email
         | 
| 150 152 | 
             
            # -> jane-doe@hamster.local
         | 
| 151 153 | 
             
            git config duet.env.git-committer-email
         | 
| 152 154 | 
             
            # -> frances-bar@hamster.local
         | 
| 153 | 
            -
             | 
| 155 | 
            +
            ```
         | 
| 154 156 |  | 
| 155 157 | 
             
            If there are any exceptions to either the default format or a provided
         | 
| 156 158 | 
             
            `email_template` config var, explicitly setting email addresses by
         | 
| 157 159 | 
             
            initials is supported.
         | 
| 158 160 |  | 
| 159 | 
            -
             | 
| 161 | 
            +
            ``` yaml
         | 
| 160 162 | 
             
            pairs:
         | 
| 161 163 | 
             
              jd: Jane Doe; jane
         | 
| 162 164 | 
             
              fb: Frances Bar
         | 
| @@ -164,35 +166,35 @@ email: | |
| 164 166 | 
             
              domain: awesometown.local
         | 
| 165 167 | 
             
            email_addresses:
         | 
| 166 168 | 
             
              jd: jane@awesome.local
         | 
| 167 | 
            -
             | 
| 169 | 
            +
            ```
         | 
| 168 170 |  | 
| 169 171 | 
             
            Then Jane Doe's email will show up like this:
         | 
| 170 172 |  | 
| 171 | 
            -
             | 
| 173 | 
            +
            ``` bash
         | 
| 172 174 | 
             
            git solo jd
         | 
| 173 175 | 
             
            # ...
         | 
| 174 176 | 
             
            git config user.email
         | 
| 175 177 | 
             
            # -> jane@awesome.local
         | 
| 176 | 
            -
             | 
| 178 | 
            +
            ```
         | 
| 177 179 |  | 
| 178 180 | 
             
            Alternatively, if you have some other preferred way to look up email
         | 
| 179 181 | 
             
            addresses by initials, name or username, just use that instead:
         | 
| 180 182 |  | 
| 181 | 
            -
             | 
| 183 | 
            +
            ``` bash
         | 
| 182 184 | 
             
            export GIT_DUET_EMAIL_LOOKUP_COMMAND="$HOME/bin/custom-ldap-thingy"
         | 
| 183 185 | 
             
            # ... do work
         | 
| 184 186 | 
             
            git duet jd fb
         | 
| 185 187 | 
             
            # ... observe emails being set via the specified executable
         | 
| 186 | 
            -
             | 
| 188 | 
            +
            ```
         | 
| 187 189 |  | 
| 188 190 | 
             
            The initials, name, and username will be passed as arguments to the
         | 
| 189 191 | 
             
            lookup executable.  Anything written to standard output will be used as
         | 
| 190 192 | 
             
            the email address:
         | 
| 191 193 |  | 
| 192 | 
            -
             | 
| 194 | 
            +
            ``` bash
         | 
| 193 195 | 
             
            $HOME/bin/custom-ldap-thingy 'jd' 'Jane Doe' 'jane'
         | 
| 194 196 | 
             
            # -> doej@behemoth.company.local
         | 
| 195 | 
            -
             | 
| 197 | 
            +
            ```
         | 
| 196 198 |  | 
| 197 199 | 
             
            If nothing is returned on standard output, email construction falls back
         | 
| 198 200 | 
             
            to the decisions described above.
         | 
| @@ -221,10 +223,10 @@ initials, use `git duet-pre-commit` in your pre-commit hook: | |
| 221 223 |  | 
| 222 224 | 
             
            *(in $REPO_ROOT/.git/hooks/pre-commit)*
         | 
| 223 225 |  | 
| 224 | 
            -
             | 
| 226 | 
            +
            ``` bash
         | 
| 225 227 | 
             
            #!/bin/bash
         | 
| 226 228 | 
             
            exec git duet-pre-commit
         | 
| 227 | 
            -
             | 
| 229 | 
            +
            ```
         | 
| 228 230 |  | 
| 229 231 | 
             
            The `duet-pre-commit` command will exit with a non-zero status if the
         | 
| 230 232 | 
             
            cached author and committer settings are missing or stale.  The default
         | 
| @@ -232,23 +234,42 @@ staleness cutoff is [20 minutes](http://en.wikipedia.org/wiki/Pomodoro_Technique | |
| 232 234 | 
             
            but may be configured via the `GIT_DUET_SECONDS_AGO_STALE` environmental variable,
         | 
| 233 235 | 
             
            which should be an integer of seconds, e.g.:
         | 
| 234 236 |  | 
| 235 | 
            -
             | 
| 237 | 
            +
            ``` bash
         | 
| 236 238 | 
             
            export GIT_DUET_SECONDS_AGO_STALE=60
         | 
| 237 239 | 
             
            # ... do work for more than a minute
         | 
| 238 240 | 
             
            git commit -v
         | 
| 239 241 | 
             
            # ... pre-commit hook fires
         | 
| 240 | 
            -
             | 
| 242 | 
            +
            ```
         | 
| 241 243 |  | 
| 242 244 | 
             
            If you want to use the default hook (as shown above), install it while
         | 
| 243 245 | 
             
            in your repo like so:
         | 
| 244 246 |  | 
| 245 | 
            -
             | 
| 247 | 
            +
            ``` bash
         | 
| 246 248 | 
             
            git duet-install-hook
         | 
| 247 | 
            -
             | 
| 249 | 
            +
            ```
         | 
| 248 250 |  | 
| 249 251 | 
             
            Don't worry if you forgot you already had a `pre-commit` hook installed.
         | 
| 250 252 | 
             
            The `git duet-install-hook` command will refuse to overwrite it.
         | 
| 251 253 |  | 
| 254 | 
            +
            ### RubyMine integration
         | 
| 255 | 
            +
             | 
| 256 | 
            +
            In order to have the author and committer properly set when committing
         | 
| 257 | 
            +
            via RubyMine, a git wrapper executable may be used to override any
         | 
| 258 | 
            +
            executions of `git commit`.  Such an executable is available in the Git
         | 
| 259 | 
            +
            Duet repository, and may be installed somewhere in your `$PATH` like so:
         | 
| 260 | 
            +
             | 
| 261 | 
            +
            ``` bash
         | 
| 262 | 
            +
            \curl -Ls -o ~/bin/rubymine-git-wrapper https://raw.github.com/meatballhat/git-duet/master/bin/rubymine-git-wrapper
         | 
| 263 | 
            +
            chmod +x ~/bin/rubymine-git-wrapper
         | 
| 264 | 
            +
            ```
         | 
| 265 | 
            +
             | 
| 266 | 
            +
            Given an install location of `~/bin/rubymine-git-wrapper` as shown
         | 
| 267 | 
            +
            above, you would then update your RubyMine setting in
         | 
| 268 | 
            +
            *Preferences* => *Version Control* => *Git* to set
         | 
| 269 | 
            +
            **Path to Git executable** to the full path of
         | 
| 270 | 
            +
             `~/bin/rubymine-git-wrapper` (with the `~` expanded).
         | 
| 271 | 
            +
            See issue #8 for more details.
         | 
| 272 | 
            +
             | 
| 252 273 | 
             
            ## Compatibility
         | 
| 253 274 |  | 
| 254 275 | 
             
            Git Duet has been tested on a bunch of platform/interpreter combinations
         | 
| @@ -258,8 +279,8 @@ While JRuby works it is not recommended as the VM startup time is | |
| 258 279 | 
             
            usually longer than it takes most Git Duet commands to execute.
         | 
| 259 280 |  | 
| 260 281 | 
             
            If you experience badness, please [let us know via
         | 
| 261 | 
            -
            email](mailto: | 
| 262 | 
            -
            github](https://github.com/ | 
| 282 | 
            +
            email](mailto:dan@meatballhat.com) or pretty please [create an issue on
         | 
| 283 | 
            +
            github](https://github.com/meatballhat/git-duet/issues/new).
         | 
| 263 284 |  | 
| 264 285 | 
             
            ## Contributing
         | 
| 265 286 |  | 
    
        data/Rakefile
    CHANGED
    
    | @@ -3,11 +3,9 @@ | |
| 3 3 | 
             
            require 'bundler/gem_tasks'
         | 
| 4 4 |  | 
| 5 5 | 
             
            require 'rspec/core/rake_task'
         | 
| 6 | 
            +
            require 'rubocop/rake_task'
         | 
| 6 7 |  | 
| 7 | 
            -
             | 
| 8 | 
            -
            task :rubocop do
         | 
| 9 | 
            -
              sh('rubocop --format simple') { |r, _| r || abort }
         | 
| 10 | 
            -
            end
         | 
| 8 | 
            +
            RuboCop::RakeTask.new
         | 
| 11 9 |  | 
| 12 10 | 
             
            RSpec::Core::RakeTask.new(:spec) do |t|
         | 
| 13 11 | 
             
              t.rspec_opts = '--format documentation'
         | 
    
        data/file.txt
    ADDED
    
    | 
            File without changes
         | 
    
        data/git-duet.gemspec
    CHANGED
    
    | @@ -9,25 +9,27 @@ Gem::Specification.new do |gem| | |
| 9 9 | 
             
                'Sheena McCoy'
         | 
| 10 10 | 
             
              ]
         | 
| 11 11 | 
             
              gem.email = %w(
         | 
| 12 | 
            -
                 | 
| 13 | 
            -
                 | 
| 14 | 
            -
                 | 
| 15 | 
            -
                 | 
| 12 | 
            +
                dan@meatballhat.com
         | 
| 13 | 
            +
                jesse.szwedko@gmail.com
         | 
| 14 | 
            +
                rafael.colton@gmail.com
         | 
| 15 | 
            +
                sheenathejunglegirl@gmail.com
         | 
| 16 16 | 
             
              )
         | 
| 17 | 
            -
              gem.description =  | 
| 17 | 
            +
              gem.description = 'Pair programming git identity thingy'
         | 
| 18 18 | 
             
              gem.summary = "Pair harmoniously!  Decide who's driving.  " \
         | 
| 19 19 | 
             
                            "Commit along the way.  Don't make a mess of " \
         | 
| 20 20 | 
             
                            'the repository history.'
         | 
| 21 | 
            -
              gem.homepage = 'https://github.com/ | 
| 21 | 
            +
              gem.homepage = 'https://github.com/meatballhat/git-duet'
         | 
| 22 22 | 
             
              gem.license = 'MIT'
         | 
| 23 23 |  | 
| 24 | 
            -
              gem.files = `git ls-files`.split( | 
| 25 | 
            -
              gem.executables = gem.files.grep(/^bin\//) | 
| 24 | 
            +
              gem.files = `git ls-files -z`.split("\x00")
         | 
| 25 | 
            +
              gem.executables = gem.files.grep(/^bin\//)
         | 
| 26 | 
            +
                                         .map { |f| File.basename(f) }
         | 
| 27 | 
            +
                                         .reject { |n| n =~ /rubymine-git-wrapper/ }
         | 
| 26 28 | 
             
              gem.test_files = gem.files.grep(/^spec\//)
         | 
| 27 29 | 
             
              gem.name = 'git-duet'
         | 
| 28 30 | 
             
              gem.require_paths = %w(lib)
         | 
| 29 31 | 
             
              gem.version = Git::Duet::VERSION
         | 
| 30 | 
            -
              gem.required_ruby_version = '>= 1.9 | 
| 32 | 
            +
              gem.required_ruby_version = '>= 1.9'
         | 
| 31 33 |  | 
| 32 34 | 
             
              gem.add_development_dependency 'rake'
         | 
| 33 35 | 
             
              gem.add_development_dependency 'rspec'
         | 
    
        data/lib/git/duet/version.rb
    CHANGED
    
    
| @@ -27,18 +27,18 @@ describe Git::Duet::AuthorMapper do | |
| 27 27 | 
             
              it 'uses an authors file given at initialization' do
         | 
| 28 28 | 
             
                instance = described_class
         | 
| 29 29 | 
             
                  .new('/blarggie/blarggie/new/friend/.git-authors')
         | 
| 30 | 
            -
                instance.authors_file
         | 
| 31 | 
            -
                  . | 
| 30 | 
            +
                expect(instance.authors_file)
         | 
| 31 | 
            +
                  .to eq('/blarggie/blarggie/new/friend/.git-authors')
         | 
| 32 32 | 
             
              end
         | 
| 33 33 |  | 
| 34 34 | 
             
              it 'uses the `GIT_DUET_AUTHORS_FILE` if provided' do
         | 
| 35 35 | 
             
                ENV['GIT_DUET_AUTHORS_FILE'] = '/fizzle/bizzle/.git-authors'
         | 
| 36 36 | 
             
                instance = described_class.new
         | 
| 37 | 
            -
                instance.authors_file. | 
| 37 | 
            +
                expect(instance.authors_file).to eq('/fizzle/bizzle/.git-authors')
         | 
| 38 38 | 
             
              end
         | 
| 39 39 |  | 
| 40 40 | 
             
              it 'falls back to using `~/.git-authors` for the author map' do
         | 
| 41 | 
            -
                subject.authors_file. | 
| 41 | 
            +
                expect(subject.authors_file).to eq(File.join(ENV['HOME'], '.git-authors'))
         | 
| 42 42 | 
             
              end
         | 
| 43 43 |  | 
| 44 44 | 
             
              it 'lets missing author errors bubble up' do
         | 
| @@ -46,41 +46,33 @@ describe Git::Duet::AuthorMapper do | |
| 46 46 | 
             
              end
         | 
| 47 47 |  | 
| 48 48 | 
             
              it 'maps initials to name -> email pairs' do
         | 
| 49 | 
            -
                subject.map('jd').fetch('jd') | 
| 50 | 
            -
                  name: 'Jane Doe',
         | 
| 51 | 
            -
                  email: 'jane@awesome.biz'
         | 
| 52 | 
            -
                }
         | 
| 49 | 
            +
                expect(subject.map('jd').fetch('jd'))
         | 
| 50 | 
            +
                  .to eq(name: 'Jane Doe', email: 'jane@awesome.biz')
         | 
| 53 51 | 
             
              end
         | 
| 54 52 |  | 
| 55 53 | 
             
              it 'constructs default emails from first initial and last name + domain' do
         | 
| 56 | 
            -
                subject.map('hb'). | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
             | 
| 60 | 
            -
                  }
         | 
| 61 | 
            -
                }
         | 
| 54 | 
            +
                expect(subject.map('hb')).to eq('hb' => {
         | 
| 55 | 
            +
                                                  name: 'Hampton Bones',
         | 
| 56 | 
            +
                                                  email: 'h.bones@awesometown.me'
         | 
| 57 | 
            +
                                                })
         | 
| 62 58 | 
             
              end
         | 
| 63 59 |  | 
| 64 60 | 
             
              it 'constructs emails from optional username (if given) + domain' do
         | 
| 65 | 
            -
                subject.map('fb'). | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 68 | 
            -
             | 
| 69 | 
            -
                  }
         | 
| 70 | 
            -
                }
         | 
| 61 | 
            +
                expect(subject.map('fb')).to eq('fb' => {
         | 
| 62 | 
            +
                                                  name: 'Frances Bar',
         | 
| 63 | 
            +
                                                  email: 'frances@awesometown.me'
         | 
| 64 | 
            +
                                                })
         | 
| 71 65 | 
             
              end
         | 
| 72 66 |  | 
| 73 67 | 
             
              it 'uses an explicitly-configured email address if given' do
         | 
| 74 | 
            -
                subject.map('jd'). | 
| 75 | 
            -
             | 
| 76 | 
            -
             | 
| 77 | 
            -
             | 
| 78 | 
            -
                  }
         | 
| 79 | 
            -
                }
         | 
| 68 | 
            +
                expect(subject.map('jd')).to eq('jd' => {
         | 
| 69 | 
            +
                                                  name: 'Jane Doe',
         | 
| 70 | 
            +
                                                  email: 'jane@awesome.biz'
         | 
| 71 | 
            +
                                                })
         | 
| 80 72 | 
             
              end
         | 
| 81 73 |  | 
| 82 74 | 
             
              it 'maps any number of initials to name -> email pairs' do
         | 
| 83 | 
            -
                subject.map('jd', 'fb', 'qx', 'hb'). | 
| 75 | 
            +
                expect(subject.map('jd', 'fb', 'qx', 'hb')).to eq(
         | 
| 84 76 | 
             
                  'jd' => {
         | 
| 85 77 | 
             
                    name: 'Jane Doe',
         | 
| 86 78 | 
             
                    email: 'jane@awesome.biz'
         | 
| @@ -97,38 +89,34 @@ describe Git::Duet::AuthorMapper do | |
| 97 89 | 
             
                    name: 'Hampton Bones',
         | 
| 98 90 | 
             
                    email: 'h.bones@awesometown.me'
         | 
| 99 91 | 
             
                  }
         | 
| 100 | 
            -
                 | 
| 92 | 
            +
                )
         | 
| 101 93 | 
             
              end
         | 
| 102 94 |  | 
| 103 95 | 
             
              context 'when using a `~/.pairs` config' do
         | 
| 104 96 | 
             
                before :each do
         | 
| 105 | 
            -
                  subject. | 
| 106 | 
            -
                     | 
| 107 | 
            -
                      ' | 
| 108 | 
            -
             | 
| 109 | 
            -
             | 
| 110 | 
            -
             | 
| 111 | 
            -
             | 
| 112 | 
            -
             | 
| 113 | 
            -
                      ' | 
| 114 | 
            -
             | 
| 115 | 
            -
             | 
| 116 | 
            -
                      ' | 
| 117 | 
            -
                        'jd' => 'jane@awesome.biz'
         | 
| 118 | 
            -
                      }
         | 
| 97 | 
            +
                  allow(subject).to receive(:cfg).and_return(
         | 
| 98 | 
            +
                    'pairs' => {
         | 
| 99 | 
            +
                      'jd' => 'Jane Doe; jdoe',
         | 
| 100 | 
            +
                      'fb' => 'Frances Bar; frances',
         | 
| 101 | 
            +
                      'qx' => 'Quincy Xavier; qx',
         | 
| 102 | 
            +
                      'hb' => 'Hampton Bones'
         | 
| 103 | 
            +
                    },
         | 
| 104 | 
            +
                    'email' => {
         | 
| 105 | 
            +
                      'domain' => 'awesometown.me'
         | 
| 106 | 
            +
                    },
         | 
| 107 | 
            +
                    'email_addresses' => {
         | 
| 108 | 
            +
                      'jd' => 'jane@awesome.biz'
         | 
| 119 109 | 
             
                    }
         | 
| 120 110 | 
             
                  )
         | 
| 121 111 | 
             
                end
         | 
| 122 112 |  | 
| 123 113 | 
             
                it 'maps initials to name -> email pairs' do
         | 
| 124 | 
            -
                  subject.map('jd').fetch('jd') | 
| 125 | 
            -
                    name: 'Jane Doe',
         | 
| 126 | 
            -
                    email: 'jane@awesome.biz'
         | 
| 127 | 
            -
                  }
         | 
| 114 | 
            +
                  expect(subject.map('jd').fetch('jd'))
         | 
| 115 | 
            +
                    .to eq(name: 'Jane Doe', email: 'jane@awesome.biz')
         | 
| 128 116 | 
             
                end
         | 
| 129 117 |  | 
| 130 118 | 
             
                it 'maps any number of initials to name -> email pairs' do
         | 
| 131 | 
            -
                  subject.map('jd', 'fb', 'qx', 'hb'). | 
| 119 | 
            +
                  expect(subject.map('jd', 'fb', 'qx', 'hb')).to eq(
         | 
| 132 120 | 
             
                    'jd' => {
         | 
| 133 121 | 
             
                      name: 'Jane Doe',
         | 
| 134 122 | 
             
                      email: 'jane@awesome.biz'
         | 
| @@ -145,7 +133,7 @@ describe Git::Duet::AuthorMapper do | |
| 145 133 | 
             
                      name: 'Hampton Bones',
         | 
| 146 134 | 
             
                      email: 'h.bones@awesometown.me'
         | 
| 147 135 | 
             
                    }
         | 
| 148 | 
            -
                   | 
| 136 | 
            +
                  )
         | 
| 149 137 | 
             
                end
         | 
| 150 138 | 
             
              end
         | 
| 151 139 |  | 
| @@ -160,20 +148,20 @@ describe Git::Duet::AuthorMapper do | |
| 160 148 |  | 
| 161 149 | 
             
                before :each do
         | 
| 162 150 | 
             
                  subject.instance_variable_set(:@cfg, nil)
         | 
| 163 | 
            -
                  IO. | 
| 151 | 
            +
                  allow(IO).to receive(:read).with(bad_path).and_raise(
         | 
| 164 152 | 
             
                    Errno::ENOENT.new("No such file or directory - #{bad_path}")
         | 
| 165 153 | 
             
                  )
         | 
| 166 154 | 
             
                end
         | 
| 167 155 |  | 
| 168 156 | 
             
                it 'warns about missing authors file' do
         | 
| 169 | 
            -
                  $stderr. | 
| 157 | 
            +
                  expect($stderr).to receive(:puts).with(
         | 
| 170 158 | 
             
                    /Missing or corrupt authors file.*#{bad_path}/i
         | 
| 171 159 | 
             
                  )
         | 
| 172 160 | 
             
                  expect { subject.map('zzz') }.to raise_error
         | 
| 173 161 | 
             
                end
         | 
| 174 162 |  | 
| 175 163 | 
             
                it 'raises a ScriptDieError' do
         | 
| 176 | 
            -
                  $stderr. | 
| 164 | 
            +
                  allow($stderr).to receive(:puts)
         | 
| 177 165 | 
             
                  expect { subject.map('zzz') }.to raise_error(Git::Duet::ScriptDieError)
         | 
| 178 166 | 
             
                end
         | 
| 179 167 | 
             
              end
         | 
| @@ -8,7 +8,7 @@ describe Git::Duet::Cli do | |
| 8 8 | 
             
              subject(:cli) { described_class }
         | 
| 9 9 |  | 
| 10 10 | 
             
              it 'responds to `.main`' do
         | 
| 11 | 
            -
                cli. | 
| 11 | 
            +
                expect(cli).to respond_to(:run)
         | 
| 12 12 | 
             
              end
         | 
| 13 13 |  | 
| 14 14 | 
             
              it 'requires the prog name and argv array' do
         | 
| @@ -20,28 +20,28 @@ describe Git::Duet::Cli do | |
| 20 20 | 
             
              end
         | 
| 21 21 |  | 
| 22 22 | 
             
              it 'returns the exit status from any script error deaths' do
         | 
| 23 | 
            -
                cli. | 
| 24 | 
            -
                cli.run('git-solo', %w(ty -q)). | 
| 23 | 
            +
                allow(cli).to receive(:solo).and_raise(Git::Duet::ScriptDieError.new(99))
         | 
| 24 | 
            +
                expect(cli.run('git-solo', %w(ty -q))).to eq(99)
         | 
| 25 25 | 
             
              end
         | 
| 26 26 |  | 
| 27 27 | 
             
              it 'runs `solo` when the progname matches /solo$/' do
         | 
| 28 | 
            -
                Git::Duet::SoloCommand. | 
| 29 | 
            -
                  solo. | 
| 30 | 
            -
                 | 
| 28 | 
            +
                allow(Git::Duet::SoloCommand).to receive(:new).and_return(
         | 
| 29 | 
            +
                  double('solo').tap { |solo| expect(solo).to receive(:execute!) }
         | 
| 30 | 
            +
                )
         | 
| 31 31 | 
             
                cli.run('git-solo', %w(jd -q))
         | 
| 32 32 | 
             
              end
         | 
| 33 33 |  | 
| 34 34 | 
             
              it 'runs `duet` when progname matches /duet$/' do
         | 
| 35 | 
            -
                Git::Duet::DuetCommand. | 
| 36 | 
            -
                  duet. | 
| 37 | 
            -
                 | 
| 35 | 
            +
                allow(Git::Duet::DuetCommand).to receive(:new).and_return(
         | 
| 36 | 
            +
                  double('duet').tap { |duet| expect(duet).to receive(:execute!) }
         | 
| 37 | 
            +
                )
         | 
| 38 38 | 
             
                cli.run('git-duet', %w(jd fb -q))
         | 
| 39 39 | 
             
              end
         | 
| 40 40 |  | 
| 41 41 | 
             
              it 'runs `pre_commit` when progname matches /pre-commit$/' do
         | 
| 42 | 
            -
                Git::Duet::PreCommitCommand. | 
| 43 | 
            -
                  pc. | 
| 44 | 
            -
                 | 
| 42 | 
            +
                allow(Git::Duet::PreCommitCommand).to receive(:new).and_return(
         | 
| 43 | 
            +
                  double('pre-commit').tap { |pc| expect(pc).to receive(:execute!) }
         | 
| 44 | 
            +
                )
         | 
| 45 45 | 
             
                cli.run('git-duet-pre-commit', %w(-q))
         | 
| 46 46 | 
             
              end
         | 
| 47 47 | 
             
            end
         | 
| @@ -17,26 +17,26 @@ describe Git::Duet::CommandMethods do | |
| 17 17 |  | 
| 18 18 | 
             
              before :each do
         | 
| 19 19 | 
             
                [:info, :error].each do |m|
         | 
| 20 | 
            -
                  subject. | 
| 20 | 
            +
                  allow(subject).to receive(m)
         | 
| 21 21 | 
             
                end
         | 
| 22 | 
            -
                subject. | 
| 22 | 
            +
                allow(subject).to receive(:in_repo_root) do |&block|
         | 
| 23 23 | 
             
                  block.call
         | 
| 24 24 | 
             
                end
         | 
| 25 25 | 
             
              end
         | 
| 26 26 |  | 
| 27 27 | 
             
              it 'writes env vars to a custom git config tree' do
         | 
| 28 | 
            -
                subject. | 
| 28 | 
            +
                expect(subject).to receive(:`)
         | 
| 29 29 | 
             
                  .with("git config #{Git::Duet::Config.namespace}.fizzle-baz 'awesome'")
         | 
| 30 | 
            -
                subject. | 
| 30 | 
            +
                expect(subject).to receive(:`)
         | 
| 31 31 | 
             
                  .with("git config #{Git::Duet::Config.namespace}.oh-snarf 'mumra'")
         | 
| 32 | 
            -
                subject. | 
| 32 | 
            +
                expect(subject).to receive(:`)
         | 
| 33 33 | 
             
                  .with(/^git config #{Git::Duet::Config.namespace}.mtime \d+/)
         | 
| 34 34 | 
             
                subject.send(:write_env_vars)
         | 
| 35 35 | 
             
              end
         | 
| 36 36 |  | 
| 37 37 | 
             
              it 'explodes if a subshell returns non-zero' do
         | 
| 38 | 
            -
                subject. | 
| 39 | 
            -
                $CHILD_STATUS. | 
| 38 | 
            +
                allow(subject).to receive(:`)
         | 
| 39 | 
            +
                expect($CHILD_STATUS).to receive(:exitstatus).and_return(1)
         | 
| 40 40 | 
             
                expect { subject.send(:exec_check, 'ls hamsters') }
         | 
| 41 41 | 
             
                  .to raise_error(StandardError)
         | 
| 42 42 | 
             
              end
         | 
| @@ -47,13 +47,13 @@ describe Git::Duet::CommandMethods do | |
| 47 47 | 
             
                end
         | 
| 48 48 |  | 
| 49 49 | 
             
                it 'writes env vars to a custom global git config tree' do
         | 
| 50 | 
            -
                  subject. | 
| 50 | 
            +
                  expect(subject).to receive(:`)
         | 
| 51 51 | 
             
                    .with("git config --global #{Git::Duet::Config.namespace}" \
         | 
| 52 52 | 
             
                          ".fizzle-baz 'awesome'")
         | 
| 53 | 
            -
                  subject. | 
| 53 | 
            +
                  expect(subject).to receive(:`)
         | 
| 54 54 | 
             
                    .with("git config --global #{Git::Duet::Config.namespace}" \
         | 
| 55 55 | 
             
                          ".oh-snarf 'mumra'")
         | 
| 56 | 
            -
                  subject. | 
| 56 | 
            +
                  expect(subject).to receive(:`)
         | 
| 57 57 | 
             
                    .with(/^git config --global #{Git::Duet::Config.namespace}.mtime \d+/)
         | 
| 58 58 | 
             
                  subject.send(:write_env_vars)
         | 
| 59 59 | 
             
                end
         | 
| @@ -10,15 +10,17 @@ describe Git::Duet::DuetCommand do | |
| 10 10 | 
             
              subject(:cmd) { described_class.new(alpha, omega) }
         | 
| 11 11 |  | 
| 12 12 | 
             
              before :each do
         | 
| 13 | 
            -
                cmd. | 
| 14 | 
            -
                   | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
                 | 
| 18 | 
            -
                 | 
| 13 | 
            +
                allow(cmd).to receive(:author_mapper).and_return(
         | 
| 14 | 
            +
                  double('author mapper').tap do |am|
         | 
| 15 | 
            +
                    allow(am).to receive(:map).and_return(author_mapping)
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
                )
         | 
| 18 | 
            +
                allow(cmd).to receive(:`).and_return('')
         | 
| 19 | 
            +
                allow(cmd).to receive(:report_env_vars)
         | 
| 20 | 
            +
                allow(Dir).to receive(:chdir) do |&block|
         | 
| 19 21 | 
             
                  block.call
         | 
| 20 22 | 
             
                end
         | 
| 21 | 
            -
                File. | 
| 23 | 
            +
                allow(File).to receive(:open) do |_, _, &block|
         | 
| 22 24 | 
             
                  block.call(double('outfile').as_null_object)
         | 
| 23 25 | 
             
                end
         | 
| 24 26 | 
             
              end
         | 
| @@ -28,42 +30,42 @@ describe Git::Duet::DuetCommand do | |
| 28 30 | 
             
              end
         | 
| 29 31 |  | 
| 30 32 | 
             
              it 'responds to `execute!`' do
         | 
| 31 | 
            -
                cmd. | 
| 33 | 
            +
                expect(cmd).to respond_to(:execute!)
         | 
| 32 34 | 
             
              end
         | 
| 33 35 |  | 
| 34 36 | 
             
              it '(privately) responds to `write_env_vars`' do
         | 
| 35 | 
            -
                cmd.private_methods.map(&:to_sym). | 
| 37 | 
            +
                expect(cmd.private_methods.map(&:to_sym)).to include(:write_env_vars)
         | 
| 36 38 | 
             
              end
         | 
| 37 39 |  | 
| 38 40 | 
             
              it 'sets the alpha name as git config user.name' do
         | 
| 39 | 
            -
                cmd. | 
| 40 | 
            -
                cmd. | 
| 41 | 
            +
                allow(cmd).to receive(:`).with(/git config user\.email/)
         | 
| 42 | 
            +
                expect(cmd).to receive(:`)
         | 
| 41 43 | 
             
                  .with("git config user.name '#{author_mapping[alpha][:name]}'")
         | 
| 42 44 | 
             
                cmd.execute!
         | 
| 43 45 | 
             
              end
         | 
| 44 46 |  | 
| 45 47 | 
             
              it 'sets the alpha email as git config user.email' do
         | 
| 46 | 
            -
                cmd. | 
| 47 | 
            -
                cmd. | 
| 48 | 
            +
                allow(cmd).to receive(:`).with(/git config user\.name/)
         | 
| 49 | 
            +
                expect(cmd).to receive(:`)
         | 
| 48 50 | 
             
                  .with("git config user.email '#{author_mapping[alpha][:email]}'")
         | 
| 49 51 | 
             
                cmd.execute!
         | 
| 50 52 | 
             
              end
         | 
| 51 53 |  | 
| 52 54 | 
             
              it 'reports env vars to $stdout' do
         | 
| 53 | 
            -
                cmd. | 
| 54 | 
            -
                $stdout. | 
| 55 | 
            +
                expect(cmd).to receive(:report_env_vars).and_call_original
         | 
| 56 | 
            +
                expect($stdout).to receive(:puts)
         | 
| 55 57 | 
             
                  .with(/^GIT_AUTHOR_NAME='#{author_mapping[alpha][:name]}'/)
         | 
| 56 | 
            -
                $stdout. | 
| 58 | 
            +
                expect($stdout).to receive(:puts)
         | 
| 57 59 | 
             
                  .with(/^GIT_AUTHOR_EMAIL='#{author_mapping[alpha][:email]}'/)
         | 
| 58 | 
            -
                $stdout. | 
| 60 | 
            +
                expect($stdout).to receive(:puts)
         | 
| 59 61 | 
             
                  .with(/^GIT_COMMITTER_NAME='#{author_mapping[omega][:name]}'/)
         | 
| 60 | 
            -
                $stdout. | 
| 62 | 
            +
                expect($stdout).to receive(:puts)
         | 
| 61 63 | 
             
                  .with(/^GIT_COMMITTER_EMAIL='#{author_mapping[omega][:email]}'/)
         | 
| 62 64 | 
             
                cmd.execute!
         | 
| 63 65 | 
             
              end
         | 
| 64 66 |  | 
| 65 67 | 
             
              it 'sets the alpha as author and omega as committer in custom git config' do
         | 
| 66 | 
            -
                cmd. | 
| 68 | 
            +
                expect(cmd).to receive(:write_env_vars)
         | 
| 67 69 | 
             
                cmd.execute!
         | 
| 68 70 | 
             
              end
         | 
| 69 71 |  | 
| @@ -72,7 +74,7 @@ describe Git::Duet::DuetCommand do | |
| 72 74 | 
             
                  let(:"#{author_type}") { 'brzzzt' }
         | 
| 73 75 |  | 
| 74 76 | 
             
                  it 'aborts' do
         | 
| 75 | 
            -
                    cmd. | 
| 77 | 
            +
                    allow(cmd).to receive(:error).and_return(nil)
         | 
| 76 78 | 
             
                    expect { cmd.execute! }.to raise_error(Git::Duet::ScriptDieError)
         | 
| 77 79 | 
             
                  end
         | 
| 78 80 | 
             
                end
         | 
| @@ -82,17 +84,17 @@ describe Git::Duet::DuetCommand do | |
| 82 84 | 
             
                subject(:cmd) { described_class.new(alpha, omega, false, true) }
         | 
| 83 85 |  | 
| 84 86 | 
             
                it 'sets the alpha name as global git config user.name' do
         | 
| 85 | 
            -
                  cmd. | 
| 87 | 
            +
                  allow(cmd).to receive(:`).with(/git config --global user\.email/)
         | 
| 86 88 | 
             
                  alpha_name = author_mapping[alpha][:name]
         | 
| 87 | 
            -
                  cmd. | 
| 89 | 
            +
                  expect(cmd).to receive(:`)
         | 
| 88 90 | 
             
                    .with("git config --global user.name '#{alpha_name}'")
         | 
| 89 91 | 
             
                  cmd.execute!
         | 
| 90 92 | 
             
                end
         | 
| 91 93 |  | 
| 92 94 | 
             
                it 'sets the alpha email as global git config user.email' do
         | 
| 93 | 
            -
                  cmd. | 
| 95 | 
            +
                  allow(cmd).to receive(:`).with(/git config --global user\.name/)
         | 
| 94 96 | 
             
                  alpha_email = author_mapping[alpha][:email]
         | 
| 95 | 
            -
                  cmd. | 
| 97 | 
            +
                  expect(cmd).to receive(:`)
         | 
| 96 98 | 
             
                    .with("git config --global user.email '#{alpha_email}'")
         | 
| 97 99 | 
             
                  cmd.execute!
         | 
| 98 100 | 
             
                end
         | 
| @@ -111,11 +113,11 @@ describe Git::Duet::DuetCommand do | |
| 111 113 | 
             
                    #{Git::Duet::Config.namespace}.mtime 138039#{rand(1000..9999)}
         | 
| 112 114 | 
             
                  EOF
         | 
| 113 115 |  | 
| 114 | 
            -
                  cmd. | 
| 116 | 
            +
                  allow(cmd).to receive(:`)
         | 
| 115 117 | 
             
                    .with("git config --get-regexp #{Git::Duet::Config.namespace}") do
         | 
| 116 118 | 
             
                    git_config_output
         | 
| 117 119 | 
             
                  end
         | 
| 118 | 
            -
                  $stdout. | 
| 120 | 
            +
                  expect($stdout).to receive(:puts).with(git_config_output)
         | 
| 119 121 |  | 
| 120 122 | 
             
                  cmd.execute!
         | 
| 121 123 | 
             
                end
         | 
| @@ -5,7 +5,7 @@ describe Git::Duet::PreCommitCommand do | |
| 5 5 | 
             
              subject(:cmd) { described_class.new(true) }
         | 
| 6 6 |  | 
| 7 7 | 
             
              before :each do
         | 
| 8 | 
            -
                cmd. | 
| 8 | 
            +
                allow(cmd).to receive(:in_repo_root) do |&block|
         | 
| 9 9 | 
             
                  block.call
         | 
| 10 10 | 
             
                end
         | 
| 11 11 | 
             
                @old_seconds_ago_stale = ENV.delete('GIT_DUET_SECONDS_AGO_STALE')
         | 
| @@ -21,19 +21,19 @@ describe Git::Duet::PreCommitCommand do | |
| 21 21 | 
             
              end
         | 
| 22 22 |  | 
| 23 23 | 
             
              it 'does nothing if the env cache is not stale' do
         | 
| 24 | 
            -
                cmd. | 
| 24 | 
            +
                allow(cmd).to receive(:exec_check)
         | 
| 25 25 | 
             
                  .with(/git config #{Git::Duet::Config.namespace}.git/)
         | 
| 26 | 
            -
                cmd. | 
| 26 | 
            +
                allow(cmd).to receive(:exec_check)
         | 
| 27 27 | 
             
                  .with("git config #{Git::Duet::Config.namespace}.mtime")
         | 
| 28 28 | 
             
                  .and_return(Time.now.to_i)
         | 
| 29 | 
            -
                cmd. | 
| 29 | 
            +
                expect(cmd).to_not receive(:explode!)
         | 
| 30 30 | 
             
                cmd.execute!
         | 
| 31 31 | 
             
              end
         | 
| 32 32 |  | 
| 33 33 | 
             
              it 'explodes if the env cache does not exist' do
         | 
| 34 | 
            -
                cmd. | 
| 34 | 
            +
                allow(cmd).to receive(:exec_check)
         | 
| 35 35 | 
             
                  .with(/git config #{Git::Duet::Config.namespace}.git/)
         | 
| 36 | 
            -
                cmd. | 
| 36 | 
            +
                allow(cmd).to receive(:exec_check)
         | 
| 37 37 | 
             
                  .with("git config #{Git::Duet::Config.namespace}.mtime")
         | 
| 38 38 | 
             
                  .and_raise(StandardError)
         | 
| 39 39 | 
             
                expect { cmd.execute! }.to raise_error(Git::Duet::ScriptDieError)
         | 
| @@ -10,12 +10,14 @@ describe Git::Duet::SoloCommand do | |
| 10 10 | 
             
              subject(:cmd) { described_class.new(soloist) }
         | 
| 11 11 |  | 
| 12 12 | 
             
              before :each do
         | 
| 13 | 
            -
                cmd. | 
| 14 | 
            -
                   | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
                 | 
| 18 | 
            -
                cmd. | 
| 13 | 
            +
                allow(cmd).to receive(:author_mapper).and_return(
         | 
| 14 | 
            +
                  double('author mapper').tap do |am|
         | 
| 15 | 
            +
                    allow(am).to receive(:map).and_return(author_mapping)
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
                )
         | 
| 18 | 
            +
                allow(cmd).to receive(:`).and_return('')
         | 
| 19 | 
            +
                allow(cmd).to receive(:report_env_vars)
         | 
| 20 | 
            +
                allow(cmd).to receive(:in_repo_root) do |&block|
         | 
| 19 21 | 
             
                  block.call
         | 
| 20 22 | 
             
                end
         | 
| 21 23 | 
             
              end
         | 
| @@ -25,64 +27,68 @@ describe Git::Duet::SoloCommand do | |
| 25 27 | 
             
              end
         | 
| 26 28 |  | 
| 27 29 | 
             
              it 'responds to `execute!`' do
         | 
| 28 | 
            -
                cmd. | 
| 30 | 
            +
                expect(cmd).to respond_to(:execute!)
         | 
| 29 31 | 
             
              end
         | 
| 30 32 |  | 
| 31 33 | 
             
              it '(privately) responds to `write_env_vars`' do
         | 
| 32 | 
            -
                cmd.private_methods.map(&:to_sym). | 
| 34 | 
            +
                expect(cmd.private_methods.map(&:to_sym)).to include(:write_env_vars)
         | 
| 33 35 | 
             
              end
         | 
| 34 36 |  | 
| 35 37 | 
             
              it 'sets the soloist name as git config user.name' do
         | 
| 36 | 
            -
                cmd. | 
| 37 | 
            -
                cmd. | 
| 38 | 
            -
             | 
| 38 | 
            +
                allow(cmd).to receive(:`).with(/git config user\.email/)
         | 
| 39 | 
            +
                allow(cmd).to receive(:`).with(
         | 
| 40 | 
            +
                  /git config --unset-all #{Git::Duet::Config.namespace}/
         | 
| 41 | 
            +
                )
         | 
| 42 | 
            +
                expect(cmd).to receive(:`)
         | 
| 39 43 | 
             
                  .with("git config user.name '#{author_mapping[soloist][:name]}'")
         | 
| 40 44 | 
             
                cmd.execute!
         | 
| 41 45 | 
             
              end
         | 
| 42 46 |  | 
| 43 47 | 
             
              it 'sets the soloist email as git config user.email' do
         | 
| 44 | 
            -
                cmd. | 
| 45 | 
            -
                cmd. | 
| 46 | 
            -
             | 
| 48 | 
            +
                allow(cmd).to receive(:`).with(/git config user\.name/)
         | 
| 49 | 
            +
                allow(cmd).to receive(:`).with(
         | 
| 50 | 
            +
                  /git config --unset-all #{Git::Duet::Config.namespace}/
         | 
| 51 | 
            +
                )
         | 
| 52 | 
            +
                expect(cmd).to receive(:`)
         | 
| 47 53 | 
             
                  .with("git config user.email '#{author_mapping[soloist][:email]}'")
         | 
| 48 54 | 
             
                cmd.execute!
         | 
| 49 55 | 
             
              end
         | 
| 50 56 |  | 
| 51 57 | 
             
              it 'unsets the committer name' do
         | 
| 52 | 
            -
                cmd. | 
| 53 | 
            -
                cmd. | 
| 54 | 
            -
                cmd. | 
| 58 | 
            +
                allow(cmd).to receive(:`).with(/git config user\.name/)
         | 
| 59 | 
            +
                allow(cmd).to receive(:`).with(/git config user\.email/)
         | 
| 60 | 
            +
                allow(cmd).to receive(:`)
         | 
| 55 61 | 
             
                  .with(/git config --unset-all #{Git::Duet::Config
         | 
| 56 62 | 
             
                                                  .namespace}.git-committer-email/)
         | 
| 57 | 
            -
                cmd. | 
| 63 | 
            +
                expect(cmd).to receive(:`)
         | 
| 58 64 | 
             
                  .with("git config --unset-all #{Git::Duet::Config
         | 
| 59 65 | 
             
                                                  .namespace}.git-committer-name")
         | 
| 60 66 | 
             
                cmd.execute!
         | 
| 61 67 | 
             
              end
         | 
| 62 68 |  | 
| 63 69 | 
             
              it 'unsets the committer email' do
         | 
| 64 | 
            -
                cmd. | 
| 65 | 
            -
                cmd. | 
| 66 | 
            -
                cmd. | 
| 70 | 
            +
                allow(cmd).to receive(:`).with(/git config user\.name/)
         | 
| 71 | 
            +
                allow(cmd).to receive(:`).with(/git config user\.email/)
         | 
| 72 | 
            +
                allow(cmd).to receive(:`)
         | 
| 67 73 | 
             
                  .with(/git config --unset-all #{Git::Duet::Config
         | 
| 68 74 | 
             
                                                  .namespace}.git-committer-name/)
         | 
| 69 | 
            -
                cmd. | 
| 75 | 
            +
                expect(cmd).to receive(:`)
         | 
| 70 76 | 
             
                  .with("git config --unset-all #{Git::Duet::Config
         | 
| 71 77 | 
             
                                                  .namespace}.git-committer-email")
         | 
| 72 78 | 
             
                cmd.execute!
         | 
| 73 79 | 
             
              end
         | 
| 74 80 |  | 
| 75 81 | 
             
              it 'reports env vars to $stdout' do
         | 
| 76 | 
            -
                cmd. | 
| 77 | 
            -
                $stdout. | 
| 82 | 
            +
                allow(cmd).to receive(:report_env_vars).and_call_original
         | 
| 83 | 
            +
                expect($stdout).to receive(:puts)
         | 
| 78 84 | 
             
                  .with(/^GIT_AUTHOR_NAME='#{author_mapping[soloist][:name]}'/)
         | 
| 79 | 
            -
                $stdout. | 
| 85 | 
            +
                expect($stdout).to receive(:puts)
         | 
| 80 86 | 
             
                  .with(/^GIT_AUTHOR_EMAIL='#{author_mapping[soloist][:email]}'/)
         | 
| 81 87 | 
             
                cmd.execute!
         | 
| 82 88 | 
             
              end
         | 
| 83 89 |  | 
| 84 90 | 
             
              it 'sets the soloist as author in custom git config' do
         | 
| 85 | 
            -
                cmd. | 
| 91 | 
            +
                expect(cmd).to receive(:write_env_vars)
         | 
| 86 92 | 
             
                cmd.execute!
         | 
| 87 93 | 
             
              end
         | 
| 88 94 |  | 
| @@ -90,7 +96,7 @@ describe Git::Duet::SoloCommand do | |
| 90 96 | 
             
                let(:soloist) { 'bzzzrt' }
         | 
| 91 97 |  | 
| 92 98 | 
             
                it 'aborts' do
         | 
| 93 | 
            -
                  cmd. | 
| 99 | 
            +
                  allow(cmd).to receive(:error).and_return(nil)
         | 
| 94 100 | 
             
                  expect { cmd.execute! }.to raise_error(Git::Duet::ScriptDieError)
         | 
| 95 101 | 
             
                end
         | 
| 96 102 | 
             
              end
         | 
| @@ -105,11 +111,11 @@ describe Git::Duet::SoloCommand do | |
| 105 111 | 
             
                    #{Git::Duet::Config.namespace}.mtime 138039#{rand(1000..9999)}
         | 
| 106 112 | 
             
                  EOF
         | 
| 107 113 |  | 
| 108 | 
            -
                  cmd. | 
| 114 | 
            +
                  allow(cmd).to receive(:`)
         | 
| 109 115 | 
             
                    .with("git config --get-regexp #{Git::Duet::Config.namespace}") do
         | 
| 110 116 | 
             
                    git_config_output
         | 
| 111 117 | 
             
                  end
         | 
| 112 | 
            -
                  $stdout. | 
| 118 | 
            +
                  expect($stdout).to receive(:puts).with(git_config_output)
         | 
| 113 119 |  | 
| 114 120 | 
             
                  cmd.execute!
         | 
| 115 121 | 
             
                end
         | 
| @@ -119,48 +125,48 @@ describe Git::Duet::SoloCommand do | |
| 119 125 | 
             
                subject(:cmd) { described_class.new(soloist, false, true) }
         | 
| 120 126 |  | 
| 121 127 | 
             
                it 'sets the soloist name as global git config user.name' do
         | 
| 122 | 
            -
                  cmd. | 
| 123 | 
            -
                  cmd. | 
| 128 | 
            +
                  allow(cmd).to receive(:`).with(/git config --global user\.email/)
         | 
| 129 | 
            +
                  allow(cmd).to receive(:`)
         | 
| 124 130 | 
             
                    .with(/git config --global --unset-all #{Git::Duet::Config.namespace}/)
         | 
| 125 131 | 
             
                  soloist_name = author_mapping[soloist][:name]
         | 
| 126 | 
            -
                  cmd. | 
| 132 | 
            +
                  expect(cmd).to receive(:`)
         | 
| 127 133 | 
             
                    .with("git config --global user.name '#{soloist_name}'")
         | 
| 128 134 | 
             
                  cmd.execute!
         | 
| 129 135 | 
             
                end
         | 
| 130 136 |  | 
| 131 137 | 
             
                it 'sets the soloist email as global git config user.email' do
         | 
| 132 | 
            -
                  cmd. | 
| 133 | 
            -
                  cmd. | 
| 138 | 
            +
                  allow(cmd).to receive(:`).with(/git config --global user\.name/)
         | 
| 139 | 
            +
                  allow(cmd).to receive(:`)
         | 
| 134 140 | 
             
                    .with(/git config --global --unset-all #{Git::Duet::Config.namespace}/)
         | 
| 135 141 | 
             
                  soloist_email = author_mapping[soloist][:email]
         | 
| 136 | 
            -
                  cmd. | 
| 142 | 
            +
                  expect(cmd).to receive(:`)
         | 
| 137 143 | 
             
                    .with("git config --global user.email '#{soloist_email}'")
         | 
| 138 144 | 
             
                  cmd.execute!
         | 
| 139 145 | 
             
                end
         | 
| 140 146 |  | 
| 141 147 | 
             
                it 'unsets the global committer name' do
         | 
| 142 | 
            -
                  cmd. | 
| 143 | 
            -
                  cmd. | 
| 144 | 
            -
                  cmd. | 
| 148 | 
            +
                  allow(cmd).to receive(:`).with(/git config --global user\.name/)
         | 
| 149 | 
            +
                  allow(cmd).to receive(:`).with(/git config --global user\.email/)
         | 
| 150 | 
            +
                  allow(cmd).to receive(:`)
         | 
| 145 151 | 
             
                    .with(
         | 
| 146 152 | 
             
                      /git config --global --unset-all #{Git::Duet::Config
         | 
| 147 153 | 
             
                                                         .namespace}.git-committer-email/
         | 
| 148 154 | 
             
                    )
         | 
| 149 | 
            -
                  cmd. | 
| 155 | 
            +
                  expect(cmd).to receive(:`)
         | 
| 150 156 | 
             
                    .with('git config --global --unset-all ' \
         | 
| 151 157 | 
             
                          "#{Git::Duet::Config.namespace}.git-committer-name")
         | 
| 152 158 | 
             
                  cmd.execute!
         | 
| 153 159 | 
             
                end
         | 
| 154 160 |  | 
| 155 161 | 
             
                it 'unsets the global committer email' do
         | 
| 156 | 
            -
                  cmd. | 
| 157 | 
            -
                  cmd. | 
| 158 | 
            -
                  cmd. | 
| 162 | 
            +
                  allow(cmd).to receive(:`).with(/git config --global user\.name/)
         | 
| 163 | 
            +
                  allow(cmd).to receive(:`).with(/git config --global user\.email/)
         | 
| 164 | 
            +
                  allow(cmd).to receive(:`)
         | 
| 159 165 | 
             
                    .with(
         | 
| 160 166 | 
             
                      /git config --global --unset-all #{Git::Duet::Config
         | 
| 161 167 | 
             
                                                         .namespace}.git-committer-name/
         | 
| 162 168 | 
             
                    )
         | 
| 163 | 
            -
                  cmd. | 
| 169 | 
            +
                  expect(cmd).to receive(:`)
         | 
| 164 170 | 
             
                    .with('git config --global --unset-all ' \
         | 
| 165 171 | 
             
                          "#{Git::Duet::Config.namespace}.git-committer-email")
         | 
| 166 172 | 
             
                  cmd.execute!
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: git-duet
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.5.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Dan Buch
         | 
| @@ -11,7 +11,7 @@ authors: | |
| 11 11 | 
             
            autorequire: 
         | 
| 12 12 | 
             
            bindir: bin
         | 
| 13 13 | 
             
            cert_chain: []
         | 
| 14 | 
            -
            date: 2014- | 
| 14 | 
            +
            date: 2014-10-07 00:00:00.000000000 Z
         | 
| 15 15 | 
             
            dependencies:
         | 
| 16 16 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 17 17 | 
             
              name: rake
         | 
| @@ -99,10 +99,10 @@ dependencies: | |
| 99 99 | 
             
                    version: '0'
         | 
| 100 100 | 
             
            description: Pair programming git identity thingy
         | 
| 101 101 | 
             
            email:
         | 
| 102 | 
            -
            -  | 
| 103 | 
            -
            -  | 
| 104 | 
            -
            -  | 
| 105 | 
            -
            -  | 
| 102 | 
            +
            - dan@meatballhat.com
         | 
| 103 | 
            +
            - jesse.szwedko@gmail.com
         | 
| 104 | 
            +
            - rafael.colton@gmail.com
         | 
| 105 | 
            +
            - sheenathejunglegirl@gmail.com
         | 
| 106 106 | 
             
            executables:
         | 
| 107 107 | 
             
            - git-duet
         | 
| 108 108 | 
             
            - git-duet-commit
         | 
| @@ -128,6 +128,8 @@ files: | |
| 128 128 | 
             
            - bin/git-duet-install-hook
         | 
| 129 129 | 
             
            - bin/git-duet-pre-commit
         | 
| 130 130 | 
             
            - bin/git-solo
         | 
| 131 | 
            +
            - bin/rubymine-git-wrapper
         | 
| 132 | 
            +
            - file.txt
         | 
| 131 133 | 
             
            - git-duet.gemspec
         | 
| 132 134 | 
             
            - lib/git-duet.rb
         | 
| 133 135 | 
             
            - lib/git/duet.rb
         | 
| @@ -155,7 +157,7 @@ files: | |
| 155 157 | 
             
            - test/git-duet.bats
         | 
| 156 158 | 
             
            - test/git-solo.bats
         | 
| 157 159 | 
             
            - test/test_helper.bash
         | 
| 158 | 
            -
            homepage: https://github.com/ | 
| 160 | 
            +
            homepage: https://github.com/meatballhat/git-duet
         | 
| 159 161 | 
             
            licenses:
         | 
| 160 162 | 
             
            - MIT
         | 
| 161 163 | 
             
            metadata: {}
         | 
| @@ -167,7 +169,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 167 169 | 
             
              requirements:
         | 
| 168 170 | 
             
              - - ">="
         | 
| 169 171 | 
             
                - !ruby/object:Gem::Version
         | 
| 170 | 
            -
                  version: 1.9 | 
| 172 | 
            +
                  version: '1.9'
         | 
| 171 173 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 172 174 | 
             
              requirements:
         | 
| 173 175 | 
             
              - - ">="
         |