Skip to content

Commit

Permalink
vendor activesupport, tzinfo, and mechanize
Browse files Browse the repository at this point in the history
  • Loading branch information
technoweenie committed Nov 4, 2008
1 parent 048df9b commit fca579a
Show file tree
Hide file tree
Showing 1,088 changed files with 90,052 additions and 3 deletions.
4 changes: 1 addition & 3 deletions lib/seinfeld/models.rb
@@ -1,7 +1,5 @@
$: << File.join(File.dirname(__FILE__), '..', '..', 'vendor', 'feed_me', 'lib')
$: << File.join(File.dirname(__FILE__), '..', '..', 'vendor', 'mechanical_github', 'lib')
$LOAD_PATH.push *Dir[File.join(File.dirname(__FILE__), '..', '..', 'vendor', '*', 'lib')]
require 'rubygems'
gem 'activesupport', '~> 2.1'
require 'active_support/time_with_zone'
require 'active_support/values/time_zone'
require 'active_support/core_ext/object'
Expand Down
1,193 changes: 1,193 additions & 0 deletions vendor/activesupport-2.1.1/CHANGELOG

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions vendor/activesupport-2.1.1/README
@@ -0,0 +1,43 @@
= Active Support -- Utility classes and standard library extensions from Rails

Active Support is a collection of various utility classes and standard library extensions that were found useful
for Rails. All these additions have hence been collected in this bundle as way to gather all that sugar that makes
Ruby sweeter.


== Download

The latest version of Active Support can be found at

* http://rubyforge.org/project/showfiles.php?group_id=182

Documentation can be found at

* http://as.rubyonrails.com


== Installation

