bog 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/README.md +8 -0
- data/bin/bog +13 -9
- data/lib/bog/command.rb +1 -0
- data/lib/bog/command/exec.rb +19 -0
- data/lib/bog/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MjVhMjNmYmE1NGMyZTg1ZWEwODllZDNkZmZkM2IyZDM4ZmYxZjg3YQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
OTZiYjUxM2ExZDMzYWQxODVjOGM3OTU5YTg0M2NlNDdjOWMwZjE5NQ==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
Mjc2Mzc1MjM4ZDI3NjNkMDc4MWYxNzg0M2MxYmQ2NmU2ODc0OWQzZjZhODhh
|
10
|
+
NjEwZjY5OTJkYmI2MWY2MzI4YjExMzhiYTdlZmU3M2QyMjJhMmJiYzJkNDNj
|
11
|
+
OTY0MGJkMDMzZTI4NmZmNGVkYjZlZTA4YzMzNmZiYzhlN2FhODY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YzcxZDdlNmJmNzAzNDRiMDc2Y2I4MTNjOTc5NmRiYmEzZmU5NDViMWNiYzJl
|
14
|
+
MGZmYjU2NzM4ODEzYzBiZmUwZDQxNWNiMzlhNjZiMmRhYzhlOWQ2N2FhMDBk
|
15
|
+
MzQ4ZWI2MjJmZjM0MDYyOTQ4NjY2YzhmZmM1ZDcyNzdlOTc2MTg=
|
data/README.md
CHANGED
@@ -23,6 +23,14 @@ $ aws s3 ls
|
|
23
23
|
$ bog personal # Switch to another profile
|
24
24
|
...
|
25
25
|
```
|
26
|
+
|
27
|
+
### One-off commands
|
28
|
+
```bash
|
29
|
+
$ bog myclient exec aws s3 ls # Exec command as myclient, then
|
30
|
+
$ bog myclient exec knife client list # switch back to previous profile
|
31
|
+
...
|
32
|
+
```
|
33
|
+
|
26
34
|
## How it works
|
27
35
|
`bog init myclient --aws --chef` will create
|
28
36
|
|
data/bin/bog
CHANGED
@@ -6,16 +6,20 @@ require 'slop'
|
|
6
6
|
profile = ARGV[0].downcase
|
7
7
|
command = ARGV[1].downcase if ARGV[1]
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
unless command == 'exec'
|
10
|
+
@options = Slop.parse(strict: true) do
|
11
|
+
banner 'Usage: bog PROFILE [COMMAND] [options]'
|
12
|
+
on 'h', 'help', 'Display this message'
|
13
|
+
on 'a', 'aws', 'When passed to the \'init\' subcommand, prompt for AWS credentials'
|
14
|
+
on 'c', 'chef', 'When passed to the \'init\' subcommand, prompt for Chef credentials'
|
15
|
+
end
|
15
16
|
|
16
|
-
if @options.help?
|
17
|
-
|
18
|
-
|
17
|
+
if @options.help?
|
18
|
+
puts @options
|
19
|
+
exit 0
|
20
|
+
end
|
21
|
+
else
|
22
|
+
@options = { :commands => ARGV[2..-1].join(' ') }
|
19
23
|
end
|
20
24
|
|
21
25
|
if command
|
data/lib/bog/command.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Bog
|
2
|
+
class Command
|
3
|
+
class Exec
|
4
|
+
def self.execute(profile, options)
|
5
|
+
old_profile = get_current_profile
|
6
|
+
Bog::Profile.switch_to(profile.profile_name)
|
7
|
+
system("#{options[:commands]} 2>&1")
|
8
|
+
Bog::Profile.switch_to(old_profile.profile_name)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def self.get_current_profile
|
14
|
+
Bog::Profile.find(File.basename(File.readlink(File.expand_path('~/.bog/current'))))
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/bog/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sam
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- bog.gemspec
|
87
87
|
- lib/bog.rb
|
88
88
|
- lib/bog/command.rb
|
89
|
+
- lib/bog/command/exec.rb
|
89
90
|
- lib/bog/command/init.rb
|
90
91
|
- lib/bog/initializer.rb
|
91
92
|
- lib/bog/initializer/aws.rb
|
@@ -105,12 +106,12 @@ require_paths:
|
|
105
106
|
- lib
|
106
107
|
required_ruby_version: !ruby/object:Gem::Requirement
|
107
108
|
requirements:
|
108
|
-
- - '>='
|
109
|
+
- - ! '>='
|
109
110
|
- !ruby/object:Gem::Version
|
110
111
|
version: '0'
|
111
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
113
|
requirements:
|
113
|
-
- - '>='
|
114
|
+
- - ! '>='
|
114
115
|
- !ruby/object:Gem::Version
|
115
116
|
version: '0'
|
116
117
|
requirements: []
|