cyoi 0.3.0 → 0.4.0
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.
- data/ChangeLog.md +4 -0
- data/Gemfile +0 -2
- data/README.md +4 -7
- data/cyoi.gemspec +1 -1
- data/lib/cyoi/cli/auto_detection.rb +2 -2
- data/lib/cyoi/cli/helpers/settings.rb +4 -4
- data/lib/cyoi/cli/provider_addresses/address_cli_aws.rb +2 -2
- data/lib/cyoi/cli/provider_key_pair/key_pair_aws.rb +2 -2
- data/lib/cyoi/cli/providers/provider_cli.rb +2 -2
- data/lib/cyoi/providers.rb +1 -1
- data/lib/cyoi/providers/clients/fog_provider_client.rb +2 -2
- data/lib/cyoi/version.rb +1 -1
- data/spec/integration/cli/key_pair/key_pair_aws_spec.rb +4 -3
- metadata +6 -6
data/ChangeLog.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
Cyoi (choose-your-own-infrastructure) is a library to ask an end-user to choose an infrastructure (AWS, OpenStack, etc), region, and login credentials.
|
4
4
|
|
5
|
+
## v0.4
|
6
|
+
|
7
|
+
* switch to using readwritesettings instead of fork of settingslogic
|
8
|
+
|
5
9
|
## v0.3
|
6
10
|
|
7
11
|
* added `cyoi keypair` & `cyoi key_pair`
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -53,19 +53,16 @@ settings["provider"]["credentials"] # aws or openstack URLs & credentials
|
|
53
53
|
|
54
54
|
## Installation
|
55
55
|
|
56
|
-
|
56
|
+
To use as a stand-alone CLI, install the rubygem:
|
57
57
|
|
58
58
|
```
|
59
|
-
gem
|
60
|
-
gem "settingslogic", github: "drnic/settingslogic", branch: "integration"
|
59
|
+
$ gem install cyoi
|
61
60
|
```
|
62
61
|
|
63
|
-
|
64
|
-
|
65
|
-
And then execute:
|
62
|
+
To use it as a library within your own application, add this line to your application's Gemfile:
|
66
63
|
|
67
64
|
```
|
68
|
-
|
65
|
+
gem "cyoi"
|
69
66
|
```
|
70
67
|
|
71
68
|
## Contributing
|
data/cyoi.gemspec
CHANGED
@@ -24,7 +24,7 @@ README
|
|
24
24
|
|
25
25
|
spec.add_dependency "fog"
|
26
26
|
spec.add_dependency "highline", "~> 1.6"
|
27
|
-
spec.add_dependency "
|
27
|
+
spec.add_dependency "readwritesettings", "~> 3.0"
|
28
28
|
|
29
29
|
spec.add_development_dependency "bundler", "~> 1.3"
|
30
30
|
spec.add_development_dependency "rake"
|
@@ -8,8 +8,8 @@ class Cyoi::Cli::AutoDetection::UI
|
|
8
8
|
|
9
9
|
def initialize(attributes, highline)
|
10
10
|
@hl = highline
|
11
|
-
@attributes = attributes.is_a?(Hash) ?
|
12
|
-
raise "@attributes must be
|
11
|
+
@attributes = attributes.is_a?(Hash) ? ReadWriteSettings.new(attributes) : attributes
|
12
|
+
raise "@attributes must be ReadWriteSettings (or Hash)" unless @attributes.is_a?(ReadWriteSettings)
|
13
13
|
end
|
14
14
|
|
15
15
|
def perform
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require "
|
1
|
+
require "readwritesettings"
|
2
2
|
require "fileutils"
|
3
3
|
|
4
4
|
module Cyoi::Cli::Helpers::Settings
|
@@ -29,12 +29,12 @@ module Cyoi::Cli::Helpers::Settings
|
|
29
29
|
end
|
30
30
|
chmod(0600, settings_path)
|
31
31
|
chmod(0700, settings_ssh_dir) if File.directory?(settings_ssh_dir)
|
32
|
-
|
32
|
+
ReadWriteSettings.new(settings_path)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
# Saves current nested
|
37
|
-
# Recreates accessors on
|
36
|
+
# Saves current nested ReadWriteSettings into pure Hash-based YAML file
|
37
|
+
# Recreates accessors on ReadWriteSettings object (since something has changed)
|
38
38
|
def save_settings!
|
39
39
|
File.open(settings_path, "w") { |f| f << settings.to_nested_hash.to_yaml }
|
40
40
|
settings.create_accessors!
|
@@ -7,8 +7,8 @@ class Cyoi::Cli::Addresses::AddressCliAws
|
|
7
7
|
def initialize(provider_client, attributes, highline)
|
8
8
|
@provider_client = provider_client
|
9
9
|
@hl = highline
|
10
|
-
@attributes = attributes.is_a?(Hash) ?
|
11
|
-
raise "@attributes must be
|
10
|
+
@attributes = attributes.is_a?(Hash) ? ReadWriteSettings.new(attributes) : attributes
|
11
|
+
raise "@attributes must be ReadWriteSettings (or Hash)" unless @attributes.is_a?(ReadWriteSettings)
|
12
12
|
end
|
13
13
|
|
14
14
|
def perform_and_return_attributes
|
@@ -7,8 +7,8 @@ class Cyoi::Cli::KeyPair::KeyPairCliAws
|
|
7
7
|
def initialize(provider_client, attributes, highline)
|
8
8
|
@provider_client = provider_client
|
9
9
|
@hl = highline
|
10
|
-
@attributes = attributes.is_a?(Hash) ?
|
11
|
-
raise "@attributes must be
|
10
|
+
@attributes = attributes.is_a?(Hash) ? ReadWriteSettings.new(attributes) : attributes
|
11
|
+
raise "@attributes must be ReadWriteSettings (or Hash)" unless @attributes.is_a?(ReadWriteSettings)
|
12
12
|
raise "@attributes.name must be set" unless @attributes["name"]
|
13
13
|
end
|
14
14
|
|
@@ -6,8 +6,8 @@ class Cyoi::Cli::Providers::ProviderCli
|
|
6
6
|
|
7
7
|
def initialize(attributes, highline)
|
8
8
|
@hl = highline
|
9
|
-
@attributes = attributes.is_a?(Hash) ?
|
10
|
-
raise "@attributes must be
|
9
|
+
@attributes = attributes.is_a?(Hash) ? ReadWriteSettings.new(attributes) : attributes
|
10
|
+
raise "@attributes must be ReadWriteSettings (or Hash)" unless @attributes.is_a?(ReadWriteSettings)
|
11
11
|
end
|
12
12
|
|
13
13
|
# helper to export the complete nested attributes.
|
data/lib/cyoi/providers.rb
CHANGED
@@ -9,7 +9,7 @@ module Cyoi::Providers
|
|
9
9
|
# with helpers related to that provider
|
10
10
|
# returns nil if +attributes.name+ is unknown
|
11
11
|
def provider_client(attributes)
|
12
|
-
attributes = attributes.is_a?(Hash) ?
|
12
|
+
attributes = attributes.is_a?(Hash) ? ReadWriteSettings.new(attributes) : attributes
|
13
13
|
case attributes.name.to_sym
|
14
14
|
when :aws
|
15
15
|
@aws_provider_client ||= begin
|
@@ -8,8 +8,8 @@ class Cyoi::Providers::Clients::FogProviderClient
|
|
8
8
|
attr_reader :attributes
|
9
9
|
|
10
10
|
def initialize(attributes)
|
11
|
-
@attributes = attributes.is_a?(Hash) ?
|
12
|
-
raise "@attributes must be
|
11
|
+
@attributes = attributes.is_a?(Hash) ? ReadWriteSettings.new(attributes) : attributes
|
12
|
+
raise "@attributes must be ReadWriteSettings (or Hash)" unless @attributes.is_a?(ReadWriteSettings)
|
13
13
|
setup_fog_connection
|
14
14
|
end
|
15
15
|
|
data/lib/cyoi/version.rb
CHANGED
@@ -5,7 +5,7 @@ describe "cyoi key_pair aws" do
|
|
5
5
|
before { @settings_dir = File.expand_path("~/.cyoi_client_lib") }
|
6
6
|
|
7
7
|
it "fails nicely if provider.name missing" do
|
8
|
-
run_interactive(unescape("cyoi key_pair #{settings_dir}"))
|
8
|
+
run_interactive(unescape("cyoi key_pair testname #{settings_dir}"))
|
9
9
|
assert_failing_with("Please run 'cyoi provider' first")
|
10
10
|
end
|
11
11
|
|
@@ -19,10 +19,11 @@ describe "cyoi key_pair aws" do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it "create new key pair (didn't already exist in AWS)" do
|
22
|
+
run_interactive(unescape("cyoi key_pair testname #{settings_dir}"))
|
22
23
|
assert_passing_with(<<-OUT)
|
23
|
-
|
24
|
+
Acquiring a key pair testname... done
|
24
25
|
|
25
|
-
|
26
|
+
Confirming: Using key pair testname
|
26
27
|
OUT
|
27
28
|
end
|
28
29
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cyoi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -44,13 +44,13 @@ dependencies:
|
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '1.6'
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
47
|
+
name: readwritesettings
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
none: false
|
50
50
|
requirements:
|
51
51
|
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: '3.0'
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '3.0'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: bundler
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,7 +192,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
192
192
|
version: '0'
|
193
193
|
segments:
|
194
194
|
- 0
|
195
|
-
hash:
|
195
|
+
hash: -3776246876278909178
|
196
196
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
197
|
none: false
|
198
198
|
requirements:
|
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
201
|
version: '0'
|
202
202
|
segments:
|
203
203
|
- 0
|
204
|
-
hash:
|
204
|
+
hash: -3776246876278909178
|
205
205
|
requirements: []
|
206
206
|
rubyforge_project:
|
207
207
|
rubygems_version: 1.8.25
|