ruby-llenv 0.0.1
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.
- data/.gitignore +20 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +38 -0
- data/Rakefile +1 -0
- data/bin/llenv +7 -0
- data/declare/node-0.9.3/exec.sh +6 -0
- data/declare/node-0.9.3/install.sh +13 -0
- data/declare/perl-5.16.2/exec.sh +6 -0
- data/declare/perl-5.16.2/install.sh +17 -0
- data/declare/python-2.7.3/exec.sh +6 -0
- data/declare/python-2.7.3/install.sh +24 -0
- data/declare/ruby-1.9.3-p327/exec.sh +5 -0
- data/declare/ruby-1.9.3-p327/install.sh +25 -0
- data/lib/llenv.rb +5 -0
- data/lib/llenv/cli.rb +64 -0
- data/lib/llenv/declare.rb +33 -0
- data/lib/llenv/version.rb +3 -0
- data/ruby-llenv.gemspec +19 -0
- metadata +65 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2012 riywo
|
|
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.
|
data/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# LLenv
|
|
2
|
+
|
|
3
|
+
LL install and exec manager
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
gem 'ruby-llenv'
|
|
10
|
+
|
|
11
|
+
And then execute:
|
|
12
|
+
|
|
13
|
+
$ bundle
|
|
14
|
+
|
|
15
|
+
Or install it yourself as:
|
|
16
|
+
|
|
17
|
+
$ gem install ruby-llenv
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
$ cd your-project
|
|
22
|
+
$ echo ruby-1.9.3-p327 > .llenv
|
|
23
|
+
$ llenv install
|
|
24
|
+
|
|
25
|
+
Install ruby-1.9.3-p327 to ~/.llenv/ruby-1.9.3-p327/, and also `bundle install` required modules to your-project/vendor/bundle. See [install.sh](https://github.com/riywo/ruby-llenv/blob/master/declare/ruby-1.9.3-p327/install.sh).
|
|
26
|
+
|
|
27
|
+
$ cd your-project
|
|
28
|
+
$ llenv exec rackup
|
|
29
|
+
|
|
30
|
+
See [exec.sh](https://github.com/riywo/ruby-llenv/blob/master/declare/ruby-1.9.3-p327/exec.sh).
|
|
31
|
+
|
|
32
|
+
## Contributing
|
|
33
|
+
|
|
34
|
+
1. Fork it
|
|
35
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
36
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
37
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
38
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/llenv
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
if ! [ -f $HOME/perl5/perlbrew/etc/bashrc ]; then
|
|
3
|
+
curl -kL http://install.perlbrew.pl | bash
|
|
4
|
+
fi
|
|
5
|
+
|
|
6
|
+
source $HOME/perl5/perlbrew/etc/bashrc
|
|
7
|
+
|
|
8
|
+
if [ "$PERLBREW_PERL" != "perl-5.16.2" ]; then
|
|
9
|
+
perlbrew install perl-5.16.2 -n -j 2
|
|
10
|
+
perlbrew switch perl-5.16.2
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
if [ -z "$(which cpanm)" ]; then
|
|
14
|
+
perlbrew install-cpanm
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
cpanm -v -l local --installdeps .
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
if ! [ -f "$HOME/.pythonbrew/etc/bashrc" ]; then
|
|
3
|
+
curl -kL http://xrl.us/pythonbrewinstall | bash
|
|
4
|
+
fi
|
|
5
|
+
|
|
6
|
+
source "$HOME/.pythonbrew/etc/bashrc"
|
|
7
|
+
|
|
8
|
+
if ! [[ "$PYTHONPATH" =~ Python-2.7.3 ]]; then
|
|
9
|
+
pythonbrew install 2.7.3
|
|
10
|
+
pythonbrew switch 2.7.3
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
if ! [ -f "$HOME/.pythonbrew/pythons/Python-2.7.3/bin/virtualenvwrapper.sh" ]; then
|
|
14
|
+
pip install virtualenv virtualenvwrapper
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
source "$HOME/.pythonbrew/pythons/Python-2.7.3/bin/virtualenvwrapper.sh"
|
|
18
|
+
|
|
19
|
+
if ! [ -d "$HOME/.virtualenvs/env" ]; then
|
|
20
|
+
mkvirtualenv env
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
workon env
|
|
24
|
+
pip install -r requirements.txt
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
if ! [ -d $HOME/.rbenv ]; then
|
|
3
|
+
git clone git://github.com/sstephenson/rbenv.git $HOME/.rbenv
|
|
4
|
+
fi
|
|
5
|
+
|
|
6
|
+
if ! [ -d $HOME/.rbenv/plugins/ruby-build ]; then
|
|
7
|
+
git clone git://github.com/sstephenson/ruby-build.git $HOME/.rbenv/plugins/ruby-build
|
|
8
|
+
fi
|
|
9
|
+
|
|
10
|
+
export PATH="$HOME/.rbenv/bin:$PATH"
|
|
11
|
+
eval "$(rbenv init -)"
|
|
12
|
+
rbenv rehash
|
|
13
|
+
|
|
14
|
+
if ! [[ $(rbenv version) =~ ^1\.9\.3-p327 ]]; then
|
|
15
|
+
rbenv install 1.9.3-p327
|
|
16
|
+
rbenv global 1.9.3-p327
|
|
17
|
+
rbenv rehash
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
if [[ -z $(gem list bundler | grep bundler) ]]; then
|
|
21
|
+
gem install bundler
|
|
22
|
+
rbenv rehash
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
bundle install --path=vendor/bundle
|
data/lib/llenv.rb
ADDED
data/lib/llenv/cli.rb
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
require "llenv"
|
|
2
|
+
require "llenv/declare"
|
|
3
|
+
require "thor"
|
|
4
|
+
require "tapp"
|
|
5
|
+
|
|
6
|
+
class LLenv::CLI < Thor
|
|
7
|
+
|
|
8
|
+
class_option :declare, :type => :string, :aliases => "-d", :desc => "Specify a user declare directory"
|
|
9
|
+
class_option :home, :type => :string, :aliases => "-h", :desc => "Specify a home directory of LL (Default: ~/.llenv)"
|
|
10
|
+
|
|
11
|
+
desc "install", "Install declared LL"
|
|
12
|
+
def install
|
|
13
|
+
load_llenv_file!
|
|
14
|
+
check_homedir!
|
|
15
|
+
load_declare!
|
|
16
|
+
@declare.install
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
desc "exec", "Execute command with declared LL"
|
|
20
|
+
def exec(*argv)
|
|
21
|
+
load_llenv_file!
|
|
22
|
+
check_homedir!
|
|
23
|
+
load_declare!
|
|
24
|
+
@declare.execute(argv)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
desc "version", "Display LLenv gem version"
|
|
28
|
+
|
|
29
|
+
map ["-v", "--version"] => :version
|
|
30
|
+
def version
|
|
31
|
+
puts LLenv::VERSION
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
private ######################################################################
|
|
35
|
+
|
|
36
|
+
def error(message)
|
|
37
|
+
puts "ERROR: #{message}"
|
|
38
|
+
exit 1
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def load_llenv_file!
|
|
42
|
+
root = File.expand_path(Dir.pwd)
|
|
43
|
+
default_env = File.join(root, ".llenv")
|
|
44
|
+
error("#{default_env} does not exist.") unless File.exist?(default_env)
|
|
45
|
+
@llenv = File.read(default_env).split("\n")[0]
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def check_homedir!
|
|
49
|
+
home = options[:home] || File.expand_path("~/.llenv")
|
|
50
|
+
llhome = File.join(home, @llenv)
|
|
51
|
+
Dir.mkdir(home) unless Dir.exists?(home)
|
|
52
|
+
Dir.mkdir(llhome) unless Dir.exists?(llhome)
|
|
53
|
+
@llhome = llhome
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def load_declare!
|
|
57
|
+
declare_dirs = []
|
|
58
|
+
declare_dirs << File.join(options[:declare], @llenv) if options[:declare]
|
|
59
|
+
declare_dirs << File.expand_path("../../../declare/#{@llenv}", __FILE__)
|
|
60
|
+
dir = declare_dirs.detect { |d| Dir.exists?(d) } or error("Declare of '#{@llenv}' does not exist.")
|
|
61
|
+
@declare = LLenv::Declare.new(dir, @llhome)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require "llenv"
|
|
2
|
+
|
|
3
|
+
class LLenv::Declare
|
|
4
|
+
def initialize(dir, llhome)
|
|
5
|
+
@install_sh = File.join(dir, "install.sh")
|
|
6
|
+
@exec_sh = File.join(dir, "exec.sh")
|
|
7
|
+
@llhome = llhome
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def install
|
|
11
|
+
set_env
|
|
12
|
+
system(@install_sh)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def execute(argv)
|
|
16
|
+
set_env
|
|
17
|
+
exec(@exec_sh, *argv)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
def set_env
|
|
23
|
+
ENV.clear
|
|
24
|
+
env = `. /etc/profile && env`
|
|
25
|
+
env.split("\n").map do |e|
|
|
26
|
+
k, v = e.split("=")
|
|
27
|
+
ENV[k] = v
|
|
28
|
+
end
|
|
29
|
+
ENV["HOME"] = @llhome
|
|
30
|
+
ENV["SHELL"] = "/bin/bash"
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
data/ruby-llenv.gemspec
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'llenv/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |gem|
|
|
7
|
+
gem.name = "ruby-llenv"
|
|
8
|
+
gem.version = LLenv::VERSION
|
|
9
|
+
gem.authors = ["riywo"]
|
|
10
|
+
gem.email = ["riywo.jp@gmail.com"]
|
|
11
|
+
gem.description = %q{LL install and exec}
|
|
12
|
+
gem.summary = %q{Using .llenv file of repository}
|
|
13
|
+
gem.homepage = "https://github.com/riywo/ruby-llenv"
|
|
14
|
+
|
|
15
|
+
gem.files = `git ls-files`.split($/)
|
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
18
|
+
gem.require_paths = ["lib"]
|
|
19
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: ruby-llenv
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
prerelease:
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- riywo
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2012-11-17 00:00:00.000000000 Z
|
|
13
|
+
dependencies: []
|
|
14
|
+
description: LL install and exec
|
|
15
|
+
email:
|
|
16
|
+
- riywo.jp@gmail.com
|
|
17
|
+
executables:
|
|
18
|
+
- llenv
|
|
19
|
+
extensions: []
|
|
20
|
+
extra_rdoc_files: []
|
|
21
|
+
files:
|
|
22
|
+
- .gitignore
|
|
23
|
+
- Gemfile
|
|
24
|
+
- LICENSE.txt
|
|
25
|
+
- README.md
|
|
26
|
+
- Rakefile
|
|
27
|
+
- bin/llenv
|
|
28
|
+
- declare/node-0.9.3/exec.sh
|
|
29
|
+
- declare/node-0.9.3/install.sh
|
|
30
|
+
- declare/perl-5.16.2/exec.sh
|
|
31
|
+
- declare/perl-5.16.2/install.sh
|
|
32
|
+
- declare/python-2.7.3/exec.sh
|
|
33
|
+
- declare/python-2.7.3/install.sh
|
|
34
|
+
- declare/ruby-1.9.3-p327/exec.sh
|
|
35
|
+
- declare/ruby-1.9.3-p327/install.sh
|
|
36
|
+
- lib/llenv.rb
|
|
37
|
+
- lib/llenv/cli.rb
|
|
38
|
+
- lib/llenv/declare.rb
|
|
39
|
+
- lib/llenv/version.rb
|
|
40
|
+
- ruby-llenv.gemspec
|
|
41
|
+
homepage: https://github.com/riywo/ruby-llenv
|
|
42
|
+
licenses: []
|
|
43
|
+
post_install_message:
|
|
44
|
+
rdoc_options: []
|
|
45
|
+
require_paths:
|
|
46
|
+
- lib
|
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
48
|
+
none: false
|
|
49
|
+
requirements:
|
|
50
|
+
- - ! '>='
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: '0'
|
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
|
+
none: false
|
|
55
|
+
requirements:
|
|
56
|
+
- - ! '>='
|
|
57
|
+
- !ruby/object:Gem::Version
|
|
58
|
+
version: '0'
|
|
59
|
+
requirements: []
|
|
60
|
+
rubyforge_project:
|
|
61
|
+
rubygems_version: 1.8.23
|
|
62
|
+
signing_key:
|
|
63
|
+
specification_version: 3
|
|
64
|
+
summary: Using .llenv file of repository
|
|
65
|
+
test_files: []
|