forked from sprinkle-tool/sprinkle
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add PackageInstaller and standardize APIs a bit more
- Loading branch information
1 parent
dee57d4
commit ad41ffc
Showing
17 changed files
with
143 additions
and
125 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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module Sprinkle | ||
module Installers | ||
# This is a abstract class installer that most all the package installers | ||
# inherit from (deb, *BSD pkg, rpm, etc) | ||
class PackageInstaller < Installer | ||
|
||
attr_accessor :packages #:nodoc: | ||
|
||
def initialize(parent, *packages, &block) #:nodoc: | ||
options = packages.extract_options! | ||
super parent, options, &block | ||
@packages = [*packages].flatten | ||
end | ||
|
||
|
||
end | ||
end | ||
end |
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
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
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,34 @@ | ||
module Sprinkle | ||
module Installers | ||
# The runner installer is great for running a single command. | ||
# | ||
# == Example Usage | ||
module Installers | ||
# The runner installer is great for running a simple command. | ||
# | ||
# == Example Usage | ||
# | ||
# package :magic_beans do | ||
# runner "make world" | ||
# end | ||
# | ||
class Runner < Installer | ||
attr_accessor :cmd #:nodoc: | ||
# You can also pass multiple commands as arguments or an array. | ||
# | ||
# package :magic_beans do | ||
# runner "make world", "destroy world" | ||
# runner [ "make world", "destroy world" ] | ||
# end | ||
# | ||
class Runner < Installer | ||
attr_accessor :cmds #:nodoc: | ||
|
||
def initialize(parent, cmd = nil , &block) #:nodoc: | ||
super parent, {}, &block | ||
@cmd = cmd | ||
end | ||
|
||
protected | ||
|
||
def install_commands #:nodoc: | ||
@cmd | ||
end | ||
end | ||
end | ||
def initialize(parent, *cmds , &block) #:nodoc: | ||
super parent, {}, &block | ||
@cmds = [*cmds].flatten | ||
raise "you need to specify a command" if cmds.nil? | ||
end | ||
|
||
protected | ||
|
||
def install_commands #:nodoc: | ||
@cmds | ||
end | ||
end | ||
end | ||
end |
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
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
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
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
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
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.