pastebin 2.0.2 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ed7929ee23484ea60bfdc8ed08b1a6081eb053f7
4
+ data.tar.gz: 476e5349e464740942d714451492502102b470ec
5
+ SHA512:
6
+ metadata.gz: 0760af8371a272d1ca099b13003ebd75ef5f44bc2969a0d9a3bf73dd4f7ed21c1ffc025bf1853f96f45cacbfb3b8117c357cc4b3fb6d625fb4b53105437dd5ad
7
+ data.tar.gz: 5b16f98cd96e77a3cb8530305ae8258ba40a97e068d6414d52274cd1cbd90fec5383f60751369d521e9dee8e16017359fe744890bef182c4688e088701f1d05c
@@ -0,0 +1,6 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
6
+ .rspec_status
data/Gemfile CHANGED
@@ -1,14 +1,4 @@
1
- source "http://rubygems.org"
2
- # Add dependencies required to use your gem here.
3
- # Example:
4
- # gem "activesupport", ">= 2.3.5"
1
+ source "https://rubygems.org"
5
2
 
6
- # Add dependencies to develop your gem here.
7
- # Include everything needed to run rake, tests, features, etc.
8
-
9
- group :development do
10
- gem "rspec"
11
- gem "bundler"
12
- gem "jeweler"
13
- gem "rcov"
14
- end
3
+ # Specify your gem's dependencies in pastebin.gemspec
4
+ gemspec
@@ -1,28 +1,35 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ pastebin (2.1.0)
5
+
1
6
  GEM
2
- remote: http://rubygems.org/
7
+ remote: https://rubygems.org/
3
8
  specs:
4
- diff-lcs (1.1.3)
5
- git (1.2.5)
6
- jeweler (1.6.4)
7
- bundler (~> 1.0)
8
- git (>= 1.2.5)
9
- rake
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
- diff-lcs (~> 1.1.2)
19
- rspec-mocks (2.7.0)
9
+ diff-lcs (1.3)
10
+ rake (10.5.0)
11
+ rspec (3.6.0)
12
+ rspec-core (~> 3.6.0)
13
+ rspec-expectations (~> 3.6.0)
14
+ rspec-mocks (~> 3.6.0)
15
+ rspec-core (3.6.0)
16
+ rspec-support (~> 3.6.0)
17
+ rspec-expectations (3.6.0)
18
+ diff-lcs (>= 1.2.0, < 2.0)
19
+ rspec-support (~> 3.6.0)
20
+ rspec-mocks (3.6.0)
21
+ diff-lcs (>= 1.2.0, < 2.0)
22
+ rspec-support (~> 3.6.0)
23
+ rspec-support (3.6.0)
20
24
 
21
25
  PLATFORMS
22
26
  ruby
23
27
 
24
28
  DEPENDENCIES
