Class: Fastlane::Actions::GetBinarySizeAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::GetBinarySizeAction
- Defined in:
- lib/fastlane/plugin/polidea/actions/get_binary_size.rb
Class Method Summary collapse
- .author ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .run(config) ⇒ Object
Class Method Details
.author ⇒ Object
44 45 46 |
# File 'lib/fastlane/plugin/polidea/actions/get_binary_size.rb', line 44 def self. "Piotrek Dubiel" end |
.available_options ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/fastlane/plugin/polidea/actions/get_binary_size.rb', line 28 def self. [ FastlaneCore::ConfigItem.new(key: :binary, env_name: "", description: ".ipa or .apk file from the build ", optional: true, default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH] || Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]) ] end |
.description ⇒ Object
24 25 26 |
# File 'lib/fastlane/plugin/polidea/actions/get_binary_size.rb', line 24 def self.description "Measures binary size in bytes, use `extract_app_info` instead" end |
.is_supported?(platform) ⇒ Boolean
48 49 50 |
# File 'lib/fastlane/plugin/polidea/actions/get_binary_size.rb', line 48 def self.is_supported?(platform) [:ios, :android].include? platform end |
.output ⇒ Object
38 39 40 41 42 |
# File 'lib/fastlane/plugin/polidea/actions/get_binary_size.rb', line 38 def self.output [ ['BINARY_SIZE', 'Size of .ipa/.apk in bytes'] ] end |
.run(config) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fastlane/plugin/polidea/actions/get_binary_size.rb', line 8 def self.run(config) binary_file = config[:binary] UI.user_error!("No IPA or APK file path given, pass using `binary: 'ipa or apk path'`") unless binary_file.to_s.length > 0 binary_size = File.open(binary_file).size binary_size_in_mb = (binary_size / 1024.0 / 1024.0).round(2) Actions.lane_context[SharedValues::BINARY_SIZE] = binary_size ENV[SharedValues::BINARY_SIZE.to_s] = binary_size.to_s UI.success("Size of #{binary_file} is #{binary_size_in_mb} MB (#{binary_size} bytes)") binary_size end |