Sha256: 6807ee1a83d834e5c7b2f01ecb10a6f3f6561692774d8e4a1e60e2c4d77ce50c

Contents?: true

Size: 1.94 KB

Versions: 30

Compression:

Stored size: 1.94 KB

Contents

case config['guard']
  when 'no'
    recipes.delete('guard')
    say_wizard "Guard recipe skipped."
  when 'standard'
    # do nothing
  when 'LiveReload'
    recipes << 'guard-LiveReload'
  else
    recipes.delete('guard')
    say_wizard "Guard recipe skipped."
end


if recipes.include? 'guard'
  gem 'guard', '>= 0.6.2', :group => :development

  prepend_file 'Gemfile' do <<-RUBY
require 'rbconfig'
HOST_OS = RbConfig::CONFIG['host_os']

RUBY
  end

  append_file 'Gemfile' do <<-RUBY
  # need newline here!
case HOST_OS
  when /darwin/i
    gem 'rb-fsevent', :group => :development
    gem 'growl', :group => :development
  when /linux/i
    gem 'libnotify', :group => :development
    gem 'rb-inotify', :group => :development
  when /mswin|windows/i
    gem 'rb-fchange', :group => :development
    gem 'win32console', :group => :development
    gem 'rb-notifu', :group => :development
end
  RUBY
  end

  def guards
    @guards ||= []
  end

  def guard(name, version = nil)
    args = []
    if version
      args << version
    end
    args << { :group => :development }
    gem "guard-#{name}", *args
    guards << name
  end

  guard 'bundler', '>= 0.1.3'

  unless recipes.include? 'pow'
    guard 'rails', '>= 0.0.3'
  end
  
  if recipes.include? 'guard-LiveReload'
    guard 'livereload', '>= 0.3.0'
  end

  if recipes.include? 'rspec'
    guard 'rspec', '>= 0.4.3'
  end

  if recipes.include? 'cucumber'
    guard 'cucumber', '>= 0.6.1'
  end

  after_bundler do
    run 'guard init'
    guards.each do |name|
      run "guard init #{name}"
    end
  end

else
  recipes.delete 'guard'
end

__END__

name: guard
description: "Automate your workflow with Guard"
author: ashley_woodard

run_after: [rspec, cucumber]
category: other
tags: [dev]

config:
  - guard:
      type: multiple_choice
      prompt: Would you like to use Guard to automate your workflow?
      choices: [["No", no], ["Guard default configuration", standard], ["Guard with LiveReload", LiveReload]]

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
rails_apps_composer-1.5.3 recipes/guard.rb
rails_apps_composer-1.5.2 recipes/guard.rb
rails_apps_composer-1.5.1 recipes/guard.rb
thyone_creator-0.0.5 recipes/guard.rb
thyone_creator-0.0.4 recipes/guard.rb
thyone_creator-0.0.3 recipes/guard.rb
thyone_creator-0.0.2 recipes/guard.rb
rails_apps_composer-1.5.0 recipes/guard.rb
rails_apps_composer-1.4.15 recipes/guard.rb
rails_apps_composer-1.4.14 recipes/guard.rb
rails_apps_composer-1.4.13 recipes/guard.rb
rails_apps_composer-1.4.12 recipes/guard.rb
rails_apps_composer-1.4.11 recipes/guard.rb
rails_apps_composer-1.4.10 recipes/guard.rb
rails_apps_composer-1.4.9 recipes/guard.rb
rails_apps_composer-1.4.8 recipes/guard.rb
rails_apps_composer-1.4.7 recipes/guard.rb
rails_apps_composer-1.4.6 recipes/guard.rb
rails_apps_composer-1.4.5 recipes/guard.rb
rails_apps_composer-1.4.4 recipes/guard.rb