dougsko-imagebin 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +14 -0
- data/README.rdoc +16 -0
- data/Rakefile +49 -0
- data/VERSION.yml +4 -0
- data/bin/imagebin +72 -0
- data/spec/imagebin_spec.rb +7 -0
- data/spec/spec_helper.rb +9 -0
- metadata +70 -0
data/LICENSE
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# Copyright (C) 2009 dougsko
|
2
|
+
#
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
data/README.rdoc
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
= imagebin
|
2
|
+
|
3
|
+
imagebin.rb is a CLI to http://imagebin.ca
|
4
|
+
Example: ./imagebin.rb -f <pic.png>
|
5
|
+
|
6
|
+
Options:
|
7
|
+
-f, --file <file> Use a file for input
|
8
|
+
-n, --name [name] Name
|
9
|
+
-t, --tags [tags] Comma separated
|
10
|
+
-d, --description [description] Description
|
11
|
+
-p, --private Private
|
12
|
+
-h, --help Show this message
|
13
|
+
|
14
|
+
== Copyright
|
15
|
+
|
16
|
+
Copyright (c) 2009 dougsko. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "imagebin"
|
8
|
+
gem.summary = %Q{TODO}
|
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 imagebin.ca'
|
14
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
+
end
|
16
|
+
rescue LoadError
|
17
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'spec/rake/spectask'
|
21
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
22
|
+
spec.libs << 'lib' << 'spec'
|
23
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
24
|
+
end
|
25
|
+
|
26
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
27
|
+
spec.libs << 'lib' << 'spec'
|
28
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
29
|
+
spec.rcov = true
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
task :default => :spec
|
34
|
+
|
35
|
+
require 'rake/rdoctask'
|
36
|
+
Rake::RDocTask.new do |rdoc|
|
37
|
+
if File.exist?('VERSION.yml')
|
38
|
+
config = YAML.load(File.read('VERSION.yml'))
|
39
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
40
|
+
else
|
41
|
+
version = ""
|
42
|
+
end
|
43
|
+
|
44
|
+
rdoc.rdoc_dir = 'rdoc'
|
45
|
+
rdoc.title = "imagebin #{version}"
|
46
|
+
rdoc.rdoc_files.include('README*')
|
47
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
48
|
+
end
|
49
|
+
|
data/VERSION.yml
ADDED
data/bin/imagebin
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
#
|
4
|
+
# CLI to imagebin.ca
|
5
|
+
#
|
6
|
+
# Copyright (C) 2009 dougsko
|
7
|
+
#
|
8
|
+
# This program is free software: you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation, either version 3 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# This program is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20
|
+
#
|
21
|
+
|
22
|
+
require 'rubygems'
|
23
|
+
require 'optparse'
|
24
|
+
require 'httpclient'
|
25
|
+
|
26
|
+
options = { "t" => "file",
|
27
|
+
"name" => "",
|
28
|
+
"tags" => "",
|
29
|
+
"description" => "",
|
30
|
+
"adult" => "f",
|
31
|
+
}
|
32
|
+
|
33
|
+
opts = OptionParser.new do |opts|
|
34
|
+
opts.banner = "imagebin.rb is a CLI to http://imagebin.ca
|
35
|
+
Example: ./imagebin.rb -f <pic.png>"
|
36
|
+
|
37
|
+
opts.separator ""
|
38
|
+
opts.separator "Options:"
|
39
|
+
|
40
|
+
opts.on("-f <file>", "--file <file>", String, "Use a file for input") do |file|
|
41
|
+
options[:f] = file
|
42
|
+
end
|
43
|
+
|
44
|
+
opts.on("-n [name]", "--name [name]", String, "Name") do |n|
|
45
|
+
options[:name] = n
|
46
|
+
end
|
47
|
+
|
48
|
+
opts.on("-t [tags]", "--tags [tags]", String, "Comma separated") do |tags|
|
49
|
+
options[:tags] = tags
|
50
|
+
end
|
51
|
+
|
52
|
+
opts.on("-d [description]", "--description [description]", String, "Description") do |desc|
|
53
|
+
options[:description] = desc
|
54
|
+
end
|
55
|
+
|
56
|
+
opts.on("-p", "--private", "Private") do |priv|
|
57
|
+
options[:adult] = "priv"
|
58
|
+
end
|
59
|
+
|
60
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
61
|
+
puts opts
|
62
|
+
exit
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
opts.parse(ARGV)
|
67
|
+
|
68
|
+
clnt = HTTPClient.new("http://imagebin.ca/upload.php")
|
69
|
+
File.open(options[:f]) do |file|
|
70
|
+
options[:f] = file
|
71
|
+
puts clnt.post('http://imagebin.ca/upload.php', options).content.match(/http.+?\.html/)
|
72
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dougsko-imagebin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- dougsko
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-06-20 00:00:00 -07:00
|
13
|
+
default_executable: imagebin
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: httpclient
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
description: Command line interface to imagebin.ca
|
26
|
+
email: dougtko@gmail.com
|
27
|
+
executables:
|
28
|
+
- imagebin
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- LICENSE
|
33
|
+
- README.rdoc
|
34
|
+
files:
|
35
|
+
- LICENSE
|
36
|
+
- README.rdoc
|
37
|
+
- Rakefile
|
38
|
+
- VERSION.yml
|
39
|
+
- bin/imagebin
|
40
|
+
- spec/imagebin_spec.rb
|
41
|
+
- spec/spec_helper.rb
|
42
|
+
has_rdoc: true
|
43
|
+
homepage: http://github.com/dougsko/imagebin
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options:
|
46
|
+
- --charset=UTF-8
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: "0"
|
54
|
+
version:
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: "0"
|
60
|
+
version:
|
61
|
+
requirements: []
|
62
|
+
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 1.2.0
|
65
|
+
signing_key:
|
66
|
+
specification_version: 3
|
67
|
+
summary: TODO
|
68
|
+
test_files:
|
69
|
+
- spec/spec_helper.rb
|
70
|
+
- spec/imagebin_spec.rb
|