pasting 0.0.2 → 0.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.
- checksums.yaml +4 -4
- data/bin/pasting +4 -60
- data/lib/pasting.rb +7 -3
- data/lib/pasting/version.rb +1 -1
- data/pasting.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 091fe3753c7a553d10fb5e2d7d98ce2503932ebe
|
4
|
+
data.tar.gz: 927ef8fefb867a4a2704d2f67ebafb493c215f1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 751d685a056028b3c5d45ee9779230b86dffecda2cec4d9c172e41b7637aed0529bbd300449f73c7cd585057880085c24c33d79f1319b9ee3d44c34e2d981362
|
7
|
+
data.tar.gz: 76c070fb19d75aff6776509558041eb559f977f21772e6af4f1e9a7969ff80b7f37576006c541be28864d668bf8afaba8348ed07d97aba4cca94fe64956b18dc
|
data/bin/pasting
CHANGED
@@ -17,32 +17,7 @@ OptionParser.new do |opts|
|
|
17
17
|
Pasting (v#{Pasting::VERSION}) lets you upload to https://Pasting.io/
|
18
18
|
|
19
19
|
The content to be uploaded can be passed as a list of files, if none are
|
20
|
-
specified STDIN will be read.
|
21
|
-
filenames can be overridden by repeating the "-f" flag. The most useful reason
|
22
|
-
to do this is to change the syntax highlighting.
|
23
|
-
|
24
|
-
If you'd like your Pastings to be associated with your GitHub account, so that you
|
25
|
-
can edit them and find them in future, first use `Pasting --login` to obtain an
|
26
|
-
Oauth2 access token. This is stored and used by Pasting in the future.
|
27
|
-
|
28
|
-
Private Pastings do not have guessable URLs and can be created with "-p", you can
|
29
|
-
also set the description at the top of the Pasting by passing "-d".
|
30
|
-
|
31
|
-
Anonymous Pastings are not associated with your GitHub account, they can be created
|
32
|
-
with "-a" even after you have used "Pasting --login".
|
33
|
-
|
34
|
-
If you would like to shorten the resulting Pasting URL, use the -s flag. This will
|
35
|
-
use GitHub's URL shortener, git.io. You can also use -R to get the link to the
|
36
|
-
raw Pasting.
|
37
|
-
|
38
|
-
To copy the resulting URL to your clipboard you can use the -c option, or to
|
39
|
-
just open it directly in your browser, use -o. Using the -e option will copy the
|
40
|
-
embeddable URL to the clipboard. You can add `alias Pasting='Pasting -c'` to your
|
41
|
-
shell's rc file to configure this behaviour by default.
|
42
|
-
|
43
|
-
Instead of creating a new Pasting, you can update an existing one by passing its ID
|
44
|
-
or URL with "-u". For this to work, you must be logged in, and have created the
|
45
|
-
original Pasting with the same GitHub account.
|
20
|
+
specified STDIN will be read.
|
46
21
|
|
47
22
|
Usage: cat file.txt | #{executable_name}
|
48
23
|
#{executable_name} --login
|
@@ -71,41 +46,10 @@ Usage: cat file.txt | #{executable_name}
|
|
71
46
|
end.parse!
|
72
47
|
|
73
48
|
begin
|
49
|
+
$stderr.puts "(type a Pasting. <ctrl-c> to cancel, <ctrl-d> when done)" if $stdin.tty?
|
74
50
|
stdin = ARGF.read
|
75
|
-
|
76
|
-
|
77
|
-
elsif options[:embed]
|
78
|
-
:javascript
|
79
|
-
elsif options[:shorten] and options[:raw]
|
80
|
-
:short_raw_url
|
81
|
-
elsif options[:shorten]
|
82
|
-
:short_url
|
83
|
-
elsif options[:raw]
|
84
|
-
:raw_url
|
85
|
-
else
|
86
|
-
:html_url
|
87
|
-
end
|
88
|
-
|
89
|
-
if options[:paste]
|
90
|
-
puts Pasting.Pasting(Pasting.paste, stdin)
|
91
|
-
else
|
92
|
-
to_read = ARGV.empty? ? ['-'] : ARGV
|
93
|
-
files = {}
|
94
|
-
to_read.zip(filenames).each do |(file, name)|
|
95
|
-
files[name || file] =
|
96
|
-
begin
|
97
|
-
if file == '-'
|
98
|
-
$stderr.puts "(type a Pasting. <ctrl-c> to cancel, <ctrl-d> when done)" if $stdin.tty?
|
99
|
-
STDIN.read
|
100
|
-
else
|
101
|
-
File.read(File.expand_path(file))
|
102
|
-
end
|
103
|
-
rescue => e
|
104
|
-
raise e.extend(Pasting::Error)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
Pasting.paste(stdin)
|
108
|
-
end
|
51
|
+
|
52
|
+
Pasting.paste(stdin,options)
|
109
53
|
|
110
54
|
rescue Pasting::Error => e
|
111
55
|
puts "Error: #{e.message}"
|
data/lib/pasting.rb
CHANGED
@@ -11,7 +11,7 @@ end
|
|
11
11
|
module Pasting
|
12
12
|
extend self
|
13
13
|
|
14
|
-
VERSION = '
|
14
|
+
VERSION = '0.0.3'
|
15
15
|
|
16
16
|
PASTING_API_URL = URI.encode("http://api.pasting.io/".strip)
|
17
17
|
|
@@ -86,8 +86,12 @@ module Pasting
|
|
86
86
|
#
|
87
87
|
# @see http://pasting.io/
|
88
88
|
def paste(content, options = {})
|
89
|
-
|
90
|
-
|
89
|
+
if options[:private]
|
90
|
+
prv = 1
|
91
|
+
else
|
92
|
+
prv = 0
|
93
|
+
end
|
94
|
+
body = {:consoleKey => auth_token, :text => content, :protected => prv }
|
91
95
|
uri = URI.parse(api_url)
|
92
96
|
http = Net::HTTP.new(uri.host, uri.port)
|
93
97
|
request = Net::HTTP::Post.new("/createFromConsole")
|
data/lib/pasting/version.rb
CHANGED
data/pasting.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["guerremdq@gmail.com"]
|
11
11
|
spec.summary = "pasting.io client"
|
12
12
|
spec.description = "Command line tool to generate new paste on pasting.io"
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "http://pasting.io"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.executables << 'pasting'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pasting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Facundo Guerrero
|
@@ -55,7 +55,7 @@ files:
|
|
55
55
|
- lib/pasting/version.rb
|
56
56
|
- pasting.gemspec
|
57
57
|
- bin/pasting
|
58
|
-
homepage:
|
58
|
+
homepage: http://pasting.io
|
59
59
|
licenses:
|
60
60
|
- MIT
|
61
61
|
metadata: {}
|