Module: Babushka

Defined in:
lib/levenshtein/levenshtein.rb,
lib/babushka.rb,
lib/components.rb,
lib/babushka/ip.rb,
lib/babushka/dep.rb,
lib/babushka/dsl.rb,
lib/babushka/base.rb,
lib/babushka/task.rb,
lib/babushka/vars.rb,
lib/babushka/asset.rb,
lib/babushka/popen.rb,
lib/babushka/shell.rb,
lib/babushka/prompt.rb,
lib/babushka/source.rb,
lib/babushka/cmdline.rb,
lib/babushka/dep_pool.rb,
lib/babushka/git_repo.rb,
lib/babushka/resource.rb,
lib/babushka/parameter.rb,
lib/babushka/pkg_helper.rb,
lib/babushka/renderable.rb,
lib/babushka/version_of.rb,
lib/babushka/xml_string.rb,
lib/babushka/dep_context.rb,
lib/babushka/dep_definer.rb,
lib/babushka/source_pool.rb,
lib/babushka/version_str.rb,
lib/babushka/bug_reporter.rb,
lib/babushka/current_ruby.rb,
lib/babushka/dep_template.rb,
lib/babushka/path_checker.rb,
lib/babushka/run_reporter.rb,
lib/babushka/cmdline/parser.rb,
lib/babushka/lambda_chooser.rb,
lib/babushka/system_matcher.rb,
lib/babushka/system_profile.rb,
lib/babushka/cmdline/handler.rb,
lib/babushka/cmdline/helpers.rb,
lib/babushka/system_detector.rb,
lib/babushka/accepts_list_for.rb,
lib/babushka/accepts_block_for.rb,
lib/babushka/accepts_value_for.rb,
lib/babushka/system_definitions.rb,
lib/babushka/helpers/git_helpers.rb,
lib/babushka/helpers/log_helpers.rb,
lib/babushka/helpers/run_helpers.rb,
lib/babushka/helpers/uri_helpers.rb,
lib/babushka/helpers/path_helpers.rb,
lib/babushka/helpers/shell_helpers.rb,
lib/babushka/templated_dep_context.rb,
lib/babushka/pkg_helpers/apt_helper.rb,
lib/babushka/pkg_helpers/gem_helper.rb,
lib/babushka/pkg_helpers/npm_helper.rb,
lib/babushka/pkg_helpers/pip_helper.rb,
lib/babushka/pkg_helpers/src_helper.rb,
lib/babushka/pkg_helpers/yum_helper.rb,
lib/babushka/pkg_helpers/brew_helper.rb,
lib/babushka/pkg_helpers/pacman_helper.rb,
lib/babushka/pkg_helpers/binports_helper.rb,
lib/babushka/pkg_helpers/binpkgsrc_helper.rb,
lib/babushka/pkg_helpers/unknown_pkg_helper.rb

Overview

This code is licensed under the MIT license with permission from the author. The license follows.

Copyright © 2008-2009 Paul Battley ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Defined Under Namespace

Modules: AcceptsBlockFor, AcceptsListFor, AcceptsValueFor, DSL, GitHelpers, Levenshtein, LogHelpers, Path, PathHelpers, RunHelpers, ShellHelpers, UriHelpers Classes: AptHelper, ArchSystemProfile, Asset, AssetError, BSDSystemProfile, Base, BaseTemplate, BinPkgSrcHelper, BinPortsHelper, BrewHelper, BugReporter, Cmdline, CurrentRuby, DebianSystemProfile, DefaultUnavailable, Dep, DepArgumentError, DepContext, DepDefiner, DepDefinitionError, DepParameterError, DepPool, DepRequirement, DepTemplate, DmgAsset, DragonFlySystemProfile, FedoraSystemProfile, FileAsset, FreeBSDSystemProfile, GemHelper, GitRepo, GitRepoError, GitRepoExists, IP, IPRange, IPTail, InvalidDepName, InvalidVersionOperator, InvalidVersionStr, LambdaChooser, LinuxSystemProfile, Logging, NpmHelper, OSXSystemProfile, Open3, PacmanHelper, Parameter, PathChecker, PipHelper, PkgHelper, Prompt, PromptUnavailable, RedhatSystemProfile, Renderable, Resource, RunReporter, Shell, Source, SourceError, SourceLoadError, SourcePool, SrcHelper, SystemDefinitions, SystemDetector, SystemMatcher, SystemProfile, TarAsset, Task, TemplateNotFound, TemplatedDepContext, UnknownPkgHelper, UnknownSystem, UnmeetableDep, Vars, VersionOf, VersionStr, VersionStrError, XMLString, YumHelper, ZipAsset

