github_workflow 0.2.1 → 0.2.2
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/lib/github_workflow/cli.rb +26 -26
- data/lib/github_workflow/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 307771fd0758e0b0292a89dc57daa128566fc32dbdd20efad4bb5a9b7a852b61
         | 
| 4 | 
            +
              data.tar.gz: c8d10657e90c9a8deb360bf0e3c5140d95480899390241475d6a325783164085
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 2eb9b2a7c39fa17f8a8385040898f344250e6713e283fb04cd644df82375bde3f2bab8ee0c713c9be54c62aaa5fe7787886558c60727a445a96b23ed07ec7704
         | 
| 7 | 
            +
              data.tar.gz: 7cc78a223f6c19aff626724cb35cec95237525a4fc98e7e9086a7c02ce380639dcb71a4dcb59d3cfcd2110736338245b48b91738924c9fa1663cbf78d7199a38
         | 
    
        data/lib/github_workflow/cli.rb
    CHANGED
    
    | @@ -150,8 +150,31 @@ module GithubWorkflow | |
| 150 150 | 
             
                  stash_pop
         | 
| 151 151 | 
             
                end
         | 
| 152 152 |  | 
| 153 | 
            -
             | 
| 154 153 | 
             
                no_tasks do
         | 
| 154 | 
            +
                  def get_issue(id)
         | 
| 155 | 
            +
                    JSON.parse(github_client.get("repos/#{user_and_repo}/issues/#{id}?access_token=#{oauth_token}").body)
         | 
| 156 | 
            +
                  end
         | 
| 157 | 
            +
             | 
| 158 | 
            +
                  def get_pr(id)
         | 
| 159 | 
            +
                    JSON.parse(github_client.get("repos/#{user_and_repo}/pulls/#{id}?access_token=#{oauth_token}").body)
         | 
| 160 | 
            +
                  end
         | 
| 161 | 
            +
             | 
| 162 | 
            +
                  def get_prs_list
         | 
| 163 | 
            +
                    JSON.parse(github_client.get("repos/#{user_and_repo}/pulls?access_token=#{oauth_token}&per_page=100").body)
         | 
| 164 | 
            +
                  end
         | 
| 165 | 
            +
             | 
| 166 | 
            +
                  def create_branch
         | 
| 167 | 
            +
                    `git checkout -b #{branch_name_for_issue_number}`
         | 
| 168 | 
            +
                  end
         | 
| 169 | 
            +
             | 
| 170 | 
            +
                  def ensure_origin_exists
         | 
| 171 | 
            +
                    Open3.capture2("git rev-parse --abbrev-ref --symbolic-full-name @{u}").tap do |_, status|
         | 
| 172 | 
            +
                      unless status.success?
         | 
| 173 | 
            +
                        failure("Upstream branch does not exist. Please set before creating pull request. E.g., `git push -u origin branch_name`")
         | 
| 174 | 
            +
                      end
         | 
| 175 | 
            +
                    end
         | 
| 176 | 
            +
                  end
         | 
| 177 | 
            +
             | 
| 155 178 | 
             
                  def create_issue_from_trello_card
         | 
| 156 179 | 
             
                    say_info("Creating issue")
         | 
| 157 180 |  | 
| @@ -208,32 +231,9 @@ module GithubWorkflow | |
| 208 231 | 
             
                    @trello_card = trello_board.cards.detect { |card| card.short_id == options["card_number"].to_i }
         | 
| 209 232 | 
             
                  end
         | 
| 210 233 |  | 
| 211 | 
            -
                   | 
| 212 | 
            -
             | 
| 213 | 
            -
                  def get_issue(id)
         | 
| 214 | 
            -
                    JSON.parse(github_client.get("repos/#{user_and_repo}/issues/#{id}?access_token=#{oauth_token}").body)
         | 
| 215 | 
            -
                  end
         | 
| 216 | 
            -
             | 
| 217 | 
            -
                  def get_pr(id)
         | 
| 218 | 
            -
                    JSON.parse(github_client.get("repos/#{user_and_repo}/pulls/#{id}?access_token=#{oauth_token}").body)
         | 
| 219 | 
            -
                  end
         | 
| 220 | 
            -
             | 
| 221 | 
            -
                  def get_prs_list
         | 
| 222 | 
            -
                    JSON.parse(github_client.get("repos/#{user_and_repo}/pulls?access_token=#{oauth_token}&per_page=100").body)
         | 
| 223 | 
            -
                  end
         | 
| 224 | 
            -
             | 
| 225 | 
            -
                  def create_branch
         | 
| 226 | 
            -
                    `git checkout -b #{branch_name_for_issue_number}`
         | 
| 227 | 
            -
                  end
         | 
| 228 | 
            -
             | 
| 229 | 
            -
                  def ensure_origin_exists
         | 
| 230 | 
            -
                    Open3.capture2("git rev-parse --abbrev-ref --symbolic-full-name @{u}").tap do |_, status|
         | 
| 231 | 
            -
                      unless status.success?
         | 
| 232 | 
            -
                        failure("Upstream branch does not exist. Please set before creating pull request. E.g., `git push -u origin branch_name`")
         | 
| 233 | 
            -
                      end
         | 
| 234 | 
            -
                    end
         | 
| 234 | 
            +
                  def trello_card
         | 
| 235 | 
            +
                    @trello_card
         | 
| 235 236 | 
             
                  end
         | 
| 236 | 
            -
             | 
| 237 237 | 
             
                  def ensure_github_config_present
         | 
| 238 238 | 
             
                    unless project_config && project_config["oauth_token"] && project_config["user_and_repo"]
         | 
| 239 239 | 
             
                      failure('Please add `.github` file containing `{ "oauth_token": "TOKEN", "user_and_repo": "user/repo" }`')
         |