yun 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/yun/config.rb +27 -0
- data/lib/yun/version.rb +1 -1
- data/lib/yun/yun.rb +8 -2
- metadata +5 -4
data/lib/yun/config.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module Yun
|
4
|
+
class Config
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@setting = YAML.load_file(config_file)[:default]
|
8
|
+
end
|
9
|
+
|
10
|
+
def config_file
|
11
|
+
@config_file ||= File.expand_path('~/.yun')
|
12
|
+
end
|
13
|
+
|
14
|
+
def aws_access_key_id
|
15
|
+
@setting[:aws_access_key_id]
|
16
|
+
end
|
17
|
+
|
18
|
+
def aws_secret_access_key
|
19
|
+
@setting[:aws_secret_access_key]
|
20
|
+
end
|
21
|
+
|
22
|
+
def region
|
23
|
+
@setting[:region]
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
data/lib/yun/version.rb
CHANGED
data/lib/yun/yun.rb
CHANGED
@@ -1,12 +1,18 @@
|
|
1
1
|
require 'fog'
|
2
2
|
require 'hirb'
|
3
|
+
require 'yun/config'
|
3
4
|
|
4
5
|
module Yun
|
5
6
|
class Yun
|
6
7
|
|
7
8
|
def self.list
|
8
|
-
|
9
|
-
|
9
|
+
config = Config.new
|
10
|
+
options = {:provider => "aws",
|
11
|
+
:aws_access_key_id => config.aws_access_key_id,
|
12
|
+
:aws_secret_access_key => config.aws_secret_access_key,
|
13
|
+
:region => config.region}
|
14
|
+
|
15
|
+
nodes = Fog::Compute.new(options).servers.map do |node|
|
10
16
|
{
|
11
17
|
:id => node.id,
|
12
18
|
:flavor_id => node.flavor_id,
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Feng Zhichao
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-11-
|
18
|
+
date: 2011-11-20 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: fog
|
@@ -82,6 +82,7 @@ files:
|
|
82
82
|
- lib/yun.rb
|
83
83
|
- lib/yun/cli.rb
|
84
84
|
- lib/yun/commands/node_command.rb
|
85
|
+
- lib/yun/config.rb
|
85
86
|
- lib/yun/version.rb
|
86
87
|
- lib/yun/yun.rb
|
87
88
|
- yun.gemspec
|