orchparty-env 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: af6e5b138fb0b6b458989b47ef35525231abca76
4
+ data.tar.gz: 10e0d6405e0e464493aa66d5623d9511b1510c34
5
+ SHA512:
6
+ metadata.gz: 8cf13c10a8d4213ab1122a364b9c9e140ea61cab18579ac37bd66ee4fac576f2deda84520f88ef326bc8e218d6089aa3ad4488578a29c2ec3f27f4c85c8e8eb3
7
+ data.tar.gz: 9a1c79d0b2928a3d9ca6946d2b0f6dfdb6eba37a0a175b126fbd41005d10358e5ee19bebfe529904cb4b2c9a9d837bc6d93a535a3eab821f91cca469950a81d8
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.14.4
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in orchparty-env.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # Orchparty::Env
2
+
3
+ [![Build Status](https://travis-ci.org/jannishuebl/orchparty-env.svg?branch=master)](https://travis-ci.org/jannishuebl/orchparty-env)
4
+ [![Gem Version](https://badge.fury.io/rb/orchparty-env.svg)](https://badge.fury.io/rb/orchparty-env)
5
+
6
+ This is a [Orchparty](https://orch.party/) plugin to extract
7
+ environment variables of a orchparty file.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'orchparty-env'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install orchparty-env
24
+
25
+ ## Usage
26
+
27
+ Run orchparty with the env generator:
28
+
29
+ ```bash
30
+ orchparty generate env -f stack.rb -a application-name
31
+ ```
32
+
33
+ For more information run:
34
+
35
+ ```bash
36
+ orchparty generate env --help
37
+
38
+ ```
39
+
40
+ For exec a command with the environment variables you can run:
41
+
42
+ ```bash
43
+ export `orchparty generate env -f input.rb -a application-name`; bash -c "echo $EXAMPLE_VARIABLE"
44
+ ```
45
+
46
+ ## Development
47
+
48
+ After checking out the repo, run `bin/setup` 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.
49
+
50
+ 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).
51
+
52
+ ## Contributing
53
+
54
+ Bug reports and pull requests are welcome on GitHub at
55
+ https://github.com/jannishuebl/orchparty-env.
56
+
data/Rakefile ADDED
@@ -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
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "orchparty/env"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,41 @@
1
+ require 'shellwords'
2
+ module Orchparty
3
+ module Plugin
4
+ module Env
5
+ def self.desc
6
+ "generate environment variables"
7
+ end
8
+
9
+ def self.define_flags(c)
10
+ c.flag [:output,:o], :desc => 'Set the output file'
11
+ c.flag [:service,:s], :desc => 'Set the service to generate environment variables from.'
12
+ c.flag [:seperator,:sep], :desc => 'How to join the environment variables', default_value: "\\n"
13
+ end
14
+
15
+ def self.generate(ast, options)
16
+ output = env_output(ast, options)
17
+ if options[:output]
18
+ File.write(options[:output], output)
19
+ else
20
+ puts output
21
+ end
22
+ end
23
+
24
+ def self.env_output(application, options)
25
+ if options[:service]
26
+ services = [ application.services[options[:service]] ]
27
+ else
28
+ services = application.services.values
29
+ end
30
+
31
+ options[:sep] = "\n" if options[:sep] == "\\n"
32
+
33
+ envs = services.map(&:environment).compact.inject({}) {|a, v| a.merge(v) }
34
+ envs.map{|k,v| "#{k.to_s}=#{v.is_a?(String) ? v.shellescape : v }"}.join(options[:sep])
35
+ end
36
+
37
+ end
38
+ end
39
+ end
40
+
41
+ Orchparty::Plugin.register_plugin(:env, Orchparty::Plugin::Env)
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ #require 'orchparty/env/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "orchparty-env"
8
+ spec.version = "0.1.0"
9
+ spec.authors = ["Jannis Hübl"]
10
+ spec.email = ["jannis.huebl@gmail.com"]
11
+
12
+ spec.summary = %q{"Add a environment variable generator to orchparty"}
13
+ spec.description = %q{"Add a environment variable generator to orchparty"}
14
+ spec.homepage = "https://github.com/jannishuebl/orchparty-env"
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+ #if spec.respond_to?(:metadata)
19
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
20
+ #else
21
+ # raise "RubyGems 2.0 or newer is required to protect against " \
22
+ # "public gem pushes."
23
+ #end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
26
+ f.match(%r{^(test|spec|features)/})
27
+ end
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+
32
+ spec.add_development_dependency "bundler", "~> 1.14"
33
+ spec.add_development_dependency "rake", "~> 10.0"
34
+ spec.add_development_dependency "rspec", "~> 3.0"
35
+ spec.add_development_dependency "orchparty", "~> 1.2.2"
36
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: orchparty-env
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jannis Hübl
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-11-22 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.14'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.14'
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: orchparty
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.2.2
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.2.2
69
+ description: '"Add a environment variable generator to orchparty"'
70
+ email:
71
+ - jannis.huebl@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
79
+ - Gemfile
80
+ - README.md
81
+ - Rakefile
82
+ - bin/console
83
+ - bin/setup
84
+ - lib/orchparty/plugins/env.rb
85
+ - orchparty-env.gemspec
86
+ homepage: https://github.com/jannishuebl/orchparty-env
87
+ licenses: []
88
+ metadata: {}
89
+ post_install_message:
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubyforge_project:
105
+ rubygems_version: 2.5.1
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: '"Add a environment variable generator to orchparty"'
109
+ test_files: []