octorelease 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2032e3956e26d172eab02058e8b567d6057ee49c
4
- data.tar.gz: af8a0607869e419a2391677e1ba604609fb4c02f
3
+ metadata.gz: ab15d2259462fc52f6972fa6de434bf60e5d928d
4
+ data.tar.gz: 10cd3193c1aa1994989b7a866b0d4a2ac4bbc616
5
5
  SHA512:
6
- metadata.gz: 55ceb61c646be762d3aa8e20ed040af95bf5b463a10fe95426ee7f421ebfcdc7ceca1bd77e66d6cc39cf6c8414a65671d084402e8e82206a8fa35cb275ce8686
7
- data.tar.gz: aa728b659f2849b869b8cd15cc1709a0b77316fcaf3f65574437c6c8f4d374c374767e99d11e08a33233fff932690e08a58d1e84de2f4a9df57882e9136d9d6d
6
+ metadata.gz: 63c13cf18796598481f3c402bc35a7bea8808e3f9c4e0222204f22e7f5fac57d33489a715585bf4f997f964cc3686955278fb877da8dca3b0f321b85eeb0b08a
7
+ data.tar.gz: 3a6651404a2a2eb9c31616cf9ad82a1c98ef25da31fbf2494ee9bd3c1e7ac96aaea45d9f14095828707ae233106b5bc7c90ad923bf7291bd1cd3060235050778
data/Rakefile CHANGED
@@ -1 +1,2 @@
1
1
  require "bundler/gem_tasks"
2
+ require "octorelease"
@@ -1,5 +1,51 @@
1
1
  require "octorelease/version"
2
+ require "hub"
3
+ require "bundler/gem_helper"
4
+ require "octokit"
2
5
 
3
- module Octorelease
4
- # Your code goes here...
6
+ desc "Release gem and create a release on GitHub"
7
+ task "octorelease" => "release" do
8
+ config_file = ENV['HUB_CONFIG'] || '~/.config/hub'
9
+ file_store = Hub::GitHubAPI::FileStore.new File.expand_path(config_file)
10
+ file_config = Hub::GitHubAPI::Configuration.new file_store
11
+ github_api = Hub::GitHubAPI.new(
12
+ file_config,
13
+ :app_url => 'http://hub.github.com/'
14
+ )
15
+ user = github_api.config.username("github.com")
16
+ token = github_api.config.oauth_token("github.com", user)
17
+
18
+ Octokit.configure do |c|
19
+ c.login = user
20
+ c.access_token = token
21
+ end
22
+
23
+ current_version = "v#{Bundler::GemHelper.new.gemspec.version.to_s}"
24
+ previous_version = ""
25
+ `git tag`.split(/\n/).each do |tag|
26
+ break if tag == current_version
27
+ previous_version = tag
28
+ end
29
+
30
+ log = `git log #{previous_version}..#{current_version} --grep=Merge`
31
+
32
+ repo = `git remote -v | grep origin`.match(/([\w-]+\/[\w-]+)\.git/)[1]
33
+
34
+ description = []
35
+ log.split(/commit/).each do |lines|
36
+ lines.match(/Merge pull request \#(\d+)/) do |m|
37
+ url = "https://github.com/#{repo}/pull/#{m[1]}"
38
+ title = Octokit.pull_request(repo, m[1]).title
39
+ description << "* [#{title}](#{url})"
40
+ end
41
+ end
42
+
43
+ Octokit.create_release(
44
+ repo,
45
+ current_version,
46
+ {:body => description.join("\n")}
47
+ )
48
+
49
+ Bundler.ui.confirm "Release #{current_version} created."
50
+ Bundler.ui.confirm "https://github.com/#{repo}/releases/tag/#{current_version}"
5
51
  end
@@ -1,3 +1,3 @@
1
- module Octorelease
2
- VERSION = "0.0.1"
1
+ module OctoRelease
2
+ VERSION = "0.0.2"
3
3
  end
@@ -5,7 +5,7 @@ require 'octorelease/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "octorelease"
8
- spec.version = Octorelease::VERSION
8
+ spec.version = OctoRelease::VERSION
9
9
  spec.authors = ["Gosuke Miyashita"]
10
10
  spec.email = ["gosukenator@gmail.com"]
11
11
  spec.summary = %q{Octorelease.}
@@ -18,6 +18,9 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
+ spec.add_runtime_dependency "octokit"
22
+ spec.add_runtime_dependency "hub"
23
+
21
24
  spec.add_development_dependency "bundler", "~> 1.5"
22
25
  spec.add_development_dependency "rake"
23
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octorelease
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
@@ -10,6 +10,34 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2014-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: octokit
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: hub
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: bundler
15
43
  requirement: !ruby/object:Gem::Requirement