radius-toolbelt 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 739cc1fd7237fb68e676015051b31dff609200b1
4
- data.tar.gz: b88f3a9ebeb1d7f06abaa9ebeb42dee46f9b7e06
3
+ metadata.gz: c692c22671f2daba30256e32933bf1ece3571bce
4
+ data.tar.gz: ad64f7506054da040eba5590d84359ad54e63592
5
5
  SHA512:
6
- metadata.gz: 5d0129648e17104255135603c49f92674e57ece30e7d1f78abe052695b459a9eb6bb020aaafd8da36a04a695ddf6c412fee0b44e8b94025f399e6ba38897d77a
7
- data.tar.gz: 237aef86d40e09684eb6c9d846388a76220e43efb2f2c21610e4817378da52b6c8a99f2d03e3613a476285db095fb7a5603bb707db5bb43579e5e61138c4b609
6
+ metadata.gz: 726761243b91de736cf5fc668f43037e2cb87cd15b47dc44f84a1413726370f03783a3f777c07a0b1c3f3d7077f5e9256a69f02297da32613c677598954220fa
7
+ data.tar.gz: 046da303794d6ef8d24320e10c1f7cb8d645dcb4218e4fc236b9629f6c2a3df3633d781d12c81f4fc523d3ae59115e6fe3a655588c20c19b041ce58b3f3a6810
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.1.3
1
+ 2.4.2
@@ -5,7 +5,6 @@ require 'launchy'
5
5
 
6
6
  module Radius
7
7
  module Toolbelt
8
-
9
8
  class ReleaseGithub
10
9
 
11
10
  attr_reader :repo, :tag_name, :release_name, :body, :filenames, :token
@@ -19,8 +18,6 @@ module Radius
19
18
  end
20
19
 
21
20
  def run
22
- # pull token from ENV or hub config
23
-
24
21
  puts "\nCreating draft release \"#{release_name}\" for repo \"#{repo}\"..."
25
22
  # create the release
26
23
  client = Octokit::Client.new(access_token: token)
@@ -39,11 +36,11 @@ module Radius
39
36
  end
40
37
 
41
38
  puts "\nRelease URL: #{release.html_url}"
42
- Launchy.open( release.html_url.gsub("/tag/", "/edit/") )
39
+ edit_url = release.html_url.gsub("/tag/", "/edit/")
40
+ if block_given?
41
+ yield({edit_url: edit_url})
42
+ end
43
43
  end
44
-
45
44
  end
46
-
47
-
48
45
  end
49
46
  end
@@ -3,10 +3,27 @@ require 'fileutils'
3
3
  module Radius
4
4
  module Toolbelt
5
5
  module ReleaseHelpers
6
+ def validate_clean_git!
7
+ fail "There are uncommitted changes in git" unless system("git diff-files --quiet")
8
+ end
9
+
10
+ def validate_version_for_repo!(repo)
11
+ ver = `cd #{repo} && agvtool what-version -terse`.chomp
12
+ puts "Validating matching version for #{repo}: #{ver}"
13
+ fail "Versions do not match (version file: #{ver} #{repo} version: #{sanitized_version}" unless (ver == sanitized_version)
14
+ end
15
+
16
+ def current_version
17
+ @current_version ||= File.read("VERSION").chomp
18
+ end
19
+
20
+ def sanitized_version
21
+ @sanitized_version ||= /([0-9\.]+)/.match(current_version)[0]
22
+ end
6
23
 
7
24
  def tag_version(ver)
8
- unless system("git tag v#{agvtool_version}")
9
- fail "Error: the tag v#{agvtool_version} already exists on this repo."
25
+ unless system("git tag v#{ver}")
26
+ fail "Error: the tag v#{ver} already exists on this repo."
10
27
  end
11
28
  end
12
29
 
@@ -15,7 +32,7 @@ module Radius
15
32
  end
16
33
 
