Skip to content

Commit

Permalink
rake sync:all_files + use bundler in circle.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
AliSoftware committed Jul 24, 2017
1 parent 7056046 commit dc04147
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 16 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ source 'https://rubygems.org'

gem 'cocoapods', '1.2.1'
gem 'xcpretty'
gem 'rake'
gem 'octokit', '~> 4.7'
34 changes: 24 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.3.5)
activesupport (4.2.8)
activesupport (4.2.9)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
claide (1.0.1)
addressable (2.5.1)
public_suffix (~> 2.0, >= 2.0.2)
claide (1.0.2)
cocoapods (1.2.1)
activesupport (>= 4.0.2, < 5)
claide (>= 1.0.1, < 2.0)
Expand Down Expand Up @@ -43,34 +45,46 @@ GEM
cocoapods-try (1.1.0)
colored2 (3.1.2)
escape (0.0.4)
faraday (0.12.2)
multipart-post (>= 1.2, < 3)
fourflusher (2.0.1)
fuzzy_match (2.0.4)
gh_inspector (1.0.3)
i18n (0.8.1)
minitest (5.10.1)
i18n (0.8.6)
minitest (5.10.3)
molinillo (0.5.7)
multipart-post (2.0.0)
nanaimo (0.2.3)
nap (1.1.0)
netrc (0.7.8)
rouge (1.11.1)
octokit (4.7.0)
sawyer (~> 0.8.0, >= 0.5.3)
public_suffix (2.0.5)
rake (12.0.0)
rouge (2.0.7)
ruby-macho (1.1.0)
sawyer (0.8.1)
addressable (>= 2.3.5, < 2.6)
faraday (~> 0.8, < 1.0)
thread_safe (0.3.6)
tzinfo (1.2.3)
thread_safe (~> 0.1)
xcodeproj (1.4.4)
xcodeproj (1.5.1)
CFPropertyList (~> 2.3.3)
claide (>= 1.0.1, < 2.0)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.2.3)
xcpretty (0.2.6)
rouge (~> 1.8)
xcpretty (0.2.8)
rouge (~> 2.0.7)

PLATFORMS
ruby

DEPENDENCIES
cocoapods (= 1.2.1)
octokit (~> 4.7)
rake
xcpretty

BUNDLED WITH
1.13.7
1.15.3
12 changes: 6 additions & 6 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ machine:

dependencies:
post:
- rake lint:install
- bundle exec rake lint:install
- curl -sS https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash

test:
override:
- rake lint:code
- rake lint:tests
- rake xcode:test
- rake spm:test
- bundle exec rake lint:code
- bundle exec rake lint:tests
- bundle exec rake xcode:test
- bundle exec rake spm:test
post:
- rake pod:lint
- bundle exec rake pod:lint
13 changes: 13 additions & 0 deletions rakelib/changelog.rake
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Used constants:
# none

require 'octokit'

namespace :changelog do
desc 'Add the empty CHANGELOG entries after a new release'
task :reset do |task|
Expand Down Expand Up @@ -49,4 +51,15 @@ namespace :changelog do
puts "\u{274C} Some wrong links found:\n" + all_wrong_links.join("\n")
end
end

desc "Push the CHANGELOG's top section as a GitHub release"
task :push_github_release do
client = Utils.octokit_client
tag = Utils.top_changelog_version
body = Utils.top_changelog_entry

repo_url = `git remote -v | grep push`.split(' ')[1]
repo_name = File.basename(repo_url, '.git')
client.create_release("SwiftGen/#{repo_name}", tag, :body => body)
end
end
24 changes: 24 additions & 0 deletions rakelib/utils.rake
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
# none

require 'json'
require 'octokit'

class Utils
COLUMN_WIDTH = 30

## [ Run commands ] #########################################################

# formatter types
:xcpretty # pass through xcpretty and store in artifacts
:raw # store in artifacts
Expand All @@ -25,6 +28,8 @@ class Utils
end
end

## [ Convenience Helpers ] ##################################################

def self.podspec_version(file = '*')
JSON.parse(`bundle exec pod ipc spec #{file}.podspec`)["version"]
end
Expand All @@ -36,6 +41,24 @@ class Utils
/\((.*)\)$/.match(pod_vers)[1] # Just the 'x.y.z' part
end

def self.octokit_client
token = File.exist?('.apitoken') && File.read('.apitoken')
token ||= File.exist?('../.apitoken') && File.read('../.apitoken')
Utils.print_error('No .apitoken file found') unless token
Octokit::Client.new(:access_token => token)
end

def self.top_changelog_version(changelog_file = 'CHANGELOG.md')
`grep -m 1 '^## ' "#{changelog_file}" | sed 's/## //'`.strip
end

def self.top_changelog_entry(changelog_file = 'CHANGELOG.md')
tag = self.top_changelog_version
`sed -n /'^## #{tag}$'/,/'^## '/p "#{changelog_file}"`.gsub(/^## .*$/,'').strip
end

## [ Print info/errors ] ####################################################

# print an info header
def self.print_header(str)
puts "== #{str.chomp} ==".format(:yellow, :bold)
Expand Down Expand Up @@ -66,6 +89,7 @@ class Utils
result
end


## [ Private helper functions ] ##################################################

# run a command, pipe output through 'xcpretty' and store the output in CI artifacts
Expand Down

0 comments on commit dc04147

Please sign in to comment.