gh-diff 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +24 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.ja.md +298 -0
- data/README.md +113 -0
- data/Rakefile +7 -0
- data/bin/gh-diff +5 -0
- data/gh-diff.gemspec +35 -0
- data/lib/gh-diff.rb +96 -0
- data/lib/gh-diff/auth.rb +25 -0
- data/lib/gh-diff/cli.rb +165 -0
- data/lib/gh-diff/option.rb +40 -0
- data/lib/gh-diff/version.rb +3 -0
- data/spec/cassettes/auth.yml +63 -0
- data/spec/cassettes/dir.yml +74 -0
- data/spec/cassettes/docs.yml +145 -0
- data/spec/cassettes/nonexist.yml +63 -0
- data/spec/cassettes/quickstart.yml +147 -0
- data/spec/cassettes/ref-tag.yml +76 -0
- data/spec/cassettes/ref.yml +76 -0
- data/spec/cassettes/save-diff.yml +147 -0
- data/spec/cassettes/save-diffs.yml +291 -0
- data/spec/cli_spec.rb +102 -0
- data/spec/fixtures/docs/migrations.md +13 -0
- data/spec/fixtures/docs/quickstart.md +26 -0
- data/spec/fixtures/ja-docs/quickstart.ja.md +50 -0
- data/spec/gh-diff_spec.rb +138 -0
- data/spec/option_spec.rb +57 -0
- data/spec/spec_helper.rb +33 -0
- metadata +246 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 57381a1e6b18fb6aee1e3d881b2324f1be6ee15e
|
4
|
+
data.tar.gz: 2120094ff604d63f3aa8ac071316b3dda1abb3cb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cf9cc0e90cde40fdcfc5074fdad3e20c58d576a42356dfc18f653837915aa2711cee81388b47b343217a0c0cf0a45e2f75d132b98735c463645fb7036e11d04b
|
7
|
+
data.tar.gz: 2dc8e5c0340c7d36e145b09a6db08098cc9931d58ebde0b6ed2c5448a05ddc9d135a80132ae4cffb445e6acaf3599dc4b992f11297bb2e6adfe71279e652731e
|
data/.gitignore
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
.env
|
24
|
+
.DS_Store
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 kyoendo
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.ja.md
ADDED
@@ -0,0 +1,298 @@
|
|
1
|
+
# Gh-Diff
|
2
|
+
|
3
|
+
<!--original
|
4
|
+
# Gh-Diff
|
5
|
+
-->
|
6
|
+
|
7
|
+
`Gh-Diff`は、ローカルとGitHubリポジトリのファイルの差分を取ります。
|
8
|
+
|
9
|
+
<!--original
|
10
|
+
Take diffs between local and a github repository files.
|
11
|
+
-->
|
12
|
+
|
13
|
+
## インストール
|
14
|
+
|
15
|
+
<!--original
|
16
|
+
## Installation
|
17
|
+
-->
|
18
|
+
|
19
|
+
アプリケーションのGemfileに以下を追加します。
|
20
|
+
|
21
|
+
<!--original
|
22
|
+
Add this line to your application's Gemfile:
|
23
|
+
-->
|
24
|
+
|
25
|
+
gem 'gh-diff'
|
26
|
+
|
27
|
+
|
28
|
+
<!--original
|
29
|
+
gem 'gh-diff'
|
30
|
+
|
31
|
+
-->
|
32
|
+
|
33
|
+
そして以下を実行します。
|
34
|
+
|
35
|
+
<!--original
|
36
|
+
And then execute:
|
37
|
+
-->
|
38
|
+
|
39
|
+
$ bundle
|
40
|
+
|
41
|
+
|
42
|
+
<!--original
|
43
|
+
$ bundle
|
44
|
+
|
45
|
+
-->
|
46
|
+
|
47
|
+
または、自身で次のようにインストールします。
|
48
|
+
|
49
|
+
<!--original
|
50
|
+
Or install it yourself as:
|
51
|
+
-->
|
52
|
+
|
53
|
+
$ gem install gh-diff
|
54
|
+
|
55
|
+
|
56
|
+
<!--original
|
57
|
+
$ gem install gh-diff
|
58
|
+
|
59
|
+
-->
|
60
|
+
|
61
|
+
## 利用方法
|
62
|
+
|
63
|
+
<!--original
|
64
|
+
## Usage
|
65
|
+
-->
|
66
|
+
|
67
|
+
Gh-Diffには`gh-diff`というターミナルコマンドが付いています。
|
68
|
+
|
69
|
+
<!--original
|
70
|
+
Gh-Diff have `gh-diff` terminal command.
|
71
|
+
-->
|
72
|
+
|
73
|
+
```bash
|
74
|
+
% gh-diff
|
75
|
+
Commands:
|
76
|
+
gh-diff diff LOCAL_FILE [REMOTE_FILE] # Compare FILE(s) between local and remote repository. LOCAL_FILE can be DIRECTORY.
|
77
|
+
gh-diff dir_diff DIRECTORY # Print added and removed files in remote repository
|
78
|
+
gh-diff get FILE # Get FILE content from github repository
|
79
|
+
gh-diff help [COMMAND] # Describe available commands or one specific command
|
80
|
+
|
81
|
+
Options:
|
82
|
+
-g, [--repo=REPO] # target repository
|
83
|
+
-r, [--revision=REVISION] # target revision
|
84
|
+
# Default: master
|
85
|
+
-p, [--dir=DIR] # target file directory
|
86
|
+
[--username=USERNAME] # github username
|
87
|
+
[--password=PASSWORD] # github password
|
88
|
+
[--token=TOKEN] # github API access token
|
89
|
+
```
|
90
|
+
|
91
|
+
<!--original
|
92
|
+
```bash
|
93
|
+
% gh-diff
|
94
|
+
Commands:
|
95
|
+
gh-diff diff LOCAL\_FILE [REMOTE\_FILE] # Compare FILE(s) between local and remote repository. LOCAL_FILE can be DIRECTORY.
|
96
|
+
gh-diff dir_diff DIRECTORY # Print added and removed files in remote repository
|
97
|
+
gh-diff get FILE # Get FILE content from github repository
|
98
|
+
gh-diff help [COMMAND] # Describe available commands or one specific command
|
99
|
+
|
100
|
+
Options:
|
101
|
+
-g, [--repo=REPO] # target repository
|
102
|
+
-r, [--revision=REVISION] # target revision
|
103
|
+
# Default: master
|
104
|
+
-p, [--dir=DIR] # target file directory
|
105
|
+
[--username=USERNAME] # github username
|
106
|
+
[--password=PASSWORD] # github password
|
107
|
+
[--token=TOKEN] # github API access token
|
108
|
+
```
|
109
|
+
-->
|
110
|
+
|
111
|
+
'melborne/tildoc'レポジトリの`README.md`を比較するには、こうします。
|
112
|
+
|
113
|
+
<!--original
|
114
|
+
To take diff of `README.md` for 'melborne/tildoc' repo, do this;
|
115
|
+
-->
|
116
|
+
|
117
|
+
```bash
|
118
|
+
% gh-diff diff README.md --repo=melborne/tildoc
|
119
|
+
Diff found on README.md <-> README.md [6147df8:master]
|
120
|
+
```
|
121
|
+
|
122
|
+
<!--original
|
123
|
+
```bash
|
124
|
+
% gh-diff diff README.md --repo=melborne/tildoc
|
125
|
+
Diff found on README.md <-> README.md [6147df8:master]
|
126
|
+
```
|
127
|
+
-->
|
128
|
+
|
129
|
+
`--name_only`オプションをfalseにセットすれば、その差分がプリントアウトされます。
|
130
|
+
|
131
|
+
<!--original
|
132
|
+
By setting `--name_only` option false, the diff will be print out.
|
133
|
+
-->
|
134
|
+
|
135
|
+
```bash
|
136
|
+
% gh-diff diff README.md --repo=melborne/tildoc --no-name_only
|
137
|
+
Base revision: 6147df8378545a4807a2ed73c9e55f8d7204c14c[refs/heads/master]
|
138
|
+
--- README.md
|
139
|
+
+++ README.md
|
140
|
+
|
141
|
+
|
142
|
+
Add String#~ for removing leading margins of heredocs.
|
143
|
+
|
144
|
+
-Added this line to local.
|
145
|
+
-
|
146
|
+
## Installation
|
147
|
+
|
148
|
+
Add this line to your application's Gemfile:
|
149
|
+
```
|
150
|
+
|
151
|
+
<!--original
|
152
|
+
```bash
|
153
|
+
% gh-diff diff README.md --repo=melborne/tildoc --no-name_only
|
154
|
+
Base revision: 6147df8378545a4807a2ed73c9e55f8d7204c14c[refs/heads/master]
|
155
|
+
--- README.md
|
156
|
+
+++ README.md
|
157
|
+
|
158
|
+
|
159
|
+
Add String#~ for removing leading margins of heredocs.
|
160
|
+
|
161
|
+
-Added this line to local.
|
162
|
+
-
|
163
|
+
## Installation
|
164
|
+
|
165
|
+
Add this line to your application's Gemfile:
|
166
|
+
```
|
167
|
+
-->
|
168
|
+
|
169
|
+
差分の結果を保存する場合は、`--save`オプションをdiffコマンドに追加します。
|
170
|
+
|
171
|
+
<!--original
|
172
|
+
To save the result of diff, put `--save` option to diff command.
|
173
|
+
-->
|
174
|
+
|
175
|
+
### 翻訳などのプロジェクトのために
|
176
|
+
|
177
|
+
<!--original
|
178
|
+
### For Translation-like project
|
179
|
+
-->
|
180
|
+
|
181
|
+
HTMLコメントタグを使って原文が挿入された翻訳ファイルがあり、この原文とリモートのオリジナルとを比較したい場合には、`commentout`オプションが役立つでしょう。
|
182
|
+
|
183
|
+
<!--original
|
184
|
+
If you have translated files in which original text inserted with
|
185
|
+
html comment tags, and want to compare the original with the remote,
|
186
|
+
`commentout` option helps you.
|
187
|
+
-->
|
188
|
+
|
189
|
+
% gh-diff diff README.ja.md README.md --commentout
|
190
|
+
|
191
|
+
|
192
|
+
<!--original
|
193
|
+
% gh-diff diff README.ja.md README.md --commentout
|
194
|
+
|
195
|
+
-->
|
196
|
+
|
197
|
+
これは、`README.ja.md`からコメントテキストを抽出し、リモートの`README.md`と比較します。
|
198
|
+
|
199
|
+
<!--original
|
200
|
+
This extract commented text in `README.ja.md`, then compare it with remote `README.md`.
|
201
|
+
-->
|
202
|
+
|
203
|
+
より詳細は`gh-diff help diff`を見てください。
|
204
|
+
|
205
|
+
<!--original
|
206
|
+
See `gh-diff help diff` for more info.
|
207
|
+
-->
|
208
|
+
|
209
|
+
### 環境変数ENVにおけるオプション
|
210
|
+
|
211
|
+
<!--original
|
212
|
+
### Options in ENV
|
213
|
+
-->
|
214
|
+
|
215
|
+
これらのオプションは、接頭辞`GH_`を使って環境変数にプリセットできます。
|
216
|
+
|
217
|
+
<!--original
|
218
|
+
These options can be preset as ENV variables with prefix `GH_`
|
219
|
+
-->
|
220
|
+
|
221
|
+
% export GH_USERNAME=melborne
|
222
|
+
% export GH_PASSWORD=xxxxxxxx
|
223
|
+
% export GH_TOKEN=1234abcd5678efgh
|
224
|
+
|
225
|
+
|
226
|
+
<!--original
|
227
|
+
% export GH_USERNAME=melborne
|
228
|
+
% export GH_PASSWORD=xxxxxxxx
|
229
|
+
% export GH_TOKEN=1234abcd5678efgh
|
230
|
+
|
231
|
+
-->
|
232
|
+
|
233
|
+
また、プロジェクトルートの`.env`ファイルに設定することもできます。
|
234
|
+
|
235
|
+
<!--original
|
236
|
+
Also, you can set them in `.env` file in the root of your project.
|
237
|
+
-->
|
238
|
+
|
239
|
+
#.env
|
240
|
+
REPO=jekyll/jekyll
|
241
|
+
DIR=site
|
242
|
+
|
243
|
+
|
244
|
+
<!--original
|
245
|
+
#.env
|
246
|
+
REPO=jekyll/jekyll
|
247
|
+
DIR=site
|
248
|
+
|
249
|
+
-->
|
250
|
+
|
251
|
+
`.env`の環境変数は、`GH_`で始まるグローバル環境変数を上書きします。
|
252
|
+
|
253
|
+
<!--original
|
254
|
+
ENVs in `.env` overwrite global ENVs with prefix `GH_`.
|
255
|
+
-->
|
256
|
+
|
257
|
+
GitHub APIにはアクセス制限があります。ベーシック認証(usernameとpassword)または[個人用のAPIトークン](https://github.com/blog/1509-personal-api-tokens "Personal API tokens")でこれを引き上げることができるので、それらを設定するとよいでしょう。
|
258
|
+
|
259
|
+
<!--original
|
260
|
+
There is rate limit for accessing GitHub API. While you can make it
|
261
|
+
up with Basic Authentication(username and password) or [Personal API tokens](https://github.com/blog/1509-personal-api-tokens "Personal API tokens"),
|
262
|
+
setting them are preferable.
|
263
|
+
-->
|
264
|
+
|
265
|
+
## 感謝
|
266
|
+
|
267
|
+
<!--original
|
268
|
+
## Thank you
|
269
|
+
-->
|
270
|
+
|
271
|
+
`Gh-Diff`は[jekyllrb-ja](https://github.com/jekyllrb-ja/jekyllrb-ja.github.io)プロジェクトという、[Jekyllサイト](http://jekyllrb.com/)の日本語版の提供を目的としたプロジェクトで生まれました。`Gh-Diff`の基本的なアイディアはこのプロジェクトのRakefileの中にある`togglate task`から来ており、これはgosyujin(kk_Ataka)により作られました。彼に感謝します。
|
272
|
+
|
273
|
+
<!--original
|
274
|
+
`Gh-Diff` is born through [jekyllrb-ja](https://github.com/jekyllrb-ja/jekyllrb-ja.github.io) project,
|
275
|
+
whose aim is to provide a [Jekyll site](http://jekyllrb.com/) in Japanese.
|
276
|
+
The basic idea of `Gh-Diff` is from `togglate task in Rakefile` of the project
|
277
|
+
which is created by gosyujin(kk_Ataka). I want to thank him.
|
278
|
+
-->
|
279
|
+
|
280
|
+
## 貢献
|
281
|
+
|
282
|
+
<!--original
|
283
|
+
## Contributing
|
284
|
+
-->
|
285
|
+
|
286
|
+
1. Fork it ( https://github.com/[my-github-username]/gh-diff/fork )
|
287
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
288
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
289
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
290
|
+
5. Create a new Pull Request
|
291
|
+
|
292
|
+
<!--original
|
293
|
+
1. Fork it ( https://github.com/[my-github-username]/gh-diff/fork )
|
294
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
295
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
296
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
297
|
+
5. Create a new Pull Request
|
298
|
+
-->
|
data/README.md
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
# Gh-Diff
|
2
|
+
|
3
|
+
Take diffs between local and a github repository files.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'gh-diff'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install gh-diff
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Gh-Diff have `gh-diff` terminal command.
|
22
|
+
|
23
|
+
```bash
|
24
|
+
% gh-diff
|
25
|
+
Commands:
|
26
|
+
gh-diff diff LOCAL_FILE [REMOTE_FILE] # Compare FILE(s) between local and remote repository. LOCAL_FILE can be DIRECTORY.
|
27
|
+
gh-diff dir_diff DIRECTORY # Print added and removed files in remote repository
|
28
|
+
gh-diff get FILE # Get FILE content from github repository
|
29
|
+
gh-diff help [COMMAND] # Describe available commands or one specific command
|
30
|
+
|
31
|
+
Options:
|
32
|
+
-g, [--repo=REPO] # target repository
|
33
|
+
-r, [--revision=REVISION] # target revision
|
34
|
+
# Default: master
|
35
|
+
-p, [--dir=DIR] # target file directory
|
36
|
+
[--username=USERNAME] # github username
|
37
|
+
[--password=PASSWORD] # github password
|
38
|
+
[--token=TOKEN] # github API access token
|
39
|
+
```
|
40
|
+
|
41
|
+
To take diff of `README.md` for 'melborne/tildoc' repo, do this;
|
42
|
+
|
43
|
+
```bash
|
44
|
+
% gh-diff diff README.md --repo=melborne/tildoc
|
45
|
+
Diff found on README.md <-> README.md [6147df8:master]
|
46
|
+
```
|
47
|
+
|
48
|
+
By setting `--name_only` option false, the diff will be print out.
|
49
|
+
|
50
|
+
```bash
|
51
|
+
% gh-diff diff README.md --repo=melborne/tildoc --no-name_only
|
52
|
+
Base revision: 6147df8378545a4807a2ed73c9e55f8d7204c14c[refs/heads/master]
|
53
|
+
--- README.md
|
54
|
+
+++ README.md
|
55
|
+
|
56
|
+
|
57
|
+
Add String#~ for removing leading margins of heredocs.
|
58
|
+
|
59
|
+
-Added this line to local.
|
60
|
+
-
|
61
|
+
## Installation
|
62
|
+
|
63
|
+
Add this line to your application's Gemfile:
|
64
|
+
```
|
65
|
+
|
66
|
+
To save the result of diff, put `--save` option to diff command.
|
67
|
+
|
68
|
+
### For Translation-like project
|
69
|
+
|
70
|
+
If you have translated files in which original text inserted with
|
71
|
+
html comment tags, and want to compare the original with the remote,
|
72
|
+
`commentout` option helps you.
|
73
|
+
|
74
|
+
% gh-diff diff README.ja.md README.md --commentout
|
75
|
+
|
76
|
+
This extract commented text in `README.ja.md`, then compare it with remote `README.md`.
|
77
|
+
|
78
|
+
See `gh-diff help diff` for more info.
|
79
|
+
|
80
|
+
### Options in ENV
|
81
|
+
|
82
|
+
These options can be preset as ENV variables with prefix `GH_`
|
83
|
+
|
84
|
+
% export GH_USERNAME=melborne
|
85
|
+
% export GH_PASSWORD=xxxxxxxx
|
86
|
+
% export GH_TOKEN=1234abcd5678efgh
|
87
|
+
|
88
|
+
Also, you can set them in `.env` file in the root of your project.
|
89
|
+
|
90
|
+
#.env
|
91
|
+
REPO=jekyll/jekyll
|
92
|
+
DIR=site
|
93
|
+
|
94
|
+
ENVs in `.env` overwrite global ENVs with prefix `GH_`.
|
95
|
+
|
96
|
+
There is rate limit for accessing GitHub API. While you can make it
|
97
|
+
up with Basic Authentication(username and password) or [Personal API tokens](https://github.com/blog/1509-personal-api-tokens "Personal API tokens"),
|
98
|
+
setting them are preferable.
|
99
|
+
|
100
|
+
## Thank you
|
101
|
+
|
102
|
+
`Gh-Diff` is born through [jekyllrb-ja](https://github.com/jekyllrb-ja/jekyllrb-ja.github.io) project,
|
103
|
+
whose aim is to provide a [Jekyll site](http://jekyllrb.com/) in Japanese.
|
104
|
+
The basic idea of `Gh-Diff` is from `togglate task in Rakefile` of the project
|
105
|
+
which is created by gosyujin(kk_Ataka). I want to thank him.
|
106
|
+
|
107
|
+
## Contributing
|
108
|
+
|
109
|
+
1. Fork it ( https://github.com/[my-github-username]/gh-diff/fork )
|
110
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
111
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
112
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
113
|
+
5. Create a new Pull Request
|