build_groups: rename to build instead of group

dev
Andy Meneely 2016-03-20 22:51:11 -04:00
parent c3f9e75d38
commit e55c450d16
6 changed files with 46 additions and 21 deletions

View File

@ -1,4 +1,4 @@
group
build
=====
Establish a set of commands that can be enabled/disabled together to allow for customized builds. See :doc:`/build_groups` for ways to use this effectively.
@ -6,10 +6,14 @@ Establish a set of commands that can be enabled/disabled together to allow for c
Required Arguments
------------------
.. note::
This is an argument, not an option like most DSL methods. See example below.
group
default: ``:all``
The name of the group. Convention is to use a Ruby symbol.
The name of the build group. Convention is to use a Ruby symbol.
&block
@ -22,7 +26,7 @@ Examples
Use group to organize your Squib code into build groups::
Squib::Deck.new do
group :pnp do
build :pnp do
save_pdf
end
end

View File

@ -1,5 +1,5 @@
groups
======
build_groups
============
Returns the set of group names that have been enabled. See :doc:`/build_groups` for ways to use this effectively.
@ -15,9 +15,9 @@ Examples
Use group to organize your Squib code into build groups::
Squib::Deck.new do
enable_group :pnp
group :pnp do
enable_build :pnp
build :pnp do
save_pdf
end
puts groups # outputs :all and :pnp
puts build_groups # outputs :all and :pnp
end

View File

@ -1,4 +1,4 @@
disable_group
disable_build
=============
Disable the given build group for the rest of the build. Thus, code within the corresponding :doc:`/dsl/group` block will not be executed. See :doc:`/build_groups` for ways to use this effectively.
@ -7,10 +7,22 @@ Disable the given build group for the rest of the build. Thus, code within the c
Required Arguments
------------------
group
build_group_name
default: ``:all``
the name of the group to disable. Convention is to use a Ruby symbol.
.. note::
Examples
--------
Can be used to disable a group (even if it's enabled via command line)::
Squib::Deck.new do
disable_build :pnp
build :pnp do
save_pdf
end
end

View File

@ -1,5 +1,5 @@
enable_group
=============
enable_build
============
Enable the given build group for the rest of the build. Thus, code within the corresponding :doc:`/dsl/group` block will be executed. See :doc:`/build_groups` for ways to use this effectively.
@ -7,10 +7,19 @@ Enable the given build group for the rest of the build. Thus, code within the co
Required Arguments
------------------
group
build_group_name
the name of the group to enable. Convention is to use a Ruby symbol.
Examples
--------
Can be used to disable a group (even if it's enabled via command line)::
Squib::Deck.new do
disable_build :pnp
build :pnp do
save_pdf
end
end

View File

@ -13,29 +13,29 @@ module Squib
class Deck
# DSL method. See http://squib.readthedocs.org
def group grp = :all, &block
def build grp = :all, &block
raise 'Please provide a block' unless block_given?
block.yield if groups.include? grp
end
# DSL method. See http://squib.readthedocs.org
def enable_group grp
groups # make sure it's initialized
def enable_build grp
build_groups # make sure it's initialized
@build_groups << grp
end
# DSL method. See http://squib.readthedocs.org
def disable_group grp
groups # make sure it's initialized
def disable_build grp
build_groups # make sure it's initialized
@build_groups.delete grp
end
# DSL method. See http://squib.readthedocs.org
def groups
def build_groups
@build_groups ||= Set.new.add(:all)
end
# DSL method. See http://squib.readthedocs.org
# Not a DSL method, but initialized from Deck.new
def enable_groups_from_env!
return if ENV['SQUIB_BUILD'].nil?
ENV['SQUIB_BUILD'].split(',').each do |grp|

@ -1 +1 @@
Subproject commit c58b225851a474d26ed3c4d1992a4af6bcf2922e
Subproject commit 943d3871f97e8d29f197d91ae306578b2e6c8c78