obelisk 0.2.2 → 0.2.3
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 +4 -4
- data/bin/obelisk_cli +52 -12
- data/lib/obelisk/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a9f369eae29acccbf0f0f359d6fa75961c665a6
|
4
|
+
data.tar.gz: 8778303261ee023e0b4f049e4c6632647606f745
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4916bc1845d24f4c578947c8d2685b3add2d84a03f9509e7ed7a6950ec1afbda8cba9ee41254a67290f7617c5fb3b28dd70f3927f5444af5e69312ad2a931b86
|
7
|
+
data.tar.gz: 6bb9da94a68aa0e9cc49605614f5c4aec617783e6fa6a9ffad290ab6ddfcd1c265693db4a91bed02353993171479cd33499a7d0b151e137fe12ddabdc2cf92f1
|
data/bin/obelisk_cli
CHANGED
@@ -1,16 +1,56 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'obelisk_cli' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
2
|
|
9
|
-
|
10
|
-
|
11
|
-
Pathname.new(__FILE__).realpath)
|
3
|
+
lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
|
4
|
+
$LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
|
12
5
|
|
13
|
-
require
|
14
|
-
require
|
6
|
+
require "optparse"
|
7
|
+
require "securerandom"
|
8
|
+
require "obelisk"
|
15
9
|
|
16
|
-
|
10
|
+
options = {}
|
11
|
+
VALID_COMMANDS = %w{install generate update}
|
12
|
+
|
13
|
+
op = OptionParser.new do |opts|
|
14
|
+
opts.banner =
|
15
|
+
%Q{Usage: obelisk_cli [options] command
|
16
|
+
Commands:
|
17
|
+
install Copy or merge configuration file for Obelisk
|
18
|
+
generate Generate config files for Asterisk
|
19
|
+
update Replace config files for Asterisk in case of any change
|
20
|
+
Options:}
|
21
|
+
opts.on("-o", "--outdir [DIR]", "Output directory for generated config files") { |dir| options[:dir] = dir }
|
22
|
+
opts.on("-d", "--db", "Update Obelisk Portal database") { options[:updb] = true }
|
23
|
+
opts.on("-r", "--restart", "Restart Asterisk in case of config change") { options[:restart] = true }
|
24
|
+
opts.on("-c", "--config [FILE]", "Specify config FILE for Obelisk") { |file| options[:config] = file }
|
25
|
+
opts.on_tail("-h", "--help", "Show this message") { puts opts; exit }
|
26
|
+
end
|
27
|
+
|
28
|
+
op.parse!
|
29
|
+
|
30
|
+
ARGV.select! { |arg| VALID_COMMANDS.include? arg }
|
31
|
+
(puts op.help; exit 1) if ARGV.empty?
|
32
|
+
|
33
|
+
Obelisk.load_conf options[:config]
|
34
|
+
$conf[:asterisk_conf_dir] = options[:dir] if options[:dir]
|
35
|
+
|
36
|
+
ARGV.each do |arg|
|
37
|
+
case arg
|
38
|
+
when "install"
|
39
|
+
if Obelisk.save_def_conf options[:config]
|
40
|
+
puts "Found and updated config file. Please, check it."
|
41
|
+
else
|
42
|
+
puts "Default configuration file's been saved. Change it accordingly."
|
43
|
+
end
|
44
|
+
when "generate"
|
45
|
+
Obelisk.make_erb_conf :force => true, :restart => options[:restart]
|
46
|
+
puts "All files has been generated."
|
47
|
+
when "update"
|
48
|
+
if Obelisk.make_erb_conf(:restart => options[:restart])
|
49
|
+
puts "Asterisk config files have been updated"
|
50
|
+
else
|
51
|
+
puts "Already up to date."
|
52
|
+
end
|
53
|
+
else
|
54
|
+
puts op
|
55
|
+
end
|
56
|
+
end
|
data/lib/obelisk/version.rb
CHANGED