Constant Summary collapse

VERSION =
'0.15.6'
WorkingPrefix =
'~/.babushka'
SourcePrefix =
'~/.babushka/sources'
BuildPrefix =
'~/.babushka/build'
DownloadPrefix =
'~/.babushka/downloads'
LogPrefix =
'~/.babushka/logs'
VarsPrefix =
'~/.babushka/vars'
ReportPrefix =
'~/.babushka/runs'
ExternalComponents =
%w[
  fancypath/fancypath
  inkan/inkan
  levenshtein/levenshtein
]
Components =
%w[
  core_patches/blank
  core_patches/try
  core_patches/array
  core_patches/hash
  core_patches/hashish
  core_patches/integer
  core_patches/numeric
  core_patches/bytes
  core_patches/object
  core_patches/string
  core_patches/symbol
  core_patches/uri
  xml_string
  helpers/log_helpers
  helpers/shell_helpers
  helpers/path_helpers
  helpers/run_helpers
  helpers/git_helpers
  helpers/uri_helpers
  popen
  shell
  git_repo
  resource
  asset
  prompt
  lambda_chooser
  ip
  version_str
  version_of
  accepts_list_for
  accepts_value_for
  accepts_block_for
  colorizer
  cmdline/parser
  cmdline/handler
  cmdline/helpers
  cmdline
  base
  renderable
  current_ruby
  system_definitions
  system_profile
  system_detector
  system_matcher
  run_reporter
  bug_reporter
  pkg_helper
  pkg_helpers/unknown_pkg_helper
  pkg_helpers/apt_helper
  pkg_helpers/yum_helper
  pkg_helpers/brew_helper
  pkg_helpers/gem_helper
  pkg_helpers/src_helper
  pkg_helpers/pip_helper
  pkg_helpers/binpkgsrc_helper
  pkg_helpers/binports_helper
  pkg_helpers/npm_helper
  pkg_helpers/pacman_helper
  dsl
  dep
  dep_pool
  task
  source
  source_pool
  vars
  parameter
  path_checker
  dep_definer
  dep_context
  dep_template
  templated_dep_context
]

Class Method Summary collapse

Class Method Details

.hostObject

host is an instance of Babushka::SystemProfile for the system the command was invoked on. If the current system isn’t supported, SystemProfile.for_host will return nil, and Base.run will fail early. If the system is known but the flavour isn’t (e.g. an unknown Linux variant), a generic SystemProfile will be used, which should work for most operations but will fail on deps that attempt to use the package manager, etc.



10
11
12
# File 'lib/babushka/base.rb', line 10

def host
  @host ||= Babushka::SystemDetector.profile_for_host
end

.rubyObject



15
16
17
# File 'lib/babushka/base.rb', line 15

def ruby
  @ruby ||= Babushka::CurrentRuby.new
end

.VersionOf(first, *rest) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/babushka/version_of.rb', line 3

def VersionOf first, *rest
  # Convert the arguments into a VersionOf. If a single string argument is
  # passed, try splitting it on space to separate name and version. Otherwise,
  # pass the arguments as-is, splatting if required.
  if rest.any?
    Babushka::VersionOf.new(*[first].concat(rest))
  elsif first.is_a?(String)
    name, version = first.split(' ', 2)
    if version && VersionStr.parseable_version?(version)
      Babushka::VersionOf.new(name, version)
    else
      Babushka::VersionOf.new(first)
    end
  elsif first.is_a?(Array)
    Babushka::VersionOf.new(*first)
  else
    Babushka::VersionOf.new(first)
  end
end