Top Level Namespace
Defined Under Namespace
Modules: OS Classes: ArgManager, ExecCommand, HelpCommand, InstallCommand, InstallGlobalCommand, RemoveCommand, RemoveGlobalCommand, StartCommand, WoodstovePackage
Instance Method Summary collapse
-
#current_package ⇒ Object
Creates a package instance for the current working directory.
-
#global_kindling ⇒ Object
Returns the global kindling directory.
-
#global_kindling_bin ⇒ Object
Returns the global kindling bin directory.
-
#install_package(package, directory, bindir) ⇒ Object
Installs the given package into the specified directory.
-
#need_args(args, error) ⇒ Object
Prints the error and terminates the program if the args array is empty.
- #parse_package_url(package, directory) ⇒ Object
-
#remove_package(package, directory, bindir) ⇒ Object
Removes the given package from the specified directory.
Instance Method Details
#current_package ⇒ Object
Creates a package instance for the current working directory.
201 202 203 |
# File 'lib/woodstove/packagemanager.rb', line 201 def current_package WoodstovePackage.new 'current package', 'gitlab', FileUtils.pwd, global_kindling_bin end |
#global_kindling ⇒ Object
Returns the global kindling directory.
206 207 208 209 210 211 212 213 214 |
# File 'lib/woodstove/packagemanager.rb', line 206 def global_kindling if OS.mac? '~/Library/Application Support/woodstove' elsif OS.windows? 'C:/ProgramData/woodstove/kindling' else '/usr/var/kindling' end end |
#global_kindling_bin ⇒ Object
Returns the global kindling bin directory.
217 218 219 220 221 222 223 |
# File 'lib/woodstove/packagemanager.rb', line 217 def global_kindling_bin if OS.windows? 'C:/ProgramData/woodstove/bin' else '/usr/local/bin' end end |
#install_package(package, directory, bindir) ⇒ Object
Installs the given package into the specified directory.
184 185 186 187 188 189 190 |
# File 'lib/woodstove/packagemanager.rb', line 184 def install_package package, directory, bindir data = parse_package_url package, directory puts data.inspect pkg = WoodstovePackage.new data[:repo], data[:site], data[:path], bindir pkg.install data[:branch] pkg end |
#need_args(args, error) ⇒ Object
Prints the error and terminates the program if the args array is empty.
9 10 11 12 13 14 |
# File 'lib/woodstove/packagecommands.rb', line 9 def need_args args, error if args.length < 1 puts error exit 1 end end |
#parse_package_url(package, directory) ⇒ Object
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/woodstove/packagemanager.rb', line 164 def parse_package_url package, directory branchget = package.split '@' branch = (branchget.length > 1 ? branchget[1] : 'master') siteget = branchget[0].split(':') site = (siteget.length > 1 ? siteget[0] : 'gitlab') repoget = (siteget.length > 1 ? siteget[1] : siteget[0]).split '/' packagename = repoget[1] packageuser = repoget[0] path = "#{directory}/#{packagename}" { :branch => branch, :site => site, :name => packagename, :user => packageuser, :path => path, :repo => repoget.join('/') } end |
#remove_package(package, directory, bindir) ⇒ Object
Removes the given package from the specified directory.
193 194 195 196 197 198 |
# File 'lib/woodstove/packagemanager.rb', line 193 def remove_package package, directory, bindir data = parse_package_url package, directory pkg = WoodstovePackage.new data[:repo], data[:site], data[:path], bindir, data[:site] pkg.remove pkg end |