Module: Nucleon

Extended by:
Facade
Defined in:
lib/nucleon_base.rb,
lib/core/core.rb,
lib/core/gems.rb,
lib/core/codes.rb,
lib/core/config.rb,
lib/core/errors.rb,
lib/core/facade.rb,
lib/core/manager.rb,
lib/nucleon_base.rb,
lib/core/util/cli.rb,
lib/core/util/git.rb,
lib/core/util/ssh.rb,
lib/core/util/data.rb,
lib/core/util/disk.rb,
lib/core/util/cache.rb,
lib/core/util/shell.rb,
lib/core/environment.rb,
lib/core/plugin/base.rb,
lib/core/util/liquid.rb,
lib/core/util/logger.rb,
lib/core/mixin/colors.rb,
lib/core/plugin/event.rb,
lib/core/util/console.rb,
lib/core/util/package.rb,
lib/core/plugin/action.rb,
lib/core/config/options.rb,
lib/core/mixin/settings.rb,
lib/core/plugin/command.rb,
lib/core/plugin/project.rb,
lib/nucleon/event/regex.rb,
lib/nucleon/project/git.rb,
lib/core/plugin/template.rb,
lib/nucleon/command/bash.rb,
lib/core/mixin/sub_config.rb,
lib/core/plugin/extension.rb,
lib/nucleon/template/JSON.rb,
lib/nucleon/template/YAML.rb,
lib/core/config/collection.rb,
lib/core/mixin/action/push.rb,
lib/core/plugin/translator.rb,
lib/nucleon/action/extract.rb,
lib/nucleon/project/github.rb,
lib/nucleon/translator/JSON.rb,
lib/nucleon/translator/YAML.rb,
lib/core/mixin/action/commit.rb,
lib/nucleon/template/wrapper.rb,
lib/core/mixin/action/project.rb,
lib/core/mixin/config/options.rb,
lib/nucleon/extension/project.rb,
lib/nucleon/action/project/add.rb,
lib/nucleon/action/project/save.rb,
lib/core/mixin/config/collection.rb,
lib/nucleon/action/project/create.rb,
lib/nucleon/action/project/remove.rb,
lib/nucleon/action/project/update.rb,
lib/core/mixin/action/registration.rb,
lib/core/mixin/macro/object_interface.rb,
lib/core/mixin/macro/plugin_interface.rb

Overview


Defined Under Namespace

Modules: Action, Command, Errors, Event, Extension, Facade, Gems, Mixin, Parallel, Plugin, Project, Template, Translator, Util Classes: Codes, Config, Core, Environment, Manager

Constant Summary collapse

@@dump_enabled =

Global flag that indicate whether or not dumping with dbg() is active

Think of this as a global on/off switch in case dbg() statements are accidentally left in code.

false
@@console_lock =

Global console Mutex lock

TODO: This may not be needed?

Mutex.new

Class Method Summary collapse

Methods included from Facade

action, action_cli, action_config, action_help, action_run, actions, active_plugins, admin?, check, class_const, class_name, cli_run, code, codes, collect, command, commands, config, create_plugin, define_types, event, events, exec, executable, executable_state, extension, get_plugin, handle, interrupt_handler, ip_address, load_plugins, loaded_plugins, log_level, log_level=, logger, manager, namespaces, plugin, plugin_class, plugins, project, projects, provider_class, quiet=, register, reload, remove_plugin, remove_plugin_by_name, render_object, render_tree, run, search_actions, sha1, silence, template, templates, test_connection, translator, translators, type_default, types, ui, ui_group, value

Methods included from Mixin::Colors

#black, #blue, #cyan, #green, #grey, #purple, #red, #yellow

Class Method Details

.console_lockObject

Get the global console Mutex for synchronized console operations.

  • Parameters

  • Returns

    • Mutex

      Console Mutex object

  • Errors



375
376
377
# File 'lib/nucleon_base.rb', line 375

def self.console_lock
  @@console_lock
end

.debug_break(condition = true) ⇒ Object

Set a debug break poing at the line of invocation if debugging is enabled.

Nucleon uses Pry to perform stepwise debugging through the code.

Note: This is not used very often so it may be buggy in areas.

  • Parameters

    • Boolean

      condition Boolean test to check if the debugging breakpoint should be active

  • Returns

    • Void

      This method does not return a value

  • Errors

See also:

  • ::debugging?



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
# File 'lib/nucleon_base.rb', line 244

def self.debug_break(condition = true)
  if debugging?
