paste2 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 06788e8e191229c08a9a02aed716ad81d8c30778
4
+ data.tar.gz: 36adae18ad901ce31da509020f103390764dc7cd
5
+ SHA512:
6
+ metadata.gz: 9db8cdfd5620b0e32bec6a84992ccb2be1022528d2f3c6d06c993cf07483d2c748be39139a07bed88588bb4027e651964fe6734606057061b8037739fb63baf6
7
+ data.tar.gz: 952408979480f7bc400634696c21bbac9fa8525bf517e06d21b52c35fcc83f0da0e0f5db81c3a4ec67021f236d0e343c5a6bfb9eef5eb89f9fa34f32637d2ae1
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in paste2.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Evgeniy Shurmin
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,40 @@
1
+ # Paste2
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'paste2'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install paste2
18
+
19
+ ## Usage
20
+
21
+ Usage: paste2 [options]
22
+
23
+ Examples:
24
+ echo 'code' | paste2
25
+ paste2 < file
26
+
27
+ Specific options:
28
+ -f, --file FILE Post content from file
29
+ -d, --description TEXT Description for post
30
+ -a, --all List supported languages
31
+ -l, --lang LANG Post content as language (default is text)
32
+ -h, --help Display this screen
33
+
34
+ ## Contributing
35
+
36
+ 1. Fork it
37
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
38
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
39
+ 4. Push to the branch (`git push origin my-new-feature`)
40
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler'
4
+
5
+ require 'paste2'
6
+
7
+ client = Paste2::Client.new
8
+ client.run
@@ -0,0 +1,243 @@
1
+ require "paste2/version"
2
+ require "paste2/client"
3
+
4
+ module Paste2
5
+ URL = 'http://paste2.org'
6
+ LANGUAGES = {
7
+ "text" => "Plain Text / Other",
8
+ "html" => "HTML",
9
+ "java" => "Java",
10
+ "js" => "JavaScript",
11
+ "perl" => "Perl",
12
+ "php" => "PHP",
13
+ "python" => "Python",
14
+ "rb" => "Ruby",
15
+ "Cucumber" => "Gherkin",
16
+ "abap" => "ABAP",
17
+ "ada" => "Ada",
18
+ "ahk" => "autohotkey",
19
+ "antlr-as" => "ANTLR With ActionScript Target",
20
+ "antlr-cpp" => "ANTLR With CPP Target",
21
+ "antlr-csharp" => "ANTLR With C# Target",
22
+ "antlr-java" => "ANTLR With Java Target",
23
+ "antlr-objc" => "ANTLR With ObjectiveC Target",
24
+ "antlr-perl" => "ANTLR With Perl Target",
25
+ "antlr-python" => "ANTLR With Python Target",
26
+ "antlr-ruby" => "ANTLR With Ruby Target",
27
+ "antlr" => "ANTLR",
28
+ "apacheconf" => "ApacheConf",
29
+ "applescript" => "AppleScript",
30
+ "as" => "ActionScript",
31
+ "as3" => "ActionScript 3",
32
+ "aspx-cs" => "aspx-cs",
33
+ "aspx-vb" => "aspx-vb",
34
+ "asy" => "Asymptote",
35
+ "awk" => "Awk",
36
+ "basemake" => "Base Makefile",
37
+ "bash" => "Bash",
38
+ "bat" => "Batchfile",
39
+ "bbcode" => "BBCode",
40
+ "befunge" => "Befunge",
41
+ "blitzmax" => "BlitzMax",
42
+ "boo" => "Boo",
43
+ "brainfuck" => "Brainfuck",
44
+ "bro" => "Bro",
45
+ "c-objdump" => "c-objdump",
46
+ "c" => "C",
47
+ "cfengine3" => "CFEngine3",
48
+ "cfm" => "Coldfusion HTML",
49
+ "cfs" => "cfstatement",
50
+ "cheetah" => "Cheetah",
51
+ "clojure" => "Clojure",
52
+ "cmake" => "CMake",
53
+ "coffee-script" => "CoffeeScript",
54
+ "common-lisp" => "Common Lisp",
55
+ "console" => "Bash Session",
56
+ "control" => "Debian Control file",
57
+ "coq" => "Coq",
58
+ "cpp" => "C++",
59
+ "cpp-objdump" => "cpp-objdump",
60
+ "csharp" => "C#",
61
+ "css+django" => "CSS+Django/Jinja",
62
+ "css+erb" => "CSS+Ruby",
63
+ "css+genshitext" => "CSS+Genshi Text",
64
+ "css+mako" => "CSS+Mako",
65
+ "css+myghty" => "CSS+Myghty",
66
+ "css+php" => "CSS+PHP",
67
+ "css+smarty" => "CSS+Smarty",
68
+ "css" => "CSS",
69
+ "cython" => "Cython",
70
+ "d-objdump" => "d-objdump",
71
+ "d" => "D",
72
+ "dart" => "Dart",
73
+ "delphi" => "Delphi",
74
+ "diff" => "Diff",
75
+ "django" => "Django/Jinja",
76
+ "dpatch" => "Darcs Patch",
77
+ "dtd" => "DTD",
78
+ "duel" => "Duel",
79
+ "dylan" => "Dylan",
80
+ "ec" => "eC",
81
+ "ecl" => "ECL",
82
+ "elixir" => "Elixir",
83
+ "erb" => "ERB",
84
+ "erl" => "Erlang erl session",
85
+ "erlang" => "Erlang",
86
+ "evoque" => "Evoque",
87
+ "factor" => "Factor",
88
+ "fan" => "Fantom",
89
+ "fancy" => "Fancy",
90
+ "felix" => "Felix",
91
+ "fortran" => "Fortran",
92
+ "fsharp" => "FSharp",
93
+ "gas" => "GAS",
94
+ "genshi" => "Genshi",
95
+ "genshitext" => "Genshi Text",
96
+ "glsl" => "GLSL",
97
+ "gnuplot" => "Gnuplot",
98
+ "go" => "Go",
99
+ "gooddata-cl" => "GoodData-CL",
100
+ "gosu" => "Gosu",
101
+ "groff" => "Groff",
102
+ "groovy" => "Groovy",
103
+ "gst" => "Gosu Template",
104
+ "haml" => "Haml",
105
+ "haskell" => "Haskell",
106
+ "html+cheetah" => "HTML+Cheetah",
107
+ "html+django" => "HTML+Django/Jinja",
108
+ "html+evoque" => "HTML+Evoque",
109
+ "html+genshi" => "HTML+Genshi",
110
+ "html+mako" => "HTML+Mako",
111
+ "html+myghty" => "HTML+Myghty",
112
+ "html+php" => "HTML+PHP",
113
+ "html+smarty" => "HTML+Smarty",
114
+ "html+velocity" => "HTML+Velocity",
115
+ "http" => "HTTP",
116
+ "hx" => "haXe",
117
+ "hybris" => "Hybris",
118
+ "iex" => "Elixir iex session",
119
+ "ini" => "INI",
120
+ "io" => "Io",
121
+ "ioke" => "Ioke",
122
+ "irc" => "IRC logs",
123
+ "jade" => "Jade",
124
+ "js+cheetah" => "JavaScript+Cheetah",
125
+ "js+django" => "JavaScript+Django/Jinja",
126
+ "js+erb" => "JavaScript+Ruby",
127
+ "js+genshitext" => "JavaScript+Genshi Text",
128
+ "js+mako" => "JavaScript+Mako",
129
+ "js+myghty" => "JavaScript+Myghty",
130
+ "js+php" => "JavaScript+PHP",
131
+ "js+smarty" => "JavaScript+Smarty",
132
+ "json" => "JSON",
133
+ "jsp" => "Java Server Page",
134
+ "kotlin" => "Kotlin",
135
+ "lhs" => "Literate Haskell",
136
+ "lighty" => "Lighttpd configuration file",
137
+ "llvm" => "LLVM",
138
+ "logtalk" => "Logtalk",
139
+ "lua" => "Lua",
140
+ "make" => "Makefile",
141
+ "mako" => "Mako",
142
+ "maql" => "MAQL",
143
+ "mason" => "Mason",
144
+ "matlab" => "Matlab",
145
+ "matlabsession" => "Matlab session",
146
+ "minid" => "MiniD",
147
+ "modelica" => "Modelica",
148
+ "modula2" => "Modula-2",
149
+ "moocode" => "MOOCode",
150
+ "moon" => "MoonScript",
151
+ "mupad" => "MuPAD",
152
+ "mxml" => "MXML",
153
+ "myghty" => "Myghty",
154
+ "mysql" => "MySQL",
155
+ "nasm" => "NASM",
156
+ "nemerle" => "Nemerle",
157
+ "newlisp" => "NewLisp",
158
+ "newspeak" => "Newspeak",
159
+ "nginx" => "Nginx configuration file",
160
+ "nimrod" => "Nimrod",
161
+ "numpy" => "NumPy",
162
+ "objdump" => "objdump",
163
+ "objective-c" => "Objective-C",
164
+ "objective-j" => "Objective-J",
165
+ "ocaml" => "OCaml",
166
+ "octave" => "Octave",
167
+ "ooc" => "Ooc",
168
+ "opa" => "Opa",
169
+ "openedge" => "OpenEdge ABL",
170
+ "plpgsql" => "PL/pgSQL",
171
+ "postgresql" => "PostgreSQL SQL dialect",
172
+ "postscript" => "PostScript",
173
+ "pot" => "Gettext Catalog",
174
+ "pov" => "POVRay",
175
+ "powershell" => "PowerShell",
176
+ "prolog" => "Prolog",
177
+ "properties" => "Properties",
178
+ "protobuf" => "Protocol Buffer",
179
+ "psql" => "PostgreSQL console (psql)",
180
+ "py3tb" => "Python 3.0 Traceback",
181
+ "pycon" => "Python console session",
182
+ "pypylog" => "PyPy Log",
183
+ "pytb" => "Python Traceback",
184
+ "python3" => "Python 3",
185
+ "ragel-c" => "Ragel in C Host",
186
+ "ragel-cpp" => "Ragel in CPP Host",
187
+ "ragel-d" => "Ragel in D Host",
188
+ "ragel-em" => "Embedded Ragel",
189
+ "ragel-java" => "Ragel in Java Host",
190
+ "ragel-objc" => "Ragel in Objective C Host",
191
+ "ragel-ruby" => "Ragel in Ruby Host",
192
+ "ragel" => "Ragel",
193
+ "raw" => "Raw token data",
194
+ "rbcon" => "Ruby irb session",
195
+ "rconsole" => "RConsole",
196
+ "rebol" => "REBOL",
197
+ "redcode" => "Redcode",
198
+ "rhtml" => "RHTML",
199
+ "rst" => "reStructuredText",
200
+ "sass" => "Sass",
201
+ "scala" => "Scala",
202
+ "scaml" => "Scaml",
203
+ "scheme" => "Scheme",
204
+ "scilab" => "Scilab",
205
+ "scss" => "SCSS",
206
+ "smalltalk" => "Smalltalk",
207
+ "smarty" => "Smarty",
208
+ "sml" => "Standard ML",
209
+ "snobol" => "Snobol",
210
+ "sourceslist" => "Debian Sourcelist",
211
+ "splus" => "S",
212
+ "sql" => "SQL",
213
+ "sqlite3" => "sqlite3con",
214
+ "squidconf" => "SquidConf",
215
+ "ssp" => "Scalate Server Page",
216
+ "sv" => "systemverilog",
217
+ "tcl" => "Tcl",
218
+ "tcsh" => "Tcsh",
219
+ "tea" => "Tea",
220
+ "tex" => "TeX",
221
+ "trac-wiki" => "MoinMoin/Trac Wiki markup",
222
+ "urbiscript" => "UrbiScript",
223
+ "v" => "verilog",
224
+ "vala" => "Vala",
225
+ "vb.net" => "VB.net",
226
+ "velocity" => "Velocity",
227
+ "vhdl" => "vhdl",
228
+ "vim" => "VimL",
229
+ "xml+cheetah" => "XML+Cheetah",
230
+ "xml+django" => "XML+Django/Jinja",
231
+ "xml+erb" => "XML+Ruby",
232
+ "xml+evoque" => "XML+Evoque",
233
+ "xml+mako" => "XML+Mako",
234
+ "xml+myghty" => "XML+Myghty",
235
+ "xml+php" => "XML+PHP",
236
+ "xml+smarty" => "XML+Smarty",
237
+ "xml+velocity" => "XML+Velocity",
238
+ "xml" => "XML",
239
+ "xquery" => "XQuery",
240
+ "xslt" => "XSLT",
241
+ "yaml" => "YAML"
242
+ }
243
+ end
@@ -0,0 +1,64 @@
1
+ require 'optparse'
2
+ require 'net/http'
3
+
4
+ class Paste2::Client
5
+ def self.post(code, description = '', lang = 'text')
6
+ uri = URI(Paste2::URL)
7
+ res = Net::HTTP.post_form(uri, :code => code, :description => description, :lang => lang)
8
+ File.join(Paste2::URL,res["location"])
9
+ end
10
+ def initialize
11
+ @options = {}
12
+ parser = OptionParser.new do|opts|
13
+ opts.separator ""
14
+ opts.separator "Examples:"
15
+ opts.separator " echo 'code' | paste2"
16
+ opts.separator " paste2 < file"
17
+ opts.separator ""
18
+ opts.separator "Specific options:"
19
+ opts.banner = "Usage: paste2 [options]"
20
+ opts.on( '-f', '--file FILE', 'Post content from file' ) do|file|
21
+ @options[:file] = file
22
+ end
23
+ opts.on( '-d', '--description TEXT', 'Description for post' ) do|description|
24
+ @options[:description] = description
25
+ end
26
+ opts.on( '-a', '--all', 'List supported languages' ) do|file|
27
+ puts "Supported languages:"
28
+ Paste2::LANGUAGES.each do |lang, name|
29
+ printf "\t%-20s %s\n", lang, name
30
+ end
31
+ exit(0)
32
+ end
33
+ opts.on( '-l', '--lang LANG', 'Post content as language (default is text)' ) do|language|
34
+ if Paste2::LANGUAGES.include? language
35
+ @options[:language] = language
36
+ else
37
+ puts "Not supported language '#{language}'"
38
+ exit(1)
39
+ end
40
+ end
41
+ opts.on( '-h', '--help', 'Display this screen' ) do
42
+ @options[:help] = true
43
+ end
44
+ end
45
+ begin
46
+ parser.parse ARGV
47
+ if @options[:help]
48
+ puts parser
49
+ end
50
+ rescue => e
51
+ puts e.message
52
+ end
53
+ end
54
+ def run
55
+ return if @options[:help]
56
+ begin
57
+ code ||= @options[:file].nil? ? STDIN.readlines : File.open(@options[:file]).readlines
58
+ puts Paste2::Client.post(code.join(""), @options[:description], @options[:language])
59
+ rescue => e
60
+ puts e.message
61
+ exit(1)
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,3 @@
1
+ module Paste2
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'paste2/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "paste2"
8
+ spec.version = Paste2::VERSION
9
+ spec.authors = ["Evgeniy Shurmin "]
10
+ spec.email = ["eshurmin@gmail.com"]
11
+ spec.description = %q{Utility allow create posts on Paste2.org}
12
+ spec.summary = %q{Utility allow create posts on Paste2.org}
13
+ spec.homepage = "http://github.com/jpascal/paste2"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: paste2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - 'Evgeniy Shurmin '
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Utility allow create posts on Paste2.org
42
+ email:
43
+ - eshurmin@gmail.com
44
+ executables:
45
+ - paste2
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - .gitignore
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - bin/paste2
55
+ - lib/paste2.rb
56
+ - lib/paste2/client.rb
57
+ - lib/paste2/version.rb
58
+ - paste2.gemspec
59
+ homepage: http://github.com/jpascal/paste2
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - '>='
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.0.6
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: Utility allow create posts on Paste2.org
83
+ test_files: []