The preferred method of installing Active Support is through its GEM file. You'll need to have
RubyGems[http://rubygems.rubyforge.org/wiki/wiki.pl] installed for that, though. If you have it,
then use:

% [sudo] gem install activesupport-1.0.0.gem


== License

Active Support is released under the MIT license.


== Support

The Active Support homepage is http://www.rubyonrails.com. You can find the Active Support
RubyForge page at http://rubyforge.org/projects/activesupport. And as Jim from Rake says:

Feel free to submit commits or feature requests. If you send a patch,
remember to update the corresponding unit tests. If fact, I prefer
new feature to be submitted in the form of new unit tests.

For other information, feel free to ask on the ruby-talk mailing list
(which is mirrored to comp.lang.ruby) or contact mailto:david@loudthinking.com.
61 changes: 61 additions & 0 deletions vendor/activesupport-2.1.1/lib/active_support.rb
@@ -0,0 +1,61 @@
#--
# Copyright (c) 2005 David Heinemeier Hansson
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++

$:.unshift(File.dirname(__FILE__))

require 'active_support/vendor'
require 'active_support/basic_object'
require 'active_support/inflector'
require 'active_support/callbacks'

require 'active_support/core_ext'

require 'active_support/clean_logger'
require 'active_support/buffered_logger'

require 'active_support/gzip'
require 'active_support/cache'

require 'active_support/dependencies'
require 'active_support/deprecation'

require 'active_support/ordered_hash'
require 'active_support/ordered_options'
require 'active_support/option_merger'

require 'active_support/string_inquirer'

require 'active_support/values/time_zone'
require 'active_support/duration'

require 'active_support/json'

require 'active_support/multibyte'

require 'active_support/base64'

require 'active_support/time_with_zone'

Inflector = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('Inflector', 'ActiveSupport::Inflector')
Dependencies = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('Dependencies', 'ActiveSupport::Dependencies')
TimeZone = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('TimeZone', 'ActiveSupport::TimeZone')
22 changes: 22 additions & 0 deletions vendor/activesupport-2.1.1/lib/active_support/base64.rb
@@ -0,0 +1,22 @@
begin
require 'base64'
rescue LoadError
end

module ActiveSupport
if defined? ::Base64
Base64 = ::Base64
else
# Ruby 1.9 doesn't provide base64, so we wrap this here
module Base64

def self.encode64(data)
[data].pack("m")
end

def self.decode64(data)
data.unpack("m").first
end
end
end
end
24 changes: 24 additions & 0 deletions vendor/activesupport-2.1.1/lib/active_support/basic_object.rb
@@ -0,0 +1,24 @@
# A base class with no predefined methods that tries to behave like Builder's
# BlankSlate in Ruby 1.9. In Ruby pre-1.9, this is actually the
# Builder::BlankSlate class.
#
# Ruby 1.9 introduces BasicObject which differs slightly from Builder's
# BlankSlate that has been used so far. ActiveSupport::BasicObject provides a
# barebones base class that emulates Builder::BlankSlate while still relying on
# Ruby 1.9's BasicObject in Ruby 1.9.
module ActiveSupport
if RUBY_VERSION >= '1.9'
class BasicObject < ::BasicObject
undef_method :==
undef_method :equal?

# Let ActiveSupport::BasicObject at least raise exceptions.
def raise(*args)
::Object.send(:raise, *args)
end
end
else
require 'blankslate'
BasicObject = BlankSlate
end
end
121 changes: 121 additions & 0 deletions vendor/activesupport-2.1.1/lib/active_support/buffered_logger.rb
@@ -0,0 +1,121 @@
module ActiveSupport
# Inspired by the buffered logger idea by Ezra
class BufferedLogger
module Severity
DEBUG = 0
INFO = 1
WARN = 2
ERROR = 3
FATAL = 4
UNKNOWN = 5
end
include Severity

MAX_BUFFER_SIZE = 1000

# Set to false to disable the silencer
cattr_accessor :silencer
self.silencer = true

# Silences the logger for the duration of the block.
def silence(temporary_level = ERROR)
if silencer
begin
old_logger_level, self.level = level, temporary_level
yield self
ensure
self.level = old_logger_level
end
else
yield self
end
end

attr_accessor :level
attr_reader :auto_flushing
attr_reader :buffer

def initialize(log, level = DEBUG)
@level = level
@buffer = []
@auto_flushing = 1
@no_block = false

if log.respond_to?(:write)
@log = log
elsif File.exist?(log)
@log = open(log, (File::WRONLY | File::APPEND))
@log.sync = true
else
FileUtils.mkdir_p(File.dirname(log))
@log = open(log, (File::WRONLY | File::APPEND | File::CREAT))
@log.sync = true
@log.write("# Logfile created on %s" % [Time.now.to_s])
end
end

def set_non_blocking_io
if !RUBY_PLATFORM.match(/java|mswin/) && !(@log == STDOUT) && @log.respond_to?(:write_nonblock)
@no_block = true
end
end

def add(severity, message = nil, progname = nil, &block)
return if @level > severity
message = (message || (block && block.call) || progname).to_s
# If a newline is necessary then create a new message ending with a newline.
# Ensures that the original message is not mutated.
message = "#{message}\n" unless message[-1] == ?\n
buffer << message
auto_flush
message
end

for severity in Severity.constants
class_eval <<-EOT, __FILE__, __LINE__
def #{severity.downcase}(message = nil, progname = nil, &block)
add(#{severity}, message, progname, &block)
end
def #{severity.downcase}?
#{severity} >= @level
end
EOT
end

# Set the auto-flush period. Set to true to flush after every log message,
# to an integer to flush every N messages, or to false, nil, or zero to
# never auto-flush. If you turn auto-flushing off, be sure to regularly
# flush the log yourself -- it will eat up memory until you do.
def auto_flushing=(period)
@auto_flushing =
case period
when true; 1
when false, nil, 0; MAX_BUFFER_SIZE
when Integer; period
else raise ArgumentError, "Unrecognized auto_flushing period: #{period.inspect}"
end
end

def flush
unless buffer.empty?
if @no_block
@log.write_nonblock(buffer.slice!(0..-1).join)
else
@log.write(buffer.slice!(0..-1).join)
end
end
end

def close
flush
@log.close if @log.respond_to?(:close)
@log = nil
end

protected
def auto_flush
flush if buffer.size >= @auto_flushing
end
end
end

0 comments on commit fca579a

Please sign in to comment.