fastlane-plugin-dependency_manager_outdated 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fb7c001bbb1cfacbb0081e4adcd8311a931edfa5bfbd30cdd5efee7453a17a30
4
+ data.tar.gz: d3e115761739d8889ed8757e5bca5a1ce2773607609c99710f29a5433ab2c11d
5
+ SHA512:
6
+ metadata.gz: 5bba6e8b589f4c95e82103e466acbbceb4a8d799466aa3b180cbc6924e3abe6597c369e17803ed92715c3da388edf65ceea6ff893a994b7a3090d16e1fd2371b
7
+ data.tar.gz: af2059a8e6e18a1052396742f0e9c1a30a4b4d8132b2beac88a2add3f33eaf9849255ccd87781d43e38245ed0ae8a49d7c2c77bce8e0163dfd1b26265e6cdfdc
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 matsuda <kosukematsuda@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
+ # dependency_manager_outdated plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-dependency_manager_outdated)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-dependency_manager_outdated`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin dependency_manager_outdated
11
+ ```
12
+
13
+ ## About dependency_manager_outdated
14
+
15
+ Fastlane plugin to check project's outdated dependencies
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,16 @@
1
+ require 'fastlane/plugin/dependency_manager_outdated/version'
2
+
3
+ module Fastlane
4
+ module DependencyManagerOutdated
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::DependencyManagerOutdated.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,129 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/carthage_outdated_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ module SharedValues
7
+ CARTHAGE_OUTDATED_LIST = :CARTHAGE_OUTDATED_LIST
8
+ CARTHAGE_REPOSITORY_LIST = :CARTHAGE_REPOSITORY_LIST
9
+ end
10
+
11
+ class CarthageOutdatedAction < Action
12
+ def self.run(params)
13
+ UI.message("The carthage_outdated action is working!")
14
+
15
+ DependencyManager.config = params
16
+
17
+ cmd = ["carthage outdated"]
18
+ cmd << "--project-directory #{params[:project_directory]}" if params[:project_directory]
19
+ cmd << "--use-ssh" if params[:use_ssh]
20
+ result = Actions.sh(cmd.join(' '))
21
+
22
+ dependencies = Helper::CarthageOutdatedHelper.parse(result)
23
+
24
+ repos = Helper::CarthageOutdatedHelper.resolved(params[:project_directory])
25
+ Actions.lane_context[SharedValues::CARTHAGE_REPOSITORY_LIST] = repos
26
+
27
+ dependencies.each do |lib|
28
+ if repository = repos[lib[:name]]
29
+ lib[:repository] = repository
30
+ end
31
+ end
32
+ Actions.lane_context[SharedValues::CARTHAGE_OUTDATED_LIST] = dependencies
33
+
34
+ Helper::CarthageOutdatedHelper.notify_slack(dependencies)
35
+ end
36
+
37
+ #####################################################
38
+ # @!group Documentation
39
+ #####################################################
40
+
41
+ def self.description
42
+ "Check outdated Carthage dependencies"
43
+ end
44
+
45
+ def self.details
46
+ "Check outdated Carthage dependencies"
47
+ end
48
+
49
+ def self.available_options
50
+ [
51
+ FastlaneCore::ConfigItem.new(key: :project_directory,
52
+ env_name: "DEPENDENCY_MANAGER_PROJECT_DIRECTORY",
53
+ description: "The path to the root of the project directory",
54
+ optional: true),
55
+ FastlaneCore::ConfigItem.new(key: :use_ssh,
56
+ env_name: "DEPENDENCY_MANAGER_CARTHAGE_USE_SSH",
57
+ description: "Use SSH for downloading GitHub repositories",
58
+ is_string: false,
59
+ type: Boolean,
60
+ optional: true),
61
+
62
+ # slack
63
+ FastlaneCore::ConfigItem.new(key: :slack_url,
64
+ short_option: "-i",
65
+ env_name: "DEPENDENCY_MANAGER_SLACK_URL",
66
+ sensitive: true,
67
+ description: "Create an Incoming WebHook for your Slack group to post results there",
68
+ optional: true,
69
+ verify_block: proc do |value|
70
+ if !value.to_s.empty? && !value.start_with?("https://")
71
+ UI.user_error!("Invalid URL, must start with https://")
72
+ end
73
+ end),
74
+ FastlaneCore::ConfigItem.new(key: :slack_channel,
75
+ short_option: "-e",
76
+ env_name: "DEPENDENCY_MANAGER_SLACK_CHANNEL",
77
+ description: "#channel or @username",
78
+ optional: true),
79
+ FastlaneCore::ConfigItem.new(key: :slack_username,
80
+ env_name: "DEPENDENCY_MANAGER_SLACK_USERNAME",
81
+ description: "Overrides the webhook's username property if slack_use_webhook_configured_username_and_icon is false",
82
+ default_value: "fastlane",
83
+ is_string: true,
84
+ optional: true),
85
+ FastlaneCore::ConfigItem.new(key: :slack_icon_url,
86
+ env_name: "DEPENDENCY_MANAGER_SLACK_ICON_URL",
87
+ description: "Overrides the webhook's image property if slack_use_webhook_configured_username_and_icon is false",
88
+ default_value: "https://s3-eu-west-1.amazonaws.com/fastlane.tools/fastlane.png",
89
+ is_string: true,
90
+ optional: true),
91
+ FastlaneCore::ConfigItem.new(key: :skip_slack,
92
+ env_name: "DEPENDENCY_MANAGER_SKIP_SLACK",
93
+ description: "Don't publish to slack, even when an URL is given",
94
+ is_string: false,
95
+ default_value: false),
96
+ ]
97
+ end
98
+
99
+ def self.output
100
+ [
101
+ ['CARTHAGE_OUTDATED_LIST', 'List of the outdated dependencies in the current Cartfile.resolved'],
102
+ ['CARTHAGE_REPOSITORY_LIST', 'List of dependencies in the current Cartfile.resolved'],
103
+ ]
104
+ end
105
+
106
+ def self.return_value
107
+ # If your method provides a return value, you can describe here what it does
108
+ end
109
+
110
+ def self.authors
111
+ ["matsuda"]
112
+ end
113
+
114
+ def self.is_supported?(platform)
115
+ platform == :ios
116
+ end
117
+
118
+ def self.example_code
119
+ [
120
+ 'carthage_outdated',
121
+ 'carthage_outdated(
122
+ project_directory: "path/to/xcode/project",
123
+ slack_url: "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX",
124
+ )',
125
+ ]
126
+ end
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,125 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/cocoapods_outdated_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ module SharedValues
7
+ COCOAPODS_OUTDATED_LIST = :COCOAPODS_OUTDATED_LIST
8
+ end
9
+
10
+ class CocoapodsOutdatedAction < Action
11
+ def self.run(params)
12
+ UI.message("The cocoapods_outdated action is working!")
13
+
14
+ DependencyManager.config = params
15
+
16
+ cmd = []
17
+ cmd << ['bundle exec'] if params[:use_bundle_exec] && shell_out_should_use_bundle_exec?
18
+ cmd << ['pod outdated']
19
+ cmd << "--project-directory=#{params[:project_directory]}" if params[:project_directory]
20
+ cmd << "--no-repo-update" if params[:no_repo_update]
21
+ result = Actions.sh(cmd.join(' '))
22
+
23
+ dependencies = Helper::CocoapodsOutdatedHelper.parse(result)
24
+ Actions.lane_context[SharedValues::COCOAPODS_OUTDATED_LIST] = dependencies
25
+
26
+ Helper::CocoapodsOutdatedHelper.notify_slack(dependencies)
27
+ end
28
+
29
+ #####################################################
30
+ # @!group Documentation
31
+ #####################################################
32
+
33
+ def self.description
34
+ "Check outdated CocoaPods dependencies"
35
+ end
36
+
37
+ def self.details
38
+ "Check outdated CocoaPods dependencies"
39
+ end
40
+
41
+ def self.available_options
42
+ [
43
+ FastlaneCore::ConfigItem.new(key: :project_directory,
44
+ env_name: "DEPENDENCY_MANAGER_PROJECT_DIRECTORY",
45
+ description: "The path to the root of the project directory",
46
+ optional: true),
47
+ FastlaneCore::ConfigItem.new(key: :use_bundle_exec,
48
+ env_name: "DEPENDENCY_MANAGER_COCOAPODS_USE_BUNDLE_EXEC",
49
+ description: "Use bundle exec when there is a Gemfile presented",
50
+ is_string: false,
51
+ default_value: true),
52
+ FastlaneCore::ConfigItem.new(key: :no_repo_update,
53
+ env_name: "COCOAPODS_OUTDATED_REPO_UPDATE",
54
+ description: "Skip running `pod repo update` before install",
55
+ is_string: false,
56
+ type: Boolean,
57
+ optional: true),
58
+
59
+ # slack
60
+ FastlaneCore::ConfigItem.new(key: :slack_url,
61
+ short_option: "-i",
62
+ env_name: "DEPENDENCY_MANAGER_SLACK_URL",
63
+ sensitive: true,
64
+ description: "Create an Incoming WebHook for your Slack group to post results there",
65
+ optional: true,
66
+ verify_block: proc do |value|
67
+ if !value.to_s.empty? && !value.start_with?("https://")
68
+ UI.user_error!("Invalid URL, must start with https://")
69
+ end
70
+ end),
71
+ FastlaneCore::ConfigItem.new(key: :slack_channel,
72
+ short_option: "-e",
73
+ env_name: "DEPENDENCY_MANAGER_SLACK_CHANNEL",
74
+ description: "#channel or @username",
75
+ optional: true),
76
+ FastlaneCore::ConfigItem.new(key: :slack_username,
77
+ env_name: "DEPENDENCY_MANAGER_SLACK_USERNAME",
78
+ description: "Overrides the webhook's username property if slack_use_webhook_configured_username_and_icon is false",
79
+ default_value: "fastlane",
80
+ is_string: true,
81
+ optional: true),
82
+ FastlaneCore::ConfigItem.new(key: :slack_icon_url,
83
+ env_name: "DEPENDENCY_MANAGER_SLACK_ICON_URL",
84
+ description: "Overrides the webhook's image property if slack_use_webhook_configured_username_and_icon is false",
85
+ default_value: "https://s3-eu-west-1.amazonaws.com/fastlane.tools/fastlane.png",
86
+ is_string: true,
87
+ optional: true),
88
+ FastlaneCore::ConfigItem.new(key: :skip_slack,
89
+ env_name: "DEPENDENCY_MANAGER_SKIP_SLACK",
90
+ description: "Don't publish to slack, even when an URL is given",
91
+ is_string: false,
92
+ default_value: false),
93
+ ]
94
+ end
95
+
96
+ def self.output
97
+ [
98
+ ['COCOAPODS_OUTDATED_LIST', 'List of the outdated pods in the current Podfile.lock'],
99
+ ]
100
+ end
101
+
102
+ def self.return_value
103
+ # If your method provides a return value, you can describe here what it does
104
+ end
105
+
106
+ def self.authors
107
+ ["matsuda"]
108
+ end
109
+
110
+ def self.is_supported?(platform)
111
+ platform == :ios
112
+ end
113
+
114
+ def self.example_code
115
+ [
116
+ 'cocoapods_outdated(
117
+ project_directory: "path/to/xcode/project",
118
+ no_repo_update: true,
119
+ slack_url: "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX",
120
+ )',
121
+ ]
122
+ end
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,80 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/dependency_manager_outdated_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class DependencyManagerOutdatedAction < Action
7
+ def self.run(params)
8
+ UI.message("The dependency_manager_outdated plugin is working!")
9
+ end
10
+
11
+ def self.description
12
+ "Fastlane plugin to check project's outdated dependencies"
13
+ end
14
+
15
+ def self.authors
16
+ ["matsuda"]
17
+ end
18
+
19
+ def self.return_value
20
+ # If your method provides a return value, you can describe here what it does
21
+ end
22
+
23
+ def self.details
24
+ # Optional:
25
+ "Check outdated outdated CocoaPods and Carthage dependencies in project and notify to slack them"
26
+ end
27
+
28
+ def self.available_options
29
+ [
30
+ FastlaneCore::ConfigItem.new(key: :project_directory,
31
+ env_name: "DEPENDENCY_MANAGER_PROJECT_DIRECTORY",
32
+ description: "The path to the root of the project directory",
33
+ optional: true),
34
+
35
+ # slack
36
+ FastlaneCore::ConfigItem.new(key: :slack_url,
37
+ short_option: "-i",
38
+ env_name: "DEPENDENCY_MANAGER_SLACK_URL",
39
+ sensitive: true,
40
+ description: "Create an Incoming WebHook for your Slack group to post results there",
41
+ optional: true,
42
+ verify_block: proc do |value|
43
+ if !value.to_s.empty? && !value.start_with?("https://")
44
+ UI.user_error!("Invalid URL, must start with https://")
45
+ end
46
+ end),
47
+ FastlaneCore::ConfigItem.new(key: :slack_channel,
48
+ short_option: "-e",
49
+ env_name: "DEPENDENCY_MANAGER_SLACK_CHANNEL",
50
+ description: "#channel or @username",
51
+ optional: true),
52
+ FastlaneCore::ConfigItem.new(key: :slack_username,
53
+ env_name: "DEPENDENCY_MANAGER_SLACK_USERNAME",
54
+ description: "Overrides the webhook's username property if slack_use_webhook_configured_username_and_icon is false",
55
+ default_value: "fastlane",
56
+ is_string: true,
57
+ optional: true),
58
+ FastlaneCore::ConfigItem.new(key: :slack_icon_url,
59
+ env_name: "DEPENDENCY_MANAGER_SLACK_ICON_URL",
60
+ description: "Overrides the webhook's image property if slack_use_webhook_configured_username_and_icon is false",
61
+ default_value: "https://s3-eu-west-1.amazonaws.com/fastlane.tools/fastlane.png",
62
+ is_string: true,
63
+ optional: true),
64
+ FastlaneCore::ConfigItem.new(key: :skip_slack,
65
+ env_name: "DEPENDENCY_MANAGER_SKIP_SLACK",
66
+ description: "Don't publish to slack, even when an URL is given",
67
+ is_string: false,
68
+ default_value: false),
69
+ ]
70
+ end
71
+
72
+ def self.is_supported?(platform)
73
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
74
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
75
+ #
76
+ [:ios].include?(platform)
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,76 @@
1
+ require 'fastlane_core/ui/ui'
2
+ require_relative './dependency_manager_outdated_helper'
3
+
4
+ module Fastlane
5
+ UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
6
+
7
+ module Helper
8
+ class CarthageOutdatedHelper < DependencyManagerOutdatedHelper
9
+ # class methods that you define here become available in your action
10
+ # as `Helper::CarthageOutdatedHelper.your_method`
11
+
12
+ SEPARATOR = "The following dependencies are outdated:"
13
+ # ex.)
14
+ # Alamofire "4.7.3" -> "4.7.3" (Latest: "4.8.2")
15
+ PATTERN = /^(\S+) "(\S+)" -> "(\S+)" \(Latest: "(\S+)"\)$/
16
+
17
+ # ex.)
18
+ # github "Alamofire/Alamofire" "4.7.3"
19
+ RESOLVED_PATTERN = /^(\S+) "(\S+)" "(\S+)"$/
20
+
21
+ def self.name
22
+ "Carthage"
23
+ end
24
+
25
+ def self.message
26
+ SEPARATOR
27
+ end
28
+
29
+ def self.parse(str)
30
+ result = str.split(SEPARATOR + "\n")[1]
31
+ libs = result.split("\n")
32
+
33
+ results = []
34
+ libs.each do |lib|
35
+ lib.match(PATTERN)
36
+ results << Dependency.new($1, $2, $3, $4)
37
+ end
38
+ results.map { |r| r.to_hash }
39
+ end
40
+
41
+ # {"Alamofire"=>"https://github.com/Alamofire/Alamofire", "RxSwift"=>"https://github.com/ReactiveX/RxSwift"}
42
+ def self.resolved(dir)
43
+ lock_file = "Cartfile.resolved"
44
+ dir ||= '.'
45
+ # dir = File.dirname(File.expand_path(__FILE__))
46
+ file = File.join(dir, lock_file)
47
+
48
+ results = {}
49
+ File.open(file) do |f|
50
+ f.each_line do |lib|
51
+ lib.match(RESOLVED_PATTERN)
52
+ origin = $1
53
+ repo = $2
54
+
55
+ url = nil
56
+ name = nil
57
+ if origin == "github"
58
+ url = "https://github.com/#{repo}"
59
+ name = repo.split("/")[1]
60
+ end
61
+ if origin == "git"
62
+ url = repo
63
+ name = repo.split("/").last
64
+ end
65
+ if name && !name.empty?
66
+ results[name] = url
67
+ end
68
+ end
69
+ rescue => e
70
+ UI.message e
71
+ end
72
+ results
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,40 @@
1
+ require 'fastlane_core/ui/ui'
2
+ require_relative './dependency_manager_outdated_helper'
3
+
4
+ module Fastlane
5
+ UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
6
+
7
+ module Helper
8
+ class CocoapodsOutdatedHelper < DependencyManagerOutdatedHelper
9
+ # class methods that you define here become available in your action
10
+ # as `Helper::CocoapodsOutdatedHelper.your_method`
11
+ #
12
+
13
+ SEPARATOR = "The following pod updates are available:"
14
+ # ex.)
15
+ # - Fabric 1.7.8 -> 1.9.0 (latest version 1.9.0)
16
+ PATTERN = /^- (\S+) (\S+) -> (\S+) \(latest version (\S+)\)$/
17
+
18
+ def self.name
19
+ "CocoaPods"
20
+ end
21
+
22
+ def self.message
23
+ SEPARATOR
24
+ end
25
+
26
+ def self.parse(str)
27
+ result = str.split(SEPARATOR + "\n")[1]
28
+ libs = result.split("\n")
29
+
30
+ results = []
31
+ libs.each do |lib|
32
+ lib.match(PATTERN)
33
+ results << Dependency.new($1, $2, $3, $4)
34
+ end
35
+ results.map { |r| r.to_hash }
36
+ end
37
+
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,112 @@
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 DependencyManagerOutdatedHelper
8
+ # class methods that you define here become available in your action
9
+ # as `Helper::DependencyManagerOutdatedHelper.your_method`
10
+ #
11
+ def self.name
12
+ ""
13
+ end
14
+
15
+ def self.message
16
+ ""
17
+ end
18
+
19
+ def self.notify_slack(libs)
20
+ require 'slack-notifier'
21
+
22
+ options = DependencyManager.config
23
+
24
+ return if options[:skip_slack]
25
+ return if options[:slack_url].to_s.empty?
26
+
27
+ ######################
28
+ # see https://github.com/fastlane/fastlane/blob/master/fastlane/lib/fastlane/actions/slack.rb
29
+ ######################
30
+
31
+ if options[:slack_channel].to_s.length > 0
32
+ channel = options[:slack_channel]
33
+ channel = ('#' + options[:slack_channel]) unless ['#', '@'].include?(channel[0]) # send message to channel by default
34
+ end
35
+
36
+ attachements = generate_slack_attachments(libs)
37
+
38
+ notifier = Slack::Notifier.new(options[:slack_url], channel: channel, username: options[:slack_username])
39
+ text = "[#{name}] #{message}"
40
+
41
+ begin
42
+ results = notifier.ping(text, icon_url: options[:slack_icon_url], attachments: attachements)
43
+ rescue => exception
44
+ UI.error("Exception: #{exception}")
45
+ ensure
46
+ result = results.first if results
47
+ if !result.nil? && result.code.to_i == 200
48
+ UI.success('Successfully sent Slack notification')
49
+ else
50
+ UI.verbose(result) unless result.nil?
51
+ message = "Error pushing Slack message, maybe the integration has no permission to post on this channel? Try removing the channel parameter in your Fastfile, this is usually caused by a misspelled or changed group/channel name or an expired SLACK_URL"
52
+ UI.error(message)
53
+ end
54
+ end
55
+ end
56
+
57
+ # def self.generate_slack_attachments(libs)
58
+ # attachements = []
59
+ # libs.each do |lib|
60
+ # attachement = {title: lib[:name]}
61
+ # if lib[:repository]
62
+ # attachement[:title_link] = lib[:repository]
63
+ # end
64
+ #
65
+ # fields = []
66
+ #
67
+ # current = lib[:current]
68
+ # available = lib[:available]
69
+ #
70
+ # if current == available
71
+ # attachement[:color] = "warning"
72
+ # else
73
+ # available = "*#{available}*"
74
+ # attachement[:color] = "danger"
75
+ # end
76
+ # # field[:value] = "#{current} -> #{available} (#{lib[:latest]})"
77
+ # # attachement[:fields] = [field]
78
+ #
79
+ # fields << {title: "current", value: current, short: true}
80
+ # fields << {title: "available", value: "#{available} (Latest: #{lib[:latest]})", short: true}
81
+ # attachement[:fields] = fields
82
+ # attachements << attachement
83
+ # end
84
+ # attachements
85
+ # end
86
+
87
+ def self.generate_slack_attachments(libs)
88
+ attachements = []
89
+ libs.each do |lib|
90
+ attachement = {title: lib[:name]}
91
+ if lib[:repository]
92
+ attachement[:title_link] = lib[:repository]
93
+ end
94
+
95
+ current = lib[:current]
96
+ available = lib[:available]
97
+
98
+ if current == available
99
+ attachement[:color] = "warning"
100
+ else
101
+ available = "*#{available}*"
102
+ attachement[:color] = "danger"
103
+ end
104
+ attachement[:text] = "#{current} -> #{available} (Latest: #{lib[:latest]})"
105
+ attachements << attachement
106
+ end
107
+ attachements
108
+ end
109
+
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,29 @@
1
+ module Fastlane
2
+
3
+ module DependencyManager
4
+ class << self
5
+ attr_accessor :config
6
+ end
7
+ end
8
+
9
+ class Dependency
10
+ attr_reader :name
11
+ attr_reader :current
12
+ attr_reader :available
13
+ attr_reader :latest
14
+
15
+ def initialize(name, current, available, latest)
16
+ @name = name
17
+ @current = current
18
+ @available = available
19
+ @latest = latest
20
+ end
21
+
22
+ def to_hash
23
+ instance_variables.each_with_object({}) { |var, hash|
24
+ hash[var.to_s.delete("@").to_sym] = instance_variable_get(var)
25
+ }
26
+ end
27
+ end
28
+
29
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module DependencyManagerOutdated
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,180 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-dependency_manager_outdated
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - matsuda
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-03-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pry
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: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
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: rspec_junit_formatter
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: rake
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: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 0.49.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 0.49.1
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-require_tools
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
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: fastlane
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: 2.117.1
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 2.117.1
139
+ description:
140
+ email: kosukematsuda@gmail.com
141
+ executables: []
142
+ extensions: []
143
+ extra_rdoc_files: []
144
+ files:
145
+ - LICENSE
146
+ - README.md
147
+ - lib/fastlane/plugin/dependency_manager_outdated.rb
148
+ - lib/fastlane/plugin/dependency_manager_outdated/actions/carthage_outdated_action.rb
149
+ - lib/fastlane/plugin/dependency_manager_outdated/actions/cocoapods_outdated_action.rb
150
+ - lib/fastlane/plugin/dependency_manager_outdated/actions/dependency_manager_outdated_action.rb
151
+ - lib/fastlane/plugin/dependency_manager_outdated/helper/carthage_outdated_helper.rb
152
+ - lib/fastlane/plugin/dependency_manager_outdated/helper/cocoapods_outdated_helper.rb
153
+ - lib/fastlane/plugin/dependency_manager_outdated/helper/dependency_manager_outdated_helper.rb
154
+ - lib/fastlane/plugin/dependency_manager_outdated/helper/module.rb
155
+ - lib/fastlane/plugin/dependency_manager_outdated/version.rb
156
+ homepage: https://github.com/matsuda/fastlane-plugin-dependency_manager_outdated
157
+ licenses:
158
+ - MIT
159
+ metadata: {}
160
+ post_install_message:
161
+ rdoc_options: []
162
+ require_paths:
163
+ - lib
164
+ required_ruby_version: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ version: '0'
169
+ required_rubygems_version: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ requirements: []
175
+ rubyforge_project:
176
+ rubygems_version: 2.7.6
177
+ signing_key:
178
+ specification_version: 4
179
+ summary: Fastlane plugin to check project's outdated dependencies
180
+ test_files: []