Module: VagrantPlugins::ProfitBricks

Defined in:
lib/vagrant-profitbricks.rb,
lib/vagrant-profitbricks/action.rb,
lib/vagrant-profitbricks/config.rb,
lib/vagrant-profitbricks/errors.rb,
lib/vagrant-profitbricks/plugin.rb,
lib/vagrant-profitbricks/version.rb,
lib/vagrant-profitbricks/provider.rb,
lib/vagrant-profitbricks/command/root.rb,
lib/vagrant-profitbricks/command/utils.rb,
lib/vagrant-profitbricks/command/images.rb,
lib/vagrant-profitbricks/command/flavors.rb,
lib/vagrant-profitbricks/command/servers.rb,
lib/vagrant-profitbricks/action/is_created.rb,
lib/vagrant-profitbricks/action/read_state.rb,
lib/vagrant-profitbricks/command/locations.rb,
lib/vagrant-profitbricks/command/snapshots.rb,
lib/vagrant-profitbricks/action/list_images.rb,
lib/vagrant-profitbricks/action/stop_server.rb,
lib/vagrant-profitbricks/action/list_flavors.rb,
lib/vagrant-profitbricks/action/start_server.rb,
lib/vagrant-profitbricks/command/datacenters.rb,
lib/vagrant-profitbricks/action/create_server.rb,
lib/vagrant-profitbricks/action/delete_server.rb,
lib/vagrant-profitbricks/action/read_ssh_info.rb,
lib/vagrant-profitbricks/action/reboot_server.rb,
lib/vagrant-profitbricks/action/run_init_script.rb,
lib/vagrant-profitbricks/action/message_not_created.rb,
lib/vagrant-profitbricks/action/connect_profitbricks.rb,
lib/vagrant-profitbricks/action/message_already_created.rb

Defined Under Namespace

Modules: Action, Command, Errors Classes: Config, Plugin, Provider

Constant Summary collapse

VERSION =
'4.0.0'.freeze

Class Method Summary collapse

Class Method Details

.init_i18nObject

This initializes the i18n load path so that the plugin-specific translations work.



21
22
23
24
# File 'lib/vagrant-profitbricks.rb', line 21

def self.init_i18n
  I18n.load_path << File.expand_path('locales/en.yml', source_root)
  I18n.reload!
end

.init_loggingObject

This initializes the logging so that our logs are outputted at the same level as Vagrant core logs.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/vagrant-profitbricks.rb', line 28

def self.init_logging
  # Initialize logging
  level = nil
  begin
    level = Log4r.const_get(ENV['VAGRANT_LOG'].upcase)
  rescue NameError
    # This means that the logging constant wasn't found,
    # which is fine. We just keep `level` as `nil`. But
    # we tell the user.
    level = nil
  end

  # Some constants, such as "true" resolve to booleans, so the
  # above error checking doesn't catch it. This will check to make
  # sure that the log level is an integer, as Log4r requires.
  level = nil unless level.is_a?(Integer)

  # Set the logging level on all "vagrant" namespaced
  # logs as long as we have a valid level.
  if level
    logger = Log4r::Logger.new('vagrant_profitbricks')
    logger.outputters = Log4r::Outputter.stderr
    logger.level = level
  end
end

.source_rootPathname

This returns the path to the source of this plugin.

Returns:

  • (Pathname)


15
16
17
# File 'lib/vagrant-profitbricks.rb', line 15

def self.source_root
  @source_root ||= Pathname.new(File.expand_path('../../', __FILE__))
end