Sha256: 3970a89d6fe6e58c0b38d7016883c8670a72e9dca72e41d6aba6bc309d4fd937
Contents?: true
Size: 1.42 KB
Versions: 2
Compression:
Stored size: 1.42 KB
Contents
require 'itamae' require 'itamae/resource/base' require 'itamae/resource/file' require 'itamae/resource/package' require 'itamae/resource/remote_directory' require 'itamae/resource/remote_file' require 'itamae/resource/directory' require 'itamae/resource/template' require 'itamae/resource/execute' require 'itamae/resource/service' require 'itamae/resource/link' require 'itamae/resource/local_ruby_block' require 'itamae/resource/git' require 'itamae/resource/user' module Itamae module Resource Error = Class.new(StandardError) AttributeMissingError = Class.new(StandardError) InvalidTypeError = Class.new(StandardError) ParseError = Class.new(StandardError) class << self def get_resource_class_name(method) to_camel_case(method.to_s) end def get_resource_plugin_class_name(method) '::Itamae::Plugin::Resource::' + to_camel_case(method.to_s) end def to_camel_case(str) str.split('_').map {|part| part.capitalize}.join end def get_resource_class(method) begin const_get(get_resource_class_name(method)) rescue NameError => e const_get(get_resource_plugin_class_name(method)) end end def parse_description(desc) if /\A([^\[]+)\[([^\]]+)\]\z/ =~ desc [$1, $2] else raise ParseError, "'#{desc}' doesn't represent a resource." end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
itamae-1.1.2 | lib/itamae/resource.rb |
itamae-1.1.1 | lib/itamae/resource.rb |