Module: Rbcli
- Defined in:
- lib/rbcli.rb,
lib/rbcli/version.rb,
lib/rbcli/engine/parser.rb,
lib/rbcli/logging/logging.rb,
lib/rbcli/engine/load_project.rb,
lib/rbcli/configuration/config.rb,
lib/rbcli/configuration/configurate.rb,
lib/rbcli/stateful_systems/storagetypes/localstate.rb,
lib/rbcli/stateful_systems/storagetypes/remotestate_dynamodb.rb
Overview
Defined Under Namespace
Modules: Autoupdate, Config, Configurate, ConfigurateStorage, Logger, Parser, State
Classes: Command, Scriptwrapper
Constant Summary
collapse
- VERSION =
"0.1.9"
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
34
35
36
|
# File 'lib/rbcli/configuration/config.rb', line 34
def self.config
Rbcli::Config::config
end
|
.configuration ⇒ Object
104
105
106
|
# File 'lib/rbcli/configuration/configurate.rb', line 104
def self.configuration
Rbcli::Configurate::configuration
end
|
.debug(obj) ⇒ Object
73
74
75
|
# File 'lib/rbcli/logging/logging.rb', line 73
def self.debug obj
puts obj.to_s.red
end
|
.load_project ⇒ Object
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/rbcli/engine/load_project.rb', line 2
def self.load_project
project_root = File.expand_path "#{File.dirname(caller[0].split(':')[0])}/../"
%w(config hooks application application/commands).each do |dir|
dirpath = "#{project_root}/#{dir}"
Dir.glob "#{dirpath}/*.rb" do |file|
require file
end if Dir.exists? dirpath
end
configspath = "#{project_root}/default_user_configs"
Dir.glob "#{configspath}/*.{yml,yaml}" do |file|
Rbcli::Configurate.me {config_defaults file}
end
end
|
.local_state ⇒ Object
15
16
17
|
# File 'lib/rbcli/stateful_systems/storagetypes/localstate.rb', line 15
def self.local_state
Rbcli::ConfigurateStorage.data[:localstate]
end
|
.log ⇒ Object
69
70
71
|
# File 'lib/rbcli/logging/logging.rb', line 69
def self.log
Rbcli::Logger::log
end
|
.parse ⇒ Object
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/rbcli/engine/parser.rb', line 61
def self.parse
if Rbcli.configuration[:first_run]
if Rbcli.local_state
if Rbcli.local_state.rbclidata.key? :first_run
Rbcli::Parser::parse
else
Rbcli.configuration[:first_run].call
Rbcli.local_state.set_rbclidata :first_run, true
Rbcli::Parser::parse unless Rbcli.configuration[:halt_after_first_run]
end
else
raise StandardError.new "Error: Can not use `first_run` without also configuring `local_state`."
end
else
Rbcli::Parser::parse
end
end
|
.remote_state ⇒ Object
19
20
21
|
# File 'lib/rbcli/stateful_systems/storagetypes/remotestate_dynamodb.rb', line 19
def self.remote_state
Rbcli::ConfigurateStorage.data[:remotestate]
end
|