grit_ext 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +0 -22
- data/lib/grit_ext.rb +1 -1
- data/lib/grit_ext/actor.rb +1 -1
- data/lib/grit_ext/blob.rb +3 -3
- data/lib/grit_ext/commit.rb +2 -2
- data/lib/grit_ext/diff.rb +3 -3
- data/lib/grit_ext/tag.rb +1 -1
- data/lib/grit_ext/tree.rb +1 -1
- data/lib/grit_ext/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -2,12 +2,6 @@
|
|
2
2
|
|
3
3
|
grit_ext is a grit extension gem.
|
4
4
|
|
5
|
-
1. auto transcoding `blob.data` to utf-8 encoding
|
6
|
-
|
7
|
-
2. give blob a language method, show the blob's programming language
|
8
|
-
|
9
|
-
3. give blob a encoding method, show the blob's text encoding.
|
10
|
-
|
11
5
|
## Installation
|
12
6
|
|
13
7
|
Add this line to your application's Gemfile:
|
@@ -29,22 +23,6 @@ Or install it yourself as:
|
|
29
23
|
=> true
|
30
24
|
[2] pry(main)> require'grit_ext'
|
31
25
|
=> true
|
32
|
-
[3] pry(main)> repo = Grit::Repo.new("/Users/saito/Develop/grit_ext")
|
33
|
-
=> #<Grit::Repo "/Users/saito/Develop/grit_ext/.git">
|
34
|
-
[4] pry(main)> blob = repo.tree / 'Gemfile'
|
35
|
-
=> #<Grit::Blob "015bb0f8c189aca154b2a54e511415e6723d104d">
|
36
|
-
[5] pry(main)> blob.language
|
37
|
-
=> "Ruby"
|
38
|
-
[6] pry(main)> blob.encoding
|
39
|
-
=> "ISO-8859-1"
|
40
|
-
[7] pry(main)> blob.data
|
41
|
-
=> "source 'https://rubygems.org'\n\n# Specify your gem's dependencies in grit_ext.gemspec\ngemspec\n"
|
42
|
-
[8] pry(main)> blob.text?
|
43
|
-
=> true
|
44
|
-
[9] pry(main)> blob.image?
|
45
|
-
=> false
|
46
|
-
[10] pry(main)> blob.binary?
|
47
|
-
=> false
|
48
26
|
```
|
49
27
|
|
50
28
|
|
data/lib/grit_ext.rb
CHANGED
data/lib/grit_ext/actor.rb
CHANGED
data/lib/grit_ext/blob.rb
CHANGED
@@ -5,11 +5,11 @@ module Grit
|
|
5
5
|
alias_method :old_data, :data
|
6
6
|
|
7
7
|
def name
|
8
|
-
GritExt.
|
8
|
+
GritExt.encode! old_name
|
9
9
|
end
|
10
10
|
|
11
11
|
def data
|
12
|
-
GritExt.
|
12
|
+
GritExt.encode! old_data
|
13
13
|
end
|
14
14
|
|
15
15
|
class << self
|
@@ -17,7 +17,7 @@ module Grit
|
|
17
17
|
|
18
18
|
def blame(repo, commit, file)
|
19
19
|
old_blame(repo, commit, file).map do |b,lines|
|
20
|
-
[b, GritExt.
|
20
|
+
[b, GritExt.encode!(lines.join('\n')).split('\n')]
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
data/lib/grit_ext/commit.rb
CHANGED
@@ -5,11 +5,11 @@ module Grit
|
|
5
5
|
alias_method :old_short_message, :short_message
|
6
6
|
|
7
7
|
def message
|
8
|
-
GritExt.
|
8
|
+
GritExt.encode! old_message
|
9
9
|
end
|
10
10
|
|
11
11
|
def short_message
|
12
|
-
GritExt.
|
12
|
+
GritExt.encode! old_short_message
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
data/lib/grit_ext/diff.rb
CHANGED
@@ -2,15 +2,15 @@ module Grit
|
|
2
2
|
class Diff
|
3
3
|
|
4
4
|
def old_path
|
5
|
-
GritExt.
|
5
|
+
GritExt.encode! @a_path
|
6
6
|
end
|
7
7
|
|
8
8
|
def new_path
|
9
|
-
GritExt.
|
9
|
+
GritExt.encode! @b_path
|
10
10
|
end
|
11
11
|
|
12
12
|
def diff
|
13
|
-
GritExt.
|
13
|
+
GritExt.encode! @diff
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
data/lib/grit_ext/tag.rb
CHANGED
data/lib/grit_ext/tree.rb
CHANGED
data/lib/grit_ext/version.rb
CHANGED