socialcast-git-extensions 2.3.3 → 2.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
    
        data/bin/git-reviewrequest
    CHANGED
    
    | 
         @@ -11,17 +11,41 @@ include Socialcast::Github 
     | 
|
| 
       11 
11 
     | 
    
         
             
            branch = current_branch
         
     | 
| 
       12 
12 
     | 
    
         
             
            username = `git config -z --global --get github.user`.strip
         
     | 
| 
       13 
13 
     | 
    
         
             
            password = HighLine.ask("Github password: ") { |q| q.echo = false }
         
     | 
| 
       14 
     | 
    
         
            -
            description = HighLine.ask("Pull Request description (blank line to complete)") { |q| q.gather = /^\W*$/}
         
     | 
| 
       15 
14 
     | 
    
         | 
| 
       16 
15 
     | 
    
         
             
            run_cmd 'git update'
         
     | 
| 
       17 
16 
     | 
    
         | 
| 
      
 17 
     | 
    
         
            +
            description = ""
         
     | 
| 
      
 18 
     | 
    
         
            +
            if index = (ARGV.index('-d') || ARGV.index('--description'))
         
     | 
| 
      
 19 
     | 
    
         
            +
              description = ARGV[index + 1]
         
     | 
| 
      
 20 
     | 
    
         
            +
              if description.nil?
         
     | 
| 
      
 21 
     | 
    
         
            +
                puts "Usage: #git-reviewrequest -d <description>"
         
     | 
| 
      
 22 
     | 
    
         
            +
                exit 1
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
            else
         
     | 
| 
      
 25 
     | 
    
         
            +
              require 'tempfile'
         
     | 
| 
      
 26 
     | 
    
         
            +
              Tempfile.open('reviewrequest.md') do |f|
         
     | 
| 
      
 27 
     | 
    
         
            +
                f << "\n\n\n# Describe your pull request\n# Use GitHub flavored Markdown http://github.github.com/github-flavored-markdown/\n# Why not include a screenshot? Format is "
         
     | 
| 
      
 28 
     | 
    
         
            +
                f.flush
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                editor = ENV['EDITOR'] || 'vi'
         
     | 
| 
      
 31 
     | 
    
         
            +
                editor = "#{editor} -w" if %w{mate emacs}.include?(editor)
         
     | 
| 
      
 32 
     | 
    
         
            +
                pid = fork { exec "#{editor} #{f.path}" }
         
     | 
| 
      
 33 
     | 
    
         
            +
                Process.waitpid(pid)
         
     | 
| 
      
 34 
     | 
    
         
            +
                description = File.read(f.path)
         
     | 
| 
      
 35 
     | 
    
         
            +
                description.gsub!(/^\#.*/, '')
         
     | 
| 
      
 36 
     | 
    
         
            +
              end
         
     | 
| 
      
 37 
     | 
    
         
            +
            end
         
     | 
| 
      
 38 
     | 
    
         
            +
            short_description = description.split("\n").first(5).join("\n")
         
     | 
| 
      
 39 
     | 
    
         
            +
            stats = `git diff --stat master...#{branch}`
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
       18 
41 
     | 
    
         
             
            repo = `git config -z --get remote.origin.url`.strip
         
     | 
| 
       19 
42 
     | 
    
         
             
            # ex: git@github.com:socialcast/socialcast-git-extensions.git
         
     | 
| 
       20 
43 
     | 
    
         
             
            repo = repo.scan(/:(.+\/.+)\./).first.first
         
     | 
| 
       21 
     | 
    
         
            -
            url = create_pull_request username, password, branch, repo, description 
     | 
| 
      
 44 
     | 
    
         
            +
            url = create_pull_request username, password, branch, repo, description
         
     | 
| 
       22 
45 
     | 
    
         | 
| 
       23 
46 
     | 
    
         
             
            if url
         
     | 
| 
       24 
     | 
    
         
            -
               
     | 
| 
      
 47 
     | 
    
         
            +
              review_message = ["@SocialcastDevelopers #reviewrequest for #{branch} #scgitx", short_description, stats].join("\n\n")
         
     | 
| 
      
 48 
     | 
    
         
            +
              share review_message, {:url => url, :message_type => 'review_request'}
         
     | 
| 
       25 
49 
     | 
    
         
             
            else
         
     | 
| 
       26 
50 
     | 
    
         
             
              HighLine.say "Skipping socialcast announcement"
         
     | 
| 
       27 
51 
     | 
    
         
             
              exit 1
         
     | 
| 
         @@ -1,3 +1,4 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
       1 
2 
     | 
    
         
             
            require 'highline/import'
         
     | 
| 
       2 
3 
     | 
    
         | 
| 
       3 
4 
     | 
    
         
             
            module Socialcast
         
     | 
| 
         @@ -11,10 +12,11 @@ module Socialcast 
     | 
|
| 
       11 
12 
     | 
    
         
             
                end
         
     | 
| 
       12 
13 
     | 
    
         
             
                def share(message, options = {})
         
     | 
| 
       13 
14 
     | 
    
         
             
                  return if ARGV.delete("--quiet") || ARGV.delete("-q")
         
     | 
| 
       14 
     | 
    
         
            -
                   
     | 
| 
       15 
     | 
    
         
            -
                   
     | 
| 
       16 
     | 
    
         
            -
                   
     | 
| 
       17 
     | 
    
         
            -
                   
     | 
| 
      
 15 
     | 
    
         
            +
                  require 'socialcast'
         
     | 
| 
      
 16 
     | 
    
         
            +
                  require 'socialcast/message'
         
     | 
| 
      
 17 
     | 
    
         
            +
                  Socialcast::Message.configure_from_credentials
         
     | 
| 
      
 18 
     | 
    
         
            +
                  Socialcast::Message.create options.merge(:body => message)
         
     | 
| 
      
 19 
     | 
    
         
            +
                  say "Message has been shared"
         
     | 
| 
       18 
20 
     | 
    
         
             
                end
         
     | 
| 
       19 
21 
     | 
    
         
             
              end
         
     | 
| 
       20 
22 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: socialcast-git-extensions
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              hash:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 11
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 2
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 3
         
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 2.3. 
     | 
| 
      
 9 
     | 
    
         
            +
              - 4
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 2.3.4
         
     | 
| 
       11 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
12 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
13 
     | 
    
         
             
            - Ryan Sonnek
         
     |