redis_vars 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -26,9 +26,9 @@ You can override the key used with an enviroment variable if you want to manage
26
26
 
27
27
  ## Developing
28
28
 
29
- There are two different ways I envision this being used, non-invasive and invasive. Let's start with non-invasive:
29
+ There are a few different ways I envision this being used: in configuation, on execution, and in code. Let's start with configuration:
30
30
 
31
- ### Non-invasive
31
+ ### Configuration
32
32
 
33
33
  This allows you to export a list of the variables you have stored to a file you use in development. There seems to be the two different formats used places, with and without requiring export. The list command is for without export, and export includes the export. Here are examples if that makes now sense:
34
34
 
@@ -44,9 +44,23 @@ Pow:
44
44
 
45
45
  redis_vars export > .powenv
46
46
 
47
- ### Invasive
47
+ ### On Execution
48
48
 
49
- You can have it load in the environment variables automatically on application start with this method.
49
+ As of version 0.7.0 there is an execute command to run a command with the environment variables you have in the store.
50
+
51
+ Here is an example:
52
+
53
+ redis_vars execute unicorn_rails
54
+
55
+ If you had a single variable store of DEFAULT_USER with a value of daniel then it should execute the following:
56
+
57
+ DEFAULT_USER=daniel unicorn_rails
58
+
59
+ I envision this being useful for running command line programs or even executing services.
60
+
61
+ ### In Code
62
+
63
+ You can have it load in the environment variables automatically in a ruby/rails application with this method.
50
64
 
51
65
  Gemfile:
52
66
 
@@ -25,6 +25,11 @@ module RedisVars
25
25
  puts store.export
26
26
  end
27
27
 
28
+ desc "execute", "List variables to run a command with them"
29
+ def execute(*commands)
30
+ exec "/bin/sh -c '#{store.execute} #{commands.join(' ')}'"
31
+ end
32
+
28
33
  desc "version", "Displays gem version"
29
34
  def version
30
35
  puts VERSION
@@ -24,6 +24,10 @@ module RedisVars
24
24
  map {|key, val| "export #{key.upcase}=#{val}"}.join("\n")
25
25
  end
26
26
 
27
+ def execute
28
+ map {|key, val| "#{key.upcase}=#{val}"}.join(" ")
29
+ end
30
+
27
31
  private
28
32
 
29
33
  def map(&block)
@@ -1,3 +1,3 @@
1
1
  module RedisVars
2
- VERSION = "0.6.1"
2
+ VERSION = "0.7.0"
3
3
  end
data/man/redis_vars.1 CHANGED
@@ -18,6 +18,9 @@
18
18
  .br
19
19
  \fBredis_vars export\fR
20
20
  .
21
+ .br
22
+ \fBredis_vars execute <command>\fR
23
+ .
21
24
  .SH "DESCRIPTION"
22
25
  RedisVars is a way to manage environment variables for a development team\.
23
26
  .
@@ -39,5 +42,8 @@ It requires passing in a key\.
39
42
  .P
40
43
  \fBredis_vars export\fR gives you a list of the variables in a format that will work for a shell or a Pow \.powenv file\.
41
44
  .
45
+ .SH "EXECUTING"
46
+ \fBredis_vars execute\fR is used to execute a command with the environment variables in the store\.
47
+ .
42
48
  .SH "COPYRIGHT"
43
49
  RedisVars is Copyright (C) 2012 Daniel Farrellr \fIhttp://danielfarrell\.com\fR
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis_vars
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-24 00:00:00.000000000 Z
12
+ date: 2012-12-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor