renuo-cli 4.12.5 → 4.12.6
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/renuo/cli/commands/create_pr.rb +17 -4
 - data/lib/renuo/cli/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: cc1e483675fe27a637d7dbab7839a890fc3c6d320a64b0305d275db0b1b2b21b
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: cf23d18a9f11e7b3323076725f30e1afa2d8a46a92008e62d9eb3aaf7667ea42
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 4ed942e771d06088afc396d1c2926e34b1a01edc67577c404b046ddd3aa93d404445784d1efaae209cfc99b428898042423362d5b93cce78af12720a3d68bed0
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: afd9b796ab99c51e4a726e420398210126a5be91b10be744698565edcb83083520fe904a37b2ec8873924403ea0152bd421ed5b43586c627ecee152c5425859f
         
     | 
| 
         @@ -9,26 +9,35 @@ class Renuo::Cli::Commands::CreatePr 
     | 
|
| 
       9 
9 
     | 
    
         
             
                c.option "--title <title>", String, "The title of the pull request (optional)"
         
     | 
| 
       10 
10 
     | 
    
         
             
                c.option "--redmine-ticket <number>", Integer, "The redmine ticket number (optional)"
         
     | 
| 
       11 
11 
     | 
    
         
             
                c.option "--draft", "Mark the PR as draft"
         
     | 
| 
      
 12 
     | 
    
         
            +
                c.option "--[no-]web-create", "Open web browser to create a pull request (default: true)"
         
     | 
| 
       12 
13 
     | 
    
         
             
                c.example "Create a PR with the title 'Implement XYZ'",
         
     | 
| 
       13 
14 
     | 
    
         
             
                          "renuo create-pr --title 'Implement XYZ'"
         
     | 
| 
       14 
     | 
    
         
            -
                c.action  
     | 
| 
      
 15 
     | 
    
         
            +
                c.action do |_, options|
         
     | 
| 
      
 16 
     | 
    
         
            +
                  options.default web_create: true
         
     | 
| 
      
 17 
     | 
    
         
            +
                  new.run(options)
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
       15 
19 
     | 
    
         
             
              end
         
     | 
| 
       16 
20 
     | 
    
         | 
| 
       17 
21 
     | 
    
         
             
              def run(opts)
         
     | 
| 
      
 22 
     | 
    
         
            +
                create_pr(opts)
         
     | 
| 
      
 23 
     | 
    
         
            +
                open_pr_in_browser unless opts.web_create
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              private
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              def create_pr(opts)
         
     | 
| 
       18 
29 
     | 
    
         
             
                command = [
         
     | 
| 
       19 
30 
     | 
    
         
             
                  "gh pr create",
         
     | 
| 
       20 
31 
     | 
    
         
             
                  "--assignee @me",
         
     | 
| 
       21 
32 
     | 
    
         
             
                  pr_title(opts),
         
     | 
| 
       22 
33 
     | 
    
         
             
                  "--body \"#{pr_body(opts)}\"",
         
     | 
| 
       23 
     | 
    
         
            -
                  "--web",
         
     | 
| 
      
 34 
     | 
    
         
            +
                  ("--web" if opts.web_create),
         
     | 
| 
       24 
35 
     | 
    
         
             
                  ("--draft" if opts.draft)
         
     | 
| 
       25 
36 
     | 
    
         
             
                ].compact.join(" ")
         
     | 
| 
       26 
37 
     | 
    
         | 
| 
       27 
38 
     | 
    
         
             
                puts `#{command}`
         
     | 
| 
       28 
39 
     | 
    
         
             
              end
         
     | 
| 
       29 
40 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
              private
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
41 
     | 
    
         
             
              def pr_title(opts)
         
     | 
| 
       33 
42 
     | 
    
         
             
                opts.title ? "--title \"#{opts.title}\"" : "--fill"
         
     | 
| 
       34 
43 
     | 
    
         
             
              end
         
     | 
| 
         @@ -44,4 +53,8 @@ class Renuo::Cli::Commands::CreatePr 
     | 
|
| 
       44 
53 
     | 
    
         
             
                current_branch = `git branch --show-current`.strip
         
     | 
| 
       45 
54 
     | 
    
         
             
                opts.redmine_ticket || current_branch.match(/(\d+)/)&.captures&.first
         
     | 
| 
       46 
55 
     | 
    
         
             
              end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
              def open_pr_in_browser
         
     | 
| 
      
 58 
     | 
    
         
            +
                puts `gh pr view --web`
         
     | 
| 
      
 59 
     | 
    
         
            +
              end
         
     | 
| 
       47 
60 
     | 
    
         
             
            end
         
     | 
    
        data/lib/renuo/cli/version.rb
    CHANGED