#*******************************************************************************
# Nucleon Pry powered development console
#
# Usage:
#
# * Execute nucleon (or derivative executable, ex; corl) with the NUCLEON_DEBUG
#   environment variable set
#
#   :> [ sudo ] NUCLEON_DEBUG=1 nucleon <args>...
#
# * Call the debug_break method anywhere in the code to start a debugging
#   session.
#
#   :> Nucleon.debug_break   or    :> Nucleon.debug_break <test?>
#
# * Since the debugging tools don't work in parallel, parallel operations are
#   serialized when NUCLEON_DEBUG environment variable is found.
#
#*******************************************************************************
# General information
#
# For more information on Pry: http://pryrepl.org
#                              ( https://github.com/pry/pry )
#
# Loaded plugins: stack explorer ( https://github.com/pry/pry-stack_explorer )
#                 debugger       ( https://github.com/nixme/pry-debugger )
#
# For available commands and help information: [ help ]
# For command specific help:                   [ <command> --help ]
#
#*******************************************************************************
# General commands:
#
# :> cd <Class>                Change to inspect class (class constant)
# :> show-method <method>      Show source for class method
# :> .<CLI command> <args>...  Execute a CLI command (always starts with dot)
#
#*******************************************************************************
# Breakpoints
#
# :> breakpoints                             List all defined breakpoints
# :> break                                   Same as breakpoints command
#
# :> break <Class>#<method>                  Break at start of `Class#method`.
# :> break <Class>#<method> if <test?>       Break at `Class#method` if `test?`.
# :> break <path>/<ruby file>:<line>         Break at line in ruby file.
# :> break <line>                            Break at line in current file.
#
# :> break --condition <breakpoint> <test?>  Change condition on breakpoint.
# :> break --condition <breakpoint>          Remove condition on breakpoint.
#
# :> break --delete <breakpoint>             Delete breakpoint.
# :> break --disable-all                     Disable all breakpoints.
#
# :> break --show <breakpoint>               Show details about breakpoint.
#
#*******************************************************************************
# Stack inspection / traversal
#
# :> show-stack      Show all accessible frames in the call stack.
# :> frame <number>  Move to a specific frame.
# :> up              Move up one frame in the call stack.
# :> down            Move down one frame in the call stack.
#
#*******************************************************************************
# Debugging execution flow:
#
# :> s = [ step | step <times> ]  Step execution into the next line or method.
# :> n = [ next | next <times> ]  Step over to the next line within same frame.
# :> f = [ finish ]               Execute until current stack frame returns.
# :> c = [ continue ]             Continue program execution (end Pry session).
#
    binding.pry if condition
  end
end

.debugging?Boolean

Check if debugging is enabled

This uses the environment variable *“NUCLEON_DEBUG”*

ENV["NUCLEON_DEBUG"]
  • Parameters

  • Returns

    • Boolean

      Whether or not debugging is enabled

  • Errors

See also:

  • ::debug_break

Returns:

  • (Boolean)


223
224
225
# File 'lib/nucleon_base.rb', line 223

def self.debugging?
  ENV["NUCLEON_DEBUG"] ? true : false
end

.dump_enabledObject

Check whether dumping is enabled or disabled through dbg()

  • Parameters

  • Returns

    • Boolean

      Whether or not to enable dumping through dbg()

  • Errors

See also:

  • ::dump_enabled=



201
202
203
# File 'lib/nucleon_base.rb', line 201

def self.dump_enabled
  @@dump_enabled
end

.dump_enabled=(dump) ⇒ Object

Enable or disable variable dumping through dbg()

  • Parameters

    • Boolean

      dump Whether or not to enable dumping through dbg()

  • Returns

    • Void

      This method does not return a value

  • Errors

See also:

  • ::dump_enabled



185
186
187
# File 'lib/nucleon_base.rb', line 185

def self.dump_enabled=dump
  @@dump_enabled = dump
end

.parallel?Boolean

Check if parallel execution is enabled

This uses the environment variable *“NUCLEON_NO_PARALLEL”*. Parallelism is enabled by default.

ENV["NUCLEON_NO_PARALLEL"]

Due to the complications with parallel debugging, parallel is suspended when debugging is enabled

  • Parameters

  • Returns

    • Boolean

      Whether or not parallel is enabled

  • Errors

See also:

  • ::debugging?

Returns:

  • (Boolean)


355
356
357
# File 'lib/nucleon_base.rb', line 355

def self.parallel?
  debugging? || ENV['NUCLEON_NO_PARALLEL'] ? false : true
end

.VERSIONObject

Get currently loaded versioin of Nucleon

This method loads from the VERSION file in the top level directory. This file gets automatically updated as we build and release new versions.

See the Rakefile and the Coral Toolbox project at:

github.com/coralnexus/coral-toolbox

Note: This process might change in the near future.

  • Parameters

  • Returns

    • String

      Currently loaded version of Nucleon framework

  • Errors



158
159
160
# File 'lib/nucleon_base.rb', line 158

def self.VERSION
  File.read(File.join(File.dirname(__FILE__), '..', 'VERSION'))
end