Module: Wright

Defined in:
lib/wright.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/resource/file.rb,
lib/wright/provider/package.rb,
lib/wright/provider/symlink.rb,
lib/wright/resource/package.rb,
lib/wright/resource/symlink.rb,
lib/wright/provider/directory.rb,
lib/wright/resource/directory.rb,
lib/wright/provider/package/apt.rb,
lib/wright/util/file_permissions.rb,
lib/wright/util/recursive_autoloader.rb,
lib/wright/util/stolen_from_activesupport.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: Config, Logger, Provider, Resource

Constant Summary collapse

VERSION =

Public: Current wright version

'0.1.1'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.logObject

Public: Get/Set Wright’s Logger.



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

def log
  @log
end

Class Method Details

.dry_runObject

Public: 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.



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

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

.dry_run?Boolean

Public: Checks if dry-run mode is currently active.

Examples

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

Returns 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