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 CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6d851cad4e70b0410b24c504646fbb3c0d0ef617
4
- data.tar.gz: d4a64a94f46cba08f82b45c076ad3c3f4eaf5220
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MjVhMjNmYmE1NGMyZTg1ZWEwODllZDNkZmZkM2IyZDM4ZmYxZjg3YQ==
5
+ data.tar.gz: !binary |-
6
+ OTZiYjUxM2ExZDMzYWQxODVjOGM3OTU5YTg0M2NlNDdjOWMwZjE5NQ==
5
7
  SHA512:
6
- metadata.gz: 5c852be30422f4dba9635ef72e3d608620919306372e85c5d248b424e0f868cabe9f5dd37cbf09544d0ceb0a713dfbbe4c5016b8d7726542f26f7691cc15e14f
7
- data.tar.gz: b75ce68e6657146b31663731d891c5354354e48bf56d4cf4e8c7007bc686627f245d0f1576f59aa4b971c7d6c82ba82ee0454c158ece0902466cb6440b01776c
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
- @options = Slop.parse(strict: true) do
10
- banner 'Usage: bog PROFILE [COMMAND] [options]'
11
- on 'h', 'help', 'Display this message'
12
- on 'a', 'aws', 'When passed to the \'init\' subcommand, prompt for AWS credentials'
13
- on 'c', 'chef', 'When passed to the \'init\' subcommand, prompt for Chef credentials'
14
- end
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
- puts @options
18
- exit 0
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
@@ -1,4 +1,5 @@
1
1
  require 'bog/command/init'
2
+ require 'bog/command/exec'
2
3
 
3
4
  module Bog
4
5
  class Command
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Bog
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
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.5
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-07-31 00:00:00.000000000 Z
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: []