Module: Wright

Defined in:
lib/wright.rb,
lib/wright/cli.rb,
lib/wright/dsl.rb,
lib/wright/util.rb,
lib/wright/config.rb,
lib/wright/logger.rb,
lib/wright/dry_run.rb,
lib/wright/version.rb,
lib/wright/provider.rb,
lib/wright/resource.rb,
lib/wright/util/file.rb,
lib/wright/util/user.rb,
lib/wright/util/color.rb,
lib/wright/provider/file.rb,
lib/wright/provider/user.rb,
lib/wright/resource/file.rb,
lib/wright/resource/user.rb,
lib/wright/provider/group.rb,
lib/wright/resource/group.rb,
lib/wright/util/file_owner.rb,
lib/wright/provider/package.rb,
lib/wright/provider/symlink.rb,
lib/wright/resource/package.rb,
lib/wright/resource/symlink.rb,
lib/wright/util/erb_renderer.rb,
lib/wright/provider/directory.rb,
lib/wright/resource/directory.rb,
lib/wright/util/file_renderer.rb,
lib/wright/provider/package/apt.rb,
lib/wright/provider/package/yum.rb,
lib/wright/util/pencil_mustache.rb,
lib/wright/util/file_permissions.rb,
lib/wright/util/mustache_renderer.rb,
lib/wright/provider/user/gnu_passwd.rb,
lib/wright/provider/group/gnu_passwd.rb,
lib/wright/provider/package/homebrew.rb,
lib/wright/util/recursive_autoloader.rb,
lib/wright/util/stolen_from_activesupport.rb,
lib/wright/provider/user/darwin_directory_service.rb,
lib/wright/provider/group/darwin_directory_service.rb

Overview

The functions in this file are based on Ruby on Rails’ ActiveSupport toolkit, more specifically the Inflector module of Rails 4 found in activesupport/lib/active_support/inflector/methods.rb.

The following is a verbatim copy of the original license:

Copyright (c) 2005-2014 David Heinemeier Hansson

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: DSL, Util Classes: CLI, Config, Logger, Provider, Resource

Constant Summary collapse

VERSION =

Current wright version

'0.5.0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.logLogger

Returns the logger used by Wright.

Returns:

  • (Logger)

    the logger used by Wright



69
70
71
# File 'lib/wright/logger.rb', line 69

def log
  @log
end

Class Method Details

.activate_dry_runvoid

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Activates dry-run mode.



36
37
38
# File 'lib/wright/dry_run.rb', line 36

def self.activate_dry_run
  @dry_run = true
end

.dry_runObject

Runs a block in dry-run mode.

Examples:

Wright.dry_run do
  symlink '/tmp/fstab' do |s|
    s.to = '/etc/fstab'
  end
end

Returns:

  • the block’s return value



25
26
27
28
29
30
31
# File 'lib/wright/dry_run.rb', line 25

def self.dry_run
  saved_dry_run = @dry_run
  @dry_run = true
  yield
ensure
  @dry_run = saved_dry_run
end

.dry_run?Bool

Checks if dry-run mode is currently active.

Examples:

puts 'Just a dry-run...' if Wright.dry_run?

Returns:

  • (Bool)

    true if dry-run mode is currently active and false otherwise



11
12
13
# File 'lib/wright/dry_run.rb', line 11

def self.dry_run?
  @dry_run
end