capcode-render-static 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,9 @@ Capcode plugin to render static file
4
4
 
5
5
  = History
6
6
 
7
+ * 0.4.0 :
8
+ ** Bug correction
9
+
7
10
  * 0.3.0 :
8
11
  ** Add mime/type detection
9
12
 
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-static"
8
8
  gem.summary = %Q{Capcode plugin to render static file}
9
9
  gem.description = gem.summary
@@ -17,3 +17,45 @@ begin
17
17
  rescue LoadError
18
18
  puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
19
  end
20
+
21
+ require 'json/pure'
22
+ require 'open-uri'
23
+
24
+ class MyGem
25
+ attr_reader :local_version
26
+ attr_reader :rubygems_version
27
+ attr_reader :name
28
+
29
+ def initialize( version, name )
30
+ @local_version = version
31
+ @name = name
32
+ url = "http://rubygems.org/api/v1/gems/#{@name}.json"
33
+ @rubygems_version = JSON.parse( open(url).read )["version"]
34
+ end
35
+
36
+ def status
37
+ @rubygems_version == @local_version
38
+ end
39
+ end
40
+
41
+ MYGEM = MyGem.new( j.jeweler.version, j.jeweler.gemspec.name )
42
+
43
+ namespace :gemcutter do
44
+ desc "push to gemcutter"
45
+ task :push => [:build] do
46
+ unless MYGEM.status
47
+ sh %{gem push pkg/#{MYGEM.name}-#{MYGEM.local_version}.gem}, :verbose => true
48
+ else
49
+ puts "This gem already existe in version #{MYGEM.local_version}!"
50
+ end
51
+ end
52
+
53
+ desc "check gemcutter status"
54
+ task :status do
55
+ if MYGEM.status
56
+ puts "This gem already existe in version #{MYGEM.local_version}!"
57
+ else
58
+ puts "This gem (#{MYGEM.name}) has not been pushed! Last version at gemcutter is #{MYGEM.rubygems_version}"
59
+ end
60
+ end
61
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.4.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{capcode-render-static}
8
- s.version = "0.3.0"
8
+ s.version = "0.4.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-02-08}
12
+ s.date = %q{2010-04-14}
13
13
  s.description = %q{Capcode plugin to render static file}
14
14
  s.email = %q{gregoire.lejeune@free.fr}
15
15
  s.extra_rdoc_files = [
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
31
31
  s.homepage = %q{http://github.com/glejeune/Capcode.more/tree/master/capcode-render-static}
32
32
  s.rdoc_options = ["--charset=UTF-8"]
33
33
  s.require_paths = ["lib"]
34
- s.rubygems_version = %q{1.3.5}
34
+ s.rubygems_version = %q{1.3.6}
35
35
  s.summary = %q{Capcode plugin to render static file}
36
36
 
37
37
  if s.respond_to? :specification_version then
@@ -1,5 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'mime/types'
3
+ require 'uri'
3
4
 
4
5
  module Capcode
5
6
  module Helpers
@@ -17,7 +18,7 @@ module Capcode
17
18
  if opts.keys.include?(:content_type)
18
19
  @response['Content-Type'] = opts[:content_type]
19
20
  else
20
- @response['Content-Type'] = MIME::Types.type_for(File.join( static[:path], f ))[0].content_type
21
+ @response['Content-Type'] = MIME::Types.type_for(File.join( static[:path], URI.parse( f ).path ))[0].content_type
21
22
  end
22
23
 
23
24
  if !opts.keys.include?(:exact_path) or opts[:exact_path] == true
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capcode-render-static
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 4
8
+ - 0
9
+ version: 0.4.0
5
10
  platform: ruby
6
11
  authors:
7
12
  - Gregoire Lejeune
@@ -9,19 +14,21 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-08 00:00:00 +01:00
17
+ date: 2010-04-14 00:00:00 +02:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: mime-types
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
23
29
  version: "0"
24
- version:
30
+ type: :runtime
31
+ version_requirements: *id001
25
32
  description: Capcode plugin to render static file
26
33
  email: gregoire.lejeune@free.fr
27
34
  executables: []
@@ -55,18 +62,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
55
62
  requirements:
56
63
  - - ">="
57
64
  - !ruby/object:Gem::Version
65
+ segments:
66
+ - 0
58
67
  version: "0"
59
- version:
60
68
  required_rubygems_version: !ruby/object:Gem::Requirement
61
69
  requirements:
62
70
  - - ">="
63
71
  - !ruby/object:Gem::Version
72
+ segments:
73
+ - 0
64
74
  version: "0"
65
- version:
66
75
  requirements: []
67
76
 
68
77
  rubyforge_project:
69
- rubygems_version: 1.3.5
78
+ rubygems_version: 1.3.6
70
79
  signing_key:
71
80
  specification_version: 3
72
81
  summary: Capcode plugin to render static file