pisec 0.0.1 → 0.0.2

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -1
  3. data/bin/pisec +24 -6
  4. data/lib/pisec/version.rb +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7866f0bdc963ff9e013c1f3c014e6a5db670974b
4
- data.tar.gz: eda9e1cb227c8b3a936924f1330f35b74b530b39
3
+ metadata.gz: 561652072a7cabccd7ec71a3924085e91cc25f15
4
+ data.tar.gz: 9bc4ee53cfbefdf4bf105396ed51c4efed43cb40
5
5
  SHA512:
6
- metadata.gz: ef8c52c8c9d5e6cf5632ae039435280f6b8289c15db1194926170fc6af0b6e40fdb695e4be96a9800fc5f079504f7fd6e517fd49b5933ee3c1ef03b8c1fdfade
7
- data.tar.gz: 2c1b21ce79d05c617dafd8d48ad5f665ec3b4aa9e4b634679d8630110a7c0583e79aa9b7164ea461f114ea1341fcd533e107ffc5e1b41ba06ec6464692c16f06
6
+ metadata.gz: c8b9f42ba484bec3217bb3eb13ef4f31f62ea9685f99417e6a4d8afdc963a8de5cd37c6b761affd3436d6fd914798fb0a7cf4ffba3bb3e022b39e25041a5626c
7
+ data.tar.gz: ea1526ff4a20256961a1013ad3e1684d38d8ede6b2c8e5cfc7443a72baa3def002fc5ef82b874b741890a88c37a58dbaa04ff3cbf1794a4c3d6b9a2348045384
data/README.md CHANGED
@@ -23,8 +23,9 @@ configure it:
23
23
  # The format for this file is essentially:
24
24
  # export <NAMESPACE>_<UPPERCASE_KEY_NAME>={<lowercase_key_name> => <val>}.to_json
25
25
  # e.g.
26
- # export PISEC_DEV_DB_USER="{\"dev_db_user\":\"pisec\"}"
26
+ export PISEC_DEV_DB_USER="{\"dev_db_user\":\"pisec\"}"
27
27
 
28
+ Rails:
28
29
  initialize it:
29
30
  vi config/initializers/pisec.rb:
30
31
  Settings = Pisec::Support.load_file(
@@ -35,6 +36,10 @@ initialize it:
35
36
  use it:
36
37
  Settings.get("dev_db_user")
37
38
 
39
+ Shell:
40
+ # config-file namespace lookup-key
41
+ ./bin/pisec -c README.md -n PISEC -l dev_db_user
42
+
38
43
  ## Contributing
39
44
 
40
45
  1. Fork it
data/bin/pisec CHANGED
@@ -1,16 +1,30 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'net/ssh/gateway'
4
- require 'json'
5
- require 'mysql2'
6
- require_relative '../lib/stat_fetcher/client'
7
-
3
+ begin
4
+ require 'rubygems'
5
+ gem 'pisec'
6
+ require 'pisec'
7
+ rescue LoadError
8
+ require_relative '../lib/pisec/settings'
9
+ end
8
10
  require 'optparse'
9
11
 
10
12
  options = {}
11
13
  opt_parser = OptionParser.new do |opts|
12
14
  opts.banner = "Usage: #{$0} [OPTIONS]..."
13
15
 
16
+ opts.on( "-c [CONFIG_FILE]", "--config_file [CONFIG_FILE]", "specify full path to config file") do |c|
17
+ options[:config_file] = c
18
+ end
19
+
20
+ opts.on( "-n [NAMESPACE]", "--namespace [NAMESPACE]", "specify namespace") do |n|
21
+ options[:namespace] = n
22
+ end
23
+
24
+ opts.on( "-l [LOOKUP_KEY]", "--lookup_key [LOOKUP_KEY]", "specify key to lookup") do |l|
25
+ options[:lookup_key] = l
26
+ end
27
+
14
28
  #opts.on( "-a", "--all", "show all params") do |a|
15
29
  # options[:mode] = :all
16
30
  #end
@@ -22,4 +36,8 @@ opt_parser = OptionParser.new do |opts|
22
36
  end
23
37
  opt_parser.parse!
24
38
 
25
- puts StatFetcher::Client.fetch
39
+ config_file = options[:config_file]
40
+ namespace = options[:namespace]
41
+ lookup_key = options[:lookup_key]
42
+
43
+ puts Pisec::Settings.load_file( config_file, namespace ).get( lookup_key )
@@ -1,3 +1,3 @@
1
1
  module Pisec
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pisec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - jayteesf