bixby-client 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,38 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem 'bixby-common', :git => "https://github.com/chetan/bixby-common.git"
4
+
5
+ gem "api-auth", :git => "https://github.com/chetan/api_auth.git", :branch => "non_rails"
6
+
7
+ gem 'multi_json'
8
+ gem 'oj'
9
+ gem 'httpi', :git => "https://github.com/chetan/httpi.git",
10
+ :branch => "chunked_responses"
11
+ gem 'curb'
12
+
13
+ gem 'mixlib-shellout'
14
+
15
+ group :development do
16
+
17
+ gem "yard"
18
+ gem "redcarpet", :platforms => [:mri, :rbx]
19
+
20
+ gem "bundler"
21
+ gem "jeweler", :git => "https://github.com/chetan/jeweler.git", :branch => "bixby"
22
+ gem "pry"
23
+ gem "debugger", :platforms => :mri_19
24
+ gem "debugger-pry", :require => "debugger/pry", :platforms => :mri_19
25
+
26
+ gem "simplecov", :platforms => [:mri_19, :rbx], :git => "https://github.com/chetan/simplecov.git", :branch => "inline_nocov"
27
+
28
+ gem "minitest", :platforms => [:mri_19, :rbx]
29
+ gem "webmock", :require => false
30
+ gem "mocha", :require => false
31
+
32
+ gem "test_guard", :git => "https://github.com/chetan/test_guard.git"
33
+ gem 'rb-inotify', :require => false
34
+ gem 'rb-fsevent', :require => false
35
+ gem 'rb-fchange', :require => false
36
+
37
+ end
38
+
data/Gemfile.lock ADDED
@@ -0,0 +1,160 @@
1
+ GIT
2
+ remote: https://github.com/chetan/api_auth.git
3
+ revision: 18a1bc002468a7f90ca92d3b50406be8a61411cb
4
+ branch: non_rails
5
+ specs:
6
+ api-auth (1.0.1)
7
+
8
+ GIT
9
+ remote: https://github.com/chetan/bixby-common.git
10
+ revision: c7dfbf7477d8137a8e79e9bde767a27f29e44c34
11
+ specs:
12
+ bixby-common (0.3.8)
13
+ httpi
14
+ logging
15
+ multi_json
16
+
17
+ GIT
18
+ remote: https://github.com/chetan/httpi.git
19
+ revision: f6e49303fee6778c714bcc556fa5f9247bc3a3f3
20
+ branch: chunked_responses
21
+ specs:
22
+ httpi (2.0.0)
23
+ rack
24
+
25
+ GIT
26
+ remote: https://github.com/chetan/jeweler.git
27
+ revision: 41062abfc55dc1f5775d6419c796fd1c8756fc7b
28
+ branch: bixby
29
+ specs:
30
+ jeweler (1.8.4)
31
+ bundler (~> 1.0)
32
+ git (>= 1.2.5)
33
+ rake
34
+ rdoc
35
+
36
+ GIT
37
+ remote: https://github.com/chetan/simplecov.git
38
+ revision: 308449b2193700f7a9a4291821a323110838fbc0
39
+ branch: inline_nocov
40
+ specs:
41
+ simplecov (0.7.1)
42
+ multi_json (~> 1.0)
43
+ simplecov-html (~> 0.7.1)
44
+
45
+ GIT
46
+ remote: https://github.com/chetan/test_guard.git
47
+ revision: dc2f30da10945323a3e8f377311b6df54f46ad4c
48
+ specs:
49
+ test_guard (0.1.2)
50
+ awesome_print
51
+ growl
52
+ guard
53
+ simplecov
54
+ simplecov-console
55
+ single_test
56
+ turn
57
+
58
+ GEM
59
+ remote: https://rubygems.org/
60
+ specs:
61
+ addressable (2.3.3)
62
+ ansi (1.4.3)
63
+ awesome_print (1.1.0)
64
+ coderay (1.0.8)
65
+ colorize (0.5.8)
66
+ columnize (0.3.6)
67
+ crack (0.3.2)
68
+ curb (0.8.3)
69
+ debugger (1.3.1)
70
+ columnize (>= 0.3.1)
71
+ debugger-linecache (~> 1.1.1)
72
+ debugger-ruby_core_source (~> 1.1.8)
73
+ debugger-linecache (1.1.2)
74
+ debugger-ruby_core_source (>= 1.1.1)
75
+ debugger-pry (0.1.1)
76
+ debugger (~> 1)
77
+ pry (>= 0.9.9)
78
+ debugger-ruby_core_source (1.1.8)
79
+ ffi (1.4.0)
80
+ git (1.2.5)
81
+ growl (1.0.3)
82
+ guard (1.6.2)
83
+ listen (>= 0.6.0)
84
+ lumberjack (>= 1.0.2)
85
+ pry (>= 0.9.10)
86
+ terminal-table (>= 1.4.3)
87
+ thor (>= 0.14.6)
88
+ hirb (0.7.1)
89
+ json (1.7.7)
90
+ listen (0.7.2)
91
+ little-plugger (1.1.3)
92
+ logging (1.8.1)
93
+ little-plugger (>= 1.1.3)
94
+ multi_json (>= 1.3.6)
95
+ lumberjack (1.0.2)
96
+ metaclass (0.0.1)
97
+ method_source (0.8.1)
98
+ minitest (4.6.1)
99
+ mixlib-shellout (1.1.0)
100
+ mocha (0.13.2)
101
+ metaclass (~> 0.0.1)
102
+ multi_json (1.6.1)
103
+ oj (2.0.7)
104
+ pry (0.9.12)
105
+ coderay (~> 1.0.5)
106
+ method_source (~> 0.8)
107
+ slop (~> 3.4)
108
+ rack (1.5.2)
109
+ rake (10.0.3)
110
+ rb-fchange (0.0.6)
111
+ ffi
112
+ rb-fsevent (0.9.3)
113
+ rb-inotify (0.9.0)
114
+ ffi (>= 0.5.0)
115
+ rdoc (3.12.1)
116
+ json (~> 1.4)
117
+ redcarpet (2.2.2)
118
+ simplecov-console (0.1.1)
119
+ colorize
120
+ hirb
121
+ simplecov
122
+ simplecov-html (0.7.1)
123
+ single_test (0.5.2)
124
+ rake (> 0.9)
125
+ slop (3.4.3)
126
+ terminal-table (1.4.5)
127
+ thor (0.17.0)
128
+ turn (0.9.6)
129
+ ansi
130
+ webmock (1.9.2)
131
+ addressable (>= 2.2.7)
132
+ crack (>= 0.3.2)
133
+ yard (0.8.4.1)
134
+
135
+ PLATFORMS
136
+ ruby
137
+
138
+ DEPENDENCIES
139
+ api-auth!
140
+ bixby-common!
141
+ bundler
142
+ curb
143
+ debugger
144
+ debugger-pry
145
+ httpi!
146
+ jeweler!
147
+ minitest
148
+ mixlib-shellout
149
+ mocha
150
+ multi_json
151
+ oj
152
+ pry
153
+ rb-fchange
154
+ rb-fsevent
155
+ rb-inotify
156
+ redcarpet
157
+ simplecov!
158
+ test_guard!
159
+ webmock
160
+ yard
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 Chetan Sarva
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = bixby-client
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to bixby-client
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
+ * Fork the project.
10
+ * Start a feature/bugfix branch.
11
+ * Commit and push until you are happy with your contribution.
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2013 Chetan Sarva. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ Dir['tasks/**/*.rake'].each { |rake| load rake }
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.1
data/bin/bixby ADDED
File without changes
@@ -0,0 +1,134 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "bixby-client"
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Chetan Sarva"]
12
+ s.date = "2013-03-23"
13
+ s.description = "Bixby Client"
14
+ s.email = "chetan@pixelcop.net"
15
+ s.executables = ["bixby"]
16
+ s.extra_rdoc_files = [
17
+ "LICENSE.txt",
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "bin/bixby",
29
+ "bixby-client.gemspec",
30
+ "lib/bixby-client.rb",
31
+ "lib/bixby-client/client.rb",
32
+ "lib/bixby-client/command.rb",
33
+ "lib/bixby-client/modules.rb",
34
+ "lib/bixby-client/modules/inventory.rb",
35
+ "lib/bixby-client/modules/metrics.rb",
36
+ "lib/bixby-client/modules/repository.rb",
37
+ "lib/bixby-client/patch/shellout.rb",
38
+ "lib/bixby-client/platform_util.rb",
39
+ "lib/bixby-client/script.rb",
40
+ "lib/bixby-client/script_util.rb",
41
+ "tasks/jeweler.rake",
42
+ "tasks/test.rake",
43
+ "tasks/yard.rake",
44
+ "test/base.rb",
45
+ "test/bixby-client/test_command.rb",
46
+ "test/bixby-client/test_platform_util.rb",
47
+ "test/helper.rb",
48
+ "test/support/root_dir/etc/bixby.yml",
49
+ "test/support/root_dir/etc/id_rsa",
50
+ "test/support/root_dir/etc/server",
51
+ "test/support/root_dir/etc/server.pub",
52
+ "test/test_bixby-client.rb"
53
+ ]
54
+ s.homepage = "http://github.com/chetan/bixby-client"
55
+ s.require_paths = ["lib"]
56
+ s.rubygems_version = "1.8.25"
57
+ s.summary = "Bixby Client"
58
+
59
+ if s.respond_to? :specification_version then
60
+ s.specification_version = 3
61
+
62
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
63
+ s.add_runtime_dependency(%q<bixby-common>, [">= 0"])
64
+ s.add_runtime_dependency(%q<api-auth>, [">= 0"])
65
+ s.add_runtime_dependency(%q<multi_json>, [">= 0"])
66
+ s.add_runtime_dependency(%q<oj>, [">= 0"])
67
+ s.add_runtime_dependency(%q<httpi>, [">= 0"])
68
+ s.add_runtime_dependency(%q<curb>, [">= 0"])
69
+ s.add_runtime_dependency(%q<mixlib-shellout>, [">= 0"])
70
+ s.add_development_dependency(%q<yard>, [">= 0"])
71
+ s.add_development_dependency(%q<redcarpet>, [">= 0"])
72
+ s.add_development_dependency(%q<bundler>, [">= 0"])
73
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
74
+ s.add_development_dependency(%q<pry>, [">= 0"])
75
+ s.add_development_dependency(%q<debugger>, [">= 0"])
76
+ s.add_development_dependency(%q<debugger-pry>, [">= 0"])
77
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
78
+ s.add_development_dependency(%q<minitest>, [">= 0"])
79
+ s.add_development_dependency(%q<webmock>, [">= 0"])
80
+ s.add_development_dependency(%q<mocha>, [">= 0"])
81
+ s.add_development_dependency(%q<test_guard>, [">= 0"])
82
+ s.add_development_dependency(%q<rb-inotify>, [">= 0"])
83
+ s.add_development_dependency(%q<rb-fsevent>, [">= 0"])
84
+ s.add_development_dependency(%q<rb-fchange>, [">= 0"])
85
+ else
86
+ s.add_dependency(%q<bixby-common>, [">= 0"])
87
+ s.add_dependency(%q<api-auth>, [">= 0"])
88
+ s.add_dependency(%q<multi_json>, [">= 0"])
89
+ s.add_dependency(%q<oj>, [">= 0"])
90
+ s.add_dependency(%q<httpi>, [">= 0"])
91
+ s.add_dependency(%q<curb>, [">= 0"])
92
+ s.add_dependency(%q<mixlib-shellout>, [">= 0"])
93
+ s.add_dependency(%q<yard>, [">= 0"])
94
+ s.add_dependency(%q<redcarpet>, [">= 0"])
95
+ s.add_dependency(%q<bundler>, [">= 0"])
96
+ s.add_dependency(%q<jeweler>, [">= 0"])
97
+ s.add_dependency(%q<pry>, [">= 0"])
98
+ s.add_dependency(%q<debugger>, [">= 0"])
99
+ s.add_dependency(%q<debugger-pry>, [">= 0"])
100
+ s.add_dependency(%q<simplecov>, [">= 0"])
101
+ s.add_dependency(%q<minitest>, [">= 0"])
102
+ s.add_dependency(%q<webmock>, [">= 0"])
103
+ s.add_dependency(%q<mocha>, [">= 0"])
104
+ s.add_dependency(%q<test_guard>, [">= 0"])
105
+ s.add_dependency(%q<rb-inotify>, [">= 0"])
106
+ s.add_dependency(%q<rb-fsevent>, [">= 0"])
107
+ s.add_dependency(%q<rb-fchange>, [">= 0"])
108
+ end
109
+ else
110
+ s.add_dependency(%q<bixby-common>, [">= 0"])
111
+ s.add_dependency(%q<api-auth>, [">= 0"])
112
+ s.add_dependency(%q<multi_json>, [">= 0"])
113
+ s.add_dependency(%q<oj>, [">= 0"])
114
+ s.add_dependency(%q<httpi>, [">= 0"])
115
+ s.add_dependency(%q<curb>, [">= 0"])
116
+ s.add_dependency(%q<mixlib-shellout>, [">= 0"])
117
+ s.add_dependency(%q<yard>, [">= 0"])
118
+ s.add_dependency(%q<redcarpet>, [">= 0"])
119
+ s.add_dependency(%q<bundler>, [">= 0"])
120
+ s.add_dependency(%q<jeweler>, [">= 0"])
121
+ s.add_dependency(%q<pry>, [">= 0"])
122
+ s.add_dependency(%q<debugger>, [">= 0"])
123
+ s.add_dependency(%q<debugger-pry>, [">= 0"])
124
+ s.add_dependency(%q<simplecov>, [">= 0"])
125
+ s.add_dependency(%q<minitest>, [">= 0"])
126
+ s.add_dependency(%q<webmock>, [">= 0"])
127
+ s.add_dependency(%q<mocha>, [">= 0"])
128
+ s.add_dependency(%q<test_guard>, [">= 0"])
129
+ s.add_dependency(%q<rb-inotify>, [">= 0"])
130
+ s.add_dependency(%q<rb-fsevent>, [">= 0"])
131
+ s.add_dependency(%q<rb-fchange>, [">= 0"])
132
+ end
133
+ end
134
+
@@ -0,0 +1,47 @@
1
+
2
+ require "api-auth"
3
+
4
+ require "bixby-common"
5
+
6
+ require "bixby-client/platform_util"
7
+ require "bixby-client/script_util"
8
+ require "bixby-client/modules"
9
+ require "bixby-client/command"
10
+ require "bixby-client/client"
11
+
12
+ module Bixby
13
+
14
+ class << self
15
+
16
+ # Set the Bixby::Client to be used
17
+ def client=(client)
18
+ @client = client
19
+ end
20
+
21
+ # Get a Bixby::Client instance
22
+ def client
23
+ @client ||= create_client()
24
+ end
25
+
26
+
27
+ private
28
+
29
+ def create_client
30
+ raise "#{root} not found" if not root
31
+
32
+ config_file = Bixby.path("etc", "bixby.yml")
33
+ raise "#{config_file} not found" if not File.exists? config_file
34
+
35
+ config = YAML.load_file(config_file)
36
+ if not config.kind_of? Hash or
37
+ !(config.include? "access_key" and config.include? "secret_key") then
38
+
39
+ raise "invalid config file #{config_file}"
40
+ end
41
+
42
+ Bixby.manager_uri = config["manager_uri"]
43
+ return Bixby::Client.new(config["access_key"], config["secret_key"])
44
+ end
45
+ end
46
+
47
+ end # Bixby