-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #230 from czechboy0/hd/sparkle_develop
Adding Sparkle autoupdater
- Loading branch information
Showing
8 changed files
with
326 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ def buildasaur_app_pods | |
rac | ||
pod 'Ji', '~> 1.2.0' | ||
pod 'CryptoSwift' | ||
pod 'Sparkle' | ||
end | ||
|
||
def test_pods | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
module Fastlane | ||
module Actions | ||
module SharedValues | ||
end | ||
|
||
class RenderGithubMarkdownAction < Action | ||
def self.run(params) | ||
|
||
contents = params[:markdown_contents] || File.read(params[:markdown_file]) | ||
raise "You must pass either the markdown contents or a file path" unless contents | ||
|
||
require 'json' | ||
body = { | ||
text: contents, | ||
mode: "gfm", | ||
context: params[:context_repository] | ||
}.to_json | ||
|
||
require 'base64' | ||
headers = { | ||
'User-Agent' => 'fastlane-render_github_markdown', | ||
'Authorization' => "Basic #{Base64.strict_encode64(params[:api_token])}" | ||
} | ||
|
||
response = Excon.post("https://api.github.com/markdown", headers: headers, body: body) | ||
|
||
raise response[:headers].to_s unless response[:status] == 200 | ||
html_markdown = response.body | ||
|
||
ENV['RENDER_GITHUB_MARKDOWN_HTML'] = html_markdown | ||
return html_markdown | ||
end | ||
|
||
##################################################### | ||
# @!group Documentation | ||
##################################################### | ||
|
||
def self.description | ||
"Uses the GitHub API to render your GitHub-flavored Markdown as HTML" | ||
end | ||
|
||
def self.available_options | ||
[ | ||
FastlaneCore::ConfigItem.new(key: :markdown_file, | ||
env_name: "FL_RENDER_GITHUB_MARKDOWN_FILE", | ||
description: "The path to your markdown file", | ||
optional: true, | ||
verify_block: proc do |value| | ||
raise "File doesn't exist '#{value}'".red unless File.exists?(value) | ||
end), | ||
FastlaneCore::ConfigItem.new(key: :markdown_contents, | ||
env_name: "FL_RENDER_GITHUB_MARKDOWN_CONTENTS", | ||
optional: true, | ||
description: "The markdown contents"), | ||
FastlaneCore::ConfigItem.new(key: :context_repository, | ||
env_name: "FL_RENDER_GITHUB_MARKDOWN_CONTEXT_REPOSITORY", | ||
description: "The path to your repo, e.g. 'fastlane/fastlane'", | ||
verify_block: proc do |value| | ||
raise "Please only pass the path, e.g. 'fastlane/fastlane'".red if value.include? "github.com" | ||
raise "Please only pass the path, e.g. 'fastlane/fastlane'".red if value.split('/').count != 2 | ||
end), | ||
FastlaneCore::ConfigItem.new(key: :api_token, | ||
env_name: "FL_RENDER_GITHUB_MARKDOWN_API_TOKEN", | ||
description: "Personal API Token for GitHub - generate one at https://github.com/settings/tokens", | ||
is_string: true, | ||
optional: false), | ||
] | ||
end | ||
|
||
def self.output | ||
[ | ||
['RENDER_GITHUB_MARKDOWN_HTML', 'Rendered HTML'] | ||
] | ||
end | ||
|
||
def self.return_value | ||
"Returns the GFM Markdown contents rendered as HTML" | ||
end | ||
|
||
def self.authors | ||
["czechboy0"] | ||
end | ||
|
||
def self.is_supported?(platform) | ||
true | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.