vvm-rb 0.0.6 → 0.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92d7636b91886c3e0a45ef4e2779486c8772c7ce
4
- data.tar.gz: 76c68c1f61a3ddf83f0ea625055f084b0a29b171
3
+ metadata.gz: 6460e5f25ab99eb833d852445ecfe65a3443d1d6
4
+ data.tar.gz: bef91e26064a61d186ab25b764089c0b84948584
5
5
  SHA512:
6
- metadata.gz: 08de45835f8864995fed2e7e4b4387d705887ae1164d2914a670cf9df600f09120578c1af50bb8698b03b698b26795679bf14a8ab3a1c249269c9041a9081fe7
7
- data.tar.gz: c9d04866473b2787d120711f098c895995e57d5387546bfe7e553e42ecc8e0b9bb9973166a7f6f096c035ccac71beebf5cea2557c9ee892896f28809aee44512
6
+ metadata.gz: b2939f83821f0a37d90aca329703bd88dc671742b5134bd93cad0f4d6b90d8e5611887de95eb422b5e32357171ea798361fce24eb14a35d5af29cd9c1474406d
7
+ data.tar.gz: 308801fa96bae8bd6094a8bb3a042d1a1d8e90035b42b0b11b458b3488b0a1d00d16edb930d36abaf668e6de167a97775f80c37db2598963b1ceb9a954e4e64e
data/.coveralls.yml CHANGED
@@ -1,2 +1 @@
1
1
  service_name: travis-ci
2
- repo_token: JXdUC0No2jFLktGfjwVfInePFNnFKEnYb
data/README.rdoc CHANGED
@@ -26,15 +26,19 @@ please add the following line into your ~/.bash_login etc:
26
26
 
27
27
  test -f ~/.vvm-rb/etc/login && source ~/.vvm-rb/etc/login
28
28
 
29
- or
29
+ you can set own root.
30
30
 
31
31
  export VVMROOT=/your/vvm-rb/root/path
32
32
  test -f $VVMROOT/etc/login && source $VVMROOT/etc/login
33
33
 
34
- commands
34
+ you can set your default options of configure.
35
+
36
+ export VVMOPT="--enable-rubyinterp --enable-pythoninterp"
37
+
38
+ == Commands
35
39
 
36
40
  $ vvm-rb help
37
- $ vvm-rb install v7-4
41
+ $ vvm-rb install v7-4 --enable-rubyinterp
38
42
  $ vvm-rb install v7-4-035
39
43
  $ vvm-rb reinstall v7-4
40
44
  $ vvm-rb rebuild v7-4 --enable-rubyinterp --enable-pythoninterp
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.7
@@ -1,39 +1,36 @@
1
1
  module Accesser
2
+
2
3
  module_function
3
4
 
4
5
  def get_dot_dir
5
- return File.expand_path(ENV['VVMROOT'] || '~/.vvm-rb')
6
+ File.expand_path(ENV['VVMROOT'] || '~/.vvm-rb')
6
7
  end
7
8
 
8
9
  def get_etc_dir
9
- return File.join(get_dot_dir, 'etc')
10
+ File.join(get_dot_dir, 'etc')
10
11
  end
11
12
 
12
13
  def get_repos_dir
13
- return File.join(get_dot_dir, 'repos')
14
+ File.join(get_dot_dir, 'repos')
14
15
  end
15
16
 
16
17
  def get_src_dir(version = '')
17
- return File.join(get_dot_dir, 'src', version)
18
+ File.join(get_dot_dir, 'src', version)
18
19
  end
19
20
 
20
21
  def get_vims_dir(version = '')
21
- return File.join(get_dot_dir, 'vims', version)
22
+ File.join(get_dot_dir, 'vims', version)
22
23
  end
23
24
 
24
25
  def get_vimorg_dir
25
- return File.join(get_repos_dir, 'vimorg')
26
+ File.join(get_repos_dir, 'vimorg')
26
27
  end
27
28
 
28
29
  def get_login_file
29
- return File.join(get_etc_dir, 'login')
30
+ File.join(get_etc_dir, 'login')
30
31
  end
31
32
 
32
33
  def get_current_dir
33
- return File.join(get_vims_dir, 'current')
34
- end
35
-
36
- def get_cache_dir
37
- return File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '.vvm_cache'))
34
+ File.join(get_vims_dir, 'current')
38
35
  end
39
36
  end
@@ -0,0 +1,19 @@
1
+ module VvmRb
2
+ module Base
3
+ def self.included(base)
4
+ base.extend(ClassMethods)
5
+ end
6
+
7
+ module ClassMethods
8
+ def before_method(*names)
9
+ names.each do |name|
10
+ m = instance_method(name)
11
+ define_method(name) do |*args, &block|
12
+ yield
13
+ m.bind(self).call(*args, &block)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
data/lib/vvm-rb/cli.rb CHANGED
@@ -2,7 +2,7 @@ require 'thor'
2
2
 
3
3
  class Cli < Thor
4
4
  include Thor::Actions
5
- include Validator
5
+ include VvmRb::Base
6
6
 
7
7
  desc 'install [TAG] [options]', 'Install a specific version of Vim'
