whatsnew 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +15 -0
- data/CHANGELOG.md +24 -0
- data/CONTRIBUTING.md +7 -0
- data/DEVELOPMENT.md +13 -0
- data/Gemfile +11 -0
- data/LICENSE.md +21 -0
- data/README.md +96 -0
- data/Rakefile +10 -0
- data/bin/dev +9 -0
- data/bin/whatsnew +14 -0
- data/lib/whatsnew/news_file.rb +24 -0
- data/lib/whatsnew/no_news_file.rb +19 -0
- data/lib/whatsnew/project.rb +56 -0
- data/lib/whatsnew/remote_news_file.rb +27 -0
- data/lib/whatsnew/version.rb +3 -0
- data/lib/whatsnew.rb +11 -0
- data/whatsnew.gemspec +23 -0
- metadata +64 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a219950a9a69efe9a80a642981f63e71b42a8cca
|
4
|
+
data.tar.gz: ac3290929b7c929d2a839adccf34a0de8d9a3237
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3737fe2813a30bbb0e5de036bcea21a6aac8b895b6684f76c0b111e4c258667f97e86902fb741982695a5ae4ffb723cc830161dee9f4bc6b6b785274266a8a70
|
7
|
+
data.tar.gz: 9d8a0d1708a8bbff80248f12afbbb11b4a99ce0e845d3f290a063cc332832187fdecdd3b9b2004e5411dba050140e2b8426e35b39ad10f8df162ffe5581f1b92
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
language: ruby
|
2
|
+
sudo: false
|
3
|
+
bundler_args: "--retry=3 --jobs=3"
|
4
|
+
rvm:
|
5
|
+
- 2.0
|
6
|
+
- 2.1
|
7
|
+
- 2.2
|
8
|
+
- ruby-head
|
9
|
+
matrix:
|
10
|
+
allow_failures:
|
11
|
+
- rvm: ruby-head
|
12
|
+
fast_finish: true
|
13
|
+
notifications:
|
14
|
+
slack:
|
15
|
+
secure: wZ1UPEcH/Zf/wSPvpR1q76vpUQvAEGuwR5500ML8C+shW7PedvuSZaiZYAOZxhyD17RXzXYroON0ArEk3NUcKD8supPzYjUWzCeWDIFaYxEb7dOm7tpRBf4GuQ/oy8HGsBi947ZTX3WytGWZU0q0aRu2EirPcoY05vzley/hYTI=
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# CHANGELOG
|
2
|
+
|
3
|
+
## Unrelease
|
4
|
+
|
5
|
+
## v0.3.0 - 2015-08-09
|
6
|
+
|
7
|
+
- API Support finding news file from Octokit response
|
8
|
+
|
9
|
+
## v0.2.0 - 2015-08-08
|
10
|
+
|
11
|
+
- NewsFile API changes
|
12
|
+
|
13
|
+
### Features
|
14
|
+
|
15
|
+
- Add `bin/dev` script for development
|
16
|
+
|
17
|
+
### Bug Fixes
|
18
|
+
|
19
|
+
- Fix matching git repository
|
20
|
+
- Fix search for a git repo without news file
|
21
|
+
|
22
|
+
## v0.1.0 - 2015-08-08
|
23
|
+
|
24
|
+
Project init. Can detect a local project's news file location.
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
1. Fork it ( https://github.com/jollygoodcode/whatsnew/fork )
|
4
|
+
2. Create your feature branch ( `git checkout -b my-new-feature` )
|
5
|
+
3. Commit your changes ( `git commit -am 'Add some feature'` )
|
6
|
+
4. Push to the branch ( `git push origin my-new-feature` )
|
7
|
+
5. Create a new Pull Request
|
data/DEVELOPMENT.md
ADDED
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Jolly Good Code
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
# What's New?
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/whatsnew.svg)](http://badge.fury.io/rb/whatsnew)
|
4
|
+
[![Build Status](https://travis-ci.org/jollygoodcode/whatsnew.svg?branch=master)](https://travis-ci.org/jollygoodcode/whatsnew)
|
5
|
+
|
6
|
+
What's New of a project?
|
7
|
+
|
8
|
+
--
|
9
|
+
|
10
|
+
Where is the document which documents changes between two releases?
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem "whatsnew"
|
18
|
+
```
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
|
22
|
+
$ bundle
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
|
26
|
+
$ gem install whatsnew
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
### Command line usage
|
31
|
+
|
32
|
+
```
|
33
|
+
$ whatsnew
|
34
|
+
|
35
|
+
What's New:
|
36
|
+
See CHANGELOG.md: https://github.com/jollygoodcode/whatsnew/blob/master/CHANGELOG.md.
|
37
|
+
```
|
38
|
+
|
39
|
+
### Local API usage
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
news = Whatsnew.about "/Users/Juan/dev/whatsnew"
|
43
|
+
|
44
|
+
news.file_name
|
45
|
+
=> "CHANGELOG.md"
|
46
|
+
|
47
|
+
news.file_url
|
48
|
+
=> "https://github.com/jollygoodcode/whatsnew/blob/master/CHANGELOG.md"
|
49
|
+
|
50
|
+
news.content
|
51
|
+
=> "What's New:\nSee CHANGELOG.md: https://github.com/jollygoodcode/whatsnew/blob/master/CHANGELOG.md."
|
52
|
+
```
|
53
|
+
|
54
|
+
### Remote API usage with [Octokit](https://github.com/octokit/octokit.rb)
|
55
|
+
|
56
|
+
First [get an OAuth access token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/), then:
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
client = Octokit::Client.new(access_token: ENV["OAUTH_TOKEN"])
|
60
|
+
|
61
|
+
news = Whatsnew.about client.contents("jollygoodcode/whatsnew")
|
62
|
+
|
63
|
+
news.file_name
|
64
|
+
=> "CHANGELOG.md"
|
65
|
+
|
66
|
+
news.file_url
|
67
|
+
=> "https://github.com/jollygoodcode/whatsnew/blob/master/CHANGELOG.md"
|
68
|
+
|
69
|
+
news.content
|
70
|
+
=> "What's New:\nSee CHANGELOG.md: https://github.com/jollygoodcode/whatsnew/blob/master/CHANGELOG.md."
|
71
|
+
```
|
72
|
+
|
73
|
+
|
74
|
+
## What it searches for?
|
75
|
+
|
76
|
+
* `CHANGELOG`, `CHANGE`, `CHANGES`, `HISTORY`, `NEWS` in the root of project (regardless of file extension).
|
77
|
+
|
78
|
+
* It doesn't search for changelog listed in README.
|
79
|
+
|
80
|
+
## Development
|
81
|
+
|
82
|
+
See [DEVELOPMENT.md](DEVELOPMENT.md).
|
83
|
+
|
84
|
+
## Contributing
|
85
|
+
|
86
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
87
|
+
|
88
|
+
## Credits
|
89
|
+
|
90
|
+
A huge THANK YOU to all our [contributors](https://github.com/jollygoodcode/whatsnew/graphs/contributors)! :heart:
|
91
|
+
|
92
|
+
This project is maintained by [Jolly Good Code](http://www.jollygoodcode.com).
|
93
|
+
|
94
|
+
## License
|
95
|
+
|
96
|
+
The gem is available as open source under the terms of the [MIT License](LICENSE.md).
|
data/Rakefile
ADDED
data/bin/dev
ADDED
data/bin/whatsnew
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
Signal.trap("INT") { abort }
|
4
|
+
|
5
|
+
require "bundler/setup"
|
6
|
+
require "whatsnew"
|
7
|
+
|
8
|
+
if news = Whatsnew.about(Dir.pwd)
|
9
|
+
puts news.content
|
10
|
+
else
|
11
|
+
puts "Not found. Do you mind keep a changelog?"
|
12
|
+
puts "Or tell the project owner to keep a changelog :)"
|
13
|
+
puts "See http://keepachangelog.com"
|
14
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require "pathname"
|
2
|
+
|
3
|
+
module Whatsnew
|
4
|
+
class NewsFile
|
5
|
+
attr_reader :file_url
|
6
|
+
|
7
|
+
def initialize(path, project_uri)
|
8
|
+
@newsfile = Pathname(path)
|
9
|
+
@file_url = "#{project_uri}/blob/master/#{file_name}"
|
10
|
+
end
|
11
|
+
|
12
|
+
def content
|
13
|
+
"What's New:\n" "See #{file_name}: #{file_url}."
|
14
|
+
end
|
15
|
+
|
16
|
+
def file_name
|
17
|
+
newsfile.basename.to_s
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
attr_reader :newsfile
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require "pathname"
|
2
|
+
|
3
|
+
module Whatsnew
|
4
|
+
class Project
|
5
|
+
attr_reader :news_file
|
6
|
+
|
7
|
+
def initialize(path)
|
8
|
+
@path = path
|
9
|
+
@news_file = get_news_file_from_path
|
10
|
+
end
|
11
|
+
|
12
|
+
def get_news_file_from_path
|
13
|
+
if path_is_a_sawyer_resource_array
|
14
|
+
RemoteNewsFile.new(path)
|
15
|
+
else
|
16
|
+
if news_file_name
|
17
|
+
NewsFile.new(news_file_name, project_uri)
|
18
|
+
else
|
19
|
+
NoNewsFile.new
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# git@github.com:jollygoodcode/whatsnew.git
|
25
|
+
# => https://github.com:jollygoodcode/whatsnew
|
26
|
+
def project_uri
|
27
|
+
if matched = matched_from_git_repository
|
28
|
+
"https://#{matched[:host]}/#{matched[:owner]}/#{matched[:repo]}"
|
29
|
+
else
|
30
|
+
"NOT FOUND".freeze
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
attr_reader :path
|
37
|
+
|
38
|
+
def path_is_a_sawyer_resource_array
|
39
|
+
path.is_a?(Array) && path.first.is_a?(Sawyer::Resource)
|
40
|
+
end
|
41
|
+
|
42
|
+
def news_file_name
|
43
|
+
@news_file_name ||= Dir.glob(File.join(path, "*".freeze)).find do |file|
|
44
|
+
file =~ %r{(CHANGE|CHANGES|CHANGELOG|NEWS|HISTORY)}i.freeze
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def matched_from_git_repository
|
49
|
+
Dir.chdir(Pathname(path).to_path) do
|
50
|
+
`git config --get remote.origin.url`.match(
|
51
|
+
%r{git.+(?<host>(github.com|bitbucket.com|bitbucket.org))[:/](?<owner>\S+)/(?<repo>\S+)\.git}
|
52
|
+
)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "pathname"
|
2
|
+
|
3
|
+
module Whatsnew
|
4
|
+
class RemoteNewsFile
|
5
|
+
def initialize(sawyer_resources)
|
6
|
+
@news_resource = sawyer_resources.find do |resource|
|
7
|
+
resource.name =~ %r{(CHANGE|CHANGES|CHANGELOG|NEWS|HISTORY)}i.freeze
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def content
|
12
|
+
"What's New:\n" "See #{file_name}: #{file_url}."
|
13
|
+
end
|
14
|
+
|
15
|
+
def file_name
|
16
|
+
news_resource.name
|
17
|
+
end
|
18
|
+
|
19
|
+
def file_url
|
20
|
+
news_resource.html_url
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
attr_reader :news_resource
|
26
|
+
end
|
27
|
+
end
|
data/lib/whatsnew.rb
ADDED
data/whatsnew.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "whatsnew/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "whatsnew"
|
8
|
+
spec.version = Whatsnew::VERSION
|
9
|
+
spec.authors = ["Juanito Fatas"]
|
10
|
+
spec.email = ["katehuang0320@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Find out what's new about a project}
|
13
|
+
spec.description = spec.summary
|
14
|
+
spec.homepage = "https://github.com/jollygoodcode/whatsnew"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.bindir = "bin"
|
18
|
+
spec.executables << "whatsnew"
|
19
|
+
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: whatsnew
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Juanito Fatas
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-09 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Find out what's new about a project
|
14
|
+
email:
|
15
|
+
- katehuang0320@gmail.com
|
16
|
+
executables:
|
17
|
+
- whatsnew
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- ".gitignore"
|
22
|
+
- ".travis.yml"
|
23
|
+
- CHANGELOG.md
|
24
|
+
- CONTRIBUTING.md
|
25
|
+
- DEVELOPMENT.md
|
26
|
+
- Gemfile
|
27
|
+
- LICENSE.md
|
28
|
+
- README.md
|
29
|
+
- Rakefile
|
30
|
+
- bin/dev
|
31
|
+
- bin/whatsnew
|
32
|
+
- lib/whatsnew.rb
|
33
|
+
- lib/whatsnew/news_file.rb
|
34
|
+
- lib/whatsnew/no_news_file.rb
|
35
|
+
- lib/whatsnew/project.rb
|
36
|
+
- lib/whatsnew/remote_news_file.rb
|
37
|
+
- lib/whatsnew/version.rb
|
38
|
+
- whatsnew.gemspec
|
39
|
+
homepage: https://github.com/jollygoodcode/whatsnew
|
40
|
+
licenses:
|
41
|
+
- MIT
|
42
|
+
metadata: {}
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options: []
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
requirements: []
|
58
|
+
rubyforge_project:
|
59
|
+
rubygems_version: 2.4.8
|
60
|
+
signing_key:
|
61
|
+
specification_version: 4
|
62
|
+
summary: Find out what's new about a project
|
63
|
+
test_files: []
|
64
|
+
has_rdoc:
|