fastlane-plugin-rooster 0.2.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 +7 -0
 - data/LICENSE +21 -0
 - data/README.md +52 -0
 - data/lib/fastlane/plugin/rooster/actions/rooster_action.rb +420 -0
 - data/lib/fastlane/plugin/rooster/helper/rooster_helper.rb +16 -0
 - data/lib/fastlane/plugin/rooster/version.rb +5 -0
 - data/lib/fastlane/plugin/rooster.rb +16 -0
 - metadata +188 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA256:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: '0884cfc7aded76d4b2f582b9a34f3f73d991b5f6499589c5bbfcb91e839ecd71'
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 766976696518e674f2a3e2c4e29249c8184bde75b39a2f3dfc569d51b81f3f51
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 907d02d8ccb22b27fa10f0a95b321e711b5703035ce4a1da3337c8c7fcfd6e1fff5307f900118dcd40b8f1787d49705dbcbf756f357545f40b59cb54c982a89c
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: a2cf1b2186e50b8a3db7736f9a354d9b113062fb531659528b5c4d12761bdd0310d9780fa295bc65fd08ff889e478b910f57796b9410aa2e98067fc557a333ff
         
     | 
    
        data/LICENSE
    ADDED
    
    | 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            The MIT License (MIT)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Copyright (c) 2023 Muhammad M Munir <muhammadmmunir24@gmail.com>
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
      
 6 
     | 
    
         
            +
            of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
      
 7 
     | 
    
         
            +
            in the Software without restriction, including without limitation the rights
         
     | 
| 
      
 8 
     | 
    
         
            +
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
      
 9 
     | 
    
         
            +
            copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
      
 10 
     | 
    
         
            +
            furnished to do so, subject to the following conditions:
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be included in all
         
     | 
| 
      
 13 
     | 
    
         
            +
            copies or substantial portions of the Software.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
      
 16 
     | 
    
         
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
      
 17 
     | 
    
         
            +
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
      
 18 
     | 
    
         
            +
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
      
 19 
     | 
    
         
            +
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
      
 20 
     | 
    
         
            +
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         
     | 
