initial commit
This commit is contained in:
commit
d26b195551
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
*.gem
|
||||
.bundle
|
||||
Gemfile.lock
|
||||
pkg/*
|
4
Gemfile
Normal file
4
Gemfile
Normal file
@ -0,0 +1,4 @@
|
||||
source "http://rubygems.org"
|
||||
|
||||
# Specify your gem's dependencies in guard-lacquer.gemspec
|
||||
gemspec
|
9
Guardfile
Normal file
9
Guardfile
Normal file
@ -0,0 +1,9 @@
|
||||
# A sample Guardfile
|
||||
# More info at https://github.com/guard/guard#readme
|
||||
|
||||
guard 'rspec', :version => 2 do
|
||||
watch(%r{^spec/.+_spec\.rb$})
|
||||
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
||||
watch('spec/spec_helper.rb') { "spec" }
|
||||
end
|
||||
|
26
guard-lacquer.gemspec
Normal file
26
guard-lacquer.gemspec
Normal file
@ -0,0 +1,26 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
$:.push File.expand_path("../lib", __FILE__)
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = "guard-lacquer"
|
||||
s.version = '0.0.1'
|
||||
s.authors = ["John Bintz"]
|
||||
s.email = ["john@coswellproductions.com"]
|
||||
s.homepage = ""
|
||||
s.summary = %q{TODO: Write a gem summary}
|
||||
s.description = %q{TODO: Write a gem description}
|
||||
|
||||
s.rubyforge_project = "guard-lacquer"
|
||||
|
||||
s.files = `git ls-files`.split("\n")
|
||||
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
||||
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
||||
s.require_paths = ["lib"]
|
||||
|
||||
s.add_runtime_dependency 'lacquer'
|
||||
s.add_runtime_dependency 'guard'
|
||||
|
||||
s.add_development_dependency 'rspec', '~> 2.6.0'
|
||||
s.add_development_dependency 'mocha'
|
||||
s.add_development_dependency 'guard-rspec'
|
||||
end
|
2
lib/guard-lacquer.rb
Normal file
2
lib/guard-lacquer.rb
Normal file
@ -0,0 +1,2 @@
|
||||
require 'guard/lacquer'
|
||||
|
50
lib/guard/lacquer.rb
Normal file
50
lib/guard/lacquer.rb
Normal file
@ -0,0 +1,50 @@
|
||||
require 'guard'
|
||||
require 'guard/guard'
|
||||
require 'lacquer'
|
||||
require 'lacquer/varnishd'
|
||||
|
||||
p "made it"
|
||||
|
||||
module Guard
|
||||
class Lacquer < Guard::Guard
|
||||
def initialize(watchers = [], options = {})
|
||||
super
|
||||
|
||||
@backend = ::Lacquer::Varnishd.new(
|
||||
:listen => "127.0.0.1:#{options[:port]}",
|
||||
:storage => "file,tmp/cache/varnish.store,32M",
|
||||
:backend => options[:backend],
|
||||
:sbin_path => File.split(`which varnishd`).first,
|
||||
:pid_file => 'tmp/pids/varnish.pid'
|
||||
)
|
||||
end
|
||||
|
||||
def start
|
||||
@backend.start
|
||||
end
|
||||
|
||||
def stop
|
||||
@backend.start stop
|
||||
end
|
||||
|
||||
def reload
|
||||
stop
|
||||
start
|
||||
end
|
||||
|
||||
def run_all
|
||||
true
|
||||
end
|
||||
|
||||
# Called on file(s) modifications
|
||||
def run_on_change(paths)
|
||||
restart
|
||||
end
|
||||
|
||||
# Called on file(s) deletions
|
||||
def run_on_deletion(paths)
|
||||
restart
|
||||
end
|
||||
end
|
||||
end
|
||||
|
13
spec/lib/guard/lacquer_spec.rb
Normal file
13
spec/lib/guard/lacquer_spec.rb
Normal file
@ -0,0 +1,13 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Guard::Lacquer do
|
||||
let(:guard) { described_class.new([], options) }
|
||||
let(:options) { {} }
|
||||
|
||||
subject { guard }
|
||||
|
||||
describe '#initialize' do
|
||||
its(:options) { should == options }
|
||||
end
|
||||
end
|
||||
|
6
spec/spec_helper.rb
Normal file
6
spec/spec_helper.rb
Normal file
@ -0,0 +1,6 @@
|
||||
require 'guard-lacquer'
|
||||
|
||||
RSpec.configure do |c|
|
||||
c.mock_with :mocha
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user