Class: Fastlane::Actions::AnsiQrCodeAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::AnsiQrCodeAction
- Defined in:
- lib/fastlane/plugin/jira_update/actions/ansi_qr_code_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .return_type ⇒ Object
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
69 70 71 |
# File 'lib/fastlane/plugin/jira_update/actions/ansi_qr_code_action.rb', line 69 def self. ["Flop Butylkin"] end |
.available_options ⇒ Object
59 60 61 62 63 64 65 66 67 |
# File 'lib/fastlane/plugin/jira_update/actions/ansi_qr_code_action.rb', line 59 def self. [ FastlaneCore::ConfigItem.new(key: :text, description: "Text for QR code", env_name: "FL_QR_TEXT", type: String, default_value: "Hello, world!") ] end |
.category ⇒ Object
87 88 89 |
# File 'lib/fastlane/plugin/jira_update/actions/ansi_qr_code_action.rb', line 87 def self.category :misc end |
.description ⇒ Object
43 44 45 |
# File 'lib/fastlane/plugin/jira_update/actions/ansi_qr_code_action.rb', line 43 def self.description "Generate QR code" end |
.details ⇒ Object
47 48 49 |
# File 'lib/fastlane/plugin/jira_update/actions/ansi_qr_code_action.rb', line 47 def self.details "Generate QR code" end |
.example_code ⇒ Object
77 78 79 80 81 82 83 84 85 |
# File 'lib/fastlane/plugin/jira_update/actions/ansi_qr_code_action.rb', line 77 def self.example_code [ ' ansi_qr_code( text: "https://www.google.com" ) ' ] end |
.is_supported?(platform) ⇒ Boolean
73 74 75 |
# File 'lib/fastlane/plugin/jira_update/actions/ansi_qr_code_action.rb', line 73 def self.is_supported?(platform) true end |
.output ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/fastlane/plugin/jira_update/actions/ansi_qr_code_action.rb', line 35 def self.output [ ['QR_CODE_ORIGINAL_TEXT', 'Original text for QR code'], ['QR_CODE_ASCII_ART', 'QR code ascii art'], ['QR_CODE_IMAGE_LINK', 'URL to QR code image'] ] end |
.return_type ⇒ Object
55 56 57 |
# File 'lib/fastlane/plugin/jira_update/actions/ansi_qr_code_action.rb', line 55 def self.return_type :string end |
.return_value ⇒ Object
51 52 53 |
# File 'lib/fastlane/plugin/jira_update/actions/ansi_qr_code_action.rb', line 51 def self.return_value "QR code link" 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 32 33 |
# File 'lib/fastlane/plugin/jira_update/actions/ansi_qr_code_action.rb', line 11 def self.run(params) Actions.verify_gem!('rqrcode') require 'rqrcode' text = params[:text] qrcode = RQRCode::QRCode.new(text) ascii_art = qrcode.as_ansi( light: "\033[47m", dark: "\033[40m", fill_character: " ", quiet_zone_size: 4 ) UI.("QR code:\n#{ascii_art}") urlencoded_text = URI.encode_www_form_component(text) link = "https://kissapi-qrcode.vercel.app/api/qrcode?chl=#{urlencoded_text}" UI.("QR code link: #{link}") Actions.lane_context[SharedValues::QR_CODE_ORIGINAL_TEXT] = text Actions.lane_context[SharedValues::QR_CODE_ASCII_ART] = ascii_art Actions.lane_context[SharedValues::QR_CODE_IMAGE_LINK] = link return link end |