initial commit with aprox specs

This commit is contained in:
Dmytrii Nagirniak 2011-06-17 20:32:50 +10:00
commit 457a7a35f8
10 changed files with 158 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
pkg/*
*.gem
*.rbc
*.swp
.bundle

3
Gemfile Normal file
View File

@ -0,0 +1,3 @@
source "http://rubygems.org"
gemspec

28
Gemfile.lock Normal file
View File

@ -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

1
Rakefile Normal file
View File

@ -0,0 +1 @@
require 'bundler/gem_tasks'

View File

@ -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

32
lib/guard/rails-assets.rb Normal file
View File

@ -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

5
lib/guard/version.rb Normal file
View File

@ -0,0 +1,5 @@
module Guard
module RailsAssetsVersion
VERSION = "0.0.1"
end
end

View File

@ -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

19
spec/spec_helper.rb Normal file
View File

@ -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

View File

@ -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