commit 457a7a35f800fd9b43edcd66a77a26140749cf51 Author: Dmytrii Nagirniak Date: Fri Jun 17 20:32:50 2011 +1000 initial commit with aprox specs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1b10c47 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +pkg/* +*.gem +*.rbc +*.swp +.bundle diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..c80ee36 --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source "http://rubygems.org" + +gemspec diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..f7d4441 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,28 @@ +PATH + remote: . + specs: + guard-rails-assets (0.0.1) + guard + +GEM + remote: http://rubygems.org/ + specs: + diff-lcs (1.1.2) + guard (0.4.2) + thor (~> 0.14.6) + rspec (2.6.0) + rspec-core (~> 2.6.0) + rspec-expectations (~> 2.6.0) + rspec-mocks (~> 2.6.0) + rspec-core (2.6.4) + rspec-expectations (2.6.0) + diff-lcs (~> 1.1.2) + rspec-mocks (2.6.0) + thor (0.14.6) + +PLATFORMS + ruby + +DEPENDENCIES + guard-rails-assets! + rspec diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..c702cfc --- /dev/null +++ b/Rakefile @@ -0,0 +1 @@ +require 'bundler/gem_tasks' diff --git a/guard-rails-assets.gemspec b/guard-rails-assets.gemspec new file mode 100644 index 0000000..f3e7b3e --- /dev/null +++ b/guard-rails-assets.gemspec @@ -0,0 +1,23 @@ +# -*- encoding: utf-8 -*- +$:.push File.expand_path("../lib", __FILE__) +require "guard/version" + +Gem::Specification.new do |s| + s.name = "guard-rails-assets" + s.version = Guard::RailsAssetsVersion::VERSION + s.authors = ["Dmytrii Nagirniak"] + s.email = ["dnagir@gmail.com"] + s.homepage = "http://github.com/dnagir/guard-rails-assets" + s.summary = %q{Guard for compiling Rails assets} + s.description = %q{guard-rails-assets automatically generates JavaScript, CSS, Image files using Rails assets pipelie} + + s.rubyforge_project = "guard-rails-assets" + + s.add_dependency 'guard' + s.add_development_dependency 'rspec' + + 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"] +end diff --git a/lib/guard/rails-assets.rb b/lib/guard/rails-assets.rb new file mode 100644 index 0000000..22e7945 --- /dev/null +++ b/lib/guard/rails-assets.rb @@ -0,0 +1,32 @@ +require 'guard' +require 'guard/guard' + +module Guard + class RailsAssets < Guard + def initialize(watchers=[], options={}) + super + end + + def start + # Started + end + + def reload + # Ctrl-Z + end + + def run_all + # Ctr-\ - restarting stuff + end + + def run_on_change(paths) + end + + def compile_assets + # clean + # prefix or path + # compile + end + + end +end diff --git a/lib/guard/version.rb b/lib/guard/version.rb new file mode 100644 index 0000000..f4db34b --- /dev/null +++ b/lib/guard/version.rb @@ -0,0 +1,5 @@ +module Guard + module RailsAssetsVersion + VERSION = "0.0.1" + end +end diff --git a/spec/guard/rails-assets_spec.rb b/spec/guard/rails-assets_spec.rb new file mode 100644 index 0000000..b69393f --- /dev/null +++ b/spec/guard/rails-assets_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper' +require 'guard/rails-assets' + +describe Guard::RailsAssets do + let(:options) { {} } + subject { Guard::RailsAssets.new(['watchers'], options) } + + it 'should be able to create guard' do + ::Guard::RailsAssets.new(['watchers'], {:options=>:here}).should_not be_nil + end + + describe '#start' do + it_behaves_like 'guard command', :command => :start, :run => true + end + + describe '#reload' do + it_behaves_like 'guard command', :command => :reload, :run => false + end + + describe '#run_all' do + it_behaves_like 'guard command', :command => :run_all, :run => true + end + + describe '#run_on_change' do + it_behaves_like 'guard command', :command => :run_on_change, :run => true + end + + + describe 'asset compilation' do + it 'should notify on success' + it 'should notify on failure' + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..b611c8c --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,19 @@ +require 'rspec' +require 'guard/rails-assets' +require 'support/shared_examples' + +RSpec.configure do |config| + config.color_enabled = true + config.filter_run :focus => true + config.run_all_when_everything_filtered = true + + config.before(:each) do + ENV["GUARD_ENV"] = 'test' + @project_path = Pathname.new(File.expand_path('../../', __FILE__)) + end + + config.after(:each) do + ENV["GUARD_ENV"] = nil + end + +end diff --git a/spec/support/shared_examples.rb b/spec/support/shared_examples.rb new file mode 100644 index 0000000..4cefbcc --- /dev/null +++ b/spec/support/shared_examples.rb @@ -0,0 +1,9 @@ +shared_examples_for "guard command" do |options| + + it "should execute #{options[:command]} when said so" + it "should not execute #{options[:command]} when disabled" + + it "should #{options[:run] ? '' : 'not '}execute #{options[:command]} by default" + it "should execute built-in helper" + +end