pastebin 1.1.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -7,8 +7,8 @@ source "http://rubygems.org"
7
7
  # Include everything needed to run rake, tests, features, etc.
8
8
 
9
9
  group :development do
10
- gem "rspec", "~> 2.1.0"
11
- gem "bundler", "~> 1.0.0"
12
- gem "jeweler", "~> 1.5.1"
13
- gem "rcov", ">= 0"
10
+ gem "rspec"
11
+ gem "bundler"
12
+ gem "jeweler"
13
+ gem "rcov"
14
14
  end
@@ -1,28 +1,28 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- diff-lcs (1.1.2)
4
+ diff-lcs (1.1.3)
5
5
  git (1.2.5)
6
- jeweler (1.5.1)
7
- bundler (~> 1.0.0)
6
+ jeweler (1.6.4)
7
+ bundler (~> 1.0)
8
8
  git (>= 1.2.5)
9
9
  rake
10
- rake (0.8.7)
11
- rcov (0.9.9)
12
- rspec (2.1.0)
13
- rspec-core (~> 2.1.0)
14
- rspec-expectations (~> 2.1.0)
15
- rspec-mocks (~> 2.1.0)
16
- rspec-core (2.1.0)
17
- rspec-expectations (2.1.0)
10
+ rake (0.9.2.2)
11
+ rcov (0.9.11)
12
+ rspec (2.7.0)
13
+ rspec-core (~> 2.7.0)
14
+ rspec-expectations (~> 2.7.0)
15
+ rspec-mocks (~> 2.7.0)
16
+ rspec-core (2.7.1)
17
+ rspec-expectations (2.7.0)
18
18
  diff-lcs (~> 1.1.2)
19
- rspec-mocks (2.1.0)
19
+ rspec-mocks (2.7.0)
20
20
 
21
21
  PLATFORMS
22
22
  ruby
23
23
 
24
24
  DEPENDENCIES
25
- bundler (~> 1.0.0)
26
- jeweler (~> 1.5.1)
25
+ bundler
26
+ jeweler
27
27
  rcov
28
- rspec (~> 2.1.0)
28
+ rspec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 2.0.0
@@ -6,7 +6,6 @@
6
6
  # Copyright (C) 2010 Doug Prostko
7
7
  #
8
8
 
9
- require 'rubygems'
10
9
  require 'optparse'
11
10
  require 'pastebin'
12
11
 
@@ -23,17 +22,17 @@ opts = OptionParser.new do |opts|
23
22
 
24
23
  opts.on("-f <file>", "--file <file>", String,
25
24
  "Use a file for input, use \"-\" for STDIN") do |f|
26
- options["paste_code"] = f
25
+ options["api_paste_code"] = f
27
26
  end
28
27
 
29
28
  opts.on("-n", "--name <name>", String,
30
29
  "Assign a name/title to your paste") do |n|
31
- options["paste_name"] = n
30
+ options["api_paste_name"] = n
32
31
  end
33
32
 
34
33
  opts.on("-s", "--subdomain <subdomain>", String,
35
34
  "Paste to a specific subdomain") do |s|
36
- options["paste_subdomain"] = s
35
+ options["api_paste_subdomain"] = s
37
36
  end
38
37
 
39
38
  opts.on("-r", "--raw <link>", String,
@@ -50,7 +49,7 @@ opts = OptionParser.new do |opts|
50
49
  ]
51
50
  expire_list = expire_array.join(", ")
52
51
  opts.on("-e", "--expire <time>", expire_array, "These can be abbriviated, as long as they are unambigous. Defaults to '1 Month'", "#{expire_list}" ) do |e|
53
- options["paste_expire_date"] = e
52
+ options["api_paste_expire_date"] = e
54
53
  end
55
54
 
