From 2a85a2f47fd8911da058bafedc643411a648b84d Mon Sep 17 00:00:00 2001 From: Masayuki Ono Date: Thu, 25 May 2017 22:08:03 +0900 Subject: [PATCH 1/3] Add Formula template --- formula.rb.tmpl | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 formula.rb.tmpl diff --git a/formula.rb.tmpl b/formula.rb.tmpl new file mode 100644 index 00000000..aae302e8 --- /dev/null +++ b/formula.rb.tmpl @@ -0,0 +1,12 @@ +class LicensePlist < Formula + desc "A license list generator of all your dependencies for iOS applications" + homepage "" + url "https://github.com/mono0926/LicensePlist/archive/{{TAG}}.tar.gz" + sha256 "{{SHA256}}" + + def install + system "make", "install", "PREFIX=#{prefix}" + end + + depends_on :xcode => ["8.3", :build] +end From 723f1dce764e581e69e33159d4d772d18be17bbf Mon Sep 17 00:00:00 2001 From: Masayuki Ono Date: Thu, 25 May 2017 22:08:09 +0900 Subject: [PATCH 2/3] Add release script --- release.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 release.sh diff --git a/release.sh b/release.sh new file mode 100755 index 00000000..520be7b1 --- /dev/null +++ b/release.sh @@ -0,0 +1,58 @@ +if [ $# -eq 1 ]; then + echo "A tag and token argument is needed!(ex: ./release.sh 1.2.3 xxxxxxx)" + exit 1 +fi +lib_name="license-plist" +tag=$1 +token=$2 +export GITHUB_TOKEN=$token +echo "Tag: '${tag}'" +echo "Token: '${token}'" +filename="${tag}.tar.gz" +echo "Filename: '${filename}'" + +# tag +git tag $tag +git push origin $tag + +curl -LOk "https://github.com/mono0926/LicensePlist/archive/${filename}" +sha256=$(shasum -a 256 $filename | cut -d ' ' -f 1) +rm $filename + +formula_path="$lib_name.rb" +formula_url="https://api.github.com/repos/mono0926/homebrew-$lib_name/contents/$formula_path" +sha=`curl GET $formula_url \ + | jq -r '.sha'` +echo "sha: \n$sha" +content_encoded=`cat formula.rb.tmpl | sed -e "s/{{TAG}}/$tag/" | sed -e "s/{{SHA256}}/$sha256/" | openssl enc -e -base64 | tr -d '\n '` +echo "content_encoded: \n$content_encoded" + +commit_message="Update version to $tag" + +curl -i -X PUT $formula_url \ + -H "Content-Type:application/json" \ + -H "Authorization:token $token" \ + -d \ +"{ + \"path\":\"$formula_path\", + \"sha\":\"$sha\", + \"content\":\"$content_encoded\", + \"message\":\"$commit_message\" +}" + +brew upgrade $lib_name +zip $lib_name.zip /usr/local/bin/$lib_name + +github-release release \ + --user mono0926 \ + --repo LicensePlist \ + --tag $tag + +github-release upload \ + --user mono0926 \ + --repo LicensePlist \ + --tag $tag \ + --name "$lib_name.zip" \ + --file $lib_name.zip + +rm $lib_name.zip From be8e039e6543c3ad4a7d7acf5f0863f29dd935e1 Mon Sep 17 00:00:00 2001 From: Masayuki Ono Date: Thu, 25 May 2017 22:08:16 +0900 Subject: [PATCH 3/3] Update version --- Sources/LicensePlistCore/Consts.swift | 2 +- Tests/LicensePlistTests/Entity/PlistInfoTests.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/LicensePlistCore/Consts.swift b/Sources/LicensePlistCore/Consts.swift index 75ab5507..91c4bf4c 100644 --- a/Sources/LicensePlistCore/Consts.swift +++ b/Sources/LicensePlistCore/Consts.swift @@ -6,6 +6,6 @@ public struct Consts { public static let prefix = "com.mono0926.LicensePlist" public static let outputPath = "\(prefix).Output" public static let configPath = "license_plist.yml" - public static let version = "1.4.3" + public static let version = "1.4.5" public static let encoding = String.Encoding.utf8 } diff --git a/Tests/LicensePlistTests/Entity/PlistInfoTests.swift b/Tests/LicensePlistTests/Entity/PlistInfoTests.swift index 0f60e8e0..7699cd94 100644 --- a/Tests/LicensePlistTests/Entity/PlistInfoTests.swift +++ b/Tests/LicensePlistTests/Entity/PlistInfoTests.swift @@ -76,7 +76,7 @@ class PlistInfoTests: XCTestCase { target.compareWithLatestSummary() XCTAssertEqual(target.summary, - "add-version-numbers: false\n\nLicensePlist Version: 1.4.1") + "add-version-numbers: false\n\nLicensePlist Version: 1.4.5") XCTAssertNotNil(target.summaryPath) }