Class: Fastlane::Actions::CocoapodsOutdatedAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/dependency_manager_outdated/actions/cocoapods_outdated_action.rb

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



110
111
112
# File 'lib/fastlane/plugin/dependency_manager_outdated/actions/cocoapods_outdated_action.rb', line 110

def self.authors
  ["matsuda"]
end

.available_optionsObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/fastlane/plugin/dependency_manager_outdated/actions/cocoapods_outdated_action.rb', line 45

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :project_directory,
                                 env_name: "DEPENDENCY_MANAGER_PROJECT_DIRECTORY",
                                 description: "The path to the root of the project directory",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :use_bundle_exec,
                                 env_name: "DEPENDENCY_MANAGER_COCOAPODS_USE_BUNDLE_EXEC",
                                 description: "Use bundle exec when there is a Gemfile presented",
                                 is_string: false,
                                 default_value: true),
    FastlaneCore::ConfigItem.new(key: :no_repo_update,
                                 env_name: "COCOAPODS_OUTDATED_REPO_UPDATE",
                                 description: "Skip running `pod repo update` before install",
                                 is_string: false,
                                 type: Boolean,
                                 optional: true),

    # slack
    FastlaneCore::ConfigItem.new(key: :slack_url,
                                 short_option: "-i",
                                 env_name: "DEPENDENCY_MANAGER_SLACK_URL",
                                 sensitive: true,
                                 description: "Create an Incoming WebHook for your Slack group to post results there",
                                 optional: true,
                                 verify_block: proc do |value|
                                   if !value.to_s.empty? && !value.start_with?("https://")
                                     UI.user_error!("Invalid URL, must start with https://")
                                   end
                                 end),
    FastlaneCore::ConfigItem.new(key: :slack_channel,
                                 short_option: "-e",
                                 env_name: "DEPENDENCY_MANAGER_SLACK_CHANNEL",
                                 description: "#channel or @username",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :slack_username,
                                 env_name: "DEPENDENCY_MANAGER_SLACK_USERNAME",
                                 description: "Overrides the webhook's username property if slack_use_webhook_configured_username_and_icon is false",
                                 default_value: "fastlane",
                                 is_string: true,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :slack_icon_url,
                                 env_name: "DEPENDENCY_MANAGER_SLACK_ICON_URL",
                                 description: "Overrides the webhook's image property if slack_use_webhook_configured_username_and_icon is false",
                                 default_value: "https://s3-eu-west-1.amazonaws.com/fastlane.tools/fastlane.png",
                                 is_string: true,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :skip_slack,
                                 env_name: "DEPENDENCY_MANAGER_SKIP_SLACK",
                                 description: "Don't publish to slack, even when an URL is given",
                                 is_string: false,
                                 default_value: false),
  ]
end

.descriptionObject



37
38
39
# File 'lib/fastlane/plugin/dependency_manager_outdated/actions/cocoapods_outdated_action.rb', line 37

def self.description
  "Check outdated CocoaPods dependencies"
end

.detailsObject



41
42
43
# File 'lib/fastlane/plugin/dependency_manager_outdated/actions/cocoapods_outdated_action.rb', line 41

def self.details
  "Check outdated CocoaPods dependencies"
end

.example_codeObject



118
119
120
121
122
123
124
125
126
127
# File 'lib/fastlane/plugin/dependency_manager_outdated/actions/cocoapods_outdated_action.rb', line 118

def self.example_code
  [
    'cocoapods_outdated',
    'cocoapods_outdated(
      project_directory: "path/to/xcode/project",
      no_repo_update: true,
      slack_url: "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX",
    )',
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


114
115
116
# File 'lib/fastlane/plugin/dependency_manager_outdated/actions/cocoapods_outdated_action.rb', line 114

def self.is_supported?(platform)
  platform == :ios
end

.outputObject



100
101
102
103
104
# File 'lib/fastlane/plugin/dependency_manager_outdated/actions/cocoapods_outdated_action.rb', line 100

def self.output
  [
    ['COCOAPODS_OUTDATED_LIST', 'List of the outdated pods in the current Podfile.lock'],
  ]
end

.return_valueObject



106
107
108
# File 'lib/fastlane/plugin/dependency_manager_outdated/actions/cocoapods_outdated_action.rb', line 106

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fastlane/plugin/dependency_manager_outdated/actions/cocoapods_outdated_action.rb', line 11

def self.run(params)
  UI.message("The cocoapods_outdated action is working!")

  DependencyManager.config = params

  cmd = []
  cmd << ['bundle exec'] if params[:use_bundle_exec] && shell_out_should_use_bundle_exec?
  cmd << ['pod outdated']
  cmd << "--project-directory=#{params[:project_directory]}" if params[:project_directory]
  cmd << "--no-repo-update" if params[:no_repo_update]
  result = Actions.sh(cmd.join(' '))

  dependencies = Helper::CocoapodsOutdatedHelper.parse(result)

  if dependencies.empty?
    UI.success("No pod updates are available.")
  else
    Actions.lane_context[SharedValues::COCOAPODS_OUTDATED_LIST] = dependencies
    Helper::CocoapodsOutdatedHelper.notify_slack(dependencies)
  end
end