obelisk 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aaacdcac68a150e3fb2a04a2801da22c3af3c7be
4
- data.tar.gz: 676f70d28fdf091a0e3574b3d84bf791efcecf13
3
+ metadata.gz: 7a9f369eae29acccbf0f0f359d6fa75961c665a6
4
+ data.tar.gz: 8778303261ee023e0b4f049e4c6632647606f745
5
5
  SHA512:
6
- metadata.gz: 25975e51edca548261d44599070d81404f863ad234ed63cadc3a567dc9cad1b0101b9072dcf0e29beb920151cf919eaf823424ca67a87df951f2571132d3ac61
7
- data.tar.gz: 01f2b6790cd4e3804b87fdc8c51ac5d9bc98313155cfde5850409395fdbc2d6d16d10c8d9a588ec99dbb523582bfadaa24018b131928153f56e7daeb97bcb174
6
+ metadata.gz: 4916bc1845d24f4c578947c8d2685b3add2d84a03f9509e7ed7a6950ec1afbda8cba9ee41254a67290f7617c5fb3b28dd70f3927f5444af5e69312ad2a931b86
7
+ data.tar.gz: 6bb9da94a68aa0e9cc49605614f5c4aec617783e6fa6a9ffad290ab6ddfcd1c265693db4a91bed02353993171479cd33499a7d0b151e137fe12ddabdc2cf92f1
@@ -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
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
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 'rubygems'
14
- require 'bundler/setup'
6
+ require "optparse"
7
+ require "securerandom"
8
+ require "obelisk"
15
9
 
16
- load Gem.bin_path('obelisk', 'obelisk_cli')
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
@@ -1,3 +1,3 @@
1
1
  module Obelisk
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: obelisk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - goredar