henv 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cae6ffcf982ed91f90c349e943ba34bbc63f8089
4
+ data.tar.gz: 1a3a36c1b2b4eb6c31bb7e8f9345fd1c1de14538
5
+ SHA512:
6
+ metadata.gz: d116808b2ce32e08af82d8259659a5ea821430d7bbe22c2a6e91786ddeae8426c7e7843b0bed439e885c4a77f7f296e49039758ecd907d3373544a3ab22f79ac
7
+ data.tar.gz: aa20f6a9674edf0b9d9f1820e8e4bd901205f07b8b630ed183e727bc1d04c03abb06840fbc4671bfa4fcf3920ae387b6c15fbbf126b0a40c94eaca7429642d1d
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /*.gem
11
+
12
+ # rspec failure tracking
13
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.15.4
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in henv.gemspec
6
+ gemspec
@@ -0,0 +1,34 @@
1
+ # Henv
2
+
3
+ Henv lets you easily set local environment variables to the values from a heroku app.
4
+
5
+ ## Installation
6
+ ```bash
7
+ gem install henv
8
+ ```
9
+
10
+
11
+ ## Usage
12
+
13
+ You can either export environment variables in your current shell, or you can run a subprocess using environment variables.
14
+
15
+ ```bash
16
+ # Export variables
17
+ eval `henv export my-heroku-app `
18
+
19
+ # Then use them right in your shell!
20
+ echo $MY_VAR_FROM_MY_APP
21
+
22
+ # Run a subprocess:
23
+ henv exec my-heroku-app 'echo $MY_VAR_FROM_MY_APP'
24
+ ```
25
+
26
+ ## Development
27
+
28
+ After checking out the repo, run `bundle` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
29
+
30
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
31
+
32
+ ## Contributing
33
+
34
+ Bug reports and pull requests are welcome on GitHub at https://github.com/sheax0r/henv.
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ $: << File.join(File.dirname(__FILE__), "..", "lib")
3
+ require 'henv'
4
+
5
+ Henv::CLI.run(ARGV)
6
+
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "henv/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "henv"
8
+ spec.version = Henv::VERSION
9
+ spec.authors = ["Michael Shea"]
10
+ spec.email = [""]
11
+
12
+ spec.summary = %q{Export env vars from heroku to use locally}
13
+ spec.description = %q{Export env vars from heroku to use locally}
14
+ spec.homepage = "https://github.com/sheax0r/henv"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "bin"
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.15"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec", "~> 3.0"
24
+
25
+ spec.add_dependency "clamp"
26
+ end
@@ -0,0 +1,6 @@
1
+ require "henv/version"
2
+ require "henv/cli"
3
+
4
+ module Henv
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,50 @@
1
+ require "clamp"
2
+ require "json"
3
+ require "shellwords"
4
+
5
+ module Henv
6
+ module Config
7
+ def config
8
+ JSON.parse(config_command_result)
9
+ end
10
+
11
+ def config_command
12
+ "heroku config -a #{app} --json"
13
+ end
14
+
15
+ def config_command_result
16
+ `#{config_command}`.tap do
17
+ fail("Failed to execute command: #{config_command}") unless $?.exitstatus.zero?
18
+ end
19
+ end
20
+ end
21
+
22
+ class ExportCommand < Clamp::Command
23
+ include Config
24
+
25
+ parameter "APP", "app", attribute_name: :app
26
+
27
+ def execute
28
+ config.each do |k,v|
29
+ puts "export #{k}=$'#{v.gsub("'", "\\\\'").gsub("\n", "\\n")}'"
30
+ end
31
+ end
32
+ end
33
+
34
+ class ExecCommand < Clamp::Command
35
+ include Config
36
+
37
+ parameter "APP", "app", attriubte_name: :app
38
+ parameter "COMMAND ...", "command", attribute_name: :command
39
+
40
+ def execute
41
+ exec(config, command.join(" "))
42
+ end
43
+ end
44
+
45
+ class CLI < Clamp::Command
46
+ subcommand "export", "Print EXPORT commands. Useful with eval.", ExportCommand
47
+ subcommand "exec", "Execute a subcommand.", ExecCommand
48
+ end
49
+
50
+ end
@@ -0,0 +1,3 @@
1
+ module Henv
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: henv
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Michael Shea
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-11-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.15'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.15'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: clamp
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Export env vars from heroku to use locally
70
+ email:
71
+ - ''
72
+ executables:
73
+ - henv
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - ".travis.yml"
80
+ - Gemfile
81
+ - README.md
82
+ - Rakefile
83
+ - bin/henv
84
+ - henv.gemspec
85
+ - lib/henv.rb
86
+ - lib/henv/cli.rb
87
+ - lib/henv/version.rb
88
+ homepage: https://github.com/sheax0r/henv
89
+ licenses: []
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.5.2.1
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: Export env vars from heroku to use locally
111
+ test_files: []