25
- bundler
26
- jeweler
27
- rcov
28
- rspec
29
+ bundler (~> 1.15)
30
+ pastebin!
31
+ rake (~> 10.0)
32
+ rspec (~> 3.0)
33
+
34
+ BUNDLED WITH
35
+ 1.15.1
@@ -0,0 +1,23 @@
1
+ = pastebin
2
+
3
+ pastebin is a CLI to http://pastebin.com
4
+ Usage: pastebin [options]
5
+ Examples: pastebin -f foo.rb -t ruby -e '10 Minutes'
6
+ cat foo.pl | pastebin -f - -t perl
7
+
8
+ Options:
9
+ -f, --file <file> Use a file for input, use "-" for STDIN
10
+ -n, --name <name> Assign a name/title to your paste
11
+ -s, --subdomain <subdomain> Paste to a specific subdomain
12
+ -r, --raw <link> Return raw text from a paste link
13
+ -e, --expire <time> These can be abbriviated, as long as they are unambigous. Defaults to '1 Month'
14
+ Never, 10 Minutes, 1 Hour, 1 Day, 1 Month
15
+ -l, --language <syntax> 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'
16
+ perl, python, c, ruby, bash, cpp, groovy, latex, java, php, sql, xml
17
+ -p, --private Make paste private.
18
+ -h, --help Show this message
19
+
20
+
21
+ == Copyright
22
+
23
+ Copyright (c) 2010 dougsko. See LICENSE for details.
data/Rakefile CHANGED
@@ -1,50 +1,6 @@
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
10
- require 'rake'
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
11
3
 
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 = "pastebin"
16
- gem.homepage = "http://github.com/dougsko/pastebin"
17
- gem.license = "MIT"
18
- gem.summary = %Q{CLI tool and library to work with pastebin.com}
19
- gem.description = %Q{CLI tool and library to work with pastebin.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'
26
- end
27
- Jeweler::RubygemsDotOrgTasks.new
28
-
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']
33
- end
34
-
35
- RSpec::Core::RakeTask.new(:rcov) do |spec|
36
- spec.pattern = 'spec/**/*_spec.rb'
37
- spec.rcov = true
38
- end
4
+ RSpec::Core::RakeTask.new(:spec)
39
5
 
40
6
  task :default => :spec
41
-
42
- require 'rake/rdoctask'
43
- Rake::RDocTask.new do |rdoc|
44
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
45
-
46
- rdoc.rdoc_dir = 'rdoc'
47
- rdoc.title = "pastebin #{version}"
48
- rdoc.rdoc_files.include('README*')
49
- rdoc.rdoc_files.include('lib/**/*.rb')
50
- end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "pastebin"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -6,8 +6,9 @@
6
6
  # Copyright (C) 2010 Doug Prostko
7
7
  #
8
8
 
9
+ require "bundler/setup"
10
+ require "pastebin"
9
11
  require 'optparse'
10
- require 'pastebin'
11
12
 
12
13
  # set up all the options stuff
13
14
  options = {}
@@ -85,6 +86,7 @@ end
85
86
  opts.parse(ARGV)
86
87
 
87
88
  pbin = Pastebin.new(options)
89
+ puts 'options = ' + options.inspect
88
90
  if options["raw"]
89
91
  puts pbin.get_raw(options["raw"])
90
92
  else
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -1,14 +1,9 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # Class to work with http://pastebin.com
4
- #
1
+ require "pastebin/version"
5
2
  require 'net/http'
6
- require 'uri'
7
- require 'rexml/document'
8
3
 
9
4
  class Pastebin
10
- include REXML
11
5
 
6
+ BASE_URL = "https://pastebin.com"
12
7
  DEVKEY = "01fe34146583c731f3725fd8dde3992c"
13
8
 
14
9
  # The only option required is 'paste_code', which holds your string.
@@ -20,7 +15,7 @@ class Pastebin
20
15
 
21
16
  # This POSTs the paste and returns the link
22
17
  #
23
- # pbin.paste #=> "http://pastebin.com/xxxxxxx"
18
+ # pbin.paste #=> "https://pastebin.com/xxxxxxx"
24
19
  #
25
20
  def paste
26
21
  if @options.has_key?("api_paste_code")
@@ -31,21 +26,20 @@ class Pastebin
31
26
  @options["api_paste_code"] = file.read
32
27
  end
33
28
  end
34
- #else
35
- # puts "You must specify a file or '-' for STDIN"
36
- # exit
29
+ #else
30
+ # puts "You must specify a file or '-' for STDIN"
31
+ # exit
37
32
  end
38
33
  @options["api_option"] = "paste"
39
- Net::HTTP.post_form(URI.parse('http://pastebin.com/api/api_post.php'),
40
- @options).body
34
+ Net::HTTP.post_form(URI.parse("#{BASE_URL}/api/api_post.php"), @options).body
41
35
  end
42
36
 
43
37
  # This method takes a link from a previous paste and returns the raw
44
38
  # text.
45
39
  #
46
- # pbin.get_raw("http://pastebin.com/xxxxxxx") #=> "some text"
40
+ # pbin.get_raw("https://pastebin.com/xxxxxxx") #=> "some text"
47
41
  #
48
42
  def get_raw(link)
49
- Net::HTTP.get_response(URI.parse("http://pastebin.com/raw.php?i=#{link[/[\w\d]+$/]}")).body
43
+ Net::HTTP.get_response(URI.parse("#{BASE_URL}/raw/#{link[/[\w\d]+$/]}")).body
50
44
  end
51
45
  end
@@ -0,0 +1,3 @@
1
+ class Pastebin
2
+ VERSION = "2.1.0"
3
+ end
@@ -1,61 +1,27 @@
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 -*-
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "pastebin/version"
5
5
 
6
- Gem::Specification.new do |s|
7
- s.name = "pastebin"
8
- s.version = "2.0.2"
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "pastebin"
8
+ spec.version = Pastebin::VERSION
9
+ spec.authors = ["Doug Prostko"]
10
+ spec.email = ["dougtko@gmail.com"]
9
11
 
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"
12
+ spec.summary = %q{CLI tool and library to work with pastebin.com}
13
+ spec.description = %q{CLI tool and library to work with pastebin.com}
14
+ spec.homepage = "https://github.com/dougsko/pastebin"
39
15
 
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"])
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
53
18
  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
19
+ spec.bindir = "bin"
20
+ #spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.executables = "pastebin"
22
+ spec.require_paths = ["lib"]
61
23
 
24
+ spec.add_development_dependency "bundler", "~> 1.15"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.0"
27
+ end
metadata CHANGED
@@ -1,107 +1,100 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pastebin
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
5
- prerelease:
4
+ version: 2.1.0
6
5
  platform: ruby
7
6
  authors:
8
- - dougsko
7
+ - Doug Prostko
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-08-10 00:00:00.000000000 Z
11
+ date: 2017-08-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: rspec
16
- requirement: &74429600 !ruby/object:Gem::Requirement
17
- none: false
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: '0'
19
+ version: '1.15'
22
20
  type: :development
23
21
  prerelease: false
24
- version_requirements: *74429600
25
- - !ruby/object:Gem::Dependency
26
- name: bundler
27
- requirement: &74429330 !ruby/object:Gem::Requirement
28
- none: false
22
+ version_requirements: !ruby/object:Gem::Requirement
29
23
  requirements:
30
- - - ! '>='
24
+ - - "~>"
31
25
  - !ruby/object:Gem::Version
32
- version: '0'
33
- type: :development
34
- prerelease: false
35
- version_requirements: *74429330
26
+ version: '1.15'
36
27
  - !ruby/object:Gem::Dependency
37
- name: jeweler
38
- requirement: &74429070 !ruby/object:Gem::Requirement
39
- none: false
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
40
30
  requirements:
41
- - - ! '>='
31
+ - - "~>"
42
32
  - !ruby/object:Gem::Version
43
- version: '0'
33
+ version: '10.0'
44
34
  type: :development
45
35
  prerelease: false
46
- version_requirements: *74429070
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
47
41
  - !ruby/object:Gem::Dependency
48
- name: rcov
49
- requirement: &75102810 !ruby/object:Gem::Requirement
50
- none: false
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
51
44
  requirements:
52
- - - ! '>='
45
+ - - "~>"
53
46
  - !ruby/object:Gem::Version
54
- version: '0'
47
+ version: '3.0'
55
48
  type: :development
56
49
  prerelease: false
57
- version_requirements: *75102810
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
58
55
  description: CLI tool and library to work with pastebin.com
59
- email: dougtko@gmail.com
56
+ email:
57
+ - dougtko@gmail.com
60
58
  executables:
61
59
  - pastebin
62
60
  extensions: []
63
- extra_rdoc_files:
64
- - LICENSE.txt
65
- - README.rdoc
61
+ extra_rdoc_files: []
66
62
  files:
67
- - .document
63
+ - ".document"
64
+ - ".gitignore"
68
65
  - Gemfile
69
66
  - Gemfile.lock
70
67
  - LICENSE.txt
68
+ - README.md
71
69
  - README.rdoc
72
70
  - Rakefile
73
- - VERSION
71
+ - bin/console
74
72
  - bin/pastebin
73
+ - bin/setup
75
74
  - lib/pastebin.rb
75
+ - lib/pastebin/version.rb
76
76
  - pastebin.gemspec
77
- - spec/pastebin_spec.rb
78
- - spec/spec_helper.rb
79
- homepage: http://github.com/dougsko/pastebin
80
- licenses:
81
- - MIT
77
+ homepage: https://github.com/dougsko/pastebin
78
+ licenses: []
79
+ metadata: {}
82
80
  post_install_message:
83
81
  rdoc_options: []
84
82
  require_paths:
85
83
  - lib
86
84
  required_ruby_version: !ruby/object:Gem::Requirement
87
- none: false
88
85
  requirements:
89
- - - ! '>='
86
+ - - ">="
90
87
  - !ruby/object:Gem::Version
91
88
  version: '0'
92
- segments:
93
- - 0
94
- hash: -12768269
95
89
  required_rubygems_version: !ruby/object:Gem::Requirement
96
- none: false
97
90
  requirements:
98
- - - ! '>='
91
+ - - ">="
99
92
  - !ruby/object:Gem::Version
100
93
  version: '0'
101
94
  requirements: []
102
95
  rubyforge_project:
103
- rubygems_version: 1.8.10
96
+ rubygems_version: 2.6.8
104
97
  signing_key:
105
- specification_version: 3
98
+ specification_version: 4
106
99
  summary: CLI tool and library to work with pastebin.com
107
100
  test_files: []
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 2.0.2
@@ -1,30 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe "Pastebin" do
4
- before do
5
- `echo "hello world" > /tmp/hw.txt`
6
- options = {"paste_code" => "/tmp/hw.txt",
7
- "paste_expire_date" => "10 Minutes",
8
- "paste_private" => "1"}
9
- @pbin = Pastebin.new(options)
10
- end
11
-
12
- after do
13
- `rm /tmp/hw.txt`
14
- end
15
-
16
- it "tests that @pbin is indeed a Pastebin object" do
17
- @pbin.class.to_s.should == "Pastebin"
18
- end
19
-
20
- it "should paste some text and return a link" do
21
- @link = @pbin.paste
22
- @link.should match(/http:.*\/[\d\w]+/)
23
- end
24
-
25
- it "should return raw text from a paste link" do
26
- link = @pbin.paste
27
- text = @pbin.get_raw(link)
28
- text.should match(/hello world/)
29
- end
30
- end
@@ -1,12 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
- $LOAD_PATH.unshift(File.dirname(__FILE__))
3
- require 'rspec'
4
- require 'pastebin'
5
-
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|
11
-
12
- end