8
8
  def install(version, *conf)
@@ -26,7 +26,7 @@ test -f ~/.vvm-rb/etc/login && source ~/.vvm-rb/etc/login
26
26
  installer(version, conf)
27
27
  end
28
28
 
29
- desc 'rebuild [TAG] [options]', 'Rebuild a specific version of Vim, then install it'
29
+ desc 'rebuild [TAG] [options]', 'Rebuild a specific version of Vim'
30
30
  def rebuild(version, *conf)
31
31
  rebuilder(version, conf)
32
32
  end
@@ -4,24 +4,25 @@ class Installer
4
4
 
5
5
  def initialize(version, conf = [])
6
6
  @version = version
7
- @conf = conf
7
+ @conf = conf.empty? && ENV['VVMOPT'] ? ENV['VVMOPT'].split(' ') : conf
8
8
  end
9
9
 
10
10
  def fetch
11
11
  FileUtils.mkdir_p(get_repos_dir)
12
12
  repos_dir = get_vimorg_dir
13
- unless File.exists?(repos_dir)
14
- system("hg clone #{VIM_URI} #{repos_dir}")
15
- end
13
+ system("hg clone #{VIM_URI} #{repos_dir}") unless File.exists?(repos_dir)
16
14
  Dir.chdir(repos_dir) { system('hg pull') }
17
15
  end
18
16
 
19
17
  def checkout
20
- repos_dir = get_vimorg_dir
21
18
  src_dir = get_src_dir
22
19
  FileUtils.mkdir_p(src_dir)
23
20
  unless File.exists?(get_src_dir(@version))
24
- system("cd #{repos_dir} && hg archive -t tar -r #{@version} -p #{@version} - | (cd #{src_dir} && tar xf -)")
21
+ archive = "hg archive -t tar -r #{@version} -p #{@version} -"
22
+ expand = "(cd #{src_dir} && tar xf -)"
23
+ Dir.chdir get_vimorg_dir do
24
+ system("#{archive} | #{expand}")
25
+ end
25
26
  end
26
27
  end
27
28
 
@@ -7,14 +7,10 @@ class Switcher
7
7
 
8
8
  def use
9
9
  current = get_current_dir
10
- if File.exists?(current)
11
- FileUtils.rm(current)
12
- end
10
+ FileUtils.rm(current) if File.exists?(current)
13
11
  unless @version == 'system'
14
12
  vims_dir = get_vims_dir(@version)
15
- unless File.exists?(vims_dir)
16
- abort "#{@version} is not installed."
17
- end
13
+ abort "#{@version} is not installed." unless File.exists?(vims_dir)
18
14
  FileUtils.ln_s(vims_dir, current)
19
15
  end
20
16
  end
@@ -15,11 +15,7 @@ class Uninstaller
15
15
  abort "#{@version} can not be uninstalled; it is currently used."
16
16
  end
17
17
  end
18
- if File.exists?(src_dir)
19
- FileUtils.rm_rf(src_dir)
20
- end
21
- if File.exists?(vims_dir)
22
- FileUtils.rm_rf(vims_dir)
23
- end
18
+ FileUtils.rm_rf(src_dir) if File.exists?(src_dir)
19
+ FileUtils.rm_rf(vims_dir) if File.exists?(vims_dir)
24
20
  end
25
21
  end
@@ -1,31 +1,18 @@
1
1
  module Validator
2
- def self.included(base)
3
- base.extend(ClassMethods)
4
- end
5
2
 
6
- module ClassMethods
7
- def before_method(*names)
8
- names.each do |name|
9
- m = instance_method(name)
10
- define_method(name) do |*args, &block|
11
- yield
12
- m.bind(self).call(*args, &block)
13
- end
14
- end
15
- end
3
+ module_function
16
4
 
17
- def check_hg
18
- unless Kernel.system('hg --version > /dev/null')
19
- abort 'mercurial is required to install.'
20
- end
21
- return true
5
+ def check_hg
6
+ unless Kernel.system('which hg > /dev/null')
7
+ abort 'mercurial is required to install.'
22
8
  end
9
+ return true
10
+ end
23
11
 
24
- def check_tag
25
- unless $*[1] =~ /(^start$|^tip$|^v7-.+$|^system$)/
26
- abort 'undefined vim version. please run [ vvm-rb list ] and check available versions.'
27
- end
28
- return true
12
+ def check_tag
13
+ unless $*[1] =~ /(^start$|^tip$|^v7-.+$|^system$)/
14
+ abort 'undefined vim version. please run [ vvm-rb list ].'
29
15
  end
16
+ return true
30
17
  end
31
18
  end
@@ -2,13 +2,15 @@ class Version
2
2
  def self.list
3
3
  Dir.chdir(get_vimorg_dir) do
4
4
  list = `hg tags`.split.reverse
5
- return list.values_at(* list.each_index.select {|i| i.odd?}).join("\n")
5
+ return list.values_at(* list.each_index.select { |i| i.odd? }).join("\n")
6
6
  end
7
7
  end
8
8
 
9
9
  def self.versions
10
10
  output = []
