Sha256: ace3c04ecacb7d9f6afbf2785d2b56bea61e32c7183ae31f3e750685c5220936

Contents?: true

Size: 1.73 KB

Versions: 27

Compression:

Stored size: 1.73 KB

Contents

module Guard

  # A group of Guard plugins. There are two reasons why you want to group your
  # Guard plugins:
  #
  # * You can start only certain groups from the command line by passing the
  #   `--group` option to `guard start`.
  # * Abort task execution chain on failure within a group with the
  #   `:halt_on_fail` option.
  #
  # @example Group that aborts on failure
  #
  #   group :frontend, halt_on_fail: true do
  #     guard 'coffeescript', input: 'spec/coffeescripts', output: 'spec/javascripts'
  #     guard 'jasmine-headless-webkit' do
  #       watch(%r{^spec/javascripts/(.*)\..*}) { |m| newest_js_file("spec/javascripts/#{m[1]}_spec") }
  #     end
  #   end
  #
  # @see Guard::CLI
  #
  class Group

    attr_accessor :name, :options

    # Initializes a Group.
    #
    # @param [String] name the name of the group
    # @param [Hash] options the group options
    # @option options [Boolean] halt_on_fail if a task execution
    #   should be halted for all Guard plugins in this group if a Guard plugin throws `:task_has_failed`
    #
    def initialize(name, options = {})
      @name    = name.to_sym
      @options = options
    end

    # Returns the group title.
    #
    # @example Title for a group named 'backend'
    #   > Guard::Group.new('backend').title
    #   => "Backend"
    #
    # @return [String]
    #
    def title
      @title ||= name.to_s.capitalize
    end

    # String representation of the group.
    #
    # @example String representation of a group named 'backend'
    #   > Guard::Group.new('backend').to_s
    #   => "#<Guard::Group @name=backend @options={}>"
    #
    # @return [String] the string representation
    #
    def to_s
      "#<#{self.class} @name=#{name} @options=#{options}>"
    end

  end
end

Version data entries

27 entries across 25 versions & 2 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/guard-2.6.1/lib/guard/group.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/guard-2.6.1/lib/guard/group.rb
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/guard-2.6.1/lib/guard/group.rb
guard-2.6.1 lib/guard/group.rb
guard-2.6.0 lib/guard/group.rb
guard-2.5.1 lib/guard/group.rb
guard-2.5.0 lib/guard/group.rb
guard-2.4.0 lib/guard/group.rb
guard-2.3.0 lib/guard/group.rb
guard-2.2.5 lib/guard/group.rb
guard-2.2.4 lib/guard/group.rb
guard-2.2.3 lib/guard/group.rb
guard-2.2.2 lib/guard/group.rb
guard-2.2.1 lib/guard/group.rb
guard-2.2.0 lib/guard/group.rb
guard-2.1.1 lib/guard/group.rb
guard-2.1.0 lib/guard/group.rb
guard-2.0.5 lib/guard/group.rb
guard-2.0.4 lib/guard/group.rb
guard-2.0.3 lib/guard/group.rb