exportr 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,16 +1,14 @@
1
- # Exportr: Environment manager for Rails development
1
+ # Exportr: An environment manager for Rails development
2
2
 
3
3
  ## Description
4
4
 
5
- Managing environment variables locally is kind of a drag. If you only build one application at a time, you *could* simply export environment variables in your .bashrc.
6
- But in reality you're working on 5 apps, each requiring different settings for Facebook, Google, AmazonS3, etc.
5
+ Managing environment variables locally is kind of a drag. If you only build one application at a time, you *could* simply export environment variables in your .bashrc. But in reality you're working on 5 apps at a time, each requiring different settings for Facebook, Google, AmazonS3, etc.
7
6
 
8
- You probably set environment variables on your production servers to store configuration options for these services. But you probably also hard code
9
- 'default' options to default to on your local machine. Hardcoding default configuation options, especially private keys for third party apis is an insane security risk.
7
+ You probably set environment variables on your production servers to store configuration options for these services. Yet you might also hard code 'default' options to fall back to on your local machine. Hardcoding default configuation options, especially private keys and passwords for third party apis is an *insane* security risk.
10
8
 
11
- Problem solved.
9
+ **Problem solved**.
12
10
 
13
- Exportr helps you manage local environment variables. Each set is scoped to a specific rails application in a local yaml file. The file is 'git ignored' when created, so it never leaves your machine. Its key:value pairs are loaded as environment variables when your application initializes.
11
+ Exportr helps you manage local environment variables. Each set is scoped to a specific rails application in `config/exportr.yml`. The file is 'git ignored' when created, so it never leaves your machine. Its key:value pairs are loaded as environment variables when your application initializes.
14
12
 
15
13
  ### Setup
16
14
 
@@ -26,12 +24,12 @@ Run the generator.
26
24
 
27
25
  $ rails generate exportr
28
26
 
29
- The generator creates a yaml file in your config directory. It will store key:value pairs to be loaded as environment variables when your app launches. You can edit it manually, or use the command line utility.
27
+ The generator creates a yaml file in your config directory. It will store key:value pairs to be loaded as environment variables when your app launches. You can edit it manually, or use the command line interface.
30
28
 
31
29
  ### CLI
32
30
 
33
31
  There are two simple options for use with the command line tool: **add** and **remove**.
34
- You can use flags longform `--add` or shorhand `-a`.
32
+ You can use flags longform `--add, --remove` or shorhand `-a, -r`.
35
33
 
36
34
  $ exportr --add KEY=VALUE
37
35
  or
@@ -44,4 +42,4 @@ You'll need to restart your webserver for the changes to take effect.
44
42
 
45
43
  ### License
46
44
 
47
- Exportr is copyright 2012 by Richard Calahan and contributors at All Day Everyday. It is licensed under the MIT license. See the include LICENSE file for details.
45
+ Exportr © 2012 by Richard Calahan and contributors at [All Day Everyday](http://alldayeveryday.com). It is licensed under the MIT license. See the include LICENSE file for details.
@@ -20,6 +20,7 @@ module Exportr
20
20
 
21
21
  global_option :add, '-a', '--add VAR', 'Add environment variable'
22
22
  global_option :remove, '-r', '--remove VAR', 'Remove environment variable'
23
+ global_option :clear, '-c', '--clear', 'Clear out all environment variables'
23
24
 
24
25
  def self.run *argv
25
26
  error NOT_ROOT unless at_root?
@@ -27,13 +28,20 @@ module Exportr
27
28
  end
28
29
 
29
30
  def self.add val
31
+ log "Adding #{val.to_a[0][0]}=#{val.to_a[0][1]} to your environment..."
30
32
  write_config load_config.merge(val)
31
33
  end
32
34
 
33
35
  def self.remove val
36
+ log "Removing #{val.to_a[0][0]} from your environment..."
34
37
  write_config load_config.reject { |k,v| k == val.to_a[0][0] }
35
38
  end
36
39
 
40
+ def self.clear val
41
+ log "Clearing environment variables..."
42
+ write_config Hash.new
43
+ end
44
+
37
45
  def self.parser
38
46
  OptionParser.new do |parser|
39
47
  global_options.each do |opt|
@@ -53,7 +61,8 @@ module Exportr
53
61
  cm = comments
54
62
  File.open CONFIG_FILE, 'w+' do |f|
55
63
  f.write cm << "\n" << dump_config(vars)
56
- end
64
+ end
65
+ log "Done."
57
66
  end
58
67
 
59
68
  def self.load_config
@@ -69,7 +78,7 @@ module Exportr
69
78
  end
70
79
 
71
80
  def self.hashify str
72
- arr = str.split '='
81
+ arr = str.split('=') rescue []
73
82
  hash = Hash.new
74
83
  hash[arr[0]] = arr[1]
75
84
  hash
@@ -3,11 +3,11 @@ module Exportr
3
3
  module Helpers
4
4
 
5
5
  def log msg
6
- STDOUT.puts msg
6
+ STDOUT.puts " | #{msg}"
7
7
  end
8
8
 
9
9
  def error msg
10
- STDERR.puts "ERROR: #{msg}"
10
+ STDERR.puts "| ERROR: #{msg}"
11
11
  exit 1
12
12
  end
13
13
 
@@ -1,3 +1,3 @@
1
1
  module Exportr
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exportr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: