Module: Babushka

Defined in:
lib/levenshtein/levenshtein.rb,
lib/babushka.rb,
lib/components.rb,
lib/babushka/dsl.rb,
lib/babushka/dep.rb,
lib/babushka/ansi.rb,
lib/babushka/task.rb,
lib/babushka/base.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/resource.rb,
lib/babushka/git_repo.rb,
lib/babushka/dep_pool.rb,
lib/babushka/dep_cache.rb,
lib/babushka/parameter.rb,
lib/babushka/xml_string.rb,
lib/babushka/version_of.rb,
lib/babushka/renderable.rb,
lib/babushka/pkg_helper.rb,
lib/babushka/dep_context.rb,
lib/babushka/dep_definer.rb,
lib/babushka/version_str.rb,
lib/babushka/source_pool.rb,
lib/babushka/path_checker.rb,
lib/babushka/dep_template.rb,
lib/babushka/current_ruby.rb,
lib/babushka/cmdline/parser.rb,
lib/babushka/system_profile.rb,
lib/babushka/lambda_chooser.rb,
lib/babushka/system_matcher.rb,
lib/babushka/system_detector.rb,
lib/babushka/cmdline/handler.rb,
lib/babushka/implicit_source.rb,
lib/babushka/cmdline/helpers.rb,
lib/babushka/accepts_list_for.rb,
lib/babushka/system_definition.rb,
lib/babushka/accepts_value_for.rb,
lib/babushka/accepts_block_for.rb,
lib/babushka/helpers/log_helpers.rb,
lib/babushka/helpers/git_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/src_helper.rb,
lib/babushka/pkg_helpers/yum_helper.rb,
lib/babushka/pkg_helpers/npm_helper.rb,
lib/babushka/pkg_helpers/gem_helper.rb,
lib/babushka/pkg_helpers/pip_helper.rb,
lib/babushka/pkg_helpers/apt_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 (pbattley@gmail.com)

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, Prompt, RunHelpers, ShellHelpers, UriHelpers, Vars Classes: ANSI, AptHelper, ArchSystemProfile, Asset, AssetError, BSDSystemProfile, Base, BaseTemplate, BinPkgSrcHelper, BinPortsHelper, BrewHelper, CentOSSystemProfile, Cmdline, CurrentRuby, DebianSystemProfile, DefaultUnavailable, Dep, DepArgumentError, DepCache, DepContext, DepDefiner, DepDefinitionError, DepParameterError, DepPool, DepRequirement, DepTemplate, DmgAsset, DragonFlySystemProfile, FedoraSystemProfile, FileAsset, FreeBSDSystemProfile, GemHelper, GitFS, GitRepo, GitRepoError, GitRepoExists, ImplicitSource, InvalidDepName, InvalidVersionOperator, InvalidVersionStr, LambdaChooser, LinuxSystemProfile, Logging, NpmHelper, OSXSystemProfile, Open3, PacmanHelper, Parameter, PathChecker, PipHelper, PkgHelper, PromptUnavailable, RedhatSystemProfile, Renderable, Resource, Shell, Source, SourceError, SourceLoadError, SourcePool, SrcHelper, SystemDefinition, SystemDetector, SystemMatcher, SystemProfile, TarAsset, Task, TemplateNotFound, TemplatedDepContext, UbuntuSystemProfile, UnknownPkgHelper, UnknownSystem, UnmeetableDep, VersionOf, VersionStr, VersionStrError, XMLString, YumHelper, ZipAsset

Constant Summary

VERSION =
'0.17.8'
WORKING_PREFIX =
'~/.babushka'
SOURCE_PREFIX =
'~/.babushka/sources'
BUILD_PREFIX =
'~/.babushka/build'
DOWNLOAD_PREFIX =
'~/.babushka/downloads'
LOG_PREFIX =
'~/.babushka/logs'
VARS_PREFIX =
'~/.babushka/vars'
REPORT_PREFIX =
'~/.babushka/runs'
EXTERNAL_COMPONENTS =
%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
git_fs
resource
asset
prompt
lambda_chooser
version_str
version_of
accepts_list_for
accepts_value_for
accepts_block_for
ansi
cmdline/parser
cmdline/handler
cmdline/helpers
cmdline
base
renderable
current_ruby
system_definition
system_profile
system_detector
system_matcher
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
dep_cache
task
source
implicit_source
source_pool
vars
parameter
path_checker
dep_definer
dep_context
dep_template
templated_dep_context

Class Method Summary collapse

Class Method Details

.const_missing(const_name) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/babushka.rb', line 13

def self.const_missing const_name
  if %w[
    WorkingPrefix
    SourcePrefix
    BuildPrefix
    DownloadPrefix
    LogPrefix
    VarsPrefix
    ReportPrefix
  ].include?(const_name.to_s)
    const_case = const_name.to_s.scan(/[A-Z][a-z]+/).map(&:upcase).join('_')
    Babushka::LogHelpers.deprecated! "2013-12-15", :method_name => "Babushka::#{const_name}", :instead => "Babushka::#{const_case}"
    Babushka.const_get(const_case)
  else
    super
  end
end

.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

ruby is an instance of Babushka::CurrentRuby for the ruby the command was invoked on.



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

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