class Fastlane::Actions::PubspecDoctorAction
Public Class Methods
available_options()
click to toggle source
# File lib/fastlane/plugin/sunny_project/actions/pubspec_doctor_action.rb, line 113 def self.available_options opts = [ ] Fastlane::SunnyProject::Options.available_options.each do |option| opts.push(option) end opts end
description()
click to toggle source
# File lib/fastlane/plugin/sunny_project/actions/pubspec_doctor_action.rb, line 96 def self.description "Modify pubspec for local or git development" end
details()
click to toggle source
# File lib/fastlane/plugin/sunny_project/actions/pubspec_doctor_action.rb, line 108 def self.details # Optional: "" end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/sunny_project/actions/pubspec_doctor_action.rb, line 124 def self.is_supported?(platform) # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example) # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform # # [:ios, :mac, :android].include?(platform) true end
return_value()
click to toggle source
# File lib/fastlane/plugin/sunny_project/actions/pubspec_doctor_action.rb, line 104 def self.return_value # If your method provides a return value, you can describe here what it does end
run(params)
click to toggle source
# File lib/fastlane/plugin/sunny_project/actions/pubspec_doctor_action.rb, line 29 def self.run(params) unless params params = FastlaneCore::Configuration.create(self.available_options, {}) end params.load_configuration_file("Sunnyfile") params.load_configuration_file(".Sunnyfile") plugins = params[:sunny_plugins] plugin_folder = params[:sunny_plugin_folder] pubspec = YAML.load_file("pubspec.yaml") local_mode = params[:sunny_local_mode] is_local = "local".eql?(local_mode) puts("Local #{local_mode} creates #{is_local}") dependency_overrides = pubspec["dependency_overrides"] plugins.keys.each do |key| info = plugins[key] ? plugins[key] : "#{key}" folder = key branch = nil path = nil repo = key if info.is_a? String repo = info else path = info[:path] branch = info[:branch] if info[:branch] repo = info[:repo] if info[:repo] folder = repo end if is_local dependency_overrides[key.to_s] = { 'path' => "#{plugin_folder}/#{folder}#{path ? "/#{path}" : ''}" } else settings = { 'git' => { 'url' => "git@github.com:SunnyApp/#{repo}.git", } } if branch settings['git']['ref'] = branch end if path settings['git']['path'] = "#{path}" end dependency_overrides[key.to_s] = settings end end pubspec["dependencies"] = resort_keys pubspec["dependencies"] pubspec["dev_dependencies"] = resort_keys pubspec["dev_dependencies"] pubspec["dependency_overrides"] = resort_keys pubspec["dependency_overrides"] pyaml = Psych::Visitors::YAMLTree.create pyaml << pubspec n = StringIO.new emitter = CustomVisitor.new(n) emitter.accept(pyaml.tree) final_pubspec = n.string.gsub("---", "") File.write('pubspec.yaml', final_pubspec) print(final_pubspec) end