octy 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7e1d4977cc37e98c4d0d7d03d77a9bb157c38496
4
+ data.tar.gz: a3eda9dfdc24afc9d8345aeaa2a1868d67a56d17
5
+ SHA512:
6
+ metadata.gz: 970bdb8fc791ac3a320daceb61781948f85fd6cb1a39690a31adf0d67b371525d0816a2617fc7b3b125d16e1ba9f39c09f4226ec71c6b742e4c74f7ff9510493
7
+ data.tar.gz: bdcf1529c52809cbf3e284bfee169d5b4e73f4722c5bfd2438797890928900600097c514e424025fa56fa3df6280474a2f0ebdef8319fb3d3dd095da678a3e54
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .idea/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.2
4
+ before_install: gem install bundler -v 1.10.4
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in octy.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 kakakakakku
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,39 @@
1
+ # Octy
2
+
3
+ Generate GitHub repository changelog.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'octy'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install octy
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Development
26
+
27
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec octy` to use the gem in this directory, ignoring other installed copies of this gem.
28
+
29
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
30
+
31
+ ## Contributing
32
+
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Kakakakakku/octy.
34
+
35
+
36
+ ## License
37
+
38
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
39
+
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "octy"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "octy"
4
+
5
+ Octy::CLI.start
@@ -0,0 +1,5 @@
1
+ require 'octy/version'
2
+
3
+ module Octy
4
+ autoload :CLI, 'octy/cli'
5
+ end
@@ -0,0 +1,25 @@
1
+ require 'thor'
2
+ require 'octokit'
3
+ require 'octy/core'
4
+
5
+ module Octy
6
+
7
+ class CLI < Thor
8
+
9
+ desc 'gen', 'Generate sample host name by mnemonic wordlist.'
10
+ method_options repo: :string
11
+ method_options from: :string
12
+ method_options to: :string
13
+
14
+ def changelog
15
+ begin
16
+ octy = Octy::Core.new
17
+ octy.changelog(options[:repo], options[:from], options[:to])
18
+ rescue => e
19
+ puts e.message
20
+ end
21
+ end
22
+
23
+ end
24
+
25
+ end
@@ -0,0 +1,42 @@
1
+ require 'octokit'
2
+ require 'octy/printer'
3
+
4
+ module Octy
5
+
6
+ class Core
7
+
8
+ def initialize
9
+ options = {
10
+ access_token: ENV['GITHUB_ACCESS_TOKEN']
11
+ }
12
+ @client = Octokit::Client.new(options)
13
+ end
14
+
15
+ def changelog(repo, from, to)
16
+ comparison = @client.compare(repo, from, to)
17
+ commits = comparison.commits
18
+ commits.map do |commit|
19
+ message = commit.commit.message
20
+ if is_merge_pr?(message)
21
+ pr_id = get_pr_id(message)
22
+ pr = @client.pull_request(repo, pr_id)
23
+ Printer.output(pr) if !pr.nil?
24
+ end
25
+ end
26
+ end
27
+
28
+ private
29
+
30
+ def is_merge_pr?(message)
31
+ message.index('Merge pull request')
32
+ end
33
+
34
+ def get_pr_id(message)
35
+ pr_id = message.split[3]
36
+ pr_id.slice!(0)
37
+ pr_id
38
+ end
39
+
40
+ end
41
+
42
+ end
@@ -0,0 +1,11 @@
1
+ module Octy
2
+
3
+ class Printer
4
+
5
+ def self.output(pr)
6
+ print sprintf("* [#%s](%s) %s [コミッター:%s]\n", pr[:number], pr[:_links][:html][:href], pr[:title], pr[:user][:login])
7
+ end
8
+
9
+ end
10
+
11
+ end
@@ -0,0 +1,3 @@
1
+ module Octy
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'octy/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "octy"
8
+ spec.version = Octy::VERSION
9
+ spec.authors = ["kakakakakku"]
10
+ spec.email = ["y.yoshida22@gmail.com"]
11
+
12
+ spec.summary = %q{octy: Generate GitHub repository changelog.}
13
+ spec.description = %q{octy: Generate GitHub repository changelog.}
14
+ spec.homepage = "https://github.com/Kakakakakku/octy"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.10"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec"
25
+
26
+ spec.add_dependency 'thor'
27
+ spec.add_dependency 'octokit'
28
+ end
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: octy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - kakakakakku
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-07-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: thor
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: octokit
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: 'octy: Generate GitHub repository changelog.'
84
+ email:
85
+ - y.yoshida22@gmail.com
86
+ executables:
87
+ - octy
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - ".travis.yml"
94
+ - Gemfile
95
+ - LICENSE.txt
96
+ - README.md
97
+ - Rakefile
98
+ - bin/console
99
+ - bin/setup
100
+ - exe/octy
101
+ - lib/octy.rb
102
+ - lib/octy/cli.rb
103
+ - lib/octy/core.rb
104
+ - lib/octy/printer.rb
105
+ - lib/octy/version.rb
106
+ - octy.gemspec
107
+ homepage: https://github.com/Kakakakakku/octy
108
+ licenses:
109
+ - MIT
110
+ metadata: {}
111
+ post_install_message:
112
+ rdoc_options: []
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubyforge_project:
127
+ rubygems_version: 2.2.2
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: 'octy: Generate GitHub repository changelog.'
131
+ test_files: []