Works using regular configurations. All is hardcoded using standard jammit/rails settings.

Please submit patches for changing output directories etc.
This commit is contained in:
Pelle Braendgaard 2010-11-08 14:53:07 -05:00
parent b5360b9fd7
commit 3a11aea76f
10 changed files with 82 additions and 54 deletions

View File

@ -1,17 +0,0 @@
= guard-jammit
Description goes here.
== Note on Patches/Pull Requests
* Fork the project.
* Make your feature addition or bug fix.
* Add tests for it. This is important so I don't break it in a
future version unintentionally.
* Commit, do not mess with rakefile, version, or history.
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
* Send me a pull request. Bonus points for topic branches.
== Copyright
Copyright (c) 2010 Pelle Braendgaard. See LICENSE for details.

19
README.textile Normal file
View File

@ -0,0 +1,19 @@
h1. Guard Jammit Plug-in
Let you configure a Guard that will run jammit whenever a javascript or stylesheet is updated.
h2. Quick Start
Edit the Gemfile for it to looks like:
bc. source "http://rubygems.org"
gem 'guard-jammit'
You can now download missing gems and initialize the guard
bc. $ bundle install
$ guard init
$ guard init jammit
$ guard

View File

@ -6,11 +6,12 @@ begin
Jeweler::Tasks.new do |gem| Jeweler::Tasks.new do |gem|
gem.name = "guard-jammit" gem.name = "guard-jammit"
gem.summary = %Q{Guard plugin for running jammit} gem.summary = %Q{Guard plugin for running jammit}
gem.description = %Q{TODO: longer description of your gem} gem.description = %Q{This is a guard plugin to watch javascript and stylesheets to afterwards run jammit.}
gem.email = "pelleb@gmail.com" gem.email = "pelleb@gmail.com"
gem.homepage = "http://github.com/pelle/guard-jammit" gem.homepage = "http://github.com/pelle/guard-jammit"
gem.authors = ["Pelle Braendgaard"] gem.authors = ["Pelle Braendgaard"]
gem.add_development_dependency "rspec", ">= 1.2.9" gem.add_dependency "guard"
gem.add_dependency "jammit"
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end end
Jeweler::GemcutterTasks.new Jeweler::GemcutterTasks.new
@ -18,21 +19,7 @@ rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler" puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
end end
require 'spec/rake/spectask' task :default => :jeweler
Spec::Rake::SpecTask.new(:spec) do |spec|
spec.libs << 'lib' << 'spec'
spec.spec_files = FileList['spec/**/*_spec.rb']
end
Spec::Rake::SpecTask.new(:rcov) do |spec|
spec.libs << 'lib' << 'spec'
spec.pattern = 'spec/**/*_spec.rb'
spec.rcov = true
end
task :spec => :check_dependencies
task :default => :spec
require 'rake/rdoctask' require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc| Rake::RDocTask.new do |rdoc|

52
guard-jammit.gemspec Normal file
View File

@ -0,0 +1,52 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{guard-jammit}
s.version = "0.1.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Pelle Braendgaard"]
s.date = %q{2010-11-08}
s.description = %q{This is a guard plugin to watch javascript and stylesheets to afterwards run jammit.}
s.email = %q{pelleb@gmail.com}
s.extra_rdoc_files = [
"LICENSE",
"README.textile"
]
s.files = [
".document",
".gitignore",
"LICENSE",
"README.textile",
"Rakefile",
"VERSION",
"guard-jammit.gemspec",
"lib/guard/jammit.rb",
"lib/guard/jammit/templates/Guardfile"
]
s.homepage = %q{http://github.com/pelle/guard-jammit}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.7}
s.summary = %q{Guard plugin for running jammit}
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<guard>, [">= 0"])
s.add_runtime_dependency(%q<jammit>, [">= 0"])
else
s.add_dependency(%q<guard>, [">= 0"])
s.add_dependency(%q<jammit>, [">= 0"])
end
else
s.add_dependency(%q<guard>, [">= 0"])
s.add_dependency(%q<jammit>, [">= 0"])
end
end

View File

View File

@ -1,11 +1,12 @@
require 'guard' require 'guard'
require 'guard/guard' require 'guard/guard'
require 'jammit'
module Guard module Guard
class GuardJammit < Guard class Jammit < Guard
def initialize(watchers = [], options = {}) def initialize(watchers = [], options = {})
super super
# init stuff here, thx! # init stuff here, thx!
end end
@ -45,7 +46,10 @@ module Guard
end end
def jammit def jammit
Jammit.packager.precache_all ::Jammit.load_configuration ::Jammit::DEFAULT_CONFIG_PATH
puts "Jamming"
::Jammit.packager.force = true
::Jammit.packager.precache_all
true true
end end

View File

@ -1,7 +0,0 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "GuardJammit" do
it "fails" do
fail "hey buddy, you should probably rename this file and start specing for real"
end
end

View File

@ -1 +0,0 @@
--color

View File

@ -1,9 +0,0 @@
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'guard-jammit'
require 'spec'
require 'spec/autorun'
Spec::Runner.configure do |config|
end