Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dump Guard:guard + fix specs (stub verification)
- Loading branch information
Showing
35 changed files
with
503 additions
and
545 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,37 @@ | ||
module Guard | ||
# Command to run all default plugin tasks | ||
class Interactor | ||
ALL = Pry::CommandSet.new do | ||
create_command 'all' do | ||
# required for async_queue_add | ||
require 'guard' | ||
|
||
group 'Guard' | ||
description 'Run all plugins.' | ||
module Guard | ||
module Commands | ||
class All | ||
def self.import | ||
Pry::Commands.create_command 'all' do | ||
group 'Guard' | ||
description 'Run all plugins.' | ||
|
||
banner <<-BANNER | ||
banner <<-BANNER | ||
Usage: all <scope> | ||
Run the Guard plugin `run_all` action. | ||
You may want to specify an optional scope to the action, | ||
either the name of a Guard plugin or a plugin group. | ||
BANNER | ||
BANNER | ||
|
||
def process(*entries) | ||
scopes, unknown = ::Guard::Interactor.convert_scope(entries) | ||
|
||
def process(*entries) | ||
scopes, rest = ::Guard::Interactor.convert_scope(entries) | ||
unless unknown.empty? | ||
output.puts "Unknown scopes: #{ unknown.join(', ') }" | ||
return | ||
end | ||
|
||
if rest.empty? | ||
::Guard.async_queue_add([:guard_run_all, scopes]) | ||
else | ||
output.puts "Unknown scope #{ rest.join(', ') }" | ||
Guard.async_queue_add([:guard_run_all, scopes]) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
Pry.commands.import ::Guard::Interactor::ALL | ||
Guard::Commands::All.import |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,29 @@ | ||
module Guard | ||
# Command to simulate file change events | ||
class Interactor | ||
CHANGE = Pry::CommandSet.new do | ||
create_command 'change' do | ||
module Commands | ||
class Change | ||
def self.import | ||
Pry::Commands.create_command 'change' do | ||
group 'Guard' | ||
description 'Trigger a file change.' | ||
|
||
group 'Guard' | ||
description 'Trigger a file change.' | ||
|
||
banner <<-BANNER | ||
banner <<-BANNER | ||
Usage: change <file> <other_file> | ||
Pass the given files to the Guard plugin `run_on_changes` action. | ||
BANNER | ||
BANNER | ||
|
||
def process(*entries) | ||
_, files = ::Guard::Interactor.convert_scope(entries) | ||
def process(*files) | ||
if files.empty? | ||
output.puts 'Please specify a file.' | ||
return | ||
end | ||
|
||
if files.empty? | ||
output.puts 'Please specify a file.' | ||
else | ||
::Guard.async_queue_add(modified: files, added: [], removed: []) | ||
end | ||
end | ||
|
||
end | ||
end | ||
end | ||
end | ||
|
||
Pry.commands.import ::Guard::Interactor::CHANGE | ||
Guard::Commands::Change.import |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
require 'guard/notifier' | ||
|
||
module Guard | ||
# Command to toggle notifications on and off | ||
class Interactor | ||
NOTIFICATION = Pry::CommandSet.new do | ||
create_command 'notification' do | ||
module Commands | ||
class Notification | ||
def self.import | ||
Pry::Commands.create_command 'notification' do | ||
group 'Guard' | ||
description 'Toggles the notifications.' | ||
|
||
group 'Guard' | ||
description 'Toggles the notifications.' | ||
|
||
banner <<-BANNER | ||
banner <<-BANNER | ||
Usage: notification | ||
Toggles the notifications on and off. | ||
BANNER | ||
BANNER | ||
|
||
def process | ||
::Guard::Notifier.toggle | ||
def process | ||
::Guard::Notifier.toggle | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
Pry.commands.import ::Guard::Interactor::NOTIFICATION | ||
Guard::Commands::Notification.import |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
module Guard | ||
class Interactor | ||
PAUSE = Pry::CommandSet.new do | ||
create_command 'pause' do | ||
module Commands | ||
class Pause | ||
def self.import | ||
Pry::Commands.create_command 'pause' do | ||
group 'Guard' | ||
description 'Toggles the file listener.' | ||
|
||
group 'Guard' | ||
description 'Toggles the file listener.' | ||
|
||
banner <<-BANNER | ||
banner <<-BANNER | ||
Usage: pause | ||
Toggles the file listener on and off. | ||
When the file listener is paused, the default Guard Pry | ||
prompt will show the pause sign `[p]`. | ||
BANNER | ||
BANNER | ||
|
||
def process | ||
::Guard.async_queue_add([:guard_pause]) | ||
def process | ||
::Guard.async_queue_add([:guard_pause]) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
Pry.commands.import ::Guard::Interactor::PAUSE | ||
Guard::Commands::Pause.import |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,34 @@ | ||
module Guard | ||
class Interactor | ||
RELOAD = Pry::CommandSet.new do | ||
create_command 'reload' do | ||
|
||
group 'Guard' | ||
description 'Reload all plugins.' | ||
|
||
banner <<-BANNER | ||
module Commands | ||
class Reload | ||
def self.import | ||
Pry::Commands.create_command 'reload' do | ||
group 'Guard' | ||
description 'Reload all plugins.' | ||
|
||
banner <<-BANNER | ||
Usage: reload <scope> | ||
Run the Guard plugin `reload` action. | ||
You may want to specify an optional scope to the action, | ||
either the name of a Guard plugin or a plugin group. | ||
BANNER | ||
BANNER | ||
|
||
def process(*entries) | ||
scopes, rest = ::Guard::Interactor.convert_scope(entries) | ||
def process(*entries) | ||
scopes, unknown = ::Guard::Interactor.convert_scope(entries) | ||
|
||
unless unknown.empty? | ||
output.puts "Unknown scopes: #{ unknown.join(', ') }" | ||
return | ||
end | ||
|
||
if rest.empty? | ||
::Guard.async_queue_add([:guard_reload, scopes]) | ||
else | ||
output.puts "Unknown scope #{ rest.join(', ') }" | ||
end | ||
end | ||
|
||
end | ||
end | ||
end | ||
end | ||
|
||
Pry.commands.import ::Guard::Interactor::RELOAD | ||
Guard::Commands::Reload.import |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,36 @@ | ||
module Guard | ||
class Interactor | ||
SCOPE = Pry::CommandSet.new do | ||
create_command 'scope' do | ||
group 'Guard' | ||
description 'Scope Guard actions to groups and plugins.' | ||
module Commands | ||
class Scope | ||
def self.import | ||
Pry::Commands.create_command 'scope' do | ||
group 'Guard' | ||
description 'Scope Guard actions to groups and plugins.' | ||
|
||
banner <<-BANNER | ||
banner <<-BANNER | ||
Usage: scope <scope> | ||
Set the global Guard scope. | ||
BANNER | ||
BANNER | ||
|
||
def process(*entries) | ||
scope, _ = ::Guard::Interactor.convert_scope(entries) | ||
def process(*entries) | ||
scope, unknown = Guard::Interactor.convert_scope(entries) | ||
|
||
if scope[:plugins].empty? && scope[:groups].empty? | ||
output.puts 'Usage: scope <scope>' | ||
else | ||
::Guard.scope = scope | ||
unless unknown.empty? | ||
output.puts "Unknown scopes: #{unknown.join(',') }" | ||
return | ||
end | ||
|
||
if scope[:plugins].empty? && scope[:groups].empty? | ||
output.puts 'Usage: scope <scope>' | ||
return | ||
end | ||
|
||
Guard.scope = scope | ||
end | ||
end | ||
|
||
end | ||
end | ||
end | ||
end | ||
|
||
Pry.commands.import ::Guard::Interactor::SCOPE | ||
Guard::Commands::Scope.import |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,24 @@ | ||
require 'guard/dsl_describer' | ||
|
||
module Guard | ||
class Interactor | ||
SHOW = Pry::CommandSet.new do | ||
create_command 'show' do | ||
|
||
group 'Guard' | ||
description 'Show all Guard plugins.' | ||
module Commands | ||
class Show | ||
def self.import | ||
Pry::Commands.create_command 'show' do | ||
group 'Guard' | ||
description 'Show all Guard plugins.' | ||
|
||
banner <<-BANNER | ||
banner <<-BANNER | ||
Usage: show | ||
Show all defined Guard plugins and their options. | ||
BANNER | ||
BANNER | ||
|
||
def process | ||
::Guard.async_queue_add([:guard_show]) | ||
def process | ||
::Guard.async_queue_add([:guard_show]) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
Pry.commands.import ::Guard::Interactor::SHOW | ||
Guard::Commands::Show.import |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.