Module: KManager

Extended by:
Forwardable
Defined in:
lib/k_manager/overview/models.rb,
lib/k_manager.rb,
lib/k_manager/area.rb,
lib/k_manager/cli/new.rb,
lib/k_manager/manager.rb,
lib/k_manager/version.rb,
lib/k_manager/watcher.rb,
lib/k_manager/cli/info.rb,
lib/k_manager/cli/watch.rb,
lib/k_manager/cli/version.rb,
lib/k_manager/cli/commands.rb,
lib/k_manager/cli/base_command.rb,
lib/k_manager/document_factory.rb,
lib/k_manager/overview/queries.rb,
lib/k_manager/overview/dashboard.rb,
lib/k_manager/overview/dump_json.rb,
lib/k_manager/resources/mem_resource.rb,
lib/k_manager/resources/resource_set.rb,
lib/k_manager/resources/web_resource.rb,
lib/k_manager/resources/base_resource.rb,
lib/k_manager/resources/file_resource.rb,
lib/k_manager/resources/resource_factory.rb,
lib/k_manager/resources/resource_manager.rb,
lib/k_manager/resources/resource_document_factory.rb,
lib/k_manager/resources/file_resources/ruby_file_resource.rb,
lib/k_manager/resources/file_resources/unknown_file_resource.rb

Overview

KDomain::Schemas::Domain::Column KDomain::Schemas::Domain::Model

Defined Under Namespace

Modules: Cli, Overview, Resources Classes: Area, DocumentFactory, Error, Manager, Watcher

Constant Summary collapse

VERSION =
'0.0.37'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.current_resourceObject (readonly)

NOTE: Can mutex be moved into manager?



47
48
49
# File 'lib/k_manager.rb', line 47

def current_resource
  @current_resource
end

Class Method Details

.clear_screenObject


Utilities




126
127
128
129
# File 'lib/k_manager.rb', line 126

def clear_screen
  puts "\n" * 70
  $stdout.clear_screen
end

.debug?Boolean

Returns:

  • (Boolean)


81
82
83
# File 'lib/k_manager.rb', line 81

def debug?
  debug_state == :enabled
end

.debug_enableObject



77
78
79
# File 'lib/k_manager.rb', line 77

def debug_enable
  @debug_state = :enabled
end

.debug_stateObject


Debug Flags




71
72
73
74
75
# File 'lib/k_manager.rb', line 71

def debug_state
  return @debug_state if defined? @debug_state

  @debug_state = :disabled
end

.document_factoryObject


Document factory facade methods




116
117
118
# File 'lib/k_manager.rb', line 116

def document_factory
  @document_factory ||= DocumentFactory.new
end

.for_current_resource {|@current_resource| ... } ⇒ Object

Yields:

Raises:



61
62
63
64
65
# File 'lib/k_manager.rb', line 61

def for_current_resource
  raise KManager::Error, 'Attempting to yield current_resource, when a different thread has the lock?' unless resource_mutex.owned?

  yield(@current_resource)
end

.for_resource(resource = nil) ⇒ Object



53
54
55
56
57
58
59
# File 'lib/k_manager.rb', line 53

def for_resource(resource = nil)
  resource_mutex.synchronize do
    @current_resource = resource
    yield(current_resource)
    @current_resource = nil
  end
end

.managerObject


Manager facade methods




89
90
91
# File 'lib/k_manager.rb', line 89

def manager
  @manager ||= Manager.new
end

.resetObject



93
94
95
96
97
# File 'lib/k_manager.rb', line 93

def reset
  # @resource_mutex.unlock if @resource_mutex
  # @current_resource = nil
  @manager = Manager.new
end

.resource_mutexObject



49
50
51
# File 'lib/k_manager.rb', line 49

def resource_mutex
  @resource_mutex ||= Mutex.new
end