diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d87d4be --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +*.gem +*.rbc +.bundle +.config +.yardoc +Gemfile.lock +InstalledFiles +_yardoc +coverage +doc/ +lib/bundler/man +pkg +rdoc +spec/reports +test/tmp +test/version_tmp +tmp diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..ae21de1 --- /dev/null +++ b/Gemfile @@ -0,0 +1,4 @@ +source 'http://rubygems.org' + +# Specify your gem's dependencies in guard-spin.gemspec +gemspec diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..f57ae68 --- /dev/null +++ b/Rakefile @@ -0,0 +1,2 @@ +#!/usr/bin/env rake +require "bundler/gem_tasks" diff --git a/guard-spin.gemspec b/guard-spin.gemspec new file mode 100644 index 0000000..e3ad787 --- /dev/null +++ b/guard-spin.gemspec @@ -0,0 +1,18 @@ +# -*- encoding: utf-8 -*- +require File.expand_path('../lib/guard/spin/version', __FILE__) + +Gem::Specification.new do |gem| + gem.authors = ["jonathangreenberg"] + gem.email = ["greenberg@entryway.net"] + gem.description = %q{Guard gem for Spin} + gem.summary = %q{Pushes watched files to Spin} + gem.homepage = "" + + gem.add_runtime_dependency 'guard' + gem.add_runtime_dependency 'spin' + + gem.name = "guard-spin" + gem.files = Dir.glob('{lib}/**/*') + %w[LICENSE README.md] + gem.require_path = 'lib' + gem.version = Guard::SpinVersion::VERSION +end diff --git a/lib/guard/spin.rb b/lib/guard/spin.rb new file mode 100644 index 0000000..e0c8576 --- /dev/null +++ b/lib/guard/spin.rb @@ -0,0 +1,14 @@ +require 'guard' +require 'guard/guard' + +module Guard + class Spin < Guard + + autoload :Runner, 'guard/spin/runner' + + def run_on_change(paths) + Runner.new(paths).run + end + end +end + diff --git a/lib/guard/spin/runner.rb b/lib/guard/spin/runner.rb new file mode 100644 index 0000000..a7ba121 --- /dev/null +++ b/lib/guard/spin/runner.rb @@ -0,0 +1,20 @@ +module Guard + class Spin + class Runner + attr_reader :paths + + def initialize(paths) + @paths = paths + end + + def run + puts "Running #{paths.join(" ")}\n" + system(run_command) + end + + def run_command + "spin push #{paths.join(" ")}" + end + end + end +end diff --git a/lib/guard/spin/version.rb b/lib/guard/spin/version.rb new file mode 100644 index 0000000..87a579c --- /dev/null +++ b/lib/guard/spin/version.rb @@ -0,0 +1,5 @@ +module Guard + module SpinVersion + VERSION = "0.0.1" + end +end