logs_tf 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.coverage ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env ruby
2
+ SimpleCov.start
data/.gitignore CHANGED
@@ -11,6 +11,10 @@ spec/reports
11
11
  test/tmp
12
12
  test/version_tmp
13
13
  tmp
14
+ rspec.html
15
+
16
+ # RBX files
17
+ .rbx/
14
18
 
15
19
  # YARD artifacts
16
20
  .yardoc
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - rbx-19mode
5
+ - jruby-19mode
6
+ script: ./script/ci
data/Gemfile.lock CHANGED
@@ -1,43 +1,58 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- logs_tf (0.0.0)
4
+ logs_tf (0.0.2)
5
5
  faraday (~> 0.8.0)
6
- multipart-post (~> 1.1.0)
6
+ multipart-post (~> 1.2.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- ZenTest (4.9.0)
12
- coderay (1.0.8)
13
- diff-lcs (1.1.3)
14
- faraday (0.8.5)
11
+ coderay (1.0.9)
12
+ colorize (0.5.8)
13
+ coveralls (0.6.4)
14
+ colorize
15
+ multi_json (~> 1.3)
16
+ rest-client
17
+ simplecov (>= 0.7)
18
+ thor
19
+ diff-lcs (1.2.2)
20
+ faraday (0.8.7)
15
21
  multipart-post (~> 1.1)
16
22
  method_source (0.8.1)
17
- multipart-post (1.1.5)
18
- pry (0.9.11.4)
23
+ mime-types (1.22)
24
+ multi_json (1.7.2)
25
+ multipart-post (1.2.0)
26
+ pry (0.9.12)
19
27
  coderay (~> 1.0.5)
20
28
  method_source (~> 0.8)
21
29
  slop (~> 3.4)
22
30
  pry-nav (0.2.3)
23
31
  pry (~> 0.9.10)
24
- rspec (2.12.0)
25
- rspec-core (~> 2.12.0)
26
- rspec-expectations (~> 2.12.0)
27
- rspec-mocks (~> 2.12.0)
28
- rspec-core (2.12.2)
29
- rspec-expectations (2.12.1)
30
- diff-lcs (~> 1.1.3)
31
- rspec-mocks (2.12.2)
32
- slop (3.4.3)
32
+ rest-client (1.6.7)
33
+ mime-types (>= 1.16)
34
+ rspec (2.13.0)
35
+ rspec-core (~> 2.13.0)
36
+ rspec-expectations (~> 2.13.0)
37
+ rspec-mocks (~> 2.13.0)
38
+ rspec-core (2.13.1)
39
+ rspec-expectations (2.13.0)
40
+ diff-lcs (>= 1.1.3, < 2.0)
41
+ rspec-mocks (2.13.0)
42
+ simplecov (0.7.1)
43
+ multi_json (~> 1.0)
44
+ simplecov-html (~> 0.7.1)
45
+ simplecov-html (0.7.1)
46
+ slop (3.4.4)
47
+ thor (0.18.1)
33
48
  vcr (2.4.0)
34
49
 
35
50
  PLATFORMS
36
51
  ruby
37
52
 
38
53
  DEPENDENCIES
39
- ZenTest (~> 4.9.0)
54
+ coveralls
40
55
  logs_tf!
41
56
  pry-nav (~> 0.2.3)
42
- rspec (~> 2.12.0)
57
+ rspec (~> 2.13.0)
43
58
  vcr (~> 2.4.0)
data/README.md CHANGED
@@ -1,4 +1,36 @@
1
- Logs.tf
2
- =======
1
+ # Logs.tf interface [![Build Status](https://secure.travis-ci.org/Arie/logs_tf.png)](http://travis-ci.org/Arie/logs_tf) [![Dependencies](https://gemnasium.com/Arie/logs_tf.png)](https://gemnasium.com/Arie/logs_tf.png) [![Code Climate](https://codeclimate.com/github/Arie/logs_tf.png)](https://codeclimate.com/github/Arie/logs_tf) [![Coverage Status](https://coveralls.io/repos/Arie/logs_tf/badge.png?branch=master)](https://coveralls.io/r/Arie/logs_tf)
3
2
 
4
- Gem for the logs.tf API
3
+ A gem for the logs.tf API
4
+
5
+ ## Usage
6
+
7
+ - Get an account and API key on [logs.tf](http://logs.tf)
8
+ - Set a constant called LogsTF:API_KEY or use it as an argument in the next step
9
+ - Create a log object.
10
+
11
+ ```ruby
12
+ log = LogsTF::Log.new(File.open('logfile.log'), 'map_name', 'title', 'api_key')
13
+ ```
14
+
15
+ - Create the upload object:
16
+
17
+ ```ruby
18
+ upload = LogsTF::Upload.new(log)
19
+ ```
20
+
21
+ - If there something wrong an error will be raised which you can rescue and inspect the message of:
22
+
23
+ ```ruby
24
+ begin
25
+ upload.send
26
+ rescue Exception => e
27
+ puts "The error is #{e.message}"
28
+ end
29
+ ```
30
+
31
+ - If everthing's alright, you can get the URL to the uploaded log:
32
+
33
+ ```ruby
34
+ upload.send
35
+ upload.url
36
+ ```
@@ -42,6 +42,10 @@ module LogsTF
42
42
  raise error_class, response_body["error"]
43
43
  end
44
44
 
45
+ def error
46
+ response_body["error"]
47
+ end
48
+
45
49
  private
46
50
 
47
51
  def response_body
@@ -56,10 +60,6 @@ module LogsTF
56
60
  response.status == 200
57
61
  end
58
62
 
59
- def error
60
- response_body["error"]
61
- end
62
-
63
63
  def post_options
64
64
  { :key => api_key,
65
65
  :title => title,
@@ -1,3 +1,3 @@
1
1
  module LogsTF
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/logs_tf.gemspec CHANGED
@@ -15,10 +15,10 @@ Gem::Specification.new do |gem|
15
15
  gem.homepage = 'http://github.com/Arie/logs_tf'
16
16
 
17
17
  gem.add_dependency "faraday", "~> 0.8.0"
18
- gem.add_dependency "multipart-post", "~> 1.1.0"
18
+ gem.add_dependency "multipart-post", "~> 1.2.0"
19
19
 
20
- gem.add_development_dependency "vcr", "~> 2.4.0"
21
- gem.add_development_dependency "pry-nav", "~> 0.2.3"
22
- gem.add_development_dependency "rspec", "~> 2.12.0"
23
- gem.add_development_dependency "ZenTest", "~> 4.9.0"
20
+ gem.add_development_dependency "vcr", "~> 2.4.0"
21
+ gem.add_development_dependency 'coveralls'
22
+ gem.add_development_dependency "pry-nav", "~> 0.2.3"
23
+ gem.add_development_dependency "rspec", "~> 2.13.0"
24
24
  end
data/script/bundler ADDED
@@ -0,0 +1,10 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ echo "--- Making sure bundler is installed"
5
+
6
+ gem which bundler &> /dev/null || gem install bundler --no-ri --no-rdoc
7
+
8
+ echo "--- Installing gems"
9
+
10
+ bundle check --no-color || time bundle install --no-color
data/script/ci ADDED
@@ -0,0 +1,22 @@
1
+ run() {
2
+ time bundle exec $*
3
+ }
4
+
5
+ echo "--- Starting continuous integration build"
6
+
7
+ ./script/bundler
8
+
9
+ if [[ -d coverage ]]; then
10
+ echo "Removing old coverage report"
11
+ rm -r coverage
12
+ fi
13
+
14
+ echo "--- Running RSpec"
15
+
16
+ run rspec --color spec --format progress --format html --out rspec.html
17
+ rspec=$?
18
+
19
+ if [[ $rspec -ne 0 ]]; then
20
+ echo "--- Some tests have failed."
21
+ exit 1
22
+ fi
@@ -46,6 +46,15 @@ module LogsTF
46
46
 
47
47
  end
48
48
 
49
+ describe '#error' do
50
+ before { upload.stub(:response => stub(:body => '{ "error": "foobar" }')) }
51
+
52
+ it "parses the JSON respone from logs.tf for the error message" do
53
+ upload.error.should == 'foobar'
54
+ end
55
+
56
+ end
57
+
49
58
  describe '#raise_logs_tf_error' do
50
59
 
51
60
  before { upload.stub(:response => stub(:body => '{ "error": "foobar" }')) }
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,12 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+
4
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
5
+ SimpleCov::Formatter::HTMLFormatter,
6
+ Coveralls::SimpleCov::Formatter
7
+ ]
8
+ SimpleCov.start
9
+
1
10
  require "logs_tf"
2
11
  require "pry-nav"
3
12
  require "vcr"
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logs_tf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
4
  prerelease:
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Arie
@@ -12,101 +12,101 @@ cert_chain: []
12
12
  date: 2013-02-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
+ prerelease: false
16
+ type: :runtime
15
17
  name: faraday
16
- requirement: !ruby/object:Gem::Requirement
18
+ version_requirements: !ruby/object:Gem::Requirement
17
19
  none: false
18
20
  requirements:
19
21
  - - ~>
20
22
  - !ruby/object:Gem::Version
21
23
  version: 0.8.0
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
24
+ requirement: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: 0.8.0
30
30
  - !ruby/object:Gem::Dependency
31
+ prerelease: false
32
+ type: :runtime
31
33
  name: multipart-post
34
+ version_requirements: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ version: 1.2.0
32
40
  requirement: !ruby/object:Gem::Requirement
33
41
  none: false
34
42
  requirements:
35
43
  - - ~>
36
44
  - !ruby/object:Gem::Version
37
- version: 1.1.0
38
- type: :runtime
45
+ version: 1.2.0
46
+ - !ruby/object:Gem::Dependency
39
47
  prerelease: false
48
+ type: :development
49
+ name: vcr
40
50
  version_requirements: !ruby/object:Gem::Requirement
41
51
  none: false
42
52
  requirements:
43
53
  - - ~>
44
54
  - !ruby/object:Gem::Version
45
- version: 1.1.0
46
- - !ruby/object:Gem::Dependency
47
- name: vcr
55
+ version: 2.4.0
48
56
  requirement: !ruby/object:Gem::Requirement
49
57
  none: false
50
58
  requirements:
51
59
  - - ~>
52
60
  - !ruby/object:Gem::Version
53
61
  version: 2.4.0
54
- type: :development
62
+ - !ruby/object:Gem::Dependency
55
63
  prerelease: false
64
+ type: :development
65
+ name: coveralls
56
66
  version_requirements: !ruby/object:Gem::Requirement
57
67
  none: false
58
68
  requirements:
59
- - - ~>
69
+ - - ! '>='
60
70
  - !ruby/object:Gem::Version
61
- version: 2.4.0
62
- - !ruby/object:Gem::Dependency
63
- name: pry-nav
71
+ version: '0'
64
72
  requirement: !ruby/object:Gem::Requirement
65
73
  none: false
66
74
  requirements:
67
- - - ~>
75
+ - - ! '>='
68
76
  - !ruby/object:Gem::Version
69
- version: 0.2.3
70
- type: :development
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
71
79
  prerelease: false
80
+ type: :development
81
+ name: pry-nav
72
82
  version_requirements: !ruby/object:Gem::Requirement
73
83
  none: false
74
84
  requirements:
75
85
  - - ~>
76
86
  - !ruby/object:Gem::Version
77
87
  version: 0.2.3
78
- - !ruby/object:Gem::Dependency
79
- name: rspec
80
88
  requirement: !ruby/object:Gem::Requirement
81
89
  none: false
82
90
  requirements:
83
91
  - - ~>
84
92
  - !ruby/object:Gem::Version
85
- version: 2.12.0
86
- type: :development
93
+ version: 0.2.3
94
+ - !ruby/object:Gem::Dependency
87
95
  prerelease: false
96
+ type: :development
97
+ name: rspec
88
98
  version_requirements: !ruby/object:Gem::Requirement
89
99
  none: false
90
100
  requirements:
91
101
  - - ~>
92
102
  - !ruby/object:Gem::Version
93
- version: 2.12.0
94
- - !ruby/object:Gem::Dependency
95
- name: ZenTest
103
+ version: 2.13.0
96
104
  requirement: !ruby/object:Gem::Requirement
97
105
  none: false
98
106
  requirements:
99
107
  - - ~>
100
108
  - !ruby/object:Gem::Version
101
- version: 4.9.0
102
- type: :development
103
- prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ~>
108
- - !ruby/object:Gem::Version
109
- version: 4.9.0
109
+ version: 2.13.0
110
110
  description: A gem to interface with the logs.tf API
111
111
  email: rubygems@ariekanarie.nl
112
112
  executables: []
@@ -114,8 +114,10 @@ extensions: []
114
114
  extra_rdoc_files: []
115
115
  files:
116
116
  - .autotest
117
+ - .coverage
117
118
  - .gitignore
118
119
  - .rspec
120
+ - .travis.yml
119
121
  - Gemfile
120
122
  - Gemfile.lock
121
123
  - README.md
@@ -124,6 +126,8 @@ files:
124
126
  - lib/logs_tf/upload.rb
125
127
  - lib/logs_tf/version.rb
126
128
  - logs_tf.gemspec
129
+ - script/bundler
130
+ - script/ci
127
131
  - spec/fixtures/logs/broder_vs_epsilon.log
128
132
  - spec/fixtures/logs/broken_log.log
129
133
  - spec/fixtures/vcr/upload.yml