extract_current_change_log.rb 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. module Fastlane
  2. module Actions
  3. class ExtractCurrentChangeLogAction < Action
  4. require 'yaml'
  5. def self.run(params)
  6. yaml = File.read(params[:file])
  7. data = YAML.load(yaml)
  8. version = data["version"]
  9. raise "The version should match in the input file".red unless (version and version == params[:version])
  10. title = "#{version}"
  11. title = title + " - #{data["name"]}" if (data["name"] and not data["name"].empty?)
  12. return {:title => title, :version => version, :add => data["add"], :fix => data["fix"], :remove => data["remove"]}
  13. end
  14. #####################################################
  15. # @!group Documentation
  16. #####################################################
  17. def self.description
  18. "Extract change log information for a specified version."
  19. end
  20. def self.details
  21. "This action will check input version and change log. If everything goes well, the change log info will be returned."
  22. end
  23. def self.available_options
  24. [
  25. FastlaneCore::ConfigItem.new(key: :version,
  26. env_name: "KF_EXTRACT_CURRENT_CHANGE_LOG_VERSION",
  27. description: "The target version which is needed to be extract",
  28. verify_block: proc do |value|
  29. raise "No version number is given, pass using `version: 'version_number'`".red unless (value and not value.empty?)
  30. end),
  31. FastlaneCore::ConfigItem.new(key: :file,
  32. env_name: "KF_EXTRACT_CURRENT_CHANGE_LOG_PRECHANGE_FILE",
  33. description: "Create a development certificate instead of a distribution one",
  34. default_value: "pre-change.yml")
  35. ]
  36. end
  37. def self.return_value
  38. "An object contains change log infomation. {version: }"
  39. end
  40. def self.is_supported?(platform)
  41. true
  42. end
  43. def self.authors
  44. ["onevcat"]
  45. end
  46. end
  47. end
  48. end