upload 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.
Files changed (5) hide show
  1. data/Manifest +4 -0
  2. data/Rakefile +13 -0
  3. data/lib/upload.rb +30 -0
  4. data/upload.gemspec +30 -0
  5. metadata +74 -0
@@ -0,0 +1,4 @@
1
+ Manifest
2
+ Rakefile
3
+ lib/upload.rb
4
+ upload.gemspec
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('upload', '0.0.1') do |p|
6
+ p.description = "gyazo upload.cgi"
7
+ p.url = "http://github.com/angervision/upload"
8
+ p.author = "Anger.Vision"
9
+ p.email = "sponsor (arf-arf) tut.by"
10
+ p.ignore_pattern = ["tmp/*", "script/*"]
11
+ p.development_dependencies = []
12
+ end
13
+
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'cgi'
4
+ require 'digest/md5'
5
+ require 'sdbm'
6
+
7
+ cgi = CGI.new("html3")
8
+
9
+ id = cgi.params['id'][0].read
10
+ imagedata = cgi.params['imagedata'][0].read
11
+ hash = Digest::MD5.hexdigest(imagedata)
12
+
13
+ create_newid = false
14
+ if not id or id == "" then
15
+ id = Digest::MD5.hexdigest(cgi.remote_addr + Time.now.to_s)
16
+ create_newid = true
17
+ end
18
+
19
+ dbm = SDBM.open('db/id',0644)
20
+ dbm[hash] = id
21
+ dbm.close
22
+
23
+ File.open("data/#{hash}.png","w").print(imagedata)
24
+
25
+ headers = {}
26
+ if create_newid then
27
+ headers = {"X-Gyazo-Id"=>id}
28
+ end
29
+
30
+ cgi.out(headers){"http://gyazo.com/#{hash}.png"}
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{upload}
5
+ s.version = "0.0.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Anger.Vision"]
9
+ s.date = %q{2011-02-18}
10
+ s.description = %q{gyazo upload.cgi}
11
+ s.email = %q{sponsor (arf-arf) tut.by}
12
+ s.extra_rdoc_files = ["lib/upload.rb"]
13
+ s.files = ["Manifest", "Rakefile", "lib/upload.rb", "upload.gemspec"]
14
+ s.homepage = %q{http://github.com/angervision/upload}
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Upload"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = %q{upload}
18
+ s.rubygems_version = %q{1.3.7}
19
+ s.summary = %q{gyazo upload.cgi}
20
+
21
+ if s.respond_to? :specification_version then
22
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
23
+ s.specification_version = 3
24
+
25
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
+ else
27
+ end
28
+ else
29
+ end
30
+ end
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: upload
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Anger.Vision
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-02-18 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: gyazo upload.cgi
23
+ email: sponsor (arf-arf) tut.by
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files:
29
+ - lib/upload.rb
30
+ files:
31
+ - Manifest
32
+ - Rakefile
33
+ - lib/upload.rb
34
+ - upload.gemspec
35
+ has_rdoc: true
36
+ homepage: http://github.com/angervision/upload
37
+ licenses: []
38
+
39
+ post_install_message:
40
+ rdoc_options:
41
+ - --line-numbers
42
+ - --inline-source
43
+ - --title
44
+ - Upload
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ hash: 3
53
+ segments:
54
+ - 0
55
+ version: "0"
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 11
62
+ segments:
63
+ - 1
64
+ - 2
65
+ version: "1.2"
66
+ requirements: []
67
+
68
+ rubyforge_project: upload
69
+ rubygems_version: 1.3.7
70
+ signing_key:
71
+ specification_version: 3
72
+ summary: gyazo upload.cgi
73
+ test_files: []
74
+