moro-ruby19_monkey 0.0.2

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 (6) hide show
  1. data/ChangeLog +4 -0
  2. data/README +29 -0
  3. data/Rakefile +106 -0
  4. data/lib/ruby19_monkey.rb +85 -0
  5. data/rails/init.rb +7 -0
  6. metadata +69 -0
data/ChangeLog ADDED
@@ -0,0 +1,4 @@
1
+ == 0.0.1 / 2009-02-13
2
+
3
+ * devided from http://github.com/moro/rubykaigi
4
+
data/README ADDED
@@ -0,0 +1,29 @@
1
+
2
+ = ruby19_monkey
3
+
4
+
5
+ == Description
6
+
7
+
8
+ == Installation
9
+
10
+ === Archive Installation
11
+
12
+ rake install
13
+
14
+ === Gem Installation
15
+
16
+ gem install ruby19_monkey
17
+
18
+
19
+ == Features/Problems
20
+
21
+
22
+ == Synopsis
23
+
24
+
25
+ == Copyright
26
+
27
+ Author:: moro <moro@>
28
+ Copyright:: Copyright (c) 2009 moro
29
+ License::
data/Rakefile ADDED
@@ -0,0 +1,106 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/clean'
4
+ require 'rake/testtask'
5
+ require 'rake/packagetask'
6
+ require 'rake/gempackagetask'
7
+ require 'rake/rdoctask'
8
+ require 'rake/contrib/rubyforgepublisher'
9
+ require 'rake/contrib/sshpublisher'
10
+ require 'fileutils'
11
+ require 'lib/ruby19_monkey'
12
+ include FileUtils
13
+
14
+ NAME = "ruby19_monkey"
15
+ AUTHOR = "moro"
16
+ EMAIL = "moronatural@gmail.com"
17
+ DESCRIPTION = "Monkey patches to work rails(2.3.0) with ruby 1.9.1"
18
+ RUBYFORGE_PROJECT = "ruby19_monkey"
19
+ HOMEPATH = "http://github.com/moro/ruby19_monkey"
20
+ BIN_FILES = %w( )
21
+
22
+ VERS = Ruby19Monkey::VERSION
23
+ REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
24
+ CLEAN.include ['**/.*.sw?', '*.gem', '.config']
25
+ RDOC_OPTS = [
26
+ '--title', "#{NAME} documentation",
27
+ "--charset", "utf-8",
28
+ "--opname", "index.html",
29
+ "--line-numbers",
30
+ "--main", "README",
31
+ "--inline-source",
32
+ ]
33
+
34
+ task :package => [:clean]
35
+
36
+ spec = Gem::Specification.new do |s|
37
+ s.name = NAME
38
+ s.version = VERS
39
+ s.platform = Gem::Platform::RUBY
40
+ s.has_rdoc = true
41
+ s.extra_rdoc_files = ["README", "ChangeLog"]
42
+ s.rdoc_options += RDOC_OPTS + ['--exclude', '^(examples|extras)/']
43
+ s.summary = DESCRIPTION
44
+ s.description = DESCRIPTION
45
+ s.author = AUTHOR
46
+ s.email = EMAIL
47
+ s.homepage = HOMEPATH
48
+ s.executables = BIN_FILES
49
+ s.rubyforge_project = RUBYFORGE_PROJECT
50
+ s.bindir = "bin"
51
+ s.require_path = "lib"
52
+ #s.autorequire = ""
53
+ s.test_files = Dir["test/*_test.rb"]
54
+
55
+ #s.add_dependency('activesupport', '>=1.3.1')
56
+ #s.required_ruby_version = '>= 1.8.2'
57
+
58
+ s.files = %w(README ChangeLog Rakefile) +
59
+ Dir.glob("{bin,doc,test,lib,templates,generator,extras,website,script}/**/*") +
60
+ Dir.glob("ext/**/*.{h,c,rb}") +
61
+ Dir.glob("examples/**/*.rb") +
62
+ Dir.glob("tools/*.rb") +
63
+ Dir.glob("rails/*.rb")
64
+
65
+ s.extensions = FileList["ext/**/extconf.rb"].to_a
66
+ end
67
+
68
+ Rake::GemPackageTask.new(spec) do |p|
69
+ p.need_tar = true
70
+ p.gem_spec = spec
71
+ end
72
+
73
+ task :install do
74
+ name = "#{NAME}-#{VERS}.gem"
75
+ sh %{rake package}
76
+ sh %{sudo gem install pkg/#{name}}
77
+ end
78
+
79
+ task :uninstall => [:clean] do
80
+ sh %{sudo gem uninstall #{NAME}}
81
+ end
82
+
83
+
84
+ Rake::RDocTask.new do |rdoc|
85
+ rdoc.rdoc_dir = 'html'
86
+ rdoc.options += RDOC_OPTS
87
+ rdoc.template = "resh"
88
+ #rdoc.template = "#{ENV['template']}.rb" if ENV['template']
89
+ if ENV['DOC_FILES']
90
+ rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
91
+ else
92
+ rdoc.rdoc_files.include('README', 'ChangeLog')
93
+ rdoc.rdoc_files.include('lib/**/*.rb')
94
+ rdoc.rdoc_files.include('ext/**/*.c')
95
+ end
96
+ end
97
+
98
+ desc 'Show information about the gem.'
99
+ task :debug_gem do
100
+ puts spec.to_ruby
101
+ end
102
+
103
+ desc 'Update gem spec'
104
+ task :gemspec do
105
+ open("#{NAME}.gemspec", 'w').write spec.to_ruby
106
+ end
@@ -0,0 +1,85 @@
1
+ require 'activesupport'
2
+
3
+ module Ruby19Monkey
4
+ VERSION = "0.0.2"
5
+
6
+ def self.install!
7
+ ActionView::Base.send(:include, ForceEncoding::OutputBuffer)
8
+ ActionView::Template.send(:include, ForceEncoding::RenderResult)
9
+
10
+ if Rails::VERSION::STRING >= "2.3.0"
11
+ ActionController::Response.send(:include, StringBytesize::ResponseContentLength)
12
+ ActionController::Dispatcher.send(:include, StringEach::RackAppCall)
13
+ ::Rack::File.send(:include, StringEach::RackAppCall)
14
+ else
15
+ ActionController::AbstractResponse.send(:include, StringBytesize::ResponseContentLength)
16
+ end
17
+ end
18
+
19
+ module StringEach
20
+ module RackAppCall
21
+ def self.included(base)
22
+ base.alias_method_chain :_call, :string_each_fix
23
+ end
24
+
25
+ def _call_with_string_each_fix(env)
26
+ status, _h, body = _call_without_string_each_fix(env)
27
+ header = {}
28
+ _h.each{|k, vs| header[k] = array_or_line_enum(vs) }
29
+ [status, header, array_or_line_enum(body)]
30
+ end
31
+
32
+ private
33
+ def array_or_line_enum(obj)
34
+ obj.respond_to?(:each) ? obj : obj.to_s.each_line
35
+ end
36
+ end
37
+ end
38
+
39
+ module StringBytesize
40
+ module ResponseContentLength
41
+ def self.included(base)
42
+ base.alias_method_chain :set_content_length!, :string_bytesize
43
+ end
44
+ private
45
+ def set_content_length_with_string_bytesize!
46
+ if "1.8.7 or lator".respond_to?(:bytesize)
47
+ unless body.respond_to?(:call) || (status && status[0..2] == '304')
48
+ self.headers["Content-Length"] ||= body.bytesize
49
+ end
50
+ else
51
+ set_content_length_without_string_bytesize!
52
+ end
53
+ end
54
+ end
55
+ end
56
+
57
+ module ForceEncoding
58
+ @@template_encoding = "UTF-8"
59
+ mattr_accessor :template_encoding
60
+
61
+ module OutputBuffer
62
+ def self.included(base)
63
+ base.alias_method_chain :output_buffer=, :encoding
64
+ end
65
+
66
+ def output_buffer_with_encoding=(out)
67
+ out && out.force_encoding(ForceEncoding.template_encoding)
68
+ self.output_buffer_without_encoding = out
69
+ end
70
+ end
71
+
72
+ module RenderResult
73
+ def self.included(base)
74
+ base.alias_method_chain :render_template, :encode
75
+ end
76
+
77
+ def render_template_with_encode(v, l = {})
78
+ render_template_without_encode(v, l).tap do |out|
79
+ out && out.force_encoding(ForceEncoding.template_encoding)
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
85
+
data/rails/init.rb ADDED
@@ -0,0 +1,7 @@
1
+ if RUBY_VERSION >= "1.9"
2
+ require 'ruby19_monkey'
3
+ Ruby19Monkey.install!
4
+ else
5
+ # do nothing
6
+ end
7
+
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: moro-ruby19_monkey
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - moro
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-02-13 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Monkey patches to work rails(2.3.0) with ruby 1.9.1
17
+ email: moronatural@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README
24
+ - ChangeLog
25
+ files:
26
+ - README
27
+ - ChangeLog
28
+ - Rakefile
29
+ - lib/ruby19_monkey.rb
30
+ - rails/init.rb
31
+ has_rdoc: true
32
+ homepage: http://github.com/moro/ruby19_monkey
33
+ post_install_message:
34
+ rdoc_options:
35
+ - --title
36
+ - ruby19_monkey documentation
37
+ - --charset
38
+ - utf-8
39
+ - --opname
40
+ - index.html
41
+ - --line-numbers
42
+ - --main
43
+ - README
44
+ - --inline-source
45
+ - --exclude
46
+ - ^(examples|extras)/
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ version:
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: "0"
60
+ version:
61
+ requirements: []
62
+
63
+ rubyforge_project: ruby19_monkey
64
+ rubygems_version: 1.2.0
65
+ signing_key:
66
+ specification_version: 2
67
+ summary: Monkey patches to work rails(2.3.0) with ruby 1.9.1
68
+ test_files: []
69
+