capcode-render-binary 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rake'
3
3
 
4
4
  begin
5
5
  require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
6
+ j = Jeweler::Tasks.new do |gem|
7
7
  gem.name = "capcode-render-binary"
8
8
  gem.summary = %Q{Capcode plugin to render binary file}
9
9
  gem.description = gem.summary
@@ -15,3 +15,50 @@ begin
15
15
  rescue LoadError
16
16
  puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
17
17
  end
18
+
19
+ require 'json/pure'
20
+ require 'open-uri'
21
+
22
+ VERS = j.jeweler.version
23
+ NAME = j.jeweler.gemspec.name
24
+
25
+ class Rubygems
26
+ def initialize
27
+ url = "http://rubygems.org/api/v1/gems/#{NAME}.json"
28
+ @version_at_rubygems = JSON.parse( open(url).read )["version"]
29
+ end
30
+
31
+ def status
32
+ version == VERS
33
+ end
34
+ def self.status
35
+ self.new.status
36
+ end
37
+
38
+ def version
39
+ @version_at_rubygems
40
+ end
41
+ def self.version
42
+ self.new.version
43
+ end
44
+ end
45
+
46
+ namespace :gemcutter do
47
+ desc "push to gemcutter"
48
+ task :push => [:build] do
49
+ unless Rubygems.status
50
+ sh %{gem push pkg/#{NAME}-#{VERS}.gem}, :verbose => true
51
+ else
52
+ puts "This gem already existe in version #{VERS}!"
53
+ end
54
+ end
55
+
56
+ desc "check gemcutter status"
57
+ task :status do
58
+ if Rubygems.status
59
+ puts "This gem already existe in version #{VERS}!"
60
+ else
61
+ puts "This gem (#{VERS}) has nos been published! Last version at gemcutter is #{Rubygems.version}"
62
+ end
63
+ end
64
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{capcode-render-binary}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Gregoire Lejeune"]
12
- s.date = %q{2010-01-07}
12
+ s.date = %q{2010-03-03}
13
13
  s.description = %q{Capcode plugin to render binary file}
14
14
  s.email = %q{gregoire.lejeune@free.fr}
15
15
  s.extra_rdoc_files = [
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
27
27
  s.homepage = %q{http://github.com/glejeune/Capcode.more/tree/master/capcode-render-binary}
28
28
  s.rdoc_options = ["--charset=UTF-8"]
29
29
  s.require_paths = ["lib"]
30
- s.rubygems_version = %q{1.3.5}
30
+ s.rubygems_version = %q{1.3.6}
31
31
  s.summary = %q{Capcode plugin to render binary file}
32
32
 
33
33
  if s.respond_to? :specification_version then
@@ -17,6 +17,12 @@ module Capcode
17
17
  render :binary => :image, :content_type => "image/png"
18
18
  end
19
19
  end
20
+
21
+ class Dwl < Route '/download'
22
+ def get
23
+ render :binary => :image, :content_type => "image/png", :content_disposition => "attachment; filename=my_image.png"
24
+ end
25
+ end
20
26
  end
21
27
 
22
28
  module Capcode::Views
@@ -1,7 +1,12 @@
1
1
  module Capcode
2
2
  module Helpers
3
3
  def render_binary( f, opts ) #:nodoc:
4
- @response['Content-Type'] = opts[:content_type]||opts['Content-Type']||"binary/octet-stream"
4
+ @response['Content-Type'] = opts.delete(:content_type)||opts.delete('Content-Type')||"binary/octet-stream"
5
+ opts.each do |k, v|
6
+ k = k.to_s.split(/_/).map{|e| e.capitalize}.join("-")
7
+ @response[k] = v
8
+ end
9
+
5
10
  self.send(f)
6
11
  end
7
12
  end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capcode-render-binary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
5
10
  platform: ruby
6
11
  authors:
7
12
  - Gregoire Lejeune
@@ -9,7 +14,7 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-01-07 00:00:00 +01:00
17
+ date: 2010-03-03 00:00:00 +01:00
13
18
  default_executable:
14
19
  dependencies: []
15
20
 
@@ -42,18 +47,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
42
47
  requirements:
43
48
  - - ">="
44
49
  - !ruby/object:Gem::Version
50
+ segments:
51
+ - 0
45
52
  version: "0"
46
- version:
47
53
  required_rubygems_version: !ruby/object:Gem::Requirement
48
54
  requirements:
49
55
  - - ">="
50
56
  - !ruby/object:Gem::Version
57
+ segments:
58
+ - 0
51
59
  version: "0"
52
- version:
53
60
  requirements: []
54
61
 
55
62
  rubyforge_project:
56
- rubygems_version: 1.3.5
63
+ rubygems_version: 1.3.6
57
64
  signing_key:
58
65
  specification_version: 3
59
66
  summary: Capcode plugin to render binary file