| 
      
 21 
     | 
    
         
            +
            SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,52 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # rooster plugin
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            [](https://rubygems.org/gems/fastlane-plugin-rooster)
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ## Getting Started
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-rooster`, add it to your project by running:
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 10 
     | 
    
         
            +
            fastlane add_plugin rooster
         
     | 
| 
      
 11 
     | 
    
         
            +
            ```
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            ## About rooster
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            Send gitlab merge requests reminder to slack
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            **Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            ## Example
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            **Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            ## Run tests for this plugin
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            To run both the tests, and code style validation, run
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            ```
         
     | 
| 
      
 30 
     | 
    
         
            +
            rake
         
     | 
| 
      
 31 
     | 
    
         
            +
            ```
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            To automatically fix many of the styling issues, use
         
     | 
| 
      
 34 
     | 
    
         
            +
            ```
         
     | 
| 
      
 35 
     | 
    
         
            +
            rubocop -a
         
     | 
| 
      
 36 
     | 
    
         
            +
            ```
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            ## Issues and Feedback
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            For any other issues and feedback about this plugin, please submit it to this repository.
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            ## Troubleshooting
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            ## Using _fastlane_ Plugins
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            ## About _fastlane_
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            _fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
         
     | 
| 
         @@ -0,0 +1,420 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'net/http'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'uri'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'json'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'csv'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'date'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            require 'fastlane/action'
         
     | 
| 
      
 8 
     | 
    
         
            +
            require_relative '../helper/rooster_helper'
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            module Fastlane
         
     | 
| 
      
 11 
     | 
    
         
            +
              module Actions
         
     | 
| 
      
 12 
     | 
    
         
            +
                class RoosterAction < Action
         
     | 
| 
      
 13 
     | 
    
         
            +
                  def self.run(params)
         
     | 
| 
      
 14 
     | 
    
         
            +
                    members_file = params[:members_file] || ENV['GITLAB_SLACK_MEMBERS_FILE']
         
     | 
| 
      
 15 
     | 
    
         
            +
                    gitlab_project_id = params[:gitlab_project_id] || ENV['GITLAB_PROJECT_ID']
         
     | 
| 
      
 16 
     | 
    
         
            +
                    slack_webhook_url = params[:slack_webhook_url] || ENV['SLACK_WEBHOOK_URL']
         
     | 
| 
      
 17 
     | 
    
         
            +
                    slack_message_format_file = params[:slack_message_format_file] || ENV['SLACK_MESSAGE_FORMAT_FILE']
         
     | 
| 
      
 18 
     | 
    
         
            +
                    gitlab_mr_total = params[:gitlab_merge_request_total] || ENV['GITLAB_MERGE_REQUEST_TOTAL']
         
     | 
| 
      
 19 
     | 
    
         
            +
                    gitlab_milestones_path = params[:gitlab_milestones_path] || ENV['GITLAB_MILESTONES_PATH']
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                    @gitlab_token = params[:gitlab_token] || ENV['GITLAB_ACCESS_TOKEN']
         
     | 
| 
      
 22 
     | 
    
         
            +
                    @gitlab_api_base_url = 'https://gitlab.com/api/v4/'
         
     | 
| 
      
 23 
     | 
    
         
            +
                    @slack_message_format = get_slack_message_format(slack_message_format_file)
         
     | 
| 
      
 24 
     | 
    
         
            +
                    @members = get_members(members_file)
         
     | 
| 
      
 25 
     | 
    
         
            +
                    @current_milestone = get_current_milestone(gitlab_milestones_path)
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                    mr_url = compose_merge_request_url(gitlab_project_id, gitlab_mr_total, @current_milestone)
         
     | 
| 
      
 28 
     | 
    
         
            +
                    mr_resp_json = get_response_json(mr_url)
         
     | 
| 
      
 29 
     | 
    
         
            +
                    merge_requests = compose_gitlab_merge_requests(mr_resp_json)
         
     | 
| 
      
 30 
     | 
    
         
            +
                    slack_payload = compose_slack_payload(merge_requests)
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                    # UI.message slack_payload.to_json
         
     | 
| 
      
 33 
     | 
    
         
            +
                    post_request(
         
     | 
| 
      
 34 
     | 
    
         
            +
                      slack_webhook_url,
         
     | 
| 
      
 35 
     | 
    
         
            +
                      slack_payload,
         
     | 
| 
      
 36 
     | 
    
         
            +
                      { "Content-Type": "application/json" }
         
     | 
| 
      
 37 
     | 
    
         
            +
                    )
         
     | 
| 
      
 38 
     | 
    
         
            +
                  end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                  #####################################################
         
     | 
| 
      
 41 
     | 
    
         
            +
                  # @!group API REQUEST
         
     | 
| 
      
 42 
     | 
    
         
            +
                  #####################################################
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                  def self.get_response_json(url)
         
     | 
| 
      
 45 
     | 
    
         
            +
                    uri = URI(url)
         
     | 
| 
      
 46 
     | 
    
         
            +
                    header = { 'PRIVATE-TOKEN' => @gitlab_token }
         
     | 
| 
      
 47 
     | 
    
         
            +
                    response = Net::HTTP.get_response(uri, header)
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                    if response.is_a?(Net::HTTPSuccess)
         
     | 
| 
      
 50 
     | 
    
         
            +
                      JSON.parse(response.body)
         
     | 
| 
      
 51 
     | 
    
         
            +
                    else
         
     | 
| 
      
 52 
     | 
    
         
            +
                      UI.error "Failed to get request from #{url} code #{response.code} message #{response.message}"
         
     | 
| 
      
 53 
     | 
    
         
            +
                    end
         
     | 
| 
      
 54 
     | 
    
         
            +
                  end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                  def self.post_request(url, body, header)
         
     | 
| 
      
 57 
     | 
    
         
            +
                    uri = URI(url)
         
     | 
| 
      
 58 
     | 
    
         
            +
                    request = Net::HTTP::Post.new(uri, header)
         
     | 
| 
      
 59 
     | 
    
         
            +
                    request.body = JSON(body)
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                    response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |https|
         
     | 
| 
      
 62 
     | 
    
         
            +
                      https.request(request)
         
     | 
| 
      
 63 
     | 
    
         
            +
                    end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                    if response.is_a?(Net::HTTPSuccess)
         
     | 
| 
      
 66 
     | 
    
         
            +
                      UI.success "Successfully post request to #{url}"
         
     | 
| 
      
 67 
     | 
    
         
            +
                    else
         
     | 
| 
      
 68 
     | 
    
         
            +
                      UI.error "Failed to post request to #{url} code #{response.code} message #{response.message}"
         
     | 
| 
      
 69 
     | 
    
         
            +
                    end
         
     | 
| 
      
 70 
     | 
    
         
            +
                  end
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
                  #####################################################
         
     | 
| 
      
 73 
     | 
    
         
            +
                  # @!group MILESTONE
         
     | 
| 
      
 74 
     | 
    
         
            +
                  #####################################################
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
                  def self.compose_milestones_url(milestones_path)
         
     | 
| 
      
 77 
     | 
    
         
            +
                    return nil unless !milestones_path.nil?
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
                    "#{@gitlab_api_base_url}#{milestones_path}/milestones?state=active"
         
     | 
| 
      
 80 
     | 
    
         
            +
                  end
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
                  def self.extract_current_milestone_title(milestone_resp_json)
         
     | 
| 
      
 83 
     | 
    
         
            +
                    current_milestone = milestone_resp_json.find do |value|
         
     | 
| 
      
 84 
     | 
    
         
            +
                      due_date = DateTime.strptime(value.dig('due_date'), '%Y-%m-%d')
         
     | 
| 
      
 85 
     | 
    
         
            +
                      DateTime.now.to_time.to_i <= due_date.to_time.to_i
         
     | 
| 
      
 86 
     | 
    
         
            +
                    end
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
                    return "" unless !current_milestone.nil?
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
                    current_milestone.dig('title')
         
     | 
| 
      
 91 
     | 
    
         
            +
                  end
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
                  def self.get_current_milestone(milestones_path)
         
     | 
| 
      
 94 
     | 
    
         
            +
                    milestones_url = compose_milestones_url(milestones_path)
         
     | 
| 
      
 95 
     | 
    
         
            +
                    return "" unless !milestones_url.nil?
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
                    milestones_json = get_response_json(milestones_url)
         
     | 
| 
      
 98 
     | 
    
         
            +
                    extract_current_milestone_title(milestones_json)
         
     | 
| 
      
 99 
     | 
    
         
            +
                  end
         
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
                  #####################################################
         
     | 
| 
      
 102 
     | 
    
         
            +
                  # @!group SLACK MESSAGE FORMAT
         
     | 
| 
      
 103 
     | 
    
         
            +
                  #####################################################
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
                  def self.get_slack_message_format(slack_message_format_file)
         
     | 
| 
      
 106 
     | 
    
         
            +
                    unless !slack_message_format_file.is_a?(Hash)
         
     | 
| 
      
 107 
     | 
    
         
            +
                      return slack_message_format_file
         
     | 
| 
      
 108 
     | 
    
         
            +
                    end
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
                    JSON.parse(File.read(slack_message_format_file))
         
     | 
| 
      
 111 
     | 
    
         
            +
                  end
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
                  #####################################################
         
     | 
| 
      
 114 
     | 
    
         
            +
                  # @!group MEMBERS
         
     | 
| 
      
 115 
     | 
    
         
            +
                  #####################################################
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
                  def self.get_members(members_file)
         
     | 
| 
      
 118 
     | 
    
         
            +
                    return nil unless !members_file.nil? && !members_file.empty?
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
                    members = {}
         
     | 
| 
      
 121 
     | 
    
         
            +
                    CSV.foreach(members_file, headers: true) do |member|
         
     | 
| 
      
 122 
     | 
    
         
            +
                      members[member['Gitlab User ID']] = {
         
     | 
| 
      
 123 
     | 
    
         
            +
                        :name => member['Name'],
         
     | 
| 
      
 124 
     | 
    
         
            +
                        :slack_id => member['Slack ID']
         
     | 
| 
      
 125 
     | 
    
         
            +
                      }
         
     | 
| 
      
 126 
     | 
    
         
            +
                    end
         
     | 
| 
      
 127 
     | 
    
         
            +
             
     | 
| 
      
 128 
     | 
    
         
            +
                    members
         
     | 
| 
      
 129 
     | 
    
         
            +
                  end
         
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
      
 131 
     | 
    
         
            +
                  #####################################################
         
     | 
| 
      
 132 
     | 
    
         
            +
                  # @!group MERGE REQUEST
         
     | 
| 
      
 133 
     | 
    
         
            +
                  #####################################################
         
     | 
| 
      
 134 
     | 
    
         
            +
             
     | 
| 
      
 135 
     | 
    
         
            +
                  def self.compose_merge_request_url(project_id, per_page, current_milestone)
         
     | 
| 
      
 136 
     | 
    
         
            +
                    "#{@gitlab_api_base_url}projects/#{project_id}/merge_requests?state=opened&order_by=created_at&sort=asc&per_page=#{per_page}&milestone=#{current_milestone}"
         
     | 
| 
      
 137 
     | 
    
         
            +
                  end
         
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
      
 139 
     | 
    
         
            +
                  def self.get_slack_member_id(gitlab_member_id, gitlab_member_username)
         
     | 
| 
      
 140 
     | 
    
         
            +
                    if !@members.nil? && @members.key?(gitlab_member_id.to_s)
         
     | 
| 
      
 141 
     | 
    
         
            +
                      @members[gitlab_member_id.to_s][:slack_id]
         
     | 
| 
      
 142 
     | 
    
         
            +
                    else
         
     | 
| 
      
 143 
     | 
    
         
            +
                      "@#{gitlab_member_username}"
         
     | 
| 
      
 144 
     | 
    
         
            +
                    end
         
     | 
| 
      
 145 
     | 
    
         
            +
                  end
         
     | 
| 
      
 146 
     | 
    
         
            +
             
     | 
| 
      
 147 
     | 
    
         
            +
                  def self.get_slack_member_ids(gitlab_mr_json, key)
         
     | 
| 
      
 148 
     | 
    
         
            +
                    gitlab_mr_json.dig("#{key}")&.map do |v|
         
     | 
| 
      
 149 
     | 
    
         
            +
                      get_slack_member_id(v.dig('id'), v.dig('username'))
         
     | 
| 
      
 150 
     | 
    
         
            +
                    end
         
     | 
| 
      
 151 
     | 
    
         
            +
                  end
         
     | 
| 
      
 152 
     | 
    
         
            +
             
     | 
| 
      
 153 
     | 
    
         
            +
                  def self.compose_gitlab_merge_requests(gitlab_mr_json)
         
     | 
| 
      
 154 
     | 
    
         
            +
                    gitlab_mr_json = gitlab_mr_json.select do |value|
         
     | 
| 
      
 155 
     | 
    
         
            +
                      title = value.dig('title')
         
     | 
| 
      
 156 
     | 
    
         
            +
                      !(title.downcase.start_with? 'draft') && !(title.downcase.start_with? 'wip')
         
     | 
| 
      
 157 
     | 
    
         
            +
                    end
         
     | 
| 
      
 158 
     | 
    
         
            +
             
     | 
| 
      
 159 
     | 
    
         
            +
                    gitlab_mr_json.map do |value|
         
     | 
| 
      
 160 
     | 
    
         
            +
                      {
         
     | 
| 
      
 161 
     | 
    
         
            +
                        :title => value.dig('title'),
         
     | 
| 
      
 162 
     | 
    
         
            +
                        :created_at => value.dig('created_at'),
         
     | 
| 
      
 163 
     | 
    
         
            +
                        :link => value.dig('web_url'),
         
     | 
| 
      
 164 
     | 
    
         
            +
                        :assignee => get_slack_member_id(value.dig('assignee', 'id'), value.dig('assignee', 'username')),
         
     | 
| 
      
 165 
     | 
    
         
            +
                        :assignees => get_slack_member_ids(value, 'assignees'),
         
     | 
| 
      
 166 
     | 
    
         
            +
                        :reviewers => get_slack_member_ids(value, 'reviewers'),
         
     | 
| 
      
 167 
     | 
    
         
            +
                        :labels => value.dig('labels')&.map { |label| label },
         
     | 
| 
      
 168 
     | 
    
         
            +
                        :milestone_title => value.dig('milestone', 'title')
         
     | 
| 
      
 169 
     | 
    
         
            +
                      }
         
     | 
| 
      
 170 
     | 
    
         
            +
                    end
         
     | 
| 
      
 171 
     | 
    
         
            +
                  end
         
     | 
| 
      
 172 
     | 
    
         
            +
             
     | 
| 
      
 173 
     | 
    
         
            +
                  #####################################################
         
     | 
| 
      
 174 
     | 
    
         
            +
                  # @!group TIME FORMAT
         
     | 
| 
      
 175 
     | 
    
         
            +
                  # source: https://stackoverflow.com/a/63106647
         
     | 
| 
      
 176 
     | 
    
         
            +
                  #####################################################
         
     | 
| 
      
 177 
     | 
    
         
            +
             
     | 
| 
      
 178 
     | 
    
         
            +
                  def self.format_relative_date_time(date_string)
         
     | 
| 
      
 179 
     | 
    
         
            +
                    time_unit_to_secs = {
         
     | 
| 
      
 180 
     | 
    
         
            +
                      SECONDS: 1,
         
     | 
| 
      
 181 
     | 
    
         
            +
                      MINUTES: 60,
         
     | 
| 
      
 182 
     | 
    
         
            +
                      HOURS: 3600,
         
     | 
| 
      
 183 
     | 
    
         
            +
                      DAYS: 24 * 3600,
         
     | 
| 
      
 184 
     | 
    
         
            +
                      WEEKS: 7 * 24 * 3600,
         
     | 
| 
      
 185 
     | 
    
         
            +
                      MONTHS: 30 * 24 * 3600,
         
     | 
| 
      
 186 
     | 
    
         
            +
                      YEARS: 365 * 24 * 3600
         
     | 
| 
      
 187 
     | 
    
         
            +
                    }
         
     | 
| 
      
 188 
     | 
    
         
            +
                    time_unit_labels = {
         
     | 
| 
      
 189 
     | 
    
         
            +
                      SECONDS: 'seconds',
         
     | 
| 
      
 190 
     | 
    
         
            +
                      MINUTES: 'minutes',
         
     | 
| 
      
 191 
     | 
    
         
            +
                      HOURS: 'hours',
         
     | 
| 
      
 192 
     | 
    
         
            +
                      DAYS: 'days',
         
     | 
| 
      
 193 
     | 
    
         
            +
                      WEEKS: 'weeks',
         
     | 
| 
      
 194 
     | 
    
         
            +
                      MONTHS: 'months',
         
     | 
| 
      
 195 
     | 
    
         
            +
                      YEARS: 'years'
         
     | 
| 
      
 196 
     | 
    
         
            +
                    }
         
     | 
| 
      
 197 
     | 
    
         
            +
             
     | 
| 
      
 198 
     | 
    
         
            +
                    created_at = DateTime.strptime(date_string, '%Y-%m-%dT%H:%M:%S.%L%Z')
         
     | 
| 
      
 199 
     | 
    
         
            +
                    diff = DateTime.now.to_time.to_i - created_at.to_time.to_i
         
     | 
| 
      
 200 
     | 
    
         
            +
             
     | 
| 
      
 201 
     | 
    
         
            +
                    UI.error("'date_time' cannot be in the future") if diff.negative?
         
     | 
| 
      
 202 
     | 
    
         
            +
             
     | 
| 
      
 203 
     | 
    
         
            +
                    time_unit = if diff < time_unit_to_secs[:MINUTES]
         
     | 
| 
      
 204 
     | 
    
         
            +
                                  :SECONDS
         
     | 
| 
      
 205 
     | 
    
         
            +
                                elsif diff < time_unit_to_secs[:HOURS]
         
     | 
| 
      
 206 
     | 
    
         
            +
                                  :MINUTES
         
     | 
| 
      
 207 
     | 
    
         
            +
                                elsif diff < time_unit_to_secs[:DAYS]
         
     | 
| 
      
 208 
     | 
    
         
            +
                                  :HOURS
         
     | 
| 
      
 209 
     | 
    
         
            +
                                elsif diff < time_unit_to_secs[:WEEKS]
         
     | 
| 
      
 210 
     | 
    
         
            +
                                  :DAYS
         
     | 
| 
      
 211 
     | 
    
         
            +
                                elsif diff < time_unit_to_secs[:MONTHS]
         
     | 
| 
      
 212 
     | 
    
         
            +
                                  :WEEKS
         
     | 
| 
      
 213 
     | 
    
         
            +
                                elsif diff < time_unit_to_secs[:YEARS]
         
     | 
| 
      
 214 
     | 
    
         
            +
                                  :MONTHS
         
     | 
| 
      
 215 
     | 
    
         
            +
                                else
         
     | 
| 
      
 216 
     | 
    
         
            +
                                  :YEARS
         
     | 
| 
      
 217 
     | 
    
         
            +
                                end
         
     | 
| 
      
 218 
     | 
    
         
            +
             
     | 
| 
      
 219 
     | 
    
         
            +
                    time_relative = case time_unit
         
     | 
| 
      
 220 
     | 
    
         
            +
                                    when :SECONDS, :MINUTES, :HOURS, :DAYS, :WEEKS
         
     | 
| 
      
 221 
     | 
    
         
            +
                                      diff / time_unit_to_secs[time_unit]
         
     | 
| 
      
 222 
     | 
    
         
            +
                                    when :MONTHS
         
     | 
| 
      
 223 
     | 
    
         
            +
                                      0.step.find { |n| (created_at >> n) > now } - 1
         
     | 
| 
      
 224 
     | 
    
         
            +
                                    else
         
     | 
| 
      
 225 
     | 
    
         
            +
                                      0.step.find { |n| (created_at >> 12 * n) > now } - 1
         
     | 
| 
      
 226 
     | 
    
         
            +
                                    end
         
     | 
| 
      
 227 
     | 
    
         
            +
             
     | 
| 
      
 228 
     | 
    
         
            +
                    "#{time_relative} #{time_unit_labels[time_unit]} ago"
         
     | 
| 
      
 229 
     | 
    
         
            +
                  end
         
     | 
| 
      
 230 
     | 
    
         
            +
             
     | 
| 
      
 231 
     | 
    
         
            +
                  #####################################################
         
     | 
| 
      
 232 
     | 
    
         
            +
                  # @!group SLACK
         
     | 
| 
      
 233 
     | 
    
         
            +
                  #####################################################
         
     | 
| 
      
 234 
     | 
    
         
            +
             
     | 
| 
      
 235 
     | 
    
         
            +
                  def self.format_users_string(users)
         
     | 
| 
      
 236 
     | 
    
         
            +
                    return '-' if users.empty?
         
     | 
| 
      
 237 
     | 
    
         
            +
             
     | 
| 
      
 238 
     | 
    
         
            +
                    users.join(' ')
         
     | 
| 
      
 239 
     | 
    
         
            +
                  end
         
     | 
| 
      
 240 
     | 
    
         
            +
             
     | 
| 
      
 241 
     | 
    
         
            +
                  def self.compose_merge_request_list_message(merge_requests)
         
     | 
| 
      
 242 
     | 
    
         
            +
                    merge_requests_formatted = merge_requests.map.with_index do |mr, index|
         
     | 
| 
      
 243 
     | 
    
         
            +
                      time = format_relative_date_time(mr[:created_at])
         
     | 
| 
      
 244 
     | 
    
         
            +
                      assignees = format_users_string(mr[:assignees])
         
     | 
| 
      
 245 
     | 
    
         
            +
                      reviewers = format_users_string(mr[:reviewers])
         
     | 
| 
      
 246 
     | 
    
         
            +
                      text = @slack_message_format['mr_item'].to_s
         
     | 
| 
      
 247 
     | 
    
         
            +
                                                  .gsub('MR_TITLE', mr[:title].to_s)
         
     | 
| 
      
 248 
     | 
    
         
            +
                                                  .gsub('MR_TIME', time.to_s)
         
     | 
| 
      
 249 
     | 
    
         
            +
                                                  .gsub('MR_ASSIGNEE_SINGLE', mr[:assignee].to_s)
         
     | 
| 
      
 250 
     | 
    
         
            +
                                                  .gsub('MR_ASSIGNEES', assignees.to_s)
         
     | 
| 
      
 251 
     | 
    
         
            +
                                                  .gsub('MR_REVIEWERS', reviewers.to_s)
         
     | 
| 
      
 252 
     | 
    
         
            +
                                                   .gsub('MR_LABELS', mr[:labels].join(','))
         
     | 
| 
      
 253 
     | 
    
         
            +
                                                  .gsub('MR_LINK', mr[:link].to_s)
         
     | 
| 
      
 254 
     | 
    
         
            +
                      "#{index+1}. #{text}"
         
     | 
| 
      
 255 
     | 
    
         
            +
                    end
         
     | 
| 
      
 256 
     | 
    
         
            +
             
     | 
| 
      
 257 
     | 
    
         
            +
                    if merge_requests_formatted.length > 1
         
     | 
| 
      
 258 
     | 
    
         
            +
                      merge_requests_formatted = merge_requests_formatted.join("\n")
         
     | 
| 
      
 259 
     | 
    
         
            +
                    end
         
     | 
| 
      
 260 
     | 
    
         
            +
             
     | 
| 
      
 261 
     | 
    
         
            +
                    {
         
     | 
| 
      
 262 
     | 
    
         
            +
                      "type": 'section',
         
     | 
| 
      
 263 
     | 
    
         
            +
                      "text": {
         
     | 
| 
      
 264 
     | 
    
         
            +
                        "type": 'mrkdwn',
         
     | 
| 
      
 265 
     | 
    
         
            +
                        "text": merge_requests_formatted
         
     | 
| 
      
 266 
     | 
    
         
            +
                      }
         
     | 
| 
      
 267 
     | 
    
         
            +
                    }
         
     | 
| 
      
 268 
     | 
    
         
            +
                  end
         
     | 
| 
      
 269 
     | 
    
         
            +
             
     | 
| 
      
 270 
     | 
    
         
            +
                  def self.compose_slack_payload(merge_requests)
         
     | 
| 
      
 271 
     | 
    
         
            +
                    unless merge_requests.length > 0
         
     | 
| 
      
 272 
     | 
    
         
            +
                      return {
         
     | 
| 
      
 273 
     | 
    
         
            +
                        :text => @slack_message_format['text'],
         
     | 
| 
      
 274 
     | 
    
         
            +
                        :blocks => [
         
     | 
| 
      
 275 
     | 
    
         
            +
                          {
         
     | 
| 
      
 276 
     | 
    
         
            +
                            "type": 'section',
         
     | 
| 
      
 277 
     | 
    
         
            +
                            "text": {
         
     | 
| 
      
 278 
     | 
    
         
            +
                              "type": 'mrkdwn',
         
     | 
| 
      
 279 
     | 
    
         
            +
                              "text": @slack_message_format['empty_mr_text'].gsub('MR_MILESTONE', @current_milestone)
         
     | 
| 
      
 280 
     | 
    
         
            +
                            }
         
     | 
| 
      
 281 
     | 
    
         
            +
                          }
         
     | 
| 
      
 282 
     | 
    
         
            +
                        ]
         
     | 
| 
      
 283 
     | 
    
         
            +
                      }
         
     | 
| 
      
 284 
     | 
    
         
            +
                    end
         
     | 
| 
      
 285 
     | 
    
         
            +
             
     | 
| 
      
 286 
     | 
    
         
            +
                    header_text = @slack_message_format['header'].gsub('MR_TOTAL', merge_requests.length.to_s)
         
     | 
| 
      
 287 
     | 
    
         
            +
                                                                 .gsub('MR_MILESTONE', @current_milestone)
         
     | 
| 
      
 288 
     | 
    
         
            +
                    header_section = {
         
     | 
| 
      
 289 
     | 
    
         
            +
                      :type => 'section',
         
     | 
| 
      
 290 
     | 
    
         
            +
                      :text => {
         
     | 
| 
      
 291 
     | 
    
         
            +
                        :type => 'mrkdwn',
         
     | 
| 
      
 292 
     | 
    
         
            +
                        :text => header_text
         
     | 
| 
      
 293 
     | 
    
         
            +
                      }
         
     | 
| 
      
 294 
     | 
    
         
            +
                    }
         
     | 
| 
      
 295 
     | 
    
         
            +
                    mr_section = compose_merge_request_list_message(merge_requests)
         
     | 
| 
      
 296 
     | 
    
         
            +
                    footer_section = {
         
     | 
| 
      
 297 
     | 
    
         
            +
                      :type => 'section',
         
     | 
| 
      
 298 
     | 
    
         
            +
                      :text => {
         
     | 
| 
      
 299 
     | 
    
         
            +
                        :type => 'mrkdwn',
         
     | 
| 
      
 300 
     | 
    
         
            +
                        :text => @slack_message_format['footer']
         
     | 
| 
      
 301 
     | 
    
         
            +
                      }
         
     | 
| 
      
 302 
     | 
    
         
            +
                    }
         
     | 
| 
      
 303 
     | 
    
         
            +
             
     | 
| 
      
 304 
     | 
    
         
            +
                    {
         
     | 
| 
      
 305 
     | 
    
         
            +
                      :text => @slack_message_format['text'],
         
     | 
| 
      
 306 
     | 
    
         
            +
                      :blocks => [header_section, mr_section, footer_section]
         
     | 
| 
      
 307 
     | 
    
         
            +
                    }
         
     | 
| 
      
 308 
     | 
    
         
            +
                  end
         
     | 
| 
      
 309 
     | 
    
         
            +
             
     | 
| 
      
 310 
     | 
    
         
            +
                  #####################################################
         
     | 
| 
      
 311 
     | 
    
         
            +
                  # @!group Documentation
         
     | 
| 
      
 312 
     | 
    
         
            +
                  #####################################################
         
     | 
| 
      
 313 
     | 
    
         
            +
             
     | 
| 
      
 314 
     | 
    
         
            +
                  def self.available_options # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
         
     | 
| 
      
 315 
     | 
    
         
            +
                    [
         
     | 
| 
      
 316 
     | 
    
         
            +
                      FastlaneCore::ConfigItem.new(
         
     | 
| 
      
 317 
     | 
    
         
            +
                        key: :gitlab_token,
         
     | 
| 
      
 318 
     | 
    
         
            +
                        env_name: 'GITLAB_ACCESS_TOKEN',
         
     | 
| 
      
 319 
     | 
    
         
            +
                        description: 'Gitlab access token',
         
     | 
| 
      
 320 
     | 
    
         
            +
                        optional: false,
         
     | 
| 
      
 321 
     | 
    
         
            +
                        verify_block: proc do |value|
         
     | 
| 
      
 322 
     | 
    
         
            +
                          UI.user_error!('No gitlab access token given') unless value and !value.empty?
         
     | 
| 
      
 323 
     | 
    
         
            +
                        end
         
     | 
| 
      
 324 
     | 
    
         
            +
                      ),
         
     | 
| 
      
 325 
     | 
    
         
            +
                      FastlaneCore::ConfigItem.new(
         
     | 
| 
      
 326 
     | 
    
         
            +
                        key: :gitlab_project_id,
         
     | 
| 
      
 327 
     | 
    
         
            +
                        env_name: 'GITLAB_PROJECT_ID',
         
     | 
| 
      
 328 
     | 
    
         
            +
                        description: 'Gitlab project id',
         
     | 
| 
      
 329 
     | 
    
         
            +
                        optional: false,
         
     | 
| 
      
 330 
     | 
    
         
            +
                        verify_block: proc do |value|
         
     | 
| 
      
 331 
     | 
    
         
            +
                          UI.user_error!('No gitlab mr url given') unless value and !value.empty?
         
     | 
| 
      
 332 
     | 
    
         
            +
                        end
         
     | 
| 
      
 333 
     | 
    
         
            +
                      ),
         
     | 
| 
      
 334 
     | 
    
         
            +
                      FastlaneCore::ConfigItem.new(
         
     | 
| 
      
 335 
     | 
    
         
            +
                        key: :gitlab_milestones_path,
         
     | 
| 
      
 336 
     | 
    
         
            +
                        env_name: 'GITLAB_MILESTONES_PATH',
         
     | 
| 
      
 337 
     | 
    
         
            +
                        description: 'Gitlab group or project milestones with given format either `groups/:group_id` or `projects/:project_id`',
         
     | 
| 
      
 338 
     | 
    
         
            +
                        optional: true,
         
     | 
| 
      
 339 
     | 
    
         
            +
                        verify_block: proc do |value|
         
     | 
| 
      
 340 
     | 
    
         
            +
                          UI.user_error!('No gitlab milestones path given') unless value and !value.empty?
         
     | 
| 
      
 341 
     | 
    
         
            +
                        end
         
     | 
| 
      
 342 
     | 
    
         
            +
                      ),
         
     | 
| 
      
 343 
     | 
    
         
            +
                      FastlaneCore::ConfigItem.new(
         
     | 
| 
      
 344 
     | 
    
         
            +
                        key: :gitlab_merge_request_total,
         
     | 
| 
      
 345 
     | 
    
         
            +
                        env_name: 'GITLAB_MERGE_REQUEST_TOTAL',
         
     | 
| 
      
 346 
     | 
    
         
            +
                        default_value: '10',
         
     | 
| 
      
 347 
     | 
    
         
            +
                        description: 'Total merge request to be shown in reminder, default value is `10`',
         
     | 
| 
      
 348 
     | 
    
         
            +
                        optional: true,
         
     | 
| 
      
 349 
     | 
    
         
            +
                        verify_block: proc do |value|
         
     | 
| 
      
 350 
     | 
    
         
            +
                          UI.user_error!('No gitlab merge request total given') unless value and !value.empty?
         
     | 
| 
      
 351 
     | 
    
         
            +
                        end
         
     | 
| 
      
 352 
     | 
    
         
            +
                      ),
         
     | 
| 
      
 353 
     | 
    
         
            +
                      FastlaneCore::ConfigItem.new(
         
     | 
| 
      
 354 
     | 
    
         
            +
                        key: :members_file,
         
     | 
| 
      
 355 
     | 
    
         
            +
                        env_name: 'GITLAB_SLACK_MEMBERS_FILE',
         
     | 
| 
      
 356 
     | 
    
         
            +
                        description: 'Gitlab members filepath in csv format',
         
     | 
| 
      
 357 
     | 
    
         
            +
                        optional: true,
         
     | 
| 
      
 358 
     | 
    
         
            +
                        verify_block: proc do |value|
         
     | 
| 
      
 359 
     | 
    
         
            +
                          UI.user_error!('No members file given') unless value and !value.empty?
         
     | 
| 
      
 360 
     | 
    
         
            +
                        end
         
     | 
| 
      
 361 
     | 
    
         
            +
                      ),
         
     | 
| 
      
 362 
     | 
    
         
            +
                      FastlaneCore::ConfigItem.new(
         
     | 
| 
      
 363 
     | 
    
         
            +
                        key: :slack_webhook_url,
         
     | 
| 
      
 364 
     | 
    
         
            +
                        env_name: 'SLACK_WEBHOOK_URL',
         
     | 
| 
      
 365 
     | 
    
         
            +
                        description: 'Slack webhook url',
         
     | 
| 
      
 366 
     | 
    
         
            +
                        optional: false,
         
     | 
| 
      
 367 
     | 
    
         
            +
                        verify_block: proc do |value|
         
     | 
| 
      
 368 
     | 
    
         
            +
                          UI.user_error!('No slack webhook url given') unless value and !value.empty?
         
     | 
| 
      
 369 
     | 
    
         
            +
                        end
         
     | 
| 
      
 370 
     | 
    
         
            +
                      ),
         
     | 
| 
      
 371 
     | 
    
         
            +
                      FastlaneCore::ConfigItem.new(
         
     | 
| 
      
 372 
     | 
    
         
            +
                        key: :slack_message_format_file,
         
     | 
| 
      
 373 
     | 
    
         
            +
                        env_name: 'SLACK_MESSAGE_FORMAT_FILE',
         
     | 
| 
      
 374 
     | 
    
         
            +
                        default_value: {
         
     | 
| 
      
 375 
     | 
    
         
            +
                          'text' => 'Hello, beautiful day!',
         
     | 
| 
      
 376 
     | 
    
         
            +
                          'header' =>'Hi there, Just wanted to let you know that we have MR_TOTAL merge requests that need your attention.',
         
     | 
| 
      
 377 
     | 
    
         
            +
                          'mr_item' => '<MR_LINK|MR_TITLE> MR_ASSIGNEE_SINGLE',
         
     | 
| 
      
 378 
     | 
    
         
            +
                          'footer' => 'Thank you',
         
     | 
| 
      
 379 
     | 
    
         
            +
                          'empty_mr_text' => 'Congratulation there is no merge request anymore, keep the good works'
         
     | 
| 
      
 380 
     | 
    
         
            +
                        },
         
     | 
| 
      
 381 
     | 
    
         
            +
                        description: "Slack message format in json format contains `text`, `header`, `mr_item`, `footer`, and `empty_mr_text`"\
         
     | 
| 
      
 382 
     | 
    
         
            +
                                      "| In `header` you can use use `MR_TOTAL` and `MR_MILESTONE`"\
         
     | 
| 
      
 383 
     | 
    
         
            +
                                      "| In `mr_item` you can use use `MR_TITLE`, `MR_TIME`, `MR_ASSIGNEE_SINGLE`, `MR_ASSIGNEES`, `MR_REVIEWERS`  `MR_LABELS`, and `MR_LINK`"\
         
     | 
| 
      
 384 
     | 
    
         
            +
                                      "| In `empty_mr_text` you can use `MR_MILESTONE`",
         
     | 
| 
      
 385 
     | 
    
         
            +
                        optional: true
         
     | 
| 
      
 386 
     | 
    
         
            +
                      )
         
     | 
| 
      
 387 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 388 
     | 
    
         
            +
                  end
         
     | 
| 
      
 389 
     | 
    
         
            +
             
     | 
| 
      
 390 
     | 
    
         
            +
                  def self.example_code
         
     | 
| 
      
 391 
     | 
    
         
            +
                    [
         
     | 
| 
      
 392 
     | 
    
         
            +
                      'gitlab_mr_reminder()',
         
     | 
| 
      
 393 
     | 
    
         
            +
                      'gitlab_mr_reminder(
         
     | 
| 
      
 394 
     | 
    
         
            +
                        gitlab_members_file: "/User/documents/fe_members.csv",
         
     | 
| 
      
 395 
     | 
    
         
            +
                        gitlab_token: "XXXX",
         
     | 
| 
      
 396 
     | 
    
         
            +
                        gitlab_project_id: "https://gitlab.com/...",
         
     | 
| 
      
 397 
     | 
    
         
            +
                        slack_webhook_url: "ttps://hooks.slack.com/...",
         
     | 
| 
      
 398 
     | 
    
         
            +
                        slack_message_format_file: "/User/documents/slack_format.csv", # optional
         
     | 
| 
      
 399 
     | 
    
         
            +
                      )'
         
     | 
| 
      
 400 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 401 
     | 
    
         
            +
                  end
         
     | 
| 
      
 402 
     | 
    
         
            +
             
     | 
| 
      
 403 
     | 
    
         
            +
                  def self.is_supported?(platform)
         
     | 
| 
      
 404 
     | 
    
         
            +
                    true
         
     | 
| 
      
 405 
     | 
    
         
            +
                  end
         
     | 
| 
      
 406 
     | 
    
         
            +
             
     | 
| 
      
 407 
     | 
    
         
            +
                  def self.author
         
     | 
| 
      
 408 
     | 
    
         
            +
                    'tbetmen'
         
     | 
| 
      
 409 
     | 
    
         
            +
                  end
         
     | 
| 
      
 410 
     | 
    
         
            +
             
     | 
| 
      
 411 
     | 
    
         
            +
                  def self.description
         
     | 
| 
      
 412 
     | 
    
         
            +
                    'Send gitlab merge requests reminder to slack.'
         
     | 
| 
      
 413 
     | 
    
         
            +
                  end
         
     | 
| 
      
 414 
     | 
    
         
            +
             
     | 
| 
      
 415 
     | 
    
         
            +
                  def self.details
         
     | 
| 
      
 416 
     | 
    
         
            +
                    "This action is reminder system of gitlab merge request, fetching merge requests using Gitlab REST API and send to Slack using webhook url."
         
     | 
| 
      
 417 
     | 
    
         
            +
                  end
         
     | 
| 
      
 418 
     | 
    
         
            +
                end
         
     | 
| 
      
 419 
     | 
    
         
            +
              end
         
     | 
| 
      
 420 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,16 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'fastlane_core/ui/ui'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Fastlane
         
     | 
| 
      
 4 
     | 
    
         
            +
              UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              module Helper
         
     | 
| 
      
 7 
     | 
    
         
            +
                class RoosterHelper
         
     | 
| 
      
 8 
     | 
    
         
            +
                  # class methods that you define here become available in your action
         
     | 
| 
      
 9 
     | 
    
         
            +
                  # as `Helper::RoosterHelper.your_method`
         
     | 
| 
      
 10 
     | 
    
         
            +
                  #
         
     | 
| 
      
 11 
     | 
    
         
            +
                  def self.show_message
         
     | 
| 
      
 12 
     | 
    
         
            +
                    UI.message("Hello from the rooster plugin helper!")
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,16 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'fastlane/plugin/rooster/version'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Fastlane
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Rooster
         
     | 
| 
      
 5 
     | 
    
         
            +
                # Return all .rb files inside the "actions" and "helper" directory
         
     | 
| 
      
 6 
     | 
    
         
            +
                def self.all_classes
         
     | 
| 
      
 7 
     | 
    
         
            +
                  Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
         
     | 
| 
      
 8 
     | 
    
         
            +
                end
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
            end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            # By default we want to import all available actions and helpers
         
     | 
| 
      
 13 
     | 
    
         
            +
            # A plugin can contain any number of actions and plugins
         
     | 
| 
      
 14 
     | 
    
         
            +
            Fastlane::Rooster.all_classes.each do |current|
         
     | 
| 
      
 15 
     | 
    
         
            +
              require current
         
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,188 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: fastlane-plugin-rooster
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.2.0
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Muhammad M Munir
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire:
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2023-06-23 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: fastlane
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: 2.213.0
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: 2.213.0
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: pry
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: rspec
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 76 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 77 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 78 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 79 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 80 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 81 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 82 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 83 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 84 
     | 
    
         
            +
              name: rspec_junit_formatter
         
     | 
| 
      
 85 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 86 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 87 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 88 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 89 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 90 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 91 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 92 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 93 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 94 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 95 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 96 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 97 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 98 
     | 
    
         
            +
              name: rubocop
         
     | 
| 
      
 99 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 100 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 101 
     | 
    
         
            +
                - - '='
         
     | 
| 
      
 102 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 103 
     | 
    
         
            +
                    version: 1.12.1
         
     | 
| 
      
 104 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 105 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 106 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 107 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 108 
     | 
    
         
            +
                - - '='
         
     | 
| 
      
 109 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 110 
     | 
    
         
            +
                    version: 1.12.1
         
     | 
| 
      
 111 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 112 
     | 
    
         
            +
              name: rubocop-performance
         
     | 
| 
      
 113 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 114 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 115 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 116 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 117 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 118 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 119 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 120 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 121 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 122 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 123 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 124 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 125 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 126 
     | 
    
         
            +
              name: rubocop-require_tools
         
     | 
| 
      
 127 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 128 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 129 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 130 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 131 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 132 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 133 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 134 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 135 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 136 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 137 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 138 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 139 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 140 
     | 
    
         
            +
              name: simplecov
         
     | 
| 
      
 141 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 142 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 143 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 144 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 145 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 146 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 147 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 148 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 149 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 150 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 151 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 152 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 153 
     | 
    
         
            +
            description:
         
     | 
| 
      
 154 
     | 
    
         
            +
            email: muhammadmmunir24@gmail.com
         
     | 
| 
      
 155 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 156 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 157 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 158 
     | 
    
         
            +
            files:
         
     | 
| 
      
 159 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 160 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 161 
     | 
    
         
            +
            - lib/fastlane/plugin/rooster.rb
         
     | 
| 
      
 162 
     | 
    
         
            +
            - lib/fastlane/plugin/rooster/actions/rooster_action.rb
         
     | 
| 
      
 163 
     | 
    
         
            +
            - lib/fastlane/plugin/rooster/helper/rooster_helper.rb
         
     | 
| 
      
 164 
     | 
    
         
            +
            - lib/fastlane/plugin/rooster/version.rb
         
     | 
| 
      
 165 
     | 
    
         
            +
            homepage: https://github.com/tbetmen/fastlane-plugin-rooster
         
     | 
| 
      
 166 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 167 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 168 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 169 
     | 
    
         
            +
            post_install_message:
         
     | 
| 
      
 170 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 171 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 172 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 173 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 174 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 175 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 176 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 177 
     | 
    
         
            +
                  version: '2.6'
         
     | 
| 
      
 178 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 179 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 180 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 181 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 182 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 183 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 184 
     | 
    
         
            +
            rubygems_version: 3.4.10
         
     | 
| 
      
 185 
     | 
    
         
            +
            signing_key:
         
     | 
| 
      
 186 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 187 
     | 
    
         
            +
            summary: Send gitlab merge requests reminder to slack
         
     | 
| 
      
 188 
     | 
    
         
            +
            test_files: []
         
     |