imagebin 1.0.2 → 1.0.3

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.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+
9
+ gem "httpclient"
10
+
11
+ group :development do
12
+ gem "rspec", "~> 2.1.0"
13
+ gem "bundler", "~> 1.0.0"
14
+ gem "jeweler", "~> 1.5.1"
15
+ gem "rcov", ">= 0"
16
+ end
@@ -12,8 +12,8 @@ Options:
12
12
 
13
13
  Here is an example of what ~/.imgur.yaml should look like:
14
14
 
15
- ---
16
- key: 543e908c545620bd1c44d43edf3a35a0
15
+ ---
16
+ key: 543e908c545620bd1c44d43edf3a35a0
17
17
 
18
18
 
19
19
  == Copyright
data/Rakefile CHANGED
@@ -1,60 +1,50 @@
1
1
  require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
2
10
  require 'rake'
3
11
 
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "imagebin"
8
- gem.summary = %Q{Command line interface to imgur.com}
9
- gem.email = "dougtko@gmail.com"
10
- gem.homepage = "http://github.com/dougsko/imagebin"
11
- gem.authors = ["dougsko"]
12
- gem.add_dependency 'httpclient'
13
- gem.description = 'Command line interface to imgur.com'
14
- gem.require_paths = ['/bin', '/lib']
15
- gem.files = FileList["[A-Z]*", "{bin,generators,lib,spec}/**/*"]
16
- gem.add_dependency "hpricot"
17
- gem.add_dependency "httpclient"
18
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
19
- end
20
- rescue LoadError
21
- puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
+ gem.name = "imagebin"
16
+ gem.homepage = "http://github.com/dougsko/imagebin"
17
+ gem.license = "MIT"
18
+ gem.summary = %Q{CLI tool and library to work with imgur.com}
19
+ gem.description = %Q{CLI tool and library to work with imgur.com}
20
+ gem.email = "dougtko@gmail.com"
21
+ gem.authors = ["dougsko"]
22
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
23
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
25
+ # gem.add_development_dependency 'rspec', '> 1.2.3'
22
26
  end
27
+ Jeweler::RubygemsDotOrgTasks.new
23
28
 
24
- require 'spec/rake/spectask'
25
- Spec::Rake::SpecTask.new(:spec) do |spec|
26
- spec.libs << 'lib' << 'spec'
27
- spec.spec_files = FileList['spec/**/*_spec.rb']
28
- spec.spec_opts = ['--color']
29
+ require 'rspec/core'
30
+ require 'rspec/core/rake_task'
31
+ RSpec::Core::RakeTask.new(:spec) do |spec|
32
+ spec.pattern = FileList['spec/**/*_spec.rb']
29
33
  end
30
34
 
31
- Spec::Rake::SpecTask.new(:rcov) do |spec|
32
- spec.libs << 'lib' << 'spec'
35
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
33
36
  spec.pattern = 'spec/**/*_spec.rb'
34
37
  spec.rcov = true
35
- spec.spec_opts = ['--color']
36
38
  end
37
39
 
38
-
39
40
  task :default => :spec
40
41
 
41
42
  require 'rake/rdoctask'
42
- #require 'darkfish-rdoc'
43
43
  Rake::RDocTask.new do |rdoc|
44
- if File.exist?('VERSION.yml')
45
- config = YAML.load(File.read('VERSION.yml'))
46
- version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
47
- else
48
- version = ""
49
- end
44
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
50
45
 
51
46
  rdoc.rdoc_dir = 'rdoc'
52
- rdoc.title = "imagebin #{version}"
47
+ rdoc.title = "pastebin #{version}"
53
48
  rdoc.rdoc_files.include('README*')
54
49
  rdoc.rdoc_files.include('lib/**/*.rb')
55
- rdoc.options += [
56
- '-N',
57
- # '-f', 'darkfish',
58
- ]
59
50
  end
60
-
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :minor: 0
3
- :patch: 2
3
+ :patch: 3
4
4
  :build:
5
5
  :major: 1
@@ -2,52 +2,51 @@
2
2
  #
3
3
  # imgur.com API
4
4
  #
5
-
6
5
  require 'rubygems'
7
6
  require 'httpclient'
8
- require 'hpricot'
7
+ require 'rexml/document'
9
8
 
10
9
  class Imagebin
10
+ include REXML
11
+
11
12
  def initialize(options)
12
13
  @options = { "image" => "file",
13
14
  "key" => "api_key",
14
15
  }
15
16
  @options.merge!(options)
16
- File.open(@options["image"]) do |file|
17
- @options["image"] = file
18
- clnt = HTTPClient.new
19
- res = clnt.post('http://imgur.com/api/upload.xml', @options).content
20
- @doc = Hpricot(res)
21
- raise @doc.at('error_msg').innerHTML if @doc.at('error_msg') != nil
22
- end
17
+ res = HTTPClient.post('http://imgur.com/api/upload.xml',
18
+ {:image => File.open(@options['image']),
19
+ :key => @options['key']}).content
20
+ @doc = Document.new(res)
21
+ raise @doc.elements.to_a("//error_msg")[0].text if @doc.elements.to_a("//error_msg").length > 0
23
22
  end
24
23
 
25
24
  def image_hash
26
- @doc.at('image_hash').innerHTML
25
+ @doc.elements.to_a("//image_hash")[0].text
27
26
  end
28
27
 
29
28
  def delete_hash