17
34
  def github_token
18
- @token ||= ENV["github_token"] || YAML.load(`cat ~/.config/hub`)["github.com"].first["oauth_token"]
35
+ @token ||= ENV["GITHUB_TOKEN"] || YAML.load(`cat ~/.config/hub`)["github.com"].first["oauth_token"]
19
36
  end
20
37
 
21
38
  def clean(dir)
@@ -23,7 +40,18 @@ module Radius
23
40
  rm_rf Dir.glob("#{dir}/*.zip")
24
41
  end
25
42
 
26
- def release_github(repo, release_name, version, files)
43
+ # Clone down the `repo`, copy all the `file` over then commit, tag and push
44
+ # it up to the origin.
45
+ #
46
+ # `files` is an array of files to copy into the root of the local repo.
47
+ def release_repo(repo, version, dir, files)
48
+ dir = File.join "build", File.basename(repo)
49
+ r = ReleaseRepo.new repo, version, dir, files
50
+ r.run
51
+ end
52
+
53
+
54
+ def release_github(repo, release_name, version, files, &block)
27
55
  tag_name = "v#{version}"
28
56
  body = <<EOF
29
57
  Bug Fixes:
@@ -41,16 +69,7 @@ EOF
41
69
  token = github_token
42
70
 
43
71
  r = ReleaseGithub.new repo, token, tag_name, release_name, body, files
44
- r.run
45
- end
46
-
47
- # Clone down the `repo`, copy all the `file` over then commit, tag and push
48
- # it up to the origin.
49
- #
50
- # `files` is an array of files to copy into the root of the local repo.
51
- def release_repo(repo, version, files, dir = "build/release-repo")
52
- r = ReleaseRepo.new repo, version, dir, files
53
- r.run
72
+ r.run(&block)
54
73
  end
55
74
 
56
75
  end
@@ -45,8 +45,8 @@ module Radius
45
45
  FileUtils.chdir dir do
46
46
  sh "git add ."
47
47
  sh "git commit -m 'Version #{ver}'"
48
- sh "git tag v#{ver}"
49
- sh "git push origin master --tags"
48
+ sh "git tag --force v#{ver}"
49
+ sh "git push --force origin v#{ver}"
50
50
  end
51
51
  end
52
52
  end
@@ -0,0 +1,28 @@
1
+
2
+ module Radius
3
+ module Toolbelt
4
+ module SlackHelpers
5
+ def slack(message, channel = nil)
6
+ uri = URI(ENV['SLACK_WEBHOOK_URL'])
7
+
8
+ parms = {
9
+ text: message,
10
+ username: "Travis CI",
11
+ icon_emoji: ":travis:"
12
+ }
13
+
14
+ parms[:channel] = channel if channel
15
+
16
+ http = Net::HTTP.new(uri.host, uri.port)
17
+ http.use_ssl = true
18
+
19
+ request = Net::HTTP::Post.new(uri.request_uri)
20
+ request.body = parms.to_json
21
+
22
+ http.request(request)
23
+ end
24
+ module_function :slack
25
+
26
+ end
27
+ end
28
+ end
@@ -1,6 +1,7 @@
1
1
  # Main hook for loading various Rake tasks
2
2
  require 'rake'
3
3
  require_relative 'release_helpers'
4
+ require_relative 'slack_helpers'
4
5
  require_relative 'xcode_helpers'
5
6
  require_relative 'release_repo'
6
7
  require_relative 'release_github'
@@ -27,17 +28,3 @@ namespace :git do
27
28
  end
28
29
  end
29
30
 
30
- namespace :version do
31
- desc "Bump the version to the next patch number"
32
- task :bump do
33
- sh "agvtool next-version -increment-minor-version"
34
- end
35
-
36
- desc "Set the version to a specific version number"
37
- task :set, [:version] do |t, args|
38
- v = args[:version]
39
- fail "Error: no version specified" unless v
40
-
41
- sh "xcrun agvtool new-version #{v}"
42
- end
43
- end
@@ -1,5 +1,5 @@
1
1
  module Radius
