grit_ext 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -9,7 +9,7 @@ require "grit_ext/version"
9
9
  module GritExt
10
10
  extend self
11
11
 
12
- def transcode(message)
12
+ def encode!(message)
13
13
  return nil unless message.respond_to? :force_encoding
14
14
 
15
15
  # if message is utf-8 encoding, just return it
@@ -4,7 +4,7 @@ module Grit
4
4
  alias_method :old_name, :name
5
5
 
6
6
  def name
7
- GritExt.transcode old_name
7
+ GritExt.encode! old_name
8
8
  end
9
9
  end
10
10
  end
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.transcode old_name
8
+ GritExt.encode! old_name
9
9
  end
10
10
 
11
11
  def data
12
- GritExt.transcode old_data
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.transcode(lines.join('\n')).split('\n')]
20
+ [b, GritExt.encode!(lines.join('\n')).split('\n')]
21
21
  end
22
22
  end
23
23
  end
@@ -5,11 +5,11 @@ module Grit
5
5
  alias_method :old_short_message, :short_message
6
6
 
7
7
  def message
8
- GritExt.transcode old_message
8
+ GritExt.encode! old_message
9
9
  end
10
10
 
11
11
  def short_message
12
- GritExt.transcode old_short_message
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.transcode @a_path
5
+ GritExt.encode! @a_path
6
6
  end
7
7
 
8
8
  def new_path
9
- GritExt.transcode @b_path
9
+ GritExt.encode! @b_path
10
10
  end
11
11
 
12
12
  def diff
13
- GritExt.transcode @diff
13
+ GritExt.encode! @diff
14
14
  end
15
15
  end
16
16
  end
data/lib/grit_ext/tag.rb CHANGED
@@ -4,7 +4,7 @@ module Grit
4
4
  alias_method :old_message, :message
5
5
 
6
6
  def message
7
- GritExt.transcode old_message
7
+ GritExt.encode! old_message
8
8
  end
9
9
  end
10
10
  end
data/lib/grit_ext/tree.rb CHANGED
@@ -4,7 +4,7 @@ module Grit
4
4
  alias_method :old_name, :name
5
5
 
6
6
  def name
7
- GritExt.transcode old_name
7
+ GritExt.encode! old_name
8
8
  end
9
9
  end
10
10
  end
@@ -2,6 +2,6 @@ module GritExt
2
2
  extend self
3
3
 
4
4
  def version
5
- "0.5.0"
5
+ "0.6.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grit_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: