From 3a11aea76f9cdb9fca8994b37699783493dad300 Mon Sep 17 00:00:00 2001 From: Pelle Braendgaard Date: Mon, 8 Nov 2010 14:53:07 -0500 Subject: [PATCH] Works using regular configurations. All is hardcoded using standard jammit/rails settings. Please submit patches for changing output directories etc. --- README.rdoc | 17 ------ README.textile | 19 +++++++ Rakefile | 21 ++------ guard-jammit.gemspec | 52 +++++++++++++++++++ lib/guard-jammit.rb | 0 lib/guard/{guard-jammit.rb => jammit.rb} | 10 ++-- .../templates/Guardfile | 0 spec/guard-jammit_spec.rb | 7 --- spec/spec.opts | 1 - spec/spec_helper.rb | 9 ---- 10 files changed, 82 insertions(+), 54 deletions(-) delete mode 100644 README.rdoc create mode 100644 README.textile create mode 100644 guard-jammit.gemspec delete mode 100644 lib/guard-jammit.rb rename lib/guard/{guard-jammit.rb => jammit.rb} (83%) rename lib/guard/{guard-jammit => jammit}/templates/Guardfile (100%) delete mode 100644 spec/guard-jammit_spec.rb delete mode 100644 spec/spec.opts delete mode 100644 spec/spec_helper.rb diff --git a/README.rdoc b/README.rdoc deleted file mode 100644 index b5c5fd9..0000000 --- a/README.rdoc +++ /dev/null @@ -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. diff --git a/README.textile b/README.textile new file mode 100644 index 0000000..991fef5 --- /dev/null +++ b/README.textile @@ -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 + + diff --git a/Rakefile b/Rakefile index a3b1542..69cdf66 100644 --- a/Rakefile +++ b/Rakefile @@ -6,11 +6,12 @@ begin Jeweler::Tasks.new do |gem| gem.name = "guard-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.homepage = "http://github.com/pelle/guard-jammit" 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 end Jeweler::GemcutterTasks.new @@ -18,21 +19,7 @@ rescue LoadError puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler" end -require 'spec/rake/spectask' -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 +task :default => :jeweler require 'rake/rdoctask' Rake::RDocTask.new do |rdoc| diff --git a/guard-jammit.gemspec b/guard-jammit.gemspec new file mode 100644 index 0000000..492033a --- /dev/null +++ b/guard-jammit.gemspec @@ -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, [">= 0"]) + s.add_runtime_dependency(%q, [">= 0"]) + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + end + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + end +end + diff --git a/lib/guard-jammit.rb b/lib/guard-jammit.rb deleted file mode 100644 index e69de29..0000000 diff --git a/lib/guard/guard-jammit.rb b/lib/guard/jammit.rb similarity index 83% rename from lib/guard/guard-jammit.rb rename to lib/guard/jammit.rb index 447e2ce..c8026a6 100644 --- a/lib/guard/guard-jammit.rb +++ b/lib/guard/jammit.rb @@ -1,11 +1,12 @@ require 'guard' require 'guard/guard' - +require 'jammit' module Guard - class GuardJammit < Guard + class Jammit < Guard def initialize(watchers = [], options = {}) super + # init stuff here, thx! end @@ -45,7 +46,10 @@ module Guard end def jammit - Jammit.packager.precache_all + ::Jammit.load_configuration ::Jammit::DEFAULT_CONFIG_PATH + puts "Jamming" + ::Jammit.packager.force = true + ::Jammit.packager.precache_all true end diff --git a/lib/guard/guard-jammit/templates/Guardfile b/lib/guard/jammit/templates/Guardfile similarity index 100% rename from lib/guard/guard-jammit/templates/Guardfile rename to lib/guard/jammit/templates/Guardfile diff --git a/spec/guard-jammit_spec.rb b/spec/guard-jammit_spec.rb deleted file mode 100644 index 3d3c904..0000000 --- a/spec/guard-jammit_spec.rb +++ /dev/null @@ -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 diff --git a/spec/spec.opts b/spec/spec.opts deleted file mode 100644 index 4e1e0d2..0000000 --- a/spec/spec.opts +++ /dev/null @@ -1 +0,0 @@ ---color diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb deleted file mode 100644 index e0e5f73..0000000 --- a/spec/spec_helper.rb +++ /dev/null @@ -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