shellac 0.0.2.1 → 0.0.2.3

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.
@@ -0,0 +1,58 @@
1
+ # Rails
2
+ .bundle
3
+ db/*.sqlite3
4
+ db/*.sqlite3-journal
5
+ *.log
6
+ tmp
7
+ tmp/**/*
8
+ public
9
+ config/database.yml
10
+ db/schema.rb
11
+ Gemfile.lock
12
+
13
+ # Vendor Cache
14
+ vendor/cache
15
+
16
+ # rcov generated
17
+ coverage
18
+
19
+ # rdoc generated
20
+ rdoc
21
+
22
+ # yard generated
23
+ doc
24
+ .yardoc
25
+
26
+ # bundler
27
+ .bundle
28
+
29
+ # jeweler generated
30
+ pkg
31
+ *.gem
32
+
33
+ # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
34
+ #
35
+ # * Create a file at ~/.gitignore
36
+ # * Include files you want ignored
37
+ # * Run: git config --global core.excludesfile ~/.gitignore
38
+ #
39
+ # After doing this, these files will be ignored in all your git projects,
40
+ # saving you from having to 'pollute' every project you touch with them
41
+ #
42
+ # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
43
+ #
44
+ # For MacOS:
45
+ #
46
+ .DS_Store
47
+ #
48
+ # For Text
49
+ *.tmproj
50
+ tmtags
51
+ #
52
+ # For emacs:
53
+ #*~
54
+ #\#*
55
+ #.\#*
56
+ #
57
+ # For vim:
58
+ #*.swp
data/Rakefile CHANGED
@@ -1,53 +1,5 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'rake'
11
-
12
- require 'jeweler'
13
- Jeweler::Tasks.new do |gem|
14
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
- gem.name = "shellac"
16
- gem.homepage = "http://github.com/bitflut/shellac"
17
- gem.license = "MIT"
18
- gem.summary = %Q{Shellac is a gem to easily send purges to varnish servers from rails}
19
- gem.description = %Q{Shellac gives you an environment aware helper for purging configured under config/varnish.yml built ontop of Max Schoefmann's klarlack gem}
20
- gem.email = "marian@bitflut.com"
21
- gem.authors = ["Marian"]
22
- # Include your dependencies below. Runtime dependencies are required when using your gem,
23
- # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24
- gem.add_runtime_dependency 'klarlack', '~> 0.0.6'
25
- # gem.add_development_dependency 'rspec', '> 1.2.3'
26
- end
27
- Jeweler::RubygemsDotOrgTasks.new
28
-
29
- require 'rake/testtask'
30
- Rake::TestTask.new(:test) do |test|
31
- test.libs << 'lib' << 'test'
32
- test.pattern = 'test/**/test_*.rb'
33
- test.verbose = true
34
- end
35
-
36
- require 'rcov/rcovtask'
37
- Rcov::RcovTask.new do |test|
38
- test.libs << 'test'
39
- test.pattern = 'test/**/test_*.rb'
40
- test.verbose = true
41
- end
1
+ require File.expand_path('../config/application', __FILE__)
2
+ ShellacApp::Application.load_tasks
42
3
 
43
- task :default => :test
44
-
45
- require 'rake/rdoctask'
46
- Rake::RDocTask.new do |rdoc|
47
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
-
49
- rdoc.rdoc_dir = 'rdoc'
50
- rdoc.title = "shellac #{version}"
51
- rdoc.rdoc_files.include('README*')
52
- rdoc.rdoc_files.include('lib/**/*.rb')
53
- end
4
+ require 'bundler'
5
+ Bundler::GemHelper.install_tasks
@@ -3,9 +3,11 @@ require 'rails/generators'
3
3
  module Shellac
4
4
  module Generators
5
5
  class InstallGenerator < Rails::Generators::Base
6
+
7
+ source_root File.expand_path("../../templates", __FILE__)
6
8
 
7
9
  def generate
8
- copy_file "../templates/varnish.yml", "config/varnish.yml"
10
+ copy_file "config/varnish.yml", "config/varnish.yml"
9
11
 
10
12
  puts "------------------------"
11
13
  puts "Now configure your varnish setup here:"
@@ -2,15 +2,13 @@ require 'rails'
2
2
  require 'klarlack'
3
3
 
4
4
  class Railtie < Rails::Railtie
5
-
6
5
  config.before_initialize do
7
6
  require File.expand_path('../shellac/cache', __FILE__)
8
7
  require File.expand_path('../shellac/actions', __FILE__)
9
8
  end
10
-
9
+
11
10
  config.to_prepare do
12
11
  ActionController::Base.send :extend, Shellac::Actions
13
12
  ActionController::Base.send :include, Shellac::Actions
14
13
  end
15
-
16
14
  end
@@ -2,7 +2,7 @@ module Shellac
2
2
  module Actions
3
3
 
4
4
  def purge regex, recursive=false
5
- return unless perform_caching
5
+ return unless ActionController::Base.perform_caching
6
6
  Shellac::Cache.instance.purge regex, recursive
7
7
  end
8
8
 
@@ -1,8 +1,12 @@
1
+ require 'singleton'
2
+
1
3
  module Shellac
2
4
  class Cache
3
5
  include Singleton
4
6
 
5
- VARNISH_CONFIGURATION = YAML.load_file("#{Rails.root.to_s}/config/varnish.yml")[::Rails.env]
7
+ if File.exist?("#{File.expand_path(Rails.root.to_s)}/config/varnish.yml")
8
+ VARNISH_CONFIGURATION = YAML.load_file("#{Rails.root.to_s}/config/varnish.yml")[::Rails.env]
9
+ end
6
10
 
7
11
  # return client instance
8
12
  def client
@@ -30,7 +34,11 @@ module Shellac
30
34
  protected
31
35
 
32
36
  def config attr
33
- VARNISH_CONFIGURATION[attr]
37
+ begin
38
+ VARNISH_CONFIGURATION[attr]
39
+ rescue
40
+ raise "Shellac was not properly configured for #{::Rails.env} environment. Did you run rails generate shellac:install?"
41
+ end
34
42
  end
35
43
  end
36
44
  end
@@ -1,74 +1,49 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require 'shellac/version'
5
4
 
6
5
  Gem::Specification.new do |s|
7
- s.name = %q{shellac}
8
- s.version = "0.0.2.1"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Marian"]
12
- s.date = %q{2011-04-12}
13
- s.description = %q{Shellac gives you an environment aware helper for purging configured under config/varnish.yml built ontop of Max Schoefmann's klarlack gem}
14
- s.email = %q{marian@bitflut.com}
15
- s.extra_rdoc_files = [
16
- "LICENSE.txt",
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".document",
21
- "Gemfile",
22
- "Gemfile.lock",
23
- "LICENSE.txt",
24
- "README.rdoc",
25
- "Rakefile",
26
- "VERSION",
27
- "lib/generators/shellac/install_generator.rb",
28
- "lib/generators/templates/config/varnish.yml",
29
- "lib/generators/templates/varnish.yml",
30
- "lib/shellac.rb",
31
- "lib/shellac/actions.rb",
32
- "lib/shellac/cache.rb",
33
- "shellac.gemspec",
34
- "test/helper.rb",
35
- "test/test_shellac.rb"
36
- ]
37
- s.homepage = %q{http://github.com/bitflut/shellac}
38
- s.licenses = ["MIT"]
6
+ s.name = "shellac"
7
+ s.version = Shellac::VERSION
8
+ s.description = %q{Shellac gives you an environment aware helper for purging configured under config/varnish.yml built ontop of Max Schoefmann's klarlack gem}
9
+ s.summary = %q{Shellac is a gem to easily send purges to varnish servers from rails}
10
+ s.email = %q{marian@bitflut.com}
11
+ s.homepage = %q{http://github.com/bitflut/shellac}
12
+ s.authors = ['Marian Andre']
13
+ s.license = %q{MIT}
14
+
15
+ s.files = `git ls-files -- {shellac*,lib,spec,LICENSE.txt,README*,Gemfile}`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
39
18
  s.require_paths = ["lib"]
40
- s.rubygems_version = %q{1.5.2}
41
- s.summary = %q{Shellac is a gem to easily send purges to varnish servers from rails}
42
- s.test_files = [
43
- "test/helper.rb",
44
- "test/test_shellac.rb"
45
- ]
46
19
 
47
- if s.respond_to? :specification_version then
48
- s.specification_version = 3
20
+ s.add_dependency 'bundler', '~> 1.0'
21
+ s.add_runtime_dependency 'klarlack', '~> 0.0.6'
22
+
23
+ s.add_development_dependency 'rspec-rails', '~> 2.5'
24
+ s.add_development_dependency 'rcov', ">= 0"
25
+ s.add_development_dependency 'rails', '3.0.7.rc2'
26
+ s.add_development_dependency 'sqlite3', '~> 0.0.6'
49
27
 
50
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
51
- s.add_runtime_dependency(%q<klarlack>, ["~> 0.0.6"])
52
- s.add_development_dependency(%q<shoulda>, [">= 0"])
53
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
54
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
55
- s.add_development_dependency(%q<rcov>, [">= 0"])
56
- s.add_runtime_dependency(%q<klarlack>, ["~> 0.0.6"])
57
- else
58
- s.add_dependency(%q<klarlack>, ["~> 0.0.6"])
59
- s.add_dependency(%q<shoulda>, [">= 0"])
60
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
61
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
62
- s.add_dependency(%q<rcov>, [">= 0"])
63
- s.add_dependency(%q<klarlack>, ["~> 0.0.6"])
64
- end
65
- else
66
- s.add_dependency(%q<klarlack>, ["~> 0.0.6"])
67
- s.add_dependency(%q<shoulda>, [">= 0"])
68
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
69
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
70
- s.add_dependency(%q<rcov>, [">= 0"])
71
- s.add_dependency(%q<klarlack>, ["~> 0.0.6"])
72
- end
28
+ s.files = [
29
+ '.gitignore',
30
+ 'LICENSE.txt',
31
+ 'README.rdoc',
32
+ 'Rakefile',
33
+ 'lib',
34
+ 'lib/generators',
35
+ 'lib/generators/shellac',
36
+ 'lib/generators/shellac/install_generator.rb',
37
+ 'lib/generators/templates',
38
+ 'lib/generators/templates/config',
39
+ 'lib/generators/templates/config/varnish.yml',
40
+ 'lib/shellac',
41
+ 'lib/shellac/actions.rb',
42
+ 'lib/shellac/cache.rb',
43
+ 'lib/shellac.rb',
44
+ 'shellac.gemspec',
45
+ 'spec',
46
+ 'spec/shellac_spec.rb',
47
+ 'spec/spec_helper.rb'
48
+ ]
73
49
  end
74
-
@@ -0,0 +1,31 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Shellac" do
4
+ it "should add purge as a class method to ActionController::Base" do
5
+ ActionController::Base.methods.include?(:purge).should be_true
6
+ end
7
+
8
+ it "should add purge as an instance method to ActionController::Base" do
9
+ ActionController::Base.instance_methods.include?(:purge).should be_true
10
+ end
11
+
12
+ context "(rails performs caching)" do
13
+ before(:each) do
14
+ ActionController::Base.perform_caching = true
15
+ end
16
+
17
+ it "should raise error if varnish is not available" do
18
+ lambda {ActionController::Base.purge("/")}.should raise_error(Errno::ECONNREFUSED)
19
+ end
20
+ end
21
+
22
+ context "(rails doesn't perform caching)" do
23
+ before(:each) do
24
+ ActionController::Base.perform_caching = false
25
+ end
26
+
27
+ it "should return nil" do
28
+ ActionController::Base.purge("/").should be nil
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,27 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV["RAILS_ENV"] ||= 'test'
3
+ require File.expand_path("../../config/environment", __FILE__)
4
+ require 'rspec/rails'
5
+
6
+ # Requires supporting ruby files with custom matchers and macros, etc,
7
+ # in spec/support/ and its subdirectories.
8
+ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+ # == Mock Framework
12
+ #
13
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
14
+ #
15
+ # config.mock_with :mocha
16
+ # config.mock_with :flexmock
17
+ # config.mock_with :rr
18
+ config.mock_with :rspec
19
+
20
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
21
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
22
+
23
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
24
+ # examples within a transaction, remove the following line or assign false
25
+ # instead of true.
26
+ config.use_transactional_fixtures = true
27
+ end
metadata CHANGED
@@ -2,81 +2,81 @@
2
2
  name: shellac
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2.1
5
+ version: 0.0.2.3
6
6
  platform: ruby
7
7
  authors:
8
- - Marian
8
+ - Marian Andre
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-12 00:00:00 +02:00
13
+ date: 2011-04-17 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
- name: klarlack
17
+ name: bundler
18
18
  requirement: &id001 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ~>
22
22
  - !ruby/object:Gem::Version
23
- version: 0.0.6
23
+ version: "1.0"
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: *id001
27
27
  - !ruby/object:Gem::Dependency
28
- name: shoulda
28
+ name: klarlack
29
29
  requirement: &id002 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
- - - ">="
32
+ - - ~>
33
33
  - !ruby/object:Gem::Version
34
- version: "0"
35
- type: :development
34
+ version: 0.0.6
35
+ type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: *id002
38
38
  - !ruby/object:Gem::Dependency
39
- name: bundler
39
+ name: rspec-rails
40
40
  requirement: &id003 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: 1.0.0
45
+ version: "2.5"
46
46
  type: :development
47
47
  prerelease: false
48
48
  version_requirements: *id003
49
49
  - !ruby/object:Gem::Dependency
50
- name: jeweler
50
+ name: rcov
51
51
  requirement: &id004 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
- - - ~>
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: 1.5.2
56
+ version: "0"
57
57
  type: :development
58
58
  prerelease: false
59
59
  version_requirements: *id004
60
60
  - !ruby/object:Gem::Dependency
61
- name: rcov
61
+ name: rails
62
62
  requirement: &id005 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
65
- - - ">="
65
+ - - "="
66
66
  - !ruby/object:Gem::Version
67
- version: "0"
67
+ version: 3.0.7.rc2
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: *id005
71
71
  - !ruby/object:Gem::Dependency
72
- name: klarlack
72
+ name: sqlite3
73
73
  requirement: &id006 !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
76
76
  - - ~>
77
77
  - !ruby/object:Gem::Version
78
78
  version: 0.0.6
79
- type: :runtime
79
+ type: :development
80
80
  prerelease: false
81
81
  version_requirements: *id006
82
82
  description: Shellac gives you an environment aware helper for purging configured under config/varnish.yml built ontop of Max Schoefmann's klarlack gem
@@ -85,26 +85,21 @@ executables: []
85
85
 
86
86
  extensions: []
87
87
 
88
- extra_rdoc_files:
89
- - LICENSE.txt
90
- - README.rdoc
88
+ extra_rdoc_files: []
89
+
91
90
  files:
92
- - .document
93
- - Gemfile
94
- - Gemfile.lock
91
+ - .gitignore
95
92
  - LICENSE.txt
96
93
  - README.rdoc
97
94
  - Rakefile
98
- - VERSION
99
95
  - lib/generators/shellac/install_generator.rb
100
96
  - lib/generators/templates/config/varnish.yml
101
- - lib/generators/templates/varnish.yml
102
- - lib/shellac.rb
103
97
  - lib/shellac/actions.rb
104
98
  - lib/shellac/cache.rb
99
+ - lib/shellac.rb
105
100
  - shellac.gemspec
106
- - test/helper.rb
107
- - test/test_shellac.rb
101
+ - spec/shellac_spec.rb
102
+ - spec/spec_helper.rb
108
103
  has_rdoc: true
109
104
  homepage: http://github.com/bitflut/shellac
110
105
  licenses:
@@ -119,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
114
  requirements:
120
115
  - - ">="
121
116
  - !ruby/object:Gem::Version
122
- hash: -1693957586213964393
117
+ hash: 4382317821384086881
123
118
  segments:
124
119
  - 0
125
120
  version: "0"
@@ -128,6 +123,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
123
  requirements:
129
124
  - - ">="
130
125
  - !ruby/object:Gem::Version
126
+ hash: 4382317821384086881
127
+ segments:
128
+ - 0
131
129
  version: "0"
132
130
  requirements: []
133
131
 
@@ -137,5 +135,5 @@ signing_key:
137
135
  specification_version: 3
138
136
  summary: Shellac is a gem to easily send purges to varnish servers from rails
139
137
  test_files:
140
- - test/helper.rb
141
- - test/test_shellac.rb
138
+ - spec/shellac_spec.rb
139
+ - spec/spec_helper.rb
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
data/Gemfile DELETED
@@ -1,13 +0,0 @@
1
- source "http://rubygems.org"
2
- # Add dependencies required to use your gem here.
3
- # Example:
4
- gem "klarlack", "~> 0.0.6"
5
-
6
- # Add dependencies to develop your gem here.
7
- # Include everything needed to run rake, tests, features, etc.
8
- group :development do
9
- gem "shoulda", ">= 0"
10
- gem "bundler", "~> 1.0.0"
11
- gem "jeweler", "~> 1.5.2"
12
- gem "rcov", ">= 0"
13
- end
@@ -1,22 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- git (1.2.5)
5
- jeweler (1.5.2)
6
- bundler (~> 1.0.0)
7
- git (>= 1.2.5)
8
- rake
9
- klarlack (0.0.6)
10
- rake (0.8.7)
11
- rcov (0.9.9)
12
- shoulda (2.11.3)
13
-
14
- PLATFORMS
15
- ruby
16
-
17
- DEPENDENCIES
18
- bundler (~> 1.0.0)
19
- jeweler (~> 1.5.2)
20
- klarlack (~> 0.0.6)
21
- rcov
22
- shoulda
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.0.2.1
@@ -1,25 +0,0 @@
1
- # Define varnish for all environments that make use of it.
2
- # Currently all options must be specified. This will change in a future
3
- # version to only need definition of non default values of varnish.
4
-
5
- # host: The host which you access your varnish server from. This
6
- # is particularly useful when you cache more than one host
7
- # with one varnish instance (default: localhost)
8
-
9
- # post: The port of your varnish telnet server (default: 6082)
10
-
11
- # timeout: Timeout in seconds when connecting to varnish (default: 1)
12
-
13
- # keep_alive: Set to true, to keep the connection alive (default: false)
14
-
15
- development:
16
- host: localhost
17
- port: 6082
18
- timeout: 1
19
- keep_alive: false
20
-
21
- production:
22
- host: example.com
23
- port: 6082
24
- timeout: 1
25
- keep_alive: false
@@ -1,18 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'test/unit'
11
- require 'shoulda'
12
-
13
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
- $LOAD_PATH.unshift(File.dirname(__FILE__))
15
- require 'shellac'
16
-
17
- class Test::Unit::TestCase
18
- end
@@ -1,7 +0,0 @@
1
- require 'helper'
2
-
3
- class TestShellac < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
6
- end
7
- end