hookit 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8ef6a1d03fe66b7dc858921b2c6f9b38c46dab67
4
- data.tar.gz: 11ab5f5d41b157edbd05903ee92714bee86fae0a
3
+ metadata.gz: 949ebb8c4d5b30e1e8e55f012c3050f32d005cdc
4
+ data.tar.gz: 777738e6010351d754de2c01af6790f193a7700b
5
5
  SHA512:
6
- metadata.gz: 695084242a78005016c86fbf9e26903e631bb2c1f6fe2a1094eac62a75a1f26cc077fc2f3a667ba3a048bfccc97c0b806d541f4091608c644acbaba2260c11bc
7
- data.tar.gz: 177d445bc16ad1ec7fef87be550b105259a47f5b890f9923fac8e409ec56fece6a14e42f29356161716dc54e6dbff756550023ebb66477bc17d0045b2f9d960e
6
+ metadata.gz: eae7b877f879646944b256248831db05571192571a2f760c30b68f933dbaa04a3743b91ddf1ed0ce994e4d9c8e95c898c334d7ee69ee64ad560bd4b2965802b7
7
+ data.tar.gz: d3cfdcd42a3df3ffcd093555af039779d9e63e19e2969a60973e1fe470d746870f00ce70ccdf04a3ac852da76536168d9e4bd74879822ce53bd25e9f8925530f
data/bin/hookit CHANGED
@@ -1,41 +1,51 @@
1
1
  #!/usr/bin/env ruby
2
-
3
- MODULE_DIR = ENV['MODULE_DIR'] || "/opt/local/hookit/mod"
4
- LOG_LEVEL = ENV['LOG_LEVEL'] || :error
5
- LOGFILE = ENV['LOGFILE'] || '/var/log/hookit/hookit.log'
6
-
7
- hook = ARGV.shift
8
-
9
- if not hook
10
- $stderr.puts "hook is required"
11
- exit 1
12
- end
13
-
14
- # uncomment if dev only
15
- lib = File.expand_path('../../lib', __FILE__)
16
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
17
-
18
- require 'hookit'
19
- require 'json'
20
-
21
- include Hookit::Hook # payload helpers / resource dsl
22
-
23
- set :log_level, LOG_LEVEL
24
- set :logfile, LOGFILE
25
- set :module_root, MODULE_DIR
26
-
27
- # require hook libs
28
- Dir.glob("#{MODULE_DIR}/lib/*.rb").each do |file|
29
- require file
30
- end
31
-
32
- logger.info ""
33
- logger.info "hook: #{hook}"
34
- logger.info "payload: #{payload.to_json}"
35
-
36
2
  begin
37
- load "#{MODULE_DIR}/hooks/#{hook}.rb"
38
- rescue LoadError
39
- logger.error "hook: #{hook} does not exist"
40
- $stderr.puts "hook: #{hook} does not exist"
3
+ MODULE_DIR = ENV['MODULE_DIR'] || "/opt/local/hookit/mod"
4
+ LOG_LEVEL = ENV['LOG_LEVEL'] || :error
5
+ LOGFILE = ENV['LOGFILE'] || '/var/log/hookit/hookit.log'
6
+
7
+ hook = ARGV.shift
8
+
9
+ if not hook
10
+ $stderr.puts "hook is required"
11
+ exit 1
12
+ end
13
+
14
+ # uncomment if dev only
15
+ lib = File.expand_path('../../lib', __FILE__)
16
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
17
+
18
+ require 'hookit'
19
+ require 'json'
20
+
21
+ include Hookit::Hook # payload helpers / resource dsl
22
+
23
+ set :log_level, LOG_LEVEL
24
+ set :logfile, LOGFILE
25
+ set :module_root, MODULE_DIR
26
+
27
+ # require hook libs
28
+ Dir.glob("#{MODULE_DIR}/lib/*.rb").each do |file|
29
+ require file
30
+ end
31
+
32
+ logger.info ""
33
+ logger.info "hook: #{hook}"
34
+ logger.info "payload: #{payload.to_json}"
35
+
36
+ begin
37
+ load "#{MODULE_DIR}/hooks/#{hook}.rb"
38
+ rescue LoadError
39
+ logger.error "hook: #{hook} does not exist"
40
+ $stderr.puts "hook: #{hook} does not exist"
41
+ end
42
+ rescue Exception => e
43
+ $stderr.puts "There has been an error."
44
+ $stderr.puts "If you choose to submit a ticket,"
45
+ $stderr.puts "please include the following backtrace."
46
+ $stderr.puts "======================================="
47
+ $stderr.puts e.message
48
+ $stderr.puts e.backtrace
49
+ $stderr.puts "======================================="
50
+ exit 1
41
51
  end
@@ -41,10 +41,10 @@ module Hookit
41
41
 
42
42
  def mount!
43
43
  ::FileUtils.mkdir_p(mount_point)
44
- case platform.name
45
- when 'smartos'
44
+ case platform.os
45
+ when 'sun'
46
46
  run_command! "mount -O -F #{fstype} -o retry=5,timeo=300 #{options!(as_arg=true)} #{device} #{mount_point}"
47
- when 'ubuntu'
47
+ when 'linux'
48
48
  run_command! "mount -t #{fstype} -o retry=5,timeo=300 #{options!(as_arg=true)} #{device} #{mount_point}"
49
49
  end
50
50
  end
@@ -55,19 +55,19 @@ module Hookit
55
55
 
56
56
  def enable!
57
57
  entry = "#{device}\t#{device =~ /^\/dev/ ? device : "-"}\t#{mount_point}\t#{fstype}\t#{pass}\tyes\t#{options!}"
58
- case platform.name
59
- when 'smartos'
58
+ case platform.os
59
+ when 'sun'
60
60
  `echo "#{entry}" >> /etc/vfstab`
61
- when 'ubuntu'
61
+ when 'linux'
62
62
  `echo "#{entry}" >> /etc/fstab`
63
63
  end
64
64
  end
65
65
 
66
66
  def disable!
67
- case platform.name
68
- when 'smartos'
67
+ case platform.os
68
+ when 'sun'
69
69
  `egrep -v "#{device}.*#{mount_point}" /etc/vfstab > /tmp/vfstab.tmp; mv -f /tmp/vfstab.tmp /etc/vfstab`
70
- when 'ubuntu'
70
+ when 'linux'
71
71
  `egrep -v "#{device}.*#{mount_point}" /etc/fstab > /tmp/vfstab.tmp; mv -f /tmp/vfstab.tmp /etc/vfstab`
72
72
  end
73
73
  end
@@ -1,3 +1,3 @@
1
1
  module Hookit
2
- VERSION = "0.11.0"
2
+ VERSION = "0.11.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hookit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Flint
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-09-14 00:00:00.000000000 Z
12
+ date: 2015-10-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: tilt
@@ -198,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
198
  version: '0'
199
199
  requirements: []
200
200
  rubyforge_project:
201
- rubygems_version: 2.2.2
201
+ rubygems_version: 2.4.5.1
202
202
  signing_key:
203
203
  specification_version: 4
204
204
  summary: Hookit is a framework to provide hookit scripts with re-usable components