56
55
  syntax_array = [ 'perl',
@@ -69,11 +68,11 @@ opts = OptionParser.new do |opts|
69
68
 
70
69
  code_list = syntax_array.join(", ")
71
70
  opts.on("-l", "--language <syntax>", syntax_array, "Syntax types can be abbriviated, as long as they are unambigous. There are many more supported languages than what is listed here. Defaults to 'text'", " #{code_list}") do |encoding|
72
- options["paste_format"] = encoding
71
+ options["api_paste_format"] = encoding
73
72
  end
74
73
 
75
74
  opts.on("-p", "--private", "Make paste private.") do
76
- options["paste_private"] = "1"
75
+ options["api_paste_private"] = "1"
77
76
  end
78
77
 
79
78
  opts.on_tail("-h", "--help", "Show this message") do
@@ -9,10 +9,13 @@ require 'rexml/document'
9
9
  class Pastebin
10
10
  include REXML
11
11
 
12
+ DEVKEY = "01fe34146583c731f3725fd8dde3992c"
13
+
12
14
  # The only option required is 'paste_code', which holds your string.
13
15
  #
14
16
  def initialize(options)
15
17
  @options = options
18
+ @options["api_dev_key"] = DEVKEY
16
19
  end
17
20
 
18
21
  # This POSTs the paste and returns the link
@@ -20,19 +23,20 @@ class Pastebin
20
23
  # pbin.paste #=> "http://pastebin.com/xxxxxxx"
21
24
  #
22
25
  def paste
23
- if @options.has_key?("paste_code")
24
- if @options["paste_code"] == "-"
25
- @options["paste_code"] = $stdin.read
26
+ if @options.has_key?("api_paste_code")
27
+ if @options["api_paste_code"] == "-"
28
+ @options["api_paste_code"] = $stdin.read
26
29
  else
27
- File.open(@options["paste_code"]) do |file|
28
- @options["paste_code"] = file.read
30
+ File.open(@options["api_paste_code"]) do |file|
31
+ @options["api_paste_code"] = file.read
29
32
  end
30
33
  end
31
34
  #else
32
35
  # puts "You must specify a file or '-' for STDIN"
33
36
  # exit
34
37
  end
35
- Net::HTTP.post_form(URI.parse('http://pastebin.com/api_public.php'),
38
+ @options["api_option"] = "paste"
39
+ Net::HTTP.post_form(URI.parse('http://pastebin.com/api/api_post.php'),
36
40
  @options).body
37
41
  end
38
42
 
@@ -0,0 +1,61 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "pastebin"
8
+ s.version = "2.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["dougsko"]
12
+ s.date = "2012-08-10"
13
+ s.description = "CLI tool and library to work with pastebin.com"
14
+ s.email = "dougtko@gmail.com"
15
+ s.executables = ["pastebin"]
16
+ s.extra_rdoc_files = [
17
+ "LICENSE.txt",
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "bin/pastebin",
29
+ "lib/pastebin.rb",
30
+ "pastebin.gemspec",
31
+ "spec/pastebin_spec.rb",
32
+ "spec/spec_helper.rb"
33
+ ]
34
+ s.homepage = "http://github.com/dougsko/pastebin"
35
+ s.licenses = ["MIT"]
36
+ s.require_paths = ["lib"]
37
+ s.rubygems_version = "1.8.10"
38
+ s.summary = "CLI tool and library to work with pastebin.com"
39
+
40
+ if s.respond_to? :specification_version then
41
+ s.specification_version = 3
42
+
43
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
44
+ s.add_development_dependency(%q<rspec>, [">= 0"])
45
+ s.add_development_dependency(%q<bundler>, [">= 0"])
46
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
47
+ s.add_development_dependency(%q<rcov>, [">= 0"])
48
+ else
49
+ s.add_dependency(%q<rspec>, [">= 0"])
50
+ s.add_dependency(%q<bundler>, [">= 0"])
51
+ s.add_dependency(%q<jeweler>, [">= 0"])
52
+ s.add_dependency(%q<rcov>, [">= 0"])
53
+ end
54
+ else
55
+ s.add_dependency(%q<rspec>, [">= 0"])
56
+ s.add_dependency(%q<bundler>, [">= 0"])
57
+ s.add_dependency(%q<jeweler>, [">= 0"])
58
+ s.add_dependency(%q<rcov>, [">= 0"])
59
+ end
60
+ end
61
+
metadata CHANGED
@@ -1,95 +1,69 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: pastebin
3
- version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 1
9
- - 0
10
- version: 1.1.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - dougsko
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-02-17 00:00:00 -05:00
19
- default_executable: pastebin
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2012-08-10 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: rspec
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &76750680 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 11
30
- segments:
31
- - 2
32
- - 1
33
- - 0
34
- version: 2.1.0
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
35
22
  type: :development
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: bundler
39
23
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *76750680
25
+ - !ruby/object:Gem::Dependency
26
+ name: bundler
27
+ requirement: &76750420 !ruby/object:Gem::Requirement
41
28
  none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- hash: 23
46
- segments:
47
- - 1
48
- - 0
49
- - 0
50
- version: 1.0.0
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
51
33
  type: :development
52
- version_requirements: *id002
53
- - !ruby/object:Gem::Dependency
54
- name: jeweler
55
34
  prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *76750420
36
+ - !ruby/object:Gem::Dependency
37
+ name: jeweler
38
+ requirement: &76750180 !ruby/object:Gem::Requirement
57
39
  none: false
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- hash: 1
62
- segments:
63
- - 1
64
- - 5
65
- - 1
66
- version: 1.5.1
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
67
44
  type: :development
68
- version_requirements: *id003
69
- - !ruby/object:Gem::Dependency
70
- name: rcov
71
45
  prerelease: false
72
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *76750180
47
+ - !ruby/object:Gem::Dependency
48
+ name: rcov
49
+ requirement: &76749940 !ruby/object:Gem::Requirement
73
50
  none: false
74
- requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- hash: 3
78
- segments:
79
- - 0
80
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
81
55
  type: :development
82
- version_requirements: *id004
56
+ prerelease: false
57
+ version_requirements: *76749940
83
58
  description: CLI tool and library to work with pastebin.com
84
59
  email: dougtko@gmail.com
85
- executables:
60
+ executables:
86
61
  - pastebin
87
62
  extensions: []
88
-
89
- extra_rdoc_files:
63
+ extra_rdoc_files:
90
64
  - LICENSE.txt
91
65
  - README.rdoc
92
- files:
66
+ files:
93
67
  - .document
94
68
  - Gemfile
95
69
  - Gemfile.lock
@@ -99,42 +73,35 @@ files:
99
73
  - VERSION
100
74
  - bin/pastebin
101
75
  - lib/pastebin.rb
76
+ - pastebin.gemspec
102
77
  - spec/pastebin_spec.rb
103
78
  - spec/spec_helper.rb
104
- has_rdoc: true
105
79
  homepage: http://github.com/dougsko/pastebin
106
- licenses:
80
+ licenses:
107
81
  - MIT
108
82
  post_install_message:
109
83
  rdoc_options: []
110
-
111
- require_paths:
84
+ require_paths:
112
85
  - lib
113
- required_ruby_version: !ruby/object:Gem::Requirement
86
+ required_ruby_version: !ruby/object:Gem::Requirement
114
87
  none: false
115
- requirements:
116
- - - ">="
117
- - !ruby/object:Gem::Version
118
- hash: 3
119
- segments:
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ segments:
120
93
  - 0
121
- version: "0"
122
- required_rubygems_version: !ruby/object:Gem::Requirement
94
+ hash: 590796271
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
123
96
  none: false
124
- requirements:
125
- - - ">="
126
- - !ruby/object:Gem::Version
127
- hash: 3
128
- segments:
129
- - 0
130
- version: "0"
97
+ requirements:
98
+ - - ! '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
131
101
  requirements: []
132
-
133
102
  rubyforge_project:
134
- rubygems_version: 1.3.7
103
+ rubygems_version: 1.8.10
135
104
  signing_key:
136
105
  specification_version: 3
137
106
  summary: CLI tool and library to work with pastebin.com
138
- test_files:
139
- - spec/pastebin_spec.rb
140
- - spec/spec_helper.rb
107
+ test_files: []