with_clean_rbenv 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: 28d32d4522bf99952d1b5831b25540bd28cdea2f
4
+ data.tar.gz: 6d8594589b9be6fc12954bd386ba157a77dc03d1
5
+ SHA512:
6
+ metadata.gz: a46e127f0465afc1b1f1c377c28578e1877314106f8b05efa1f3725c2f5a4d7e4e006afb3d255328191b5e82215520a3ba0acab12e22eb61a72bf271e11659de
7
+ data.tar.gz: 640e583d422935a6a312fead3a12533ae6726d4bea29d1eff750c5a395e87bf1747888a09006ac7f5eba0212b4a97a5338a26361fcada346c3673a1e118497e7
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,12 @@
1
+ AllCops:
2
+ Include:
3
+ - Rakefile
4
+ Exclude:
5
+ - .*/**/*
6
+ - vendor/**/*
7
+
8
+ Style/Documentation:
9
+ Enabled: false
10
+
11
+ Style/TrivialAccessors:
12
+ Enabled: false
@@ -0,0 +1,10 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 2.1
5
+ - 2.2
6
+
7
+ script:
8
+ - bundle install
9
+ - bundle exec rubocop
10
+ - bundle exec rake spec
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in with_clean_rbenv.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Takumi IINO
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,79 @@
1
+ # WithCleanRbenv
2
+
3
+ Prepare a bare-enviroment for nested rbenv.
4
+
5
+ This gem is based on this article.
6
+
7
+ * [rbenv のメカニズム - @kyanny's blog](http://blog.kyanny.me/entry/2013/05/10/rbenv_%E3%81%AE%E3%83%A1%E3%82%AB%E3%83%8B%E3%82%BA%E3%83%A0)
8
+
9
+ [![Build Status](https://travis-ci.org/troter/with_clean_rbenv.svg?branch=master)](https://travis-ci.org/troter/with_clean_rbenv)
10
+ [![Coverage Status](https://coveralls.io/repos/troter/with_clean_rbenv/badge.svg)](https://coveralls.io/r/troter/with_clean_rbenv)
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'with_clean_rbenv'
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install with_clean_rbenv
27
+
28
+ ## Usage
29
+
30
+ ```ruby
31
+ require 'with_clean_rbenv'
32
+
33
+ WithCleanRbenv.with_clean_rbenv do
34
+ Dir.chdir '/path/to/other/ruby/project' do
35
+ system('rbenv exec bundle exec ruby -v')
36
+ end
37
+ end
38
+
39
+ # or short
40
+ WithCleanRbenv.within_clean_rbenv '/path/to/other/ruby/project' do
41
+ system('rbenv exec bundle exec ruby -v')
42
+ end
43
+
44
+ ```
45
+
46
+ If you need to set custom environment variables:
47
+
48
+ ```ruby
49
+ context = WithCleanRbenv::Context.new('GEM_HOME' => nil)
50
+
51
+ context.with_clean_rbenv do
52
+ system('rbenv exec bundle exec ruby -v')
53
+ end
54
+ ```
55
+
56
+ If you want to replace default context:
57
+
58
+ ```ruby
59
+ # Replace default context.
60
+ WithCleanRbenv.current = WithCleanRbenv::Context.new('GEM_HOME' => nil)
61
+
62
+ WithCleanRbenv.with_clean_rbenv do
63
+ system('rbenv exec bundle exec ruby -v')
64
+ end
65
+ ```
66
+
67
+ ## Development
68
+
69
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
70
+
71
+ 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` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
72
+
73
+ ## Contributing
74
+
75
+ 1. Fork it ( https://github.com/troter/with_clean_rbenv/fork )
76
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
77
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
78
+ 4. Push to the branch (`git push origin my-new-feature`)
79
+ 5. Create a new Pull Request
@@ -0,0 +1,5 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new('spec')
5
+ task :default, [] => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'with_clean_rbenv'
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
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,24 @@
1
+ require 'with_clean_rbenv/version'
2
+ require 'with_clean_rbenv/context'
3
+
4
+ module WithCleanRbenv
5
+ class << self
6
+ def current=(context)
7
+ Context.current = context
8
+ end
9
+
10
+ def current
11
+ Context.current
12
+ end
13
+ end
14
+
15
+ def with_clean_rbenv(*args, &block)
16
+ Context.current.with_clean_rbenv(*args, &block)
17
+ end
18
+
19
+ def within_clean_rbenv(*args, &block)
20
+ Context.current.within_clean_rbenv(*args, &block)
21
+ end
22
+
23
+ module_function :with_clean_rbenv, :within_clean_rbenv
24
+ end
@@ -0,0 +1,51 @@
1
+ module WithCleanRbenv
2
+ class Context
3
+ class << self
4
+ def current
5
+ @current ||= Context.new
6
+ end
7
+
8
+ def current=(context)
9
+ @current = context
10
+ end
11
+ end
12
+
13
+ def initialize(env = {})
14
+ @env = default_clean_env.merge(env)
15
+ end
16
+
17
+ def default_clean_env
18
+ { 'RBENV_VERSION' => nil, 'RBENV_DIR' => nil }
19
+ end
20
+
21
+ def with_env(env, &_block)
22
+ original_env = ENV.to_hash
23
+ ENV.update(env)
24
+ yield if block_given?
25
+ ensure
26
+ ENV.replace(original_env)
27
+ end
28
+
29
+ def with_clean_bundler_env(&_block)
30
+ if defined?(Bundler)
31
+ Bundler.with_clean_env do
32
+ yield if block_given?
33
+ end
34
+ else
35
+ yield if block_given?
36
+ end
37
+ end
38
+
39
+ def with_clean_rbenv(&block)
40
+ with_clean_bundler_env do
41
+ with_env(@env, &block)
42
+ end
43
+ end
44
+
45
+ def within_clean_rbenv(directory, &block)
46
+ with_clean_rbenv do
47
+ Dir.chdir(directory, &block)
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,3 @@
1
+ module WithCleanRbenv
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'with_clean_rbenv/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'with_clean_rbenv'
8
+ spec.version = WithCleanRbenv::VERSION
9
+ spec.authors = ['Takumi IINO']
10
+ spec.email = ['trot.thunder@gmail.com']
11
+
12
+ spec.summary = %q{Prepare a bare-enviroment for nested rbenv}
13
+ spec.description = %q{Prepare a bare-enviroment for nested rbenv}
14
+ spec.homepage = 'https://github.com/troter/with_clean_rbenv'
15
+ spec.license = 'MIT'
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = 'exe'
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler'
22
+ spec.add_development_dependency 'rake'
23
+
24
+ spec.add_development_dependency 'rspec'
25
+ spec.add_development_dependency 'rubocop'
26
+ spec.add_development_dependency 'coveralls'
27
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: with_clean_rbenv
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Takumi IINO
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-06-04 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: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
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
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: coveralls
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Prepare a bare-enviroment for nested rbenv
84
+ email:
85
+ - trot.thunder@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - ".rubocop.yml"
93
+ - ".travis.yml"
94
+ - CODE_OF_CONDUCT.md
95
+ - Gemfile
96
+ - LICENSE.txt
97
+ - README.md
98
+ - Rakefile
99
+ - bin/console
100
+ - bin/setup
101
+ - lib/with_clean_rbenv.rb
102
+ - lib/with_clean_rbenv/context.rb
103
+ - lib/with_clean_rbenv/version.rb
104
+ - with_clean_rbenv.gemspec
105
+ homepage: https://github.com/troter/with_clean_rbenv
106
+ licenses:
107
+ - MIT
108
+ metadata: {}
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ requirements: []
124
+ rubyforge_project:
125
+ rubygems_version: 2.4.5
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: Prepare a bare-enviroment for nested rbenv
129
+ test_files: []