bs 0.0.1

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: b6ce7d6f7672ce1fbb2519ce124b8652048dca26
4
+ data.tar.gz: fcf836f3151bf5b75df8a262f110975e0856147b
5
+ SHA512:
6
+ metadata.gz: 4297267ac50d5a1da1e9b91a0e553ab91525d5c54b64ee3e3da652b5c8403e73e5017c95913224c1e6042987bbbc627dff5dd85407fc5dd4fe720dfd296e3317
7
+ data.tar.gz: 06e95be9f60ca4902c63d3d45874fcfe6f53a0a70f4dbddaa2942cdd7dace08cbc8edc0e456db4bc26e5a8762824c8089cc5fef7bb0fc27afca85b9921c88e06
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bs.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 cj
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,106 @@
1
+ bs
2
+ ==
3
+
4
+ An environment manager for your shell.
5
+
6
+ Usage
7
+ -----
8
+
9
+ Place a `.env` file in your project with the environment variables you need.
10
+
11
+ For instance:
12
+
13
+ $ cat .env
14
+ RACK_ENV=development
15
+ REDIS_URL=redis://127.0.0.1:6380
16
+
17
+ Then:
18
+
19
+ $ bs rackup -p 8080
20
+
21
+ This will run `rackup` with your environment variables set.
22
+
23
+ If you want to drop to a new shell to work for a little while, just:
24
+
25
+ $ bs
26
+
27
+ To restore the old environment, simply `Ctrl-D` and go back to the parent
28
+ shell.
29
+
30
+ Sometimes you'll want to modify the environment of your current shell without
31
+ creating a new one (for instance, if your init scripts modify the environment
32
+ and overwrite what `bs` is setting for you). That's easy to do:
33
+
34
+ $ source bs
35
+
36
+ Or the more cryptic:
37
+
38
+ $ . bs
39
+
40
+ Motivation
41
+ ----------
42
+
43
+ We are long-time users of [`gs`][gs]. This small tool allows you to start a
44
+ shell (or run a command) within a specific gem set. And it does it beautifully
45
+ simply: by only setting a few environment variables which RubyGems will
46
+ honor. That's it.
47
+
48
+ Then there's [Foreman]. We use it to read our [Procfile] and start our
49
+ services. But it also has the feature of loading a `.env` file and setting
50
+ environment variables before spawning your processes.
51
+
52
+ Now Foreman is a gem, so it should be installed inside the application's gem
53
+ set. So, what if you need to run `irb` inside a bare shell?
54
+
55
+ $ gs foreman run irb
56
+
57
+ We realized we could replace `gs` by setting the appropriate variables in our
58
+ `.env` file:
59
+
60
+ GEM_HOME=$(pwd)/.gs
61
+ GEM_PATH=$(pwd)/.gs:$(gem env path)
62
+ PATH=$(pwd)/.gs/bin:$PATH
63
+
64
+ Now we had everything in our `.env` file and `foreman start` would pick it
65
+ up. But there are a few problems:
66
+
67
+ 1. We don't use Foreman in production (at least not yet), so our deploy scripts
68
+ needed a simple way to also read `.env` without needing the whole of Foreman.
69
+
70
+ 2. Foreman itself is a gem, so you would need to install it in your global gem
71
+ set.
72
+
73
+ 3. Some people don't use Foreman at all.
74
+
75
+ We needed something simple, probably pure-shell, to read `.env` and either run
76
+ a given command or drop to a new shell with the variables set (similar to how
77
+ `bash` or `sh` behave).
78
+
79
+ Installation
80
+ ------------
81
+
82
+ Place `bin/bs` somewhere in your `$PATH`.
83
+
84
+ With Homebrew:
85
+
86
+ $ brew tap educabilia/tooling
87
+ $ brew install bs
88
+
89
+ Support
90
+ -------
91
+
92
+ All of the features are tested on Bash and Zsh. We'll happily take patches
93
+ to make `bs` POSIX-compliant.
94
+
95
+ Acknowledgements
96
+ ----------------
97
+
98
+ * [gs]
99
+ * [Foreman]
100
+ * [gst]
101
+
102
+
103
+ [gs]: https://github.com/soveran/gs
104
+ [Foreman]: http://ddollar.github.io/foreman
105
+ [Procfile]: http://ddollar.github.io/foreman/#PROCFILE
106
+ [gst]: https://github.com/tonchis/gst
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/bs ADDED
@@ -0,0 +1,13 @@
1
+ #!/bin/bash
2
+
3
+ if [[ -f .env ]]; then
4
+ eval "$(awk '{ print "export " $0}' .env)"
5
+
6
+ if [[ $# -gt 0 ]]; then
7
+ "$@"
8
+ elif [[ -z $PS2 ]]; then
9
+ $SHELL
10
+ fi
11
+ else
12
+ echo "No .env file found. Aborting." >&2
13
+ fi
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bs/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bs"
8
+ spec.version = BS::VERSION
9
+ spec.authors = ["cj"]
10
+ spec.email = ["cjlazell@gmail.com"]
11
+ spec.summary = %q{An environment manager for your shell.}
12
+ spec.description = %q{An environment manager for your shell.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ end
@@ -0,0 +1,5 @@
1
+ require "bs/version"
2
+
3
+ module BS
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,3 @@
1
+ module BS
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bs
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - cj
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-09 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.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: An environment manager for your shell.
42
+ email:
43
+ - cjlazell@gmail.com
44
+ executables:
45
+ - bs
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - .gitignore
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - bin/bs
55
+ - bs.gemspec
56
+ - lib/bs.rb
57
+ - lib/bs/version.rb
58
+ homepage: ''
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.0.14
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: An environment manager for your shell.
82
+ test_files: []
83
+ has_rdoc: