exportr 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,10 +24,11 @@ module Exportr
24
24
  global_option :clear, '-c', '--clear', 'Clear out all environment variables'
25
25
  global_option :list, '-l', '--list', 'List all environment variables'
26
26
  global_option :version, '-v', '--version', 'Get exportr version number'
27
+ global_option :help, '-h', '--help', 'Print this message'
27
28
 
28
29
  def self.run *argv
29
30
  error NOT_RAILS unless in_rails_application?
30
- parser.parse! argv
31
+ argv.any? ? parser.parse!(argv) : help
31
32
  end
32
33
 
33
34
  def self.add val
@@ -42,13 +43,13 @@ module Exportr
42
43
  write_config load_config.reject { |k,v| k == val.to_a[0][0] }
43
44
  end
44
45
 
45
- def self.clear val=nil
46
+ def self.clear
46
47
  log
47
48
  log "Clearing environment variables..."
48
49
  write_config Hash.new
49
50
  end
50
51
 
51
- def self.list val=nil
52
+ def self.list
52
53
  log
53
54
  log "Exportr Environment Variables"
54
55
  log "--------------------------------------------------"
@@ -58,16 +59,26 @@ module Exportr
58
59
  log
59
60
  end
60
61
 
61
- def self.version val=nil
62
+ def self.version
62
63
  log
63
64
  log "Version #{Exportr::VERSION}"
64
65
  log
65
66
  end
66
67
 
68
+ def self.help
69
+ STDOUT.puts
70
+ STDOUT.puts parser.help
71
+ STDOUT.puts
72
+ end
73
+
67
74
  def self.parser
68
75
  OptionParser.new do |parser|
76
+ parser.banner = "Usage:\n exportr [options]"
77
+ parser.separator "\nOptions: "
69
78
  global_options.each do |opt|
70
- parser.on *opt[:args] { |val| send opt[:name], hashify(val) }
79
+ parser.on *opt[:args] do |val|
80
+ send(opt[:name], hashify(val)) rescue send opt[:name]
81
+ end
71
82
  end
72
83
  end
73
84
  end
@@ -1,3 +1,3 @@
1
1
  module Exportr
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
data/lib/exportr.rb CHANGED
@@ -2,4 +2,3 @@ require 'exportr/version'
2
2
  require 'exportr/railtie'
3
3
 
4
4
  module Exportr; end
5
-
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.2.4
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: