diff --git a/Gemfile b/Gemfile index c24f7ad..f46b06e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ source 'https://rubygems.org' -# Specify your gem's dependencies in hooky.gemspec +# Specify your gem's dependencies in hookit.gemspec gemspec diff --git a/README.md b/README.md index 5add1df..8397554 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -# Hooky +# Hookit -Hooky is the framework to provide hooky scripts with re-usable components and resources via an elegant dsl +Hookit is the framework to provide hookit scripts with re-usable components and resources via an elegant dsl diff --git a/Rakefile b/Rakefile index a560591..5f19ff9 100644 --- a/Rakefile +++ b/Rakefile @@ -1,17 +1,10 @@ require "bundler/gem_tasks" -desc "Create tag v#{Hooky::VERSION}" +desc "Create tag v#{Hookit::VERSION}" task :tag do - puts "tagging version v#{Hooky::VERSION}" - `git tag -a v#{Hooky::VERSION} -m "Version #{Hooky::VERSION}"` + puts "tagging version v#{Hookit::VERSION}" + `git tag -a v#{Hookit::VERSION} -m "Version #{Hookit::VERSION}"` `git push origin --tags` end - -desc "Create tag v#{Hooky::VERSION} and build and push hooky-#{Hooky::VERSION}.gem to Gemfury" -task :fury => [:tag, :build] do - - puts `fury push pkg/hooky-#{Hooky::VERSION}.gem` - -end \ No newline at end of file diff --git a/bin/hooky b/bin/hookit similarity index 78% rename from bin/hooky rename to bin/hookit index dda01cf..e455b54 100755 --- a/bin/hooky +++ b/bin/hookit @@ -1,8 +1,8 @@ #!/usr/bin/env ruby -MODULE_DIR = ENV['MODULE_DIR'] || "/opt/local/hooky/mod" +MODULE_DIR = ENV['MODULE_DIR'] || "/opt/local/hookit/mod" LOG_LEVEL = ENV['LOG_LEVEL'] || :error -LOGFILE = ENV['LOGFILE'] || '/var/log/hooky/hooky.log' +LOGFILE = ENV['LOGFILE'] || '/var/log/hookit/hookit.log' hook = ARGV.shift @@ -15,10 +15,10 @@ end lib = File.expand_path('../../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'hooky' +require 'hookit' require 'json' -include Hooky::Hook # payload helpers / resource dsl +include Hookit::Hook # payload helpers / resource dsl set :log_level, LOG_LEVEL set :logfile, LOGFILE diff --git a/hooky.gemspec b/hookit.gemspec similarity index 71% rename from hooky.gemspec rename to hookit.gemspec index 6bac6be..4ee8adf 100644 --- a/hooky.gemspec +++ b/hookit.gemspec @@ -1,15 +1,15 @@ # coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'hooky/version' +require 'hookit/version' Gem::Specification.new do |spec| - spec.name = "hooky" - spec.version = Hooky::VERSION + spec.name = "hookit" + spec.version = Hookit::VERSION spec.authors = ["Tyler Flint", "Greg Linton"] spec.email = ["tyler@pagodabox.com"] - spec.summary = %q{Hooky is a framework to provide hooky scripts with re-usable components and resources via an elegant dsl.} - spec.description = %q{The core framework to provide hooky scripts with re-usable components.} + spec.summary = %q{Hookit is a framework to provide hookit scripts with re-usable components and resources via an elegant dsl.} + spec.description = %q{The core framework to provide hookit scripts with re-usable components.} spec.homepage = "" spec.license = "MIT" diff --git a/lib/hookit.rb b/lib/hookit.rb new file mode 100644 index 0000000..5743fb4 --- /dev/null +++ b/lib/hookit.rb @@ -0,0 +1,27 @@ +require 'hookit/converginator' +require 'hookit/db' +require 'hookit/error' +require 'hookit/exit' +require 'hookit/helper' +require 'hookit/hook' +require 'hookit/logger' +require 'hookit/logvac' +require 'hookit/platform' +require 'hookit/registry' +require 'hookit/resource' +require "hookit/version" + +module Hookit + extend self + + def resources + @resources ||= Hookit::Registry.new + end + + def platforms + @platforms ||= Hookit::Registry.new + end +end + +require 'hookit/resources' +require 'hookit/platforms' \ No newline at end of file diff --git a/lib/hooky/converginator.rb b/lib/hookit/converginator.rb similarity index 99% rename from lib/hooky/converginator.rb rename to lib/hookit/converginator.rb index 2356016..b5569fc 100644 --- a/lib/hooky/converginator.rb +++ b/lib/hookit/converginator.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit class Converginator def initialize(map, list) diff --git a/lib/hooky/db.rb b/lib/hookit/db.rb similarity index 89% rename from lib/hooky/db.rb rename to lib/hookit/db.rb index 8b1df2d..ee77d1e 100644 --- a/lib/hooky/db.rb +++ b/lib/hookit/db.rb @@ -2,10 +2,10 @@ require 'multi_json' require 'fileutils' -module Hooky +module Hookit class DB - DEFAULT_PATH = '/var/db/hooky/db.json' + DEFAULT_PATH = '/var/db/hookit/db.json' def initialize(path=nil) @path = path || DEFAULT_PATH diff --git a/lib/hooky/error.rb b/lib/hookit/error.rb similarity index 93% rename from lib/hooky/error.rb rename to lib/hookit/error.rb index d4dafab..e350b56 100644 --- a/lib/hooky/error.rb +++ b/lib/hookit/error.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Error class UnexpectedExit < StandardError; end class UnknownAction < StandardError; end diff --git a/lib/hooky/exit.rb b/lib/hookit/exit.rb similarity index 96% rename from lib/hooky/exit.rb rename to lib/hookit/exit.rb index 4320792..eaa1c67 100644 --- a/lib/hooky/exit.rb +++ b/lib/hookit/exit.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Exit SUCCESS = 0 ERROR = 1 diff --git a/lib/hookit/helper.rb b/lib/hookit/helper.rb new file mode 100644 index 0000000..5a1dbee --- /dev/null +++ b/lib/hookit/helper.rb @@ -0,0 +1,9 @@ +require 'hookit/helper/nfs' +require 'hookit/helper/shell' +require 'hookit/helper/xml' +require 'hookit/helper/cron' + +module Hookit + module Helper + end +end \ No newline at end of file diff --git a/lib/hooky/helper/cron.rb b/lib/hookit/helper/cron.rb similarity index 98% rename from lib/hooky/helper/cron.rb rename to lib/hookit/helper/cron.rb index 2681f60..b1e49ce 100644 --- a/lib/hooky/helper/cron.rb +++ b/lib/hookit/helper/cron.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Helper module Cron diff --git a/lib/hooky/helper/nfs.rb b/lib/hookit/helper/nfs.rb similarity index 99% rename from lib/hooky/helper/nfs.rb rename to lib/hookit/helper/nfs.rb index f187688..107448e 100644 --- a/lib/hooky/helper/nfs.rb +++ b/lib/hookit/helper/nfs.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Helper module NFS diff --git a/lib/hooky/helper/shell.rb b/lib/hookit/helper/shell.rb similarity index 98% rename from lib/hooky/helper/shell.rb rename to lib/hookit/helper/shell.rb index 8c18e3c..aa0e307 100644 --- a/lib/hooky/helper/shell.rb +++ b/lib/hookit/helper/shell.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Helper module Shell diff --git a/lib/hooky/helper/xml.rb b/lib/hookit/helper/xml.rb similarity index 97% rename from lib/hooky/helper/xml.rb rename to lib/hookit/helper/xml.rb index f3cceb0..47c5068 100644 --- a/lib/hooky/helper/xml.rb +++ b/lib/hookit/helper/xml.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Helper module XML diff --git a/lib/hooky/hook.rb b/lib/hookit/hook.rb similarity index 87% rename from lib/hooky/hook.rb rename to lib/hookit/hook.rb index aa065a4..c1567e7 100644 --- a/lib/hooky/hook.rb +++ b/lib/hookit/hook.rb @@ -1,7 +1,7 @@ require 'oj' require 'multi_json' -module Hooky +module Hookit module Hook def payload @@ -29,7 +29,7 @@ def registry(key, value=nil) end def db - @db ||= Hooky::DB.new + @db ||= Hookit::DB.new end def dict @@ -49,11 +49,11 @@ def log(level, message) end def logger - @logger ||= Hooky::Logger.new(get(:logfile), get(:log_level)) + @logger ||= Hookit::Logger.new(get(:logfile), get(:log_level)) end def logvac - @logvac ||= Hooky::Logvac.new({ + @logvac ||= Hookit::Logvac.new({ app: payload[:app][:id], token: payload[:app][:logvac_token], deploy: payload[:deploy][:id] @@ -65,7 +65,7 @@ def platform end def detect_platform - Hooky.platforms.each do |key, value| + Hookit.platforms.each do |key, value| platform = value.new if platform.detect? return platform @@ -76,7 +76,7 @@ def detect_platform # awesome resource-backed dsl def method_missing(method_symbol, *args, &block) - resource_klass = Hooky.resources.get(method_symbol) + resource_klass = Hookit.resources.get(method_symbol) if resource_klass resource = resource_klass.new(*args) resource.dict = dict diff --git a/lib/hooky/logger.rb b/lib/hookit/logger.rb similarity index 92% rename from lib/hooky/logger.rb rename to lib/hookit/logger.rb index 02b376c..bda14a9 100644 --- a/lib/hooky/logger.rb +++ b/lib/hookit/logger.rb @@ -1,10 +1,10 @@ -module Hooky +module Hookit class Logger attr_reader :log_file, :log_level def initialize(file, level) - @log_file = file || '/var/log/hooky/hooky.log' + @log_file = file || '/var/log/hookit/hookit.log' @log_level = level || :error end diff --git a/lib/hooky/logvac.rb b/lib/hookit/logvac.rb similarity index 97% rename from lib/hooky/logvac.rb rename to lib/hookit/logvac.rb index bec8b68..de0900f 100644 --- a/lib/hooky/logvac.rb +++ b/lib/hookit/logvac.rb @@ -1,6 +1,6 @@ require 'faraday' -module Hooky +module Hookit class Logvac def initialize(opts) diff --git a/lib/hookit/platform.rb b/lib/hookit/platform.rb new file mode 100644 index 0000000..4c73731 --- /dev/null +++ b/lib/hookit/platform.rb @@ -0,0 +1,9 @@ +require 'hookit/platform/base' +require 'hookit/platform/smartos' +require 'hookit/platform/ubuntu' + +module Hookit + module Platform + + end +end \ No newline at end of file diff --git a/lib/hooky/platform/base.rb b/lib/hookit/platform/base.rb similarity index 89% rename from lib/hooky/platform/base.rb rename to lib/hookit/platform/base.rb index 28da799..325ad0c 100644 --- a/lib/hooky/platform/base.rb +++ b/lib/hookit/platform/base.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Platform class Base diff --git a/lib/hooky/platform/smartos.rb b/lib/hookit/platform/smartos.rb similarity index 94% rename from lib/hooky/platform/smartos.rb rename to lib/hookit/platform/smartos.rb index 6c2285e..f1d17d3 100644 --- a/lib/hooky/platform/smartos.rb +++ b/lib/hookit/platform/smartos.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Platform class Smartos < Base diff --git a/lib/hooky/platform/ubuntu.rb b/lib/hookit/platform/ubuntu.rb similarity index 95% rename from lib/hooky/platform/ubuntu.rb rename to lib/hookit/platform/ubuntu.rb index 1c92e78..6d7fd38 100644 --- a/lib/hooky/platform/ubuntu.rb +++ b/lib/hookit/platform/ubuntu.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Platform class Ubuntu < Base diff --git a/lib/hookit/platforms.rb b/lib/hookit/platforms.rb new file mode 100644 index 0000000..4188807 --- /dev/null +++ b/lib/hookit/platforms.rb @@ -0,0 +1,2 @@ +Hookit.platforms.register(:smartos) { Hookit::Platform::Smartos } +Hookit.platforms.register(:ubuntu) { Hookit::Platform::Ubuntu } \ No newline at end of file diff --git a/lib/hooky/registry.rb b/lib/hookit/registry.rb similarity index 98% rename from lib/hooky/registry.rb rename to lib/hookit/registry.rb index f138aec..9ad8b53 100644 --- a/lib/hooky/registry.rb +++ b/lib/hookit/registry.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit # Register components in a single location that can be queried. # # This allows certain components (such as guest systems, configuration diff --git a/lib/hookit/resource.rb b/lib/hookit/resource.rb new file mode 100644 index 0000000..ae7ae6b --- /dev/null +++ b/lib/hookit/resource.rb @@ -0,0 +1,21 @@ +require 'hookit/resource/base' +require 'hookit/resource/directory' +require 'hookit/resource/execute' +require 'hookit/resource/file' +require 'hookit/resource/hook_file' +require 'hookit/resource/link' +require 'hookit/resource/logrotate' +require 'hookit/resource/mount' +require 'hookit/resource/package' +require 'hookit/resource/rsync' +require 'hookit/resource/socket' +require 'hookit/resource/scp' +require 'hookit/resource/service' +require 'hookit/resource/template' +require 'hookit/resource/zfs' + +module Hookit + module Resource + + end +end \ No newline at end of file diff --git a/lib/hooky/resource/base.rb b/lib/hookit/resource/base.rb similarity index 91% rename from lib/hooky/resource/base.rb rename to lib/hookit/resource/base.rb index 8adeb99..de7feeb 100644 --- a/lib/hooky/resource/base.rb +++ b/lib/hookit/resource/base.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Resource class Base @@ -61,7 +61,7 @@ def action(*actions) if actions.any? actions.each do |action| if not self.class.actions.include? action - raise Hooky::Error::UnknownAction, "unknown action '#{action}'" + raise Hookit::Error::UnknownAction, "unknown action '#{action}'" end end @actions = *actions @@ -96,7 +96,7 @@ def run_command!(cmd, expect_code=0) `#{cmd}` code = $?.exitstatus if code != expect_code - raise Hooky::Error::UnexpectedExit, "#{cmd} failed with exit code '#{code}'" + raise Hookit::Error::UnexpectedExit, "#{cmd} failed with exit code '#{code}'" end end diff --git a/lib/hooky/resource/cron.rb b/lib/hookit/resource/cron.rb similarity index 97% rename from lib/hooky/resource/cron.rb rename to lib/hookit/resource/cron.rb index 5aa5dc7..d937495 100644 --- a/lib/hooky/resource/cron.rb +++ b/lib/hookit/resource/cron.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Resource class Cron < Execute diff --git a/lib/hooky/resource/directory.rb b/lib/hookit/resource/directory.rb similarity index 86% rename from lib/hooky/resource/directory.rb rename to lib/hookit/resource/directory.rb index b91260e..02af74d 100644 --- a/lib/hooky/resource/directory.rb +++ b/lib/hookit/resource/directory.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Resource class Directory < Base @@ -35,7 +35,7 @@ def create! `#{cmd}` code = $?.exitstatus if code != 0 - raise Hooky::Error::UnexpectedExit, "#{cmd} failed with exit code '#{code}'" + raise Hookit::Error::UnexpectedExit, "#{cmd} failed with exit code '#{code}'" end end @@ -45,7 +45,7 @@ def delete! `#{cmd}` code = $?.exitstatus if code != 0 - raise Hooky::Error::UnexpectedExit, "#{cmd} failed with exit code '#{code}'" + raise Hookit::Error::UnexpectedExit, "#{cmd} failed with exit code '#{code}'" end end diff --git a/lib/hooky/resource/execute.rb b/lib/hookit/resource/execute.rb similarity index 95% rename from lib/hooky/resource/execute.rb rename to lib/hookit/resource/execute.rb index c635571..87e0ee8 100644 --- a/lib/hooky/resource/execute.rb +++ b/lib/hookit/resource/execute.rb @@ -1,6 +1,6 @@ require 'timeout' -module Hooky +module Hookit module Resource class Execute < Base @@ -140,7 +140,7 @@ def env_string(key, val) end def unexpected_exit(res) - raise Hooky::Error::UnexpectedExit, "'#{name}' exited with #{res}, expected #{returns}" unless ignore_exit + raise Hookit::Error::UnexpectedExit, "'#{name}' exited with #{res}, expected #{returns}" unless ignore_exit end end diff --git a/lib/hooky/resource/file.rb b/lib/hookit/resource/file.rb similarity index 98% rename from lib/hooky/resource/file.rb rename to lib/hookit/resource/file.rb index 8554a87..123ad4b 100644 --- a/lib/hooky/resource/file.rb +++ b/lib/hookit/resource/file.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Resource class File < Base diff --git a/lib/hooky/resource/hook_file.rb b/lib/hookit/resource/hook_file.rb similarity index 99% rename from lib/hooky/resource/hook_file.rb rename to lib/hookit/resource/hook_file.rb index f3c24f6..1fdf864 100644 --- a/lib/hooky/resource/hook_file.rb +++ b/lib/hookit/resource/hook_file.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Resource class HookFile < Base diff --git a/lib/hooky/resource/link.rb b/lib/hookit/resource/link.rb similarity index 85% rename from lib/hooky/resource/link.rb rename to lib/hookit/resource/link.rb index 76af498..c78df26 100644 --- a/lib/hooky/resource/link.rb +++ b/lib/hookit/resource/link.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Resource class Link < Base @@ -36,7 +36,7 @@ def create! `#{cmd}` code = $?.exitstatus if code != 0 - raise Hooky::Error::UnexpectedExit, "#{cmd} failed with exit code '#{code}'" + raise Hookit::Error::UnexpectedExit, "#{cmd} failed with exit code '#{code}'" end end @@ -45,7 +45,7 @@ def delete! `#{cmd}` code = $?.exitstatus if code != 0 - raise Hooky::Error::UnexpectedExit, "#{cmd} failed with exit code '#{code}'" + raise Hookit::Error::UnexpectedExit, "#{cmd} failed with exit code '#{code}'" end end diff --git a/lib/hooky/resource/logrotate.rb b/lib/hookit/resource/logrotate.rb similarity index 84% rename from lib/hooky/resource/logrotate.rb rename to lib/hookit/resource/logrotate.rb index bcd482d..628758e 100644 --- a/lib/hooky/resource/logrotate.rb +++ b/lib/hookit/resource/logrotate.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Resource class Logrotate < Base @@ -29,7 +29,7 @@ def create! when 'sun' `logadm -c -w #{path} -s #{filesize ||= '10m'} -S #{max_size ||= '500m'} -C #{count ||= '10'} -N` else - raise Hooky::Error::UnsupportedPlatform, "unsupported platform '#{platform.name}'" + raise Hookit::Error::UnsupportedPlatform, "unsupported platform '#{platform.name}'" end end diff --git a/lib/hooky/resource/mount.rb b/lib/hookit/resource/mount.rb similarity index 94% rename from lib/hooky/resource/mount.rb rename to lib/hookit/resource/mount.rb index 52d7299..2943653 100644 --- a/lib/hooky/resource/mount.rb +++ b/lib/hookit/resource/mount.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Resource class Mount < Base @@ -69,7 +69,7 @@ def run_command!(cmd, expect_code=0) `#{cmd}` code = $?.exitstatus if code != expect_code - raise Hooky::Error::UnexpectedExit, "#{cmd} failed with exit code '#{code}'" + raise Hookit::Error::UnexpectedExit, "#{cmd} failed with exit code '#{code}'" end end end diff --git a/lib/hooky/resource/package.rb b/lib/hookit/resource/package.rb similarity index 88% rename from lib/hooky/resource/package.rb rename to lib/hookit/resource/package.rb index 5a56270..732032b 100644 --- a/lib/hooky/resource/package.rb +++ b/lib/hookit/resource/package.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Resource class Package < Base @@ -26,7 +26,7 @@ def run(action) def install! begin install_package - rescue Hooky::Error::UnexpectedExit + rescue Hookit::Error::UnexpectedExit if not registry("pkgsrc.#{scope}.updated") update_pkg_db registry("pkgsrc.#{scope}.updated", true) @@ -44,7 +44,7 @@ def install_package code = $?.exitstatus if not code == 0 - raise Hooky::Error::UnexpectedExit, "pkgin in #{package} failed with exit code '#{code}'" + raise Hookit::Error::UnexpectedExit, "pkgin in #{package} failed with exit code '#{code}'" end end diff --git a/lib/hooky/resource/rsync.rb b/lib/hookit/resource/rsync.rb similarity index 91% rename from lib/hooky/resource/rsync.rb rename to lib/hookit/resource/rsync.rb index a01c4c2..cc34178 100644 --- a/lib/hooky/resource/rsync.rb +++ b/lib/hookit/resource/rsync.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Resource class Rsync < Base @@ -58,7 +58,7 @@ def run_command!(cmd, expect_code=0) `#{cmd}` code = $?.exitstatus if code != expect_code - raise Hooky::Error::UnexpectedExit, "#{cmd} failed with exit code '#{code}'" + raise Hookit::Error::UnexpectedExit, "#{cmd} failed with exit code '#{code}'" end end diff --git a/lib/hooky/resource/scp.rb b/lib/hookit/resource/scp.rb similarity index 93% rename from lib/hooky/resource/scp.rb rename to lib/hookit/resource/scp.rb index 6f5ec13..76189f8 100644 --- a/lib/hooky/resource/scp.rb +++ b/lib/hookit/resource/scp.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Resource class Scp < Base @@ -78,7 +78,7 @@ def run_command!(cmd, expect_code=0) `#{cmd}` code = $?.exitstatus if code != expect_code - raise Hooky::Error::UnexpectedExit, "#{cmd} failed with exit code '#{code}'" + raise Hookit::Error::UnexpectedExit, "#{cmd} failed with exit code '#{code}'" end end diff --git a/lib/hooky/resource/service.rb b/lib/hookit/resource/service.rb similarity index 83% rename from lib/hooky/resource/service.rb rename to lib/hookit/resource/service.rb index 3b833ff..2beee44 100644 --- a/lib/hooky/resource/service.rb +++ b/lib/hookit/resource/service.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Resource class Service < Base @@ -49,7 +49,7 @@ def enable! when :runit run_command! "sv start #{service_name}" else - Hooky::Error::UnsupportedOption, "Unsupported init schema '#{init}'" + Hookit::Error::UnsupportedOption, "Unsupported init schema '#{init}'" end end @@ -60,7 +60,7 @@ def disable! when :runit run_command! "sv stop #{service_name}" else - Hooky::Error::UnsupportedOption, "Unsupported init schema '#{init}'" + Hookit::Error::UnsupportedOption, "Unsupported init schema '#{init}'" end end @@ -71,7 +71,7 @@ def restart! when :runit disable!; enable! else - Hooky::Error::UnsupportedOption, "Unsupported init schema '#{init}'" + Hookit::Error::UnsupportedOption, "Unsupported init schema '#{init}'" end end @@ -80,7 +80,7 @@ def reload! when :smf run_command! "svcadm refresh #{service_name}" else - Hooky::Error::UnsupportedOption, "Unsupported init schema '#{init}'" + Hookit::Error::UnsupportedOption, "Unsupported init schema '#{init}'" end end diff --git a/lib/hooky/resource/socket.rb b/lib/hookit/resource/socket.rb similarity index 96% rename from lib/hooky/resource/socket.rb rename to lib/hookit/resource/socket.rb index 99720f8..0fa3ab3 100644 --- a/lib/hooky/resource/socket.rb +++ b/lib/hookit/resource/socket.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Resource class Socket < Base @@ -39,7 +39,7 @@ def check_listening! exit(count + 10) else $stderr.puts "ERROR: timed out waiting for #{service} to listen" - exit(Hooky::Exit::ERROR) + exit(Hookit::Exit::ERROR) end end diff --git a/lib/hooky/resource/template.rb b/lib/hookit/resource/template.rb similarity index 99% rename from lib/hooky/resource/template.rb rename to lib/hookit/resource/template.rb index 00bbb55..dc44702 100644 --- a/lib/hooky/resource/template.rb +++ b/lib/hookit/resource/template.rb @@ -4,7 +4,7 @@ require 'oj' require 'multi_json' -module Hooky +module Hookit module Resource class Template < Base diff --git a/lib/hooky/resource/warning.rb b/lib/hookit/resource/warning.rb similarity index 99% rename from lib/hooky/resource/warning.rb rename to lib/hookit/resource/warning.rb index c949a7e..c025529 100644 --- a/lib/hooky/resource/warning.rb +++ b/lib/hookit/resource/warning.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Resource class Warning < Base diff --git a/lib/hooky/resource/zfs.rb b/lib/hookit/resource/zfs.rb similarity index 95% rename from lib/hooky/resource/zfs.rb rename to lib/hookit/resource/zfs.rb index eaa8a3b..db8a3d4 100644 --- a/lib/hooky/resource/zfs.rb +++ b/lib/hookit/resource/zfs.rb @@ -1,4 +1,4 @@ -module Hooky +module Hookit module Resource class Zfs < Base @@ -89,7 +89,7 @@ def run_command!(cmd, expect_code=0) res = `#{cmd}` code = $?.exitstatus if code != expect_code - raise Hooky::Error::UnexpectedExit, "#{cmd} failed with exit code '#{code}'" + raise Hookit::Error::UnexpectedExit, "#{cmd} failed with exit code '#{code}'" end return validate!(res) end diff --git a/lib/hookit/resources.rb b/lib/hookit/resources.rb new file mode 100644 index 0000000..a3297f7 --- /dev/null +++ b/lib/hookit/resources.rb @@ -0,0 +1,15 @@ +Hookit.resources.register(:directory) { Hookit::Resource::Directory } +Hookit.resources.register(:ensure_socket) { Hookit::Resource::Socket } +Hookit.resources.register(:execute) { Hookit::Resource::Execute } +Hookit.resources.register(:file) { Hookit::Resource::File } +Hookit.resources.register(:hook_file) { Hookit::Resource::HookFile } +Hookit.resources.register(:hookit_file) { Hookit::Resource::HookFile } +Hookit.resources.register(:link) { Hookit::Resource::Link } +Hookit.resources.register(:logrotate) { Hookit::Resource::Logrotate } +Hookit.resources.register(:mount) { Hookit::Resource::Mount } +Hookit.resources.register(:package) { Hookit::Resource::Package } +Hookit.resources.register(:rsync) { Hookit::Resource::Rsync } +Hookit.resources.register(:scp) { Hookit::Resource::Scp } +Hookit.resources.register(:service) { Hookit::Resource::Service } +Hookit.resources.register(:template) { Hookit::Resource::Template } +Hookit.resources.register(:zfs) { Hookit::Resource::Zfs } diff --git a/lib/hooky/version.rb b/lib/hookit/version.rb similarity index 64% rename from lib/hooky/version.rb rename to lib/hookit/version.rb index ecc508a..fc3a8a5 100644 --- a/lib/hooky/version.rb +++ b/lib/hookit/version.rb @@ -1,3 +1,3 @@ -module Hooky +module Hookit VERSION = "0.7.11" end diff --git a/lib/hooky.rb b/lib/hooky.rb deleted file mode 100644 index 83510e7..0000000 --- a/lib/hooky.rb +++ /dev/null @@ -1,27 +0,0 @@ -require 'hooky/converginator' -require 'hooky/db' -require 'hooky/error' -require 'hooky/exit' -require 'hooky/helper' -require 'hooky/hook' -require 'hooky/logger' -require 'hooky/logvac' -require 'hooky/platform' -require 'hooky/registry' -require 'hooky/resource' -require "hooky/version" - -module Hooky - extend self - - def resources - @resources ||= Hooky::Registry.new - end - - def platforms - @platforms ||= Hooky::Registry.new - end -end - -require 'hooky/resources' -require 'hooky/platforms' \ No newline at end of file diff --git a/lib/hooky/helper.rb b/lib/hooky/helper.rb deleted file mode 100644 index cf7afb7..0000000 --- a/lib/hooky/helper.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'hooky/helper/nfs' -require 'hooky/helper/shell' -require 'hooky/helper/xml' -require 'hooky/helper/cron' - -module Hooky - module Helper - end -end \ No newline at end of file diff --git a/lib/hooky/platform.rb b/lib/hooky/platform.rb deleted file mode 100644 index 76a39db..0000000 --- a/lib/hooky/platform.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'hooky/platform/base' -require 'hooky/platform/smartos' -require 'hooky/platform/ubuntu' - -module Hooky - module Platform - - end -end \ No newline at end of file diff --git a/lib/hooky/platforms.rb b/lib/hooky/platforms.rb deleted file mode 100644 index b90210b..0000000 --- a/lib/hooky/platforms.rb +++ /dev/null @@ -1,2 +0,0 @@ -Hooky.platforms.register(:smartos) { Hooky::Platform::Smartos } -Hooky.platforms.register(:ubuntu) { Hooky::Platform::Ubuntu } \ No newline at end of file diff --git a/lib/hooky/resource.rb b/lib/hooky/resource.rb deleted file mode 100644 index 7e7a788..0000000 --- a/lib/hooky/resource.rb +++ /dev/null @@ -1,21 +0,0 @@ -require 'hooky/resource/base' -require 'hooky/resource/directory' -require 'hooky/resource/execute' -require 'hooky/resource/file' -require 'hooky/resource/hook_file' -require 'hooky/resource/link' -require 'hooky/resource/logrotate' -require 'hooky/resource/mount' -require 'hooky/resource/package' -require 'hooky/resource/rsync' -require 'hooky/resource/socket' -require 'hooky/resource/scp' -require 'hooky/resource/service' -require 'hooky/resource/template' -require 'hooky/resource/zfs' - -module Hooky - module Resource - - end -end \ No newline at end of file diff --git a/lib/hooky/resources.rb b/lib/hooky/resources.rb deleted file mode 100644 index 9831dfd..0000000 --- a/lib/hooky/resources.rb +++ /dev/null @@ -1,15 +0,0 @@ -Hooky.resources.register(:directory) { Hooky::Resource::Directory } -Hooky.resources.register(:ensure_socket) { Hooky::Resource::Socket } -Hooky.resources.register(:execute) { Hooky::Resource::Execute } -Hooky.resources.register(:file) { Hooky::Resource::File } -Hooky.resources.register(:hook_file) { Hooky::Resource::HookFile } -Hooky.resources.register(:hooky_file) { Hooky::Resource::HookFile } -Hooky.resources.register(:link) { Hooky::Resource::Link } -Hooky.resources.register(:logrotate) { Hooky::Resource::Logrotate } -Hooky.resources.register(:mount) { Hooky::Resource::Mount } -Hooky.resources.register(:package) { Hooky::Resource::Package } -Hooky.resources.register(:rsync) { Hooky::Resource::Rsync } -Hooky.resources.register(:scp) { Hooky::Resource::Scp } -Hooky.resources.register(:service) { Hooky::Resource::Service } -Hooky.resources.register(:template) { Hooky::Resource::Template } -Hooky.resources.register(:zfs) { Hooky::Resource::Zfs }