proviso 0.1.0 → 0.2.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/proviso/commands/config.rb +49 -0
- data/lib/proviso/helpers.rb +8 -0
- data/proviso.gemspec +4 -3
- data/spec/fixtures/proviso.yml +1 -1
- metadata +11 -7
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0.beta1
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Proviso::Command
|
4
|
+
class Config < Base
|
5
|
+
|
6
|
+
def list
|
7
|
+
display "List Config"
|
8
|
+
if File.exists?(yaml_file)
|
9
|
+
display open(yaml_file, 'r').read
|
10
|
+
else
|
11
|
+
error "config does not exists run config:create"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def add
|
16
|
+
if @args.length == 3
|
17
|
+
modify_config_file
|
18
|
+
display "successfully added config setting"
|
19
|
+
else
|
20
|
+
error "section, key and value pair required. eg. config:add [section] [key] [value]"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def update
|
25
|
+
if @args.length == 3
|
26
|
+
modify_config_file
|
27
|
+
display "successfully updated config setting"
|
28
|
+
else
|
29
|
+
error "section, key and value pair required. eg. config:update [section] [key] [value]"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def create
|
34
|
+
data = { "config" => { "hello" => 'world'}}
|
35
|
+
FileUtils.mkdir_p(File.join(home_directory, PROVISO_PATH))
|
36
|
+
open(yaml_file, 'w') { |f| f.write data.to_yaml }
|
37
|
+
display "created config file"
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def modify_config_file
|
43
|
+
config_hash = YAML.load_file(yaml_file)
|
44
|
+
config_hash.merge!({@args[0] => { @args[1] => @args[2] }})
|
45
|
+
open(yaml_file, 'w') { |f| f.write config_hash.to_yaml }
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
data/lib/proviso/helpers.rb
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
module Proviso
|
4
4
|
module Helpers
|
5
|
+
PROVISO_PATH = '.proviso'
|
6
|
+
CONFIG_FILE = 'proviso.yml'
|
7
|
+
|
5
8
|
def home_directory
|
6
9
|
running_on_windows? ? ENV['USERPROFILE'] : ENV['HOME']
|
7
10
|
end
|
@@ -13,6 +16,11 @@ module Proviso
|
|
13
16
|
def running_on_a_mac?
|
14
17
|
RUBY_PLATFORM =~ /-darwin\d/
|
15
18
|
end
|
19
|
+
|
20
|
+
def yaml_file
|
21
|
+
File.join(home_directory, PROVISO_PATH, CONFIG_FILE)
|
22
|
+
end
|
23
|
+
|
16
24
|
end
|
17
25
|
end
|
18
26
|
|
data/proviso.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{proviso}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0.beta1"
|
9
9
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tom Wilson"]
|
12
|
-
s.date = %q{2010-08-
|
12
|
+
s.date = %q{2010-08-16}
|
13
13
|
s.default_executable = %q{proviso}
|
14
14
|
s.description = %q{Proviso is a cli plugin system that focuses on provisioning servers, but you can create plugins for anything.}
|
15
15
|
s.email = %q{tom@jackhq.com}
|
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
"lib/proviso.rb",
|
28
28
|
"lib/proviso/command.rb",
|
29
29
|
"lib/proviso/commands/base.rb",
|
30
|
+
"lib/proviso/commands/config.rb",
|
30
31
|
"lib/proviso/commands/hello.rb",
|
31
32
|
"lib/proviso/commands/plugins.rb",
|
32
33
|
"lib/proviso/helpers.rb",
|
data/spec/fixtures/proviso.yml
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proviso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
4
|
+
prerelease: true
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 2
|
8
8
|
- 0
|
9
|
-
|
9
|
+
- beta1
|
10
|
+
version: 0.2.0.beta1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Tom Wilson
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-16 00:00:00 -04:00
|
18
19
|
default_executable: proviso
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
@@ -50,6 +51,7 @@ files:
|
|
50
51
|
- lib/proviso.rb
|
51
52
|
- lib/proviso/command.rb
|
52
53
|
- lib/proviso/commands/base.rb
|
54
|
+
- lib/proviso/commands/config.rb
|
53
55
|
- lib/proviso/commands/hello.rb
|
54
56
|
- lib/proviso/commands/plugins.rb
|
55
57
|
- lib/proviso/helpers.rb
|
@@ -83,11 +85,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
83
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
86
|
none: false
|
85
87
|
requirements:
|
86
|
-
- - "
|
88
|
+
- - ">"
|
87
89
|
- !ruby/object:Gem::Version
|
88
90
|
segments:
|
89
|
-
-
|
90
|
-
|
91
|
+
- 1
|
92
|
+
- 3
|
93
|
+
- 1
|
94
|
+
version: 1.3.1
|
91
95
|
requirements: []
|
92
96
|
|
93
97
|
rubyforge_project:
|