nonopaste-cli 0.0.1
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.
- data/README.markdown +24 -0
- data/Rakefile +1 -0
- data/nonopaste +35 -0
- data/nonopaste-cli.gemspec +14 -0
- metadata +53 -0
data/README.markdown
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# nonopaste-cli #
|
2
|
+
|
3
|
+
command line tool for [NoNoPaste](https://github.com/kazeburo/NoNoPaste) and [NoNoPaste-Cloud](https://github.com/kazeburo/NoNoPaste-Cloud).
|
4
|
+
|
5
|
+
## Usage ##
|
6
|
+
|
7
|
+
$ git clone git://github.com/kyanny/nonopaste-cli.git
|
8
|
+
$ chmod a+x nonopaste-cli/nonopaste
|
9
|
+
$ export PATH=`pwd`/nonopaste-cli:$PATH
|
10
|
+
$ nonopaste -h
|
11
|
+
|
12
|
+
## Change NoNoPaste URL ##
|
13
|
+
|
14
|
+
You can change NoNoPaste URL. Default URL is http://www.kazeburo.dotcloud.com/
|
15
|
+
|
16
|
+
$ export NONOPASTE=http://example.com/nonopaste/add
|
17
|
+
|
18
|
+
## Author ##
|
19
|
+
|
20
|
+
Kensuke Nagae <kyanny at gmail dot com>
|
21
|
+
|
22
|
+
## License ##
|
23
|
+
|
24
|
+
MIT License
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/nonopaste
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'optparse'
|
3
|
+
require 'uri'
|
4
|
+
require 'net/http'
|
5
|
+
Net::HTTP.version_1_2
|
6
|
+
|
7
|
+
NONOPASTE = ENV["NONOPASTE"] ? ENV["NONOPASTE"] : "http://www.kazeburo.dotcloud.com/add"
|
8
|
+
|
9
|
+
def main
|
10
|
+
if $stdin.tty? && !$*.empty? # read data from file
|
11
|
+
$*.map{ |file|
|
12
|
+
post(open(file).read)
|
13
|
+
}
|
14
|
+
else # read data from input redirection
|
15
|
+
post($stdin.read)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def post(data, nick=`whoami`.chomp)
|
20
|
+
uri = URI(NONOPASTE)
|
21
|
+
Net::HTTP.start(uri.host, uri.port){ |http|
|
22
|
+
req = Net::HTTP::Post.new(uri.path)
|
23
|
+
req.set_form_data({ :body => data, :nick => nick })
|
24
|
+
res = http.request(req)
|
25
|
+
loc = res['location']
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
script = File.basename(__FILE__)
|
30
|
+
opt = OptionParser.new
|
31
|
+
opt.banner = <<-BANNER
|
32
|
+
Usage: #{script} file[, file, ...]
|
33
|
+
#{script} < file
|
34
|
+
BANNER
|
35
|
+
puts opt.parse!($*) && main() rescue opt.help
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "nonopaste-cli"
|
3
|
+
s.version = "0.0.1"
|
4
|
+
s.authors = ["Kensuke Nagae", "KITAITI Makoto"]
|
5
|
+
s.email = ["kyanny@gmail.com"]
|
6
|
+
s.homepage = "https://github.com/kyanny/nonopaste-cli"
|
7
|
+
s.summary = %q{command line tool for NoNoPaste}
|
8
|
+
s.description = %q{command line tool for NoNoPaste and NoNoPaste-Cloud.}
|
9
|
+
s.license = 'MIT'
|
10
|
+
|
11
|
+
s.files = `git ls-files`.split("\n")
|
12
|
+
s.bindir = '.'
|
13
|
+
s.executables = 'nonopaste'
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nonopaste-cli
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Kensuke Nagae
|
9
|
+
- KITAITI Makoto
|
10
|
+
autorequire:
|
11
|
+
bindir: .
|
12
|
+
cert_chain: []
|
13
|
+
date: 2012-02-19 00:00:00.000000000 Z
|
14
|
+
dependencies: []
|
15
|
+
description: command line tool for NoNoPaste and NoNoPaste-Cloud.
|
16
|
+
email:
|
17
|
+
- kyanny@gmail.com
|
18
|
+
executables:
|
19
|
+
- nonopaste
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
23
|
+
- README.markdown
|
24
|
+
- Rakefile
|
25
|
+
- nonopaste
|
26
|
+
- nonopaste-cli.gemspec
|
27
|
+
- ./nonopaste
|
28
|
+
homepage: https://github.com/kyanny/nonopaste-cli
|
29
|
+
licenses:
|
30
|
+
- MIT
|
31
|
+
post_install_message:
|
32
|
+
rdoc_options: []
|
33
|
+
require_paths:
|
34
|
+
- lib
|
35
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
requirements: []
|
48
|
+
rubyforge_project:
|
49
|
+
rubygems_version: 1.8.11
|
50
|
+
signing_key:
|
51
|
+
specification_version: 3
|
52
|
+
summary: command line tool for NoNoPaste
|
53
|
+
test_files: []
|