30
- @doc.at('delete_hash').innerHTML
29
+ @doc.elements.to_a("//delete_hash")[0].text
31
30
  end
32
31
 
33
32
  def original_image
34
- @doc.at("original_image").innerHTML
33
+ @doc.elements.to_a("//original_image")[0].text
35
34
  end
36
35
 
37
36
  def large_thumbnail
38
- @doc.at('large_thumbnail').innerHTML
37
+ @doc.elements.to_a("//large_thumbnail")[0].text
39
38
  end
40
39
 
41
40
  def small_thumbnail
42
- @doc.at('small_thumbnail').innerHTML
41
+ @doc.elements.to_a("//small_thumbnail")[0].text
43
42
  end
44
43
 
45
44
  def imgur_page
46
- @doc.at('imgur_page').innerHTML
45
+ @doc.elements.to_a("//imgur_page")[0].text
47
46
  end
48
47
 
49
48
  def delete_page
50
- @doc.at('delete_page').innerHTML
49
+ @doc.elements.to_a("//delete_page")[0].text
51
50
  end
52
51
 
53
52
  end
@@ -1,4 +1,5 @@
1
- require 'spec_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+ require 'imagebin'
2
3
 
3
4
  describe "Imagebin" do
4
5
  before do
@@ -1,9 +1,12 @@
1
- require 'spec'
2
-
3
- $LOAD_PATH.unshift(File.dirname(__FILE__))
4
1
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
5
4
  require 'imagebin'
6
5
 
7
- Spec::Runner.configure do |config|
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
8
11
 
9
12
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imagebin
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 2
10
- version: 1.0.2
9
+ - 3
10
+ version: 1.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - dougsko
@@ -15,13 +15,13 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-09 00:00:00 -04:00
18
+ date: 2011-02-17 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: httpclient
23
22
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
23
+ name: httpclient
24
+ version_requirements: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
27
  - - ">="
@@ -30,26 +30,60 @@ dependencies:
30
30
  segments:
31
31
  - 0
32
32
  version: "0"
33
+ requirement: *id001
33
34
  type: :runtime
34
- version_requirements: *id001
35
35
  - !ruby/object:Gem::Dependency
36
- name: hpricot
37
36
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
37
+ name: rspec
38
+ version_requirements: &id002 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
- - - ">="
41
+ - - ~>
42
42
  - !ruby/object:Gem::Version
43
- hash: 3
43
+ hash: 11
44
44
  segments:
45
+ - 2
46
+ - 1
45
47
  - 0
46
- version: "0"
47
- type: :runtime
48
- version_requirements: *id002
48
+ version: 2.1.0
49
+ requirement: *id002
50
+ type: :development
51
+ - !ruby/object:Gem::Dependency
52
+ prerelease: false
53
+ name: bundler
54
+ version_requirements: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ~>
58
+ - !ruby/object:Gem::Version
59
+ hash: 23
60
+ segments:
61
+ - 1
62
+ - 0
63
+ - 0
64
+ version: 1.0.0
65
+ requirement: *id003
66
+ type: :development
49
67
  - !ruby/object:Gem::Dependency
50
- name: httpclient
51
68
  prerelease: false
52
- requirement: &id003 !ruby/object:Gem::Requirement
69
+ name: jeweler
70
+ version_requirements: &id004 !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ hash: 1
76
+ segments:
77
+ - 1
78
+ - 5
79
+ - 1
80
+ version: 1.5.1
81
+ requirement: *id004
82
+ type: :development
83
+ - !ruby/object:Gem::Dependency
84
+ prerelease: false
85
+ name: rcov
86
+ version_requirements: &id005 !ruby/object:Gem::Requirement
53
87
  none: false
54
88
  requirements:
55
89
  - - ">="
@@ -58,19 +92,21 @@ dependencies:
58
92
  segments:
59
93
  - 0
60
94
  version: "0"
61
- type: :runtime
62
- version_requirements: *id003
63
- description: Command line interface to imgur.com
95
+ requirement: *id005
96
+ type: :development
97
+ description: CLI tool and library to work with imgur.com
64
98
  email: dougtko@gmail.com
65
99
  executables:
66
- - take-screenshot
67
100
  - imagebin
101
+ - take-screenshot
68
102
  extensions: []
69
103
 
70
104
  extra_rdoc_files:
71
105
  - LICENSE
72
106
  - README.rdoc
73
107
  files:
108
+ - .document
109
+ - Gemfile
74
110
  - LICENSE
75
111
  - README.rdoc
76
112
  - Rakefile
@@ -83,14 +119,13 @@ files:
83
119
  - spec/spec_helper.rb
84
120
  has_rdoc: true
85
121
  homepage: http://github.com/dougsko/imagebin
86
- licenses: []
87
-
122
+ licenses:
123
+ - MIT
88
124
  post_install_message:
89
- rdoc_options:
90
- - --charset=UTF-8
125
+ rdoc_options: []
126
+
91
127
  require_paths:
92
- - /bin
93
- - /lib
128
+ - lib
94
129
  required_ruby_version: !ruby/object:Gem::Requirement
95
130
  none: false
96
131
  requirements:
@@ -115,7 +150,7 @@ rubyforge_project:
115
150
  rubygems_version: 1.3.7
116
151
  signing_key:
117
152
  specification_version: 3
118
- summary: Command line interface to imgur.com
153
+ summary: CLI tool and library to work with imgur.com
119
154
  test_files:
120
155
  - spec/imagebin_spec.rb
121
156
  - spec/spec_helper.rb