Sha256: 4fe2a48f70291f86f9fdeeb17c63a6a865bb36501ed17317a3912e47c46a074a

Contents?: true

Size: 1.77 KB

Versions: 45

Compression:

Stored size: 1.77 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/(.*)\..*}) do |m|
  #       newest_js_file("spec/javascripts/#{m[1]}_spec")
  #     end
  #     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

45 entries across 45 versions & 10 rubygems

Version Path
guard-2.16.1 lib/guard/group.rb
guard-2.16.0 lib/guard/group.rb
guard-2.15.1 lib/guard/group.rb
alimentos-alu0100945645-0.1.0 vendor/bundle/ruby/2.3.0/gems/guard-2.15.0/lib/guard/group.rb
alimentos-alu0100945645-1.0.0 vendor/bundle/ruby/2.3.0/gems/guard-2.15.0/lib/guard/group.rb
guard-2.15.0 lib/guard/group.rb
guard-2.14.2 lib/guard/group.rb
comiditaULL-0.1.1 vendor/bundle/ruby/2.3.0/gems/guard-2.14.1/lib/guard/group.rb
comidita_ull-0.1.1 vendor/bundle/ruby/2.3.0/gems/guard-2.14.1/lib/guard/group.rb
comidita_ull-0.1.0 vendor/bundle/ruby/2.3.0/gems/guard-2.14.1/lib/guard/group.rb
guard-2.14.1 lib/guard/group.rb
gameboard-3.1.0 vendor/bundle/ruby/2.3.0/gems/guard-2.14.0/lib/guard/group.rb
gameboard-3.0.0 vendor/bundle/ruby/2.3.0/gems/guard-2.14.0/lib/guard/group.rb
guard-2.14.0 lib/guard/group.rb
mastermind_adeybee-0.1.4 vendor/bundle/ruby/2.2.0/gems/guard-2.13.0/lib/guard/group.rb
mastermind_adeybee-0.1.3 vendor/bundle/ruby/2.2.0/gems/guard-2.13.0/lib/guard/group.rb
mastermind_adeybee-0.1.2 vendor/bundle/ruby/2.2.0/gems/guard-2.13.0/lib/guard/group.rb
mastermind_adeybee-0.1.1 vendor/bundle/ruby/2.2.0/gems/guard-2.13.0/lib/guard/group.rb
geminfo-0.1.0 path/gems/guard-2.13.0/lib/guard/group.rb
guard-2.13.0 lib/guard/group.rb