carmine 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/carmine.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "carmine"
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Genadi Samokovarov"]
12
- s.date = "2012-02-29"
12
+ s.date = "2012-03-01"
13
13
  s.description = "Ruby client for pygmentize.me"
14
14
  s.email = "gsamokovarov@gmail.com"
15
15
  s.extra_rdoc_files = [
data/lib/carmine.rb CHANGED
@@ -15,12 +15,12 @@ class Carmine
15
15
 
16
16
  def to_s
17
17
  return @response.body unless /\(.*?\)/ =~ @response.body
18
- $~.gsub /[()]/, ""
18
+ $~[0].gsub /[()]/, ""
19
19
  end
20
20
  end
21
21
 
22
22
  class << self
23
- # Public: Delegates the calls to '#colorize', '#pygmentize' and #defaults.
23
+ # Public: Delegates the calls to the #instance_methods.
24
24
  #
25
25
  # Examples
26
26
  #
data/spec/carmine_spec.rb CHANGED
@@ -1,4 +1,22 @@
1
1
  describe Carmine do
2
+ before do
3
+ Carmine.base_uri ENV['base_uri'] if ENV['base_uri']
4
+ end
5
+
6
+ describe '::Error' do
7
+ it 'should extract /\(.*?\)/' do
8
+ response = Struct.new(:body).new('Skipped and (showed)')
9
+
10
+ Carmine::Error.new(response).to_s.should == 'showed'
11
+ end
12
+
13
+ it 'should extract /\(.*?\)/ only if present' do
14
+ response = Struct.new(:body).new('Still fine')
15
+
16
+ Carmine::Error.new(response).to_s.should == 'Still fine'
17
+ end
18
+ end
19
+
2
20
  describe '#initialize' do
3
21
  it 'should accept options used as defaults' do
4
22
  carmine = Carmine.new :lexer => :ruby, :formatter => :latex
@@ -12,16 +30,17 @@ describe Carmine do
12
30
  describe "#{access}colorize" do
13
31
  let(:carmine) { access == '::' ? Carmine : Carmine.new }
14
32
 
15
- it 'should colorize code with valid lexer and formatter' do
33
+ it 'should colorize code :lexer and :formatter' do
16
34
  carmine.colorize('puts "Hello World!"', :lexer => :ruby, :formatter => 'html').should ==
17
35
  %Q{<div class="highlight"><pre><span class="nb">puts</span> <span class="s2">&quot;Hello World!&quot;</span>\n</pre></div>\n}
18
36
  end
19
37
 
20
-
21
38
  it 'should throw Carmine::Error on server side errors' do
22
- expect {
39
+ colorization = proc do
23
40
  carmine.colorize 'pass', :lexer => :python, :formatter => :invalid
24
- }.to raise_error(Carmine::Error)
41
+ end
42
+
43
+ expect { colorization.call }.to raise_error(Carmine::Error)
25
44
  end
26
45
 
27
46
  it 'should raise ArgumentError on missing code' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carmine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-29 00:00:00.000000000Z
12
+ date: 2012-03-01 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
16
- requirement: &27811680 !ruby/object:Gem::Requirement
16
+ requirement: &16903100 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *27811680
24
+ version_requirements: *16903100
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &27811180 !ruby/object:Gem::Requirement
27
+ requirement: &16902580 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *27811180
35
+ version_requirements: *16902580
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &27810700 !ruby/object:Gem::Requirement
38
+ requirement: &16902080 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *27810700
46
+ version_requirements: *16902080
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: guard
49
- requirement: &27810220 !ruby/object:Gem::Requirement
49
+ requirement: &16901600 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *27810220
57
+ version_requirements: *16901600
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: guard-rspec
60
- requirement: &27809720 !ruby/object:Gem::Requirement
60
+ requirement: &16901120 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *27809720
68
+ version_requirements: *16901120
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: jeweler
71
- requirement: &27809180 !ruby/object:Gem::Requirement
71
+ requirement: &16900600 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *27809180
79
+ version_requirements: *16900600
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: httparty
82
- requirement: &27808640 !ruby/object:Gem::Requirement
82
+ requirement: &16900060 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *27808640
90
+ version_requirements: *16900060
91
91
  description: Ruby client for pygmentize.me
92
92
  email: gsamokovarov@gmail.com
93
93
  executables: []