Browse files

Merge branch 'rails' of github.com:winton/gem_template

Conflicts:
	README.md
	bin/gem_template
	lib/gem_template.rb
	rails/init.rb
	require.rb
	spec/spec_helper.rb
  • Loading branch information...
2 parents bf8728a + 8e9b60b commit a13b2637d0cfedf7c2c6201fc93aa25606f767ae @winton committed Oct 20, 2011
View
4 .gitignore
@@ -1,7 +1,7 @@
.DS_Store
*.gem
-*.gemspec
-coverage
+.bundle
+Gemfile.lock
pkg
spec/fixtures/rails/log/*
tmp
View
3 Gemfile
@@ -0,0 +1,3 @@
+source "http://rubygems.org"
+
+gemspec
View
2 MIT-LICENSE → LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2009 Winton Welsh
+Copyright (c) 2010
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
View
2 README.markdown → README.md
@@ -61,4 +61,4 @@ Rake task
Add <code>rake background_cache</code> to cron. All cache configurations are busted every time it is run.
-To run a specific group of caches, run <code>rake background\_cache[every\_hour]</code> (as per the example above).
+To run a specific group of caches, run <code>rake background\_cache[every\_hour]</code> (as per the example above).
View
24 Rakefile
@@ -1,23 +1 @@
-require "#{File.dirname(__FILE__)}/require"
-Require.rakefile!
-
-# You can delete this after you use it
-desc "Rename project"
-task :rename do
- name = ENV['NAME'] || File.basename(Dir.pwd)
- begin
- dir = Dir['**/gem_template*']
- from = dir.pop
- if from
- rb = from.include?('.rb')
- to = File.dirname(from) + "/#{name}#{'.rb' if rb}"
- FileUtils.mv(from, to)
- end
- end while dir.length > 0
- Dir["**/*"].each do |path|
- next if path.include?('Rakefile')
- if File.file?(path)
- `sed -i "" 's/gem_template/#{name}/g' #{path}`
- end
- end
-end
+require 'bundler/gem_tasks'
View
25 background_cache.gemspec
@@ -0,0 +1,25 @@
+# -*- encoding: utf-8 -*-
+root = File.expand_path('../', __FILE__)
+lib = "#{root}/lib"
+
+$:.unshift lib unless $:.include?(lib)
+
+Gem::Specification.new do |s|
+ s.name = "background_cache"
+ s.version = '0.1.0'
+ s.platform = Gem::Platform::RUBY
+ s.authors = [ "Winton Welsh" ]
+ s.email = [ "mail@wintoni.us" ]
+ s.homepage = "http://github.com/winton/background_cache"
+ s.summary = %q{Bust caches before your users do}
+ s.description = %q{Bust caches before your users do.}
+
+ s.executables = `cd #{root} && git ls-files bin/*`.split("\n").collect { |f| File.basename(f) }
+ s.files = `cd #{root} && git ls-files`.split("\n")
+ s.require_paths = %w(lib)
+ s.test_files = `cd #{root} && git ls-files -- {features,test,spec}/*`.split("\n")
+
+ s.add_development_dependency "rack-test", "= 0.5.3"
+ s.add_development_dependency "rails", "= 2.3.10"
+ s.add_development_dependency "rspec", "~> 1.0"
+end
View
3 bin/background_cache
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+
+require File.expand_path("../../lib/background_cache", __FILE__)
View
13 lib/background_cache.rb
@@ -1,5 +1,14 @@
-require File.expand_path("#{File.dirname(__FILE__)}/../require")
-Require.lib!
+gem 'rack-test', '=0.5.3'
+
+require 'digest/sha2'
+require 'rack/test'
+
+$:.unshift File.dirname(__FILE__)
+
+require 'background_cache/config'
+require 'background_cache/controller'
+require 'background_cache/helper'
+require 'background_cache/mem_cache'
module BackgroundCache
View
2 lib/background_cache/config.rb
@@ -1,5 +1,3 @@
-require 'digest/sha2'
-
module BackgroundCache
class Config
View
3 rails/init.rb
@@ -3,8 +3,7 @@
rescue LoadError
end
-require File.expand_path("#{File.dirname(__FILE__)}/../require")
-Require.rails_init!
+require File.expand_path('../../lib/background_cache.rb', __FILE__)
ActionController::Base.send(:include, BackgroundCache::Controller)
ActionView::Helpers::CacheHelper.send(:include, BackgroundCache::Helper)
View
50 require.rb
@@ -1,50 +0,0 @@
-require 'rubygems'
-gem 'require'
-require 'require'
-
-Require do
- gem :rails, '=2.3.10'
- gem :require, '=0.2.7'
- gem(:'rack-test', '=0.5.3') { require 'rack/test' }
- gem(:rake, '=0.8.7') { require 'rake' }
- gem :rspec, '=1.3.0'
-
- gemspec do
- author 'Winton Welsh'
- dependencies do
- gem :'rack-test'
- gem :require
- end
- email 'mail@wintoni.us'
- name 'background_cache'
- homepage "http://github.com/winton/#{name}"
- summary "Bust caches before your users do"
- version '0.1.3'
- end
-
- bin { require 'lib/background_cache' }
-
- lib do
- gem :'rack-test'
- require 'lib/background_cache/config'
- require 'lib/background_cache/controller'
- require 'lib/background_cache/helper'
- require 'lib/background_cache/mem_cache'
- end
-
- rails_init { require 'lib/background_cache' }
-
- rakefile do
- gem(:rake) { require 'rake/gempackagetask' }
- gem(:rspec) { require 'spec/rake/spectask' }
- require 'require/tasks'
- end
-
- spec_helper do
- gem :rails
- gem :'rack-test'
- require 'require/spec_helper'
- require 'pp'
- require 'spec/fixtures/rails/config/environment'
- end
-end
View
14 spec/spec_helper.rb
@@ -1,12 +1,14 @@
-RAILS_ENV = 'production'
-
-require File.expand_path("#{File.dirname(__FILE__)}/../require")
-Require.spec_helper!
+require "pp"
+require "bundler"
-Spec::Runner.configure do |config|
-end
+Bundler.require(:development)
COMMENT_REGEX = /<!-- .+ cached .+ -->\n/
+RAILS_ENV = 'production'
+
+require 'spec/fixtures/rails/config/environment'
+
+$root = File.expand_path('../../', __FILE__)
def cache_read(key)
value = ::ActionController::Base.cache_store.read('views/' + key)

0 comments on commit a13b263

Please sign in to comment.