11
- Dir.glob(File.join(get_vims_dir, 'v*')).sort.each{ |d| output << File.basename(d) }
11
+ Dir.glob(File.join(get_vims_dir, 'v*')).sort.each do |d|
12
+ output << File.basename(d)
13
+ end
12
14
  return output.join("\n")
13
15
  end
14
16
  end
data/lib/vvm-rb.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'vvm-rb/base'
1
2
  require 'vvm-rb/constants'
2
3
  require 'vvm-rb/installer'
3
4
  require 'vvm-rb/uninstaller'
@@ -8,4 +9,5 @@ require 'vvm-rb/version'
8
9
 
9
10
  module VvmRb
10
11
  include Accesser
12
+ include Validator
11
13
  end
@@ -7,6 +7,7 @@ describe 'Installer' do
7
7
  FileUtils.rm_rf(get_vims_dir)
8
8
  FileUtils.rm_rf(get_repos_dir)
9
9
  FileUtils.rm_rf(get_etc_dir)
10
+ ENV['VVMOPT'] = '--enable-rubyinterp'
10
11
  @version = 'v7-4'
11
12
  @installer = Installer.new(@version)
12
13
  end
@@ -55,6 +56,14 @@ describe 'Installer' do
55
56
  expect(File.exists?(get_login_file)).to be_true
56
57
  end
57
58
  end
59
+
60
+ context 'vvmopt' do
61
+ let(:vim) { "#{get_vims_dir(@version)}/bin/vim" }
62
+
63
+ it 'enable rubyinterp' do
64
+ expect(`#{vim} --version |grep ruby`).to match(/\+ruby/)
65
+ end
66
+ end
58
67
  end
59
68
 
60
69
  describe 'rebuild' do
data/spec/spec_helper.rb CHANGED
@@ -17,7 +17,7 @@ require 'tmpdir'
17
17
  require 'vvm-rb'
18
18
  include VvmRb
19
19
 
20
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
20
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
21
21
 
22
22
  RSpec.configure do |config|
23
23
  config.before :suite do
@@ -41,9 +41,14 @@ RSpec.configure do |config|
41
41
  FileUtils.cp_r(get_cache_dir, @tmp)
42
42
  @vvm_tmp = File.expand_path(File.join(@tmp, '.vvm_cache'))
43
43
  ENV['VVMROOT'] = @vvm_tmp
44
+ ENV['VVMOPT'] = nil
44
45
  end
45
46
 
46
47
  config.after :all do
47
48
  FileUtils.rm_rf(@tmp)
48
49
  end
49
50
  end
51
+
52
+ def get_cache_dir
53
+ File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '.vvm_cache'))
54
+ end
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- include Validator
2
+ include VvmRb::Base
3
3
 
4
4
  describe 'Validator' do
5
5
 
data/vvm-rb.gemspec CHANGED
@@ -2,15 +2,15 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: vvm-rb 0.0.6 ruby lib
5
+ # stub: vvm-rb 0.0.7 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "vvm-rb"
9
- s.version = "0.0.6"
9
+ s.version = "0.0.7"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["Yuu Shigetani"]
13
- s.date = "2013-11-02"
13
+ s.date = "2013-11-04"
14
14
  s.description = "vim version manager."
15
15
  s.email = "s2g4t1n2@gmail.com"
16
16
  s.executables = ["vvm-rb"]
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
32
32
  "etc/login",
33
33
  "lib/vvm-rb.rb",
34
34
  "lib/vvm-rb/accesser.rb",
35
+ "lib/vvm-rb/base.rb",
35
36
  "lib/vvm-rb/cli.rb",
36
37
  "lib/vvm-rb/constants.rb",
37
38
  "lib/vvm-rb/installer.rb",
@@ -45,7 +46,6 @@ Gem::Specification.new do |s|
45
46
  "spec/uninstaller_spec.rb",
46
47
  "spec/validator_spec.rb",
47
48
  "spec/version_spec.rb",
48
- "spec/vvm-rb_spec.rb",
49
49
  "vvm-rb.gemspec"
50
50
  ]
51
51
  s.homepage = "http://github.com/calorie/vvm-rb"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vvm-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuu Shigetani
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-02 00:00:00.000000000 Z
11
+ date: 2013-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -144,6 +144,7 @@ files:
144
144
  - etc/login
145
145
  - lib/vvm-rb.rb
146
146
  - lib/vvm-rb/accesser.rb
147
+ - lib/vvm-rb/base.rb
147
148
  - lib/vvm-rb/cli.rb
148
149
  - lib/vvm-rb/constants.rb
149
150
  - lib/vvm-rb/installer.rb
@@ -157,7 +158,6 @@ files:
157
158
  - spec/uninstaller_spec.rb
158
159
  - spec/validator_spec.rb
159
160
  - spec/version_spec.rb
160
- - spec/vvm-rb_spec.rb
161
161
  - vvm-rb.gemspec
162
162
  homepage: http://github.com/calorie/vvm-rb
163
163
  licenses:
data/spec/vvm-rb_spec.rb DELETED
@@ -1,4 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "VvmRb" do
4
- end