Top Level Namespace
Defined Under Namespace
Modules: GitCommands, Lace, LaceArgvExtension
Classes: AbbrevGitDownloadStrategy, AbstractDownloadStrategy, AlreadyActiveError, CannotRemoveActivePackage, DownloadStrategyDetector, ErrorDuringExecution, FlavorArgumentRequired, FlavorError, GitDownloadStrategy, GitUpdateStrategy, LocalFileStrategy, ManifestErbError, NonActiveFlavorError, OnlyGitReposCanBeUpdatedError, Package, PackageAlreadyInstalled, PackageFacts, PackageFactsNotFound, PackageFlavorDoesNotExist, PackageNotInstalled, PackagePresenter, PackageUtils, PackageValidator, Pathname, ResourceNotSpecified, Tty, UsageError
Constant Summary
collapse
- HELP =
<<-EOS
Example usage:
Synopsis:
lace <cmd> <pkg-uri/name> [<flavor>] [--name=<name>] [--version] [--no-hooks] [--force]
lace ls
lace fetch <pkg-uri>
lace fetch <pkg-uri>
lace setup <pkg-uri>
lace setup <pkg-uri> <flavor>
lace activate <pkg-name>
lace activate <pkg-name> <flavor>
lace deactivate <pkg-name>
lace deactivate <pkg-name> <flavor>
lace remove <pkg-name>
lace update <pkg-name>
Troubleshooting:
lace help
lace info <pkg-name>
lace validate <local-directory>
For further help visit:
https://github.com/kairichard/lace
EOS
- INSPECT =
<<-EOS
Inspection of <%= package.name %>:
active: <%= package.is_active? %>
flavors: <%= package.flavors %>
version: <%= package.version %>
homepage: <%= package.homepage %>
upgradeable: <%= package.upgradeable? %>
manifest: <%= package.manifest %>
EOS
- VALIDATE =
<<-EOS
Lace-Manifest Validation Report:
<% validation.errors.each do |error| -%>
<%= "%-58s [ %s ]" % [error[0] + ':', error[1]] %>
<% unless error[2].nil? -%>
<% error[2].each do |line| -%>
<%= Tty.gray %><%= '# '+line.to_s %><%= Tty.reset %>
<% end -%>
<% end -%>
<% end -%>
EOS
- FlavorArgumentMsg =
<<-EOS
Sorry, this command needs a flavor argument you can choose from the following:
- %s
EOS
Instance Method Summary
collapse
Instance Method Details
#determine_os ⇒ Object
91
92
93
94
95
96
97
|
# File 'lib/lace/utils.rb', line 91
def determine_os
case RUBY_PLATFORM
when /darwin/ then :mac
when /linux/ then :linux
else raise InvalidOSError
end
end
|
#odie(error) ⇒ Object
86
87
88
89
|
# File 'lib/lace/utils.rb', line 86
def odie error
onoe error
exit 1
end
|
#ofail(error) ⇒ Object
81
82
83
84
|
# File 'lib/lace/utils.rb', line 81
def ofail error
onoe error
Lace.failed = true
end
|
#oh1(title) ⇒ Object
66
67
68
69
|
# File 'lib/lace/utils.rb', line 66
def oh1 title
title = Tty.truncate(title) if $stdout.tty? && !ARGV.verbose?
puts "#{Tty.green}==>#{Tty.white} #{title}#{Tty.reset}"
end
|
#ohai(title, *sput) ⇒ Object
60
61
62
63
64
|
# File 'lib/lace/utils.rb', line 60
def ohai title, *sput
title = Tty.truncate(title) if $stdout.tty? && !ARGV.verbose?
puts "#{Tty.blue}==>#{Tty.white} #{title}#{Tty.reset}"
puts sput unless sput.empty?
end
|
#onoe(error) ⇒ Object
75
76
77
78
79
|
# File 'lib/lace/utils.rb', line 75
def onoe error
lines = error.to_s.split("\n")
STDERR.puts "#{Tty.red}Error#{Tty.reset}: #{lines.shift}"
STDERR.puts lines unless lines.empty?
end
|
#opoo(warning) ⇒ Object
71
72
73
|
# File 'lib/lace/utils.rb', line 71
def opoo warning
STDERR.puts "#{Tty.red}Warning#{Tty.reset}: #{warning}"
end
|
#quiet_system(cmd, *args) ⇒ Object
122
123
124
125
126
127
128
129
|
# File 'lib/lace/utils.rb', line 122
def quiet_system cmd, *args
Lace.system(cmd, *args) do
$stdout.reopen('/dev/null')
$stderr.reopen('/dev/null')
end
end
|
#safe_system(cmd, *args) ⇒ Object
Kernel.system but with exceptions
114
115
116
117
118
119
|
# File 'lib/lace/utils.rb', line 114
def safe_system cmd, *args
unless Lace.system cmd, *args
args = args.map{ |arg| arg.to_s.gsub " ", "\\ " } * " "
raise ErrorDuringExecution, "Failure while executing: #{cmd} #{args}"
end
end
|