2
2
  module Toolbelt
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
  end
5
5
  end
@@ -7,21 +7,54 @@ module Radius
7
7
  def self.included klass
8
8
  klass.class_eval do
9
9
  include ReleaseHelpers
10
+ include SlackHelpers
10
11
  end
11
12
  end
12
13
 
13
14
  def compress(src, dest)
14
- system "ditto -ck --rsrc --sequesterRsrc --keepParent #{src} #{dest}"
15
+ sh "ditto -ck --rsrc --sequesterRsrc --keepParent #{src} #{dest}"
15
16
  end
16
17
 
17
- def xcode(action, params)
18
- system "xcodebuild #{params.map {|k,v| "-#{k} #{v}"}.join ' '} #{action}"
18
+ def xcodebuild(args, pretty=true)
19
+ output_dir = File.expand_path("./build")
20
+ cmd = "xcodebuild #{args} UNIVERSAL_OUTPUT_DIR=#{output_dir} CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY='' #{ "| ./bin/xcpretty" if pretty }"
21
+ puts cmd
22
+ sh cmd
19
23
  end
20
24
 
21
- def agvtool_version
22
- @agvtool_version ||= `xcrun agvtool what-version -terse`.chomp
25
+ def schemes
26
+ schemes = `xcodebuild -workspace Monsters.xcworkspace -list`
27
+ schemes.each_line.map { |l| l.strip if l[/^ /]}.compact
23
28
  end
24
29
 
30
+ def agvtool(repo = ".")
31
+ `cd #{repo} && xcrun agvtool what-version -terse`.strip
32
+ end
33
+
34
+
35
+ def appledoc(name, framework, repo)
36
+ sh <<-EOF
37
+ ./bin/appledoc \
38
+ --output "build/#{framework}Docs" \
39
+ --create-html \
40
+ --no-create-docset \
41
+ --project-name "#{name}" \
42
+ --project-company "Radius Networks" \
43
+ --project-version #{agvtool repo} \
44
+ --company-id "com.radiusnetworks.#{framework}" \
45
+ --exit-threshold 2 \
46
+ "./build/#{framework}.framework/Headers"
47
+ EOF
48
+ end
49
+
50
+ #def xcode(action, params)
51
+ # system "xcodebuild #{params.map {|k,v| "-#{k} #{v}"}.join ' '} #{action}"
52
+ #end
53
+
54
+ #def agvtool_version
55
+ # @agvtool_version ||= `xcrun agvtool what-version -terse`.chomp
56
+ #end
57
+
25
58
  end
26
59
  end
27
60
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radius-toolbelt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Radius Networks
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-05-26 00:00:00.000000000 Z
13
+ date: 2017-12-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -117,6 +117,7 @@ files:
117
117
  - lib/radius/toolbelt/release_github.rb
118
118
  - lib/radius/toolbelt/release_helpers.rb
119
119
  - lib/radius/toolbelt/release_repo.rb
120
+ - lib/radius/toolbelt/slack_helpers.rb
120
121
  - lib/radius/toolbelt/tasks.rb
121
122
  - lib/radius/toolbelt/version.rb
122
123
  - lib/radius/toolbelt/xcode_helpers.rb
@@ -145,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
146
  version: '0'
146
147
  requirements: []
147
148
  rubyforge_project:
148
- rubygems_version: 2.5.1
149
+ rubygems_version: 2.6.13
149
150
  signing_key:
150
151
  specification_version: 4
151
152
  summary: Radius Networks Tools and Utilities
@@ -154,4 +155,3 @@ test_files:
154
155
  - spec/spec_helper.rb
155
156
  - spec/support/string.rb
156
157
  - spec/support/subcommand.rb
157
- has_rdoc: