Top Level Namespace
- Includes:
- MMGen::MetamodelGenerator
Defined Under Namespace
Modules: DOT, DefaultMM, EASupport, EmptyMM, FFI, Generators, HieraPuppet, HouseMetamodel, Kernel, MMGen, Nagios, PSON, Puppet, Puppetx, RDoc, RGen, ResolverSpecs, SafeYAML, SecureRandom, Semantic, SimpleECoreModelChecker, SimpleXMIMetaModel, StatemachineMetamodel, Testmodel, UML13, UML13EA, Win32, YAML Classes: AbstractXMLInstantiator, AddCreatedAtToAllTables, AddEnvironmentToHost, AddInventoryServiceTables, Array, ArrayExtensionsTest, BuilderContextTest, Class, Date, EAInstantiatorTest, EASerializerTest, ECoreCopyTransformer, ECoreSelfTest, ECoreToUML13, ECoreXMLInstantiator, EnvironmentTest, Exception, ExploitableBackDoor, ExternalNode, FalseClass, FileCacheMapTest, Float, Formatter, GitIgnoreSpec, Hash, Hiera, IO, IdStore, JsonTest, MetamodelBuilderTest, MetamodelFromEcoreTest, MetamodelOrderTest, MetamodelRoundtripTest, MethodDelegationTest, ModelBuilderTest, ModelFragmentTest, ModelSerializerTest, MyExternalNode, NilClass, Numeric, Object, PathSpec, PatternMatcherTest, QualifiedNameProviderTest, QualifiedNameResolverTest, Range, ReferenceResolverTest, RegexSpec, Regexp, RemoveDuplicatedIndexOnAllTables, RequestPool, SemVer, SimpleXMIECoreInstantiator, SimpleXmiToECore, Spec, String, Symbol, TemplateContainerTest, Time, TransformerTest, TrueClass, TypeDoc, UML13EAToUML13, UML13ToECore, UML13ToUML13EA, UserAttr, WindowsDaemon, XMI11Instantiator, XMLInstantiatorTest, ZAML
Constant Summary collapse
- SEPARATOR =
[Regexp.escape(File::SEPARATOR.to_s), Regexp.escape(File::ALT_SEPARATOR.to_s)].join
- PROJECT_ROOT =
File.join(File.dirname(__FILE__), '..')
- HERE =
File.dirname(__FILE__)
- ROOT =
File.join(HERE, "..")
- Syck =
YAML::Syck
- BASEDIR =
Dir.chdir(File.dirname(__FILE__) + "/..") { Dir.getwd }
- WORKINGDIR =
"#{p.realpath}"
Instance Method Summary collapse
-
#date ⇒ Object
- lib/trollop.rb – trollop command-line processing library Author
- William Morgan (mailto: [email protected]) Copyright
- Copyright 2007 William Morgan License
-
the same terms as ruby itself.
- #format_bytes(bytes) ⇒ Object
-
#log(message, level = :debug) ⇒ Object
Helper method to log to syslog; we log at level debug if no level is specified since those are the most frequent calls to this method.
- #mean(array) ⇒ Object
- #median(array) ⇒ Object
- #post_compile ⇒ Object
- #read_facts(file) ⇒ Object
-
#read_node(node) ⇒ Object
Read in a pure yaml representation of our node.
Methods included from MMGen::MetamodelGenerator
Instance Method Details
#date ⇒ Object
lib/trollop.rb – trollop command-line processing library
- Author
-
William Morgan (mailto: [email protected])
- Copyright
-
Copyright 2007 William Morgan
- License
-
the same terms as ruby itself
2012-03: small changes made by cprice ([email protected]);
patch submitted for upstream consideration:
https://gitorious.org/trollop/mainline/merge_requests/9
2012-08: namespace changes made by Jeff McCune ([email protected])
moved Trollop into Puppet::Util::CommandLine to prevent monkey
patching the upstream trollop library if also loaded.
13 |
# File 'lib/puppet/util/command_line/trollop.rb', line 13 require 'date' |
#format_bytes(bytes) ⇒ Object
350 351 352 353 354 355 356 357 358 |
# File 'ext/puppet-load.rb', line 350 def format_bytes(bytes) if bytes < 1024 "%.2f B" % bytes elsif bytes < 1024 * 1024 "%.2f KiB" % (bytes/1024.0) else "%.2f MiB" % (bytes/(1024.0*1024.0)) end end |
#log(message, level = :debug) ⇒ Object
Helper method to log to syslog; we log at level debug if no level is specified since those are the most frequent calls to this method
65 66 67 |
# File 'ext/regexp_nodes/regexp_nodes.rb', line 65 def log(,level=:debug) Syslog.send(level,) end |
#mean(array) ⇒ Object
340 341 342 |
# File 'ext/puppet-load.rb', line 340 def mean(array) array.inject(0) { |sum, x| sum += x } / array.size.to_f end |
#median(array) ⇒ Object
344 345 346 347 348 |
# File 'ext/puppet-load.rb', line 344 def median(array) array = array.sort m_pos = array.size / 2 return array.size % 2 == 1 ? array[m_pos] : mean(array[m_pos-1..m_pos]) end |
#read_facts(file) ⇒ Object
159 160 161 162 |
# File 'ext/puppet-load.rb', line 159 def read_facts(file) Puppet.debug("reading facts from: #{file}") fact = YAML.load(File.read(file)) end |
#read_node(node) ⇒ Object
Read in a pure yaml representation of our node.
62 63 64 65 66 67 68 69 |
# File 'ext/yaml_nodes.rb', line 62 def read_node(node) nodefile = File.join(YAMLDIR, "#{node}.yaml") if FileTest.exist?(nodefile) return YAML.load_file(nodefile) else raise "Could not find information for #{node}" end end |