odania 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f3ea4dc6ef659e59d62f4afa7b347f84ca289143
4
+ data.tar.gz: 1f2cb8775a0d6df2ea304b0296688d569f0813c0
5
+ SHA512:
6
+ metadata.gz: 39b57280e4fc8b73efb5751ff85063bd0196394546b5f803b0d08766f37201cb834571ce21b323607c601d56823fe88d7824467966f9d706bcb345909071f556
7
+ data.tar.gz: 4d71815ae0788bc39f911a82853f38c1ead7387e209811b60dc8a43b301fedef03296101c31b4b88c9fe77cea438347260fa01f41445ed0f4fc1d1c7d87568ce
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ InstalledFiles
7
+ _yardoc
8
+ coverage
9
+ doc/
10
+ lib/bundler/man
11
+ pkg
12
+ rdoc
13
+ spec/reports
14
+ test/tmp
15
+ test/version_tmp
16
+ tmp
17
+ .idea
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in odania.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,40 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ odania (0.0.1)
5
+ diplomat
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.2.5)
11
+ diplomat (0.14.0)
12
+ faraday (~> 0.9)
13
+ json (~> 1.8)
14
+ faraday (0.9.2)
15
+ multipart-post (>= 1.2, < 3)
16
+ json (1.8.3)
17
+ multipart-post (2.0.0)
18
+ rake (10.4.2)
19
+ rspec (3.3.0)
20
+ rspec-core (~> 3.3.0)
21
+ rspec-expectations (~> 3.3.0)
22
+ rspec-mocks (~> 3.3.0)
23
+ rspec-core (3.3.2)
24
+ rspec-support (~> 3.3.0)
25
+ rspec-expectations (3.3.1)
26
+ diff-lcs (>= 1.2.0, < 2.0)
27
+ rspec-support (~> 3.3.0)
28
+ rspec-mocks (3.3.2)
29
+ diff-lcs (>= 1.2.0, < 2.0)
30
+ rspec-support (~> 3.3.0)
31
+ rspec-support (3.3.0)
32
+
33
+ PLATFORMS
34
+ ruby
35
+
36
+ DEPENDENCIES
37
+ bundler (~> 1.5)
38
+ odania!
39
+ rake
40
+ rspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Mike Petersen Odania IT
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Odania
2
+
3
+ Helper for the Odania Portal
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'odania'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install odania
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( https://github.com/Odania-IT/odania-gem/fork )
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,3 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ Dir.glob('tasks/**/*.rake').each(&method(:import))
@@ -0,0 +1,41 @@
1
+ module Odania
2
+ class Consul
3
+ def initialize
4
+ consul_url = "http://#{ENV['CONSUL_PORT_8500_TCP_ADDR']}:#{ENV['CONSUL_PORT_8500_TCP_PORT']}"
5
+ puts "Consul: #{consul_url}"
6
+
7
+ Diplomat.configure do |config|
8
+ # Set up a custom Consul URL
9
+ config.url = consul_url
10
+ end
11
+ end
12
+
13
+ def get_config
14
+ configs = retrieve_value 'plugins'
15
+ puts
16
+ puts 'Configs'
17
+ puts configs.inspect
18
+ puts
19
+ puts
20
+
21
+ result = {}
22
+ configs.each do |json_data|
23
+ config = JSON.parse json_data[:value]
24
+ # TODO merge
25
+ puts config.inspect
26
+ result = config
27
+ end
28
+ result
29
+ end
30
+
31
+ private
32
+
33
+ def retrieve_value(plugin_path)
34
+ begin
35
+ Diplomat::Kv.get(plugin_path, :recurse => true)
36
+ rescue Diplomat::KeyNotFound
37
+ []
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,3 @@
1
+ module Odania
2
+ VERSION = '0.0.1'
3
+ end
data/lib/odania.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'odania/version'
2
+ require 'diplomat'
3
+
4
+ module Odania
5
+ autoload :Consul, 'odania/consul'
6
+ end
data/odania.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'odania/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'odania'
8
+ spec.version = Odania::VERSION
9
+ spec.authors = ['Mike Petersen']
10
+ spec.email = ['mike@odania-it.de']
11
+ spec.summary = %q{Helper for the odania portal}
12
+ spec.description = %q{Helper for the odania portal}
13
+ spec.homepage = 'http://www.odania.com'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.5'
22
+ spec.add_development_dependency 'rake'
23
+ spec.add_development_dependency 'rspec'
24
+
25
+ spec.add_dependency 'diplomat'
26
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe Odania::Consul do
4
+ subject { Odania::Consul.new }
5
+
6
+ describe '#process' do
7
+ let(:output) { subject.get_config }
8
+
9
+ it 'retrieves config' do
10
+ allow(subject).to receive(:retrieve_value) do |plugin_path|
11
+ {}
12
+ end
13
+
14
+ expected_config = {}
15
+ expect(output).to eq expected_config
16
+ end
17
+ end
18
+ end
@@ -0,0 +1 @@
1
+ require 'odania'
data/tasks/rspec.rake ADDED
@@ -0,0 +1,3 @@
1
+ require 'rspec/core/rake_task'
2
+
3
+ RSpec::Core::RakeTask.new(:spec)
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: odania
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Mike Petersen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-10-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: diplomat
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Helper for the odania portal
70
+ email:
71
+ - mike@odania-it.de
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - Gemfile.lock
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - lib/odania.rb
83
+ - lib/odania/consul.rb
84
+ - lib/odania/version.rb
85
+ - odania.gemspec
86
+ - spec/odania_spec.rb
87
+ - spec/spec_helper.rb
88
+ - tasks/rspec.rake
89
+ homepage: http://www.odania.com
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.4.6
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: Helper for the odania portal
113
+ test_files:
114
+ - spec/odania_spec.rb
115
+ - spec/spec_helper.rb