vimpack 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/.autotest +13 -0
  2. data/.gitignore +6 -0
  3. data/.rspec +2 -0
  4. data/.rvmrc +1 -0
  5. data/Gemfile +2 -0
  6. data/LICENSE +21 -0
  7. data/README.md +47 -0
  8. data/Rakefile +5 -0
  9. data/autotest/discover.rb +2 -0
  10. data/bin/vimpack +103 -0
  11. data/cucumber.yml +13 -0
  12. data/features/commands/environments.feature +26 -0
  13. data/features/commands/git.feature +77 -0
  14. data/features/commands/info.feature +28 -0
  15. data/features/commands/init.feature +47 -0
  16. data/features/commands/install.feature +50 -0
  17. data/features/commands/list.feature +18 -0
  18. data/features/commands/search.feature +137 -0
  19. data/features/commands/uninstall.feature +46 -0
  20. data/features/step_definitions/environment_steps.rb +3 -0
  21. data/features/step_definitions/file_utils_steps.rb +36 -0
  22. data/features/step_definitions/initialize_steps.rb +14 -0
  23. data/features/step_definitions/output_steps.rb +12 -0
  24. data/features/step_definitions/vimpack_git_steps.rb +91 -0
  25. data/features/support/env.rb +11 -0
  26. data/features/support/executable_paths.rb +15 -0
  27. data/lib/vimpack/commands/command.rb +46 -0
  28. data/lib/vimpack/commands/git.rb +32 -0
  29. data/lib/vimpack/commands/info.rb +26 -0
  30. data/lib/vimpack/commands/init.rb +23 -0
  31. data/lib/vimpack/commands/install.rb +35 -0
  32. data/lib/vimpack/commands/list.rb +14 -0
  33. data/lib/vimpack/commands/search.rb +37 -0
  34. data/lib/vimpack/commands/uninstall.rb +27 -0
  35. data/lib/vimpack/commands.rb +8 -0
  36. data/lib/vimpack/models/apibase.rb +7 -0
  37. data/lib/vimpack/models/base.rb +29 -0
  38. data/lib/vimpack/models/repo.rb +117 -0
  39. data/lib/vimpack/models/script.rb +110 -0
  40. data/lib/vimpack/models.rb +8 -0
  41. data/lib/vimpack/utils/api.rb +39 -0
  42. data/lib/vimpack/utils/file.rb +66 -0
  43. data/lib/vimpack/utils/file_path.rb +25 -0
  44. data/lib/vimpack/utils/git.rb +103 -0
  45. data/lib/vimpack/utils/github.rb +41 -0
  46. data/lib/vimpack/utils/io.rb +26 -0
  47. data/lib/vimpack/utils/process.rb +61 -0
  48. data/lib/vimpack/utils/vimscripts.rb +64 -0
  49. data/lib/vimpack/version.rb +4 -0
  50. data/lib/vimpack.rb +46 -0
  51. data/simplecov_setup.rb +5 -0
  52. data/spec/spec_helper.rb +32 -0
  53. data/spec/vimpack/models/repo_spec.rb +150 -0
  54. data/spec/vimpack/models/script_spec.rb +230 -0
  55. data/spec/vimpack/utils/github_spec.rb +39 -0
  56. data/spec/vimpack/utils/vimscripts_spec.rb +38 -0
  57. data/tasks/cucumber.rake +8 -0
  58. data/tasks/default.rake +2 -0
  59. data/tasks/rspec.rake +5 -0
  60. data/templates/vimrc.erb +6 -0
  61. data/vimpack.gemspec +42 -0
  62. metadata +333 -0
@@ -0,0 +1,110 @@
1
+ module Vimpack
2
+ module Models
3
+
4
+ class Script
5
+ include Vimpack::Utils::Vimscripts
6
+ include Vimpack::Utils::Github
7
+
8
+ class ScriptNotFound < StandardError; end
9
+ class AlreadyInstalled < StandardError; end
10
+ class NotInstalled < StandardError; end
11
+
12
+ # From Vimscripts.org
13
+ attr_reader :name, :type, :version, :version_date, :author, :author_email
14
+ # From Github
15
+ attr_reader :url, :description
16
+
17
+ SCRIPT_TYPES = [ 'utility', 'color scheme', 'syntax', 'ftplugin',
18
+ 'indent', 'game', 'plugin', 'patch' ]
19
+
20
+ def initialize(attrs={})
21
+ set_attributes_from_input(attrs)
22
+ set_attributes_from_github
23
+ end
24
+
25
+ def set_attributes_from_input(attrs)
26
+ attrs.each_pair do |attr, value|
27
+ instance_variable_set("@#{attr}".to_sym, value)
28
+ end
29
+ end
30
+
31
+ def set_attributes_from_github
32
+ url = "vim-scripts/#{name}"
33
+ @repo = self.class.repo("vim-scripts/#{name}")
34
+ [ :url, :description ].each { |attr| instance_variable_set("@#{attr}".to_sym, @repo[attr]) }
35
+ set_version_from_github
36
+ end
37
+
38
+ def commits
39
+ @commits ||= self.class.commits(@repo).sort do |a, b|
40
+ a.authored_date <=> b.authored_date
41
+ end
42
+ end
43
+
44
+ def set_version_from_github
45
+ last_commit = commits.last
46
+ @version = last_commit.message[0..10].gsub(/Version /, '')
47
+ @version_date = last_commit.authored_date
48
+ end
49
+
50
+ def self.search(q, types = [], limit = 10, offset = 0)
51
+ search_vimscripts(q, types).map do |vimscript|
52
+ Script.new(vimscript)
53
+ end
54
+ end
55
+
56
+ def self.get(name)
57
+ vimscript = get_vimscript(name)
58
+ raise ScriptNotFound.new(name) if vimscript.nil?
59
+ Script.new(vimscript)
60
+ end
61
+
62
+ def self.info(name)
63
+ get(name)
64
+ end
65
+
66
+ def install!(link_to_bundle=true)
67
+ Repo.raise_unless_initialized!
68
+ raise AlreadyInstalled.new(name) if installed?
69
+ Repo.add_submodule(url, type.gsub(' ', '_'), name)
70
+ if link_to_bundle
71
+ Repo.create_link(install_path, bundle_path)
72
+ end
73
+ true
74
+ end
75
+
76
+ def uninstall!
77
+ Repo.raise_unless_initialized!
78
+ raise NotInstalled.new(name) unless installed?
79
+ Repo.remove_submodule(type.gsub(' ', '_'), name)
80
+ Repo.remove_link(bundle_path) if Repo.symlink_exists?(bundle_path)
81
+ true
82
+ end
83
+
84
+ def installed?
85
+ Repo.initialized? && Repo.directory_exists?(install_path)
86
+ end
87
+
88
+ def installable?
89
+ Repo.initialized? && !installed?
90
+ end
91
+
92
+ def install_path
93
+ Repo.script_path.join(type.gsub(' ', '_'), name)
94
+ end
95
+
96
+ def bundle_path
97
+ Repo.bundle_path.join(name)
98
+ end
99
+
100
+ private
101
+
102
+ def self.script_not_found(name)
103
+ scripts = search(name, Array.new, 1)
104
+ return exit_with_error!("Script not found! Did you mean #{scripts.first.name}?") if scripts.any?
105
+ exit_with_error!('Script not found!')
106
+ end
107
+
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,8 @@
1
+ module Vimpack
2
+ module Models
3
+ autoload :Base, 'vimpack/models/base'
4
+ autoload :ApiBase, 'vimpack/models/apibase'
5
+ autoload :Script, 'vimpack/models/script'
6
+ autoload :Repo, 'vimpack/models/repo'
7
+ end
8
+ end
@@ -0,0 +1,39 @@
1
+ module Vimpack
2
+ module Utils
3
+ module Api
4
+
5
+ def self.included(base)
6
+ base.send(:extend, ClassMethods)
7
+ unless Vimpack.env?('production')
8
+ require 'vcr'
9
+ VCR.config do |c|
10
+ c.cassette_library_dir = Vimpack.root.join('cassette_library')
11
+ c.stub_with :webmock
12
+ c.ignore_localhost = true
13
+ c.default_cassette_options = { :record => :new_episodes }
14
+ end
15
+ end
16
+ end
17
+
18
+ module ClassMethods
19
+
20
+ def wrap_open(*args)
21
+ wrap_http_call do
22
+ open(*args)
23
+ end
24
+ end
25
+
26
+ def wrap_http_call(cassette_name='vimpack')
27
+ raise StandardError.new('you must give a block to wrap_http_call') unless block_given?
28
+ if Vimpack.env?(:production)
29
+ yield
30
+ else
31
+ VCR.use_cassette(cassette_name) do
32
+ yield
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,66 @@
1
+ module Vimpack
2
+ module Utils
3
+
4
+ module File
5
+
6
+ attr_accessor :home_path, :pack_path, :script_path, :vim_path, :bundle_path
7
+
8
+ def setup_paths(home_path)
9
+ self.home_path = FilePath.new(home_path)
10
+ self.pack_path = FilePath.new(self.home_path.join('.vimpack'))
11
+ self.script_path = FilePath.new(self.pack_path.join('scripts'))
12
+ self.vim_path = FilePath.new(self.pack_path.join('vim'))
13
+ self.bundle_path = FilePath.new(self.vim_path.join('bundle'))
14
+ end
15
+
16
+ def file_exists?(filename)
17
+ ::File.exists?(filename)
18
+ end
19
+
20
+ def directory_exists?(directory)
21
+ ::File::directory?(directory)
22
+ end
23
+
24
+ def symlink_exists?(linkname)
25
+ ::File.exists?(linkname) && ::File.stat(linkname).symlink?
26
+ end
27
+
28
+ def create_link(target, linkname, relative=true)
29
+ target = Pathname.new(target).relative_path_from(
30
+ Pathname.new(::File.dirname(linkname))
31
+ ) if relative
32
+ ::FileUtils.ln_s(target, linkname)
33
+ end
34
+
35
+ def remove_link(link)
36
+ ::FileUtils.rm(link)
37
+ end
38
+
39
+ def remove_directory(directory)
40
+ exit_with_error!("no way!") if directory == '/'
41
+ ::FileUtils.rmtree(directory)
42
+ end
43
+
44
+ def move_path(source, target)
45
+ ::FileUtils.mv(source, target) if file_exists?(source)
46
+ end
47
+
48
+ def make_dir(*paths)
49
+ ::FileUtils.mkdir_p(*paths)
50
+ end
51
+
52
+ def template_path(*path)
53
+ Vimpack.root.join('templates', *path)
54
+ end
55
+
56
+ def template(name, path)
57
+ name = name + '.erb'
58
+ contents = ::ERB.new(::File.read(template_path(name))).result(binding)
59
+ target = ::File.open(path, 'w')
60
+ target.write(contents)
61
+ target.close
62
+ end
63
+
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,25 @@
1
+ module Vimpack
2
+ module Utils
3
+
4
+ class FilePath
5
+ attr_accessor :base_path
6
+ def initialize(base_path)
7
+ self.base_path = base_path
8
+ end
9
+
10
+ def base_path=(base_path)
11
+ @base_path = ::File.expand_path(base_path)
12
+ end
13
+
14
+ def join(*paths)
15
+ ::File.join(@base_path, *paths)
16
+ end
17
+
18
+ def to_s
19
+ @base_path
20
+ end
21
+
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,103 @@
1
+ module Vimpack
2
+ module Utils
3
+ module Git
4
+
5
+ include Process
6
+
7
+ def init_repo(path, bare=false)
8
+ run_process_or_die!("git init --quiet#{bare == true ? ' --bare' : ''}", path)
9
+ end
10
+
11
+ def add_submodule(repo_uri, *paths)
12
+ parent, name = paths[0..-2], paths[-1]
13
+ path = ::File.join('scripts', *paths)
14
+ run_process_or_die!("git submodule add #{repo_uri} #{path}",
15
+ self.pack_path)
16
+ init_submodule(path)
17
+ update_submodule(path)
18
+ end
19
+
20
+ def replace_contents(path, match, new='')
21
+ contents = ::File.read(path)
22
+ contents = contents.sub(match, new)
23
+ ::File.open(path, 'w') do |file|
24
+ file.write(contents)
25
+ end
26
+ end
27
+
28
+ def remove_submodule(*paths)
29
+ path = ::File.join('scripts', *paths)
30
+ submod_match = ::Regexp.escape("[submodule \"#{path}\"]") + '\n.*\n.*'
31
+ config_match = ::Regexp.escape("[submodule \"#{path}\"]") + '\n.*'
32
+ replace_contents(self.pack_path.join('.gitmodules'), submod_match)
33
+ replace_contents(self.pack_path.join('.git', 'config'), config_match)
34
+ remove_link(self.bundle_path.join(paths[-1]))
35
+ remove_directory(self.pack_path.join(path))
36
+ run_process_or_die!("git rm -r #{path}", self.pack_path)
37
+ end
38
+
39
+ def init_submodule(path='')
40
+ run_process_or_die!("git submodule init #{path}", self.pack_path)
41
+ end
42
+
43
+ def update_submodule(path='')
44
+ run_process_or_die!("git submodule update #{path}", self.pack_path)
45
+ end
46
+
47
+ def repo_add_remote(name, path)
48
+ cmd = "git remote add #{name} #{path}"
49
+ run_process_or_die!(cmd, self.pack_path.to_s)
50
+ end
51
+
52
+ def repo_remote?(name)
53
+ remotes = run_process_and_wait!("git remote show #{name}", pack_path.to_s)
54
+ !remotes.message.include?('does not appear to be a git') && remotes.message.include?(name)
55
+ end
56
+
57
+
58
+ def repo_commit(msg='')
59
+ msg = '[VIMPACK] vimpack updated' if msg == ''
60
+ cmd = "git add . && git commit -m '#{msg}'"
61
+ run_process_or_die!(cmd, self.pack_path.to_s)
62
+ end
63
+
64
+ def repo_pull(remote_path='origin master')
65
+ run_process_or_die!("git pull #{remote_path}", self.pack_path.to_s)
66
+ end
67
+
68
+ def repo_push
69
+ cmd = "git push origin master"
70
+ error_message = <<-EOE
71
+ error: local repo out of sync with remote
72
+ use git to sync with something like this:
73
+ vimpack git fetch && vimpack git merge origin/master
74
+ EOE
75
+ run_process_or_die!(cmd, self.pack_path.to_s, error_message)
76
+ end
77
+
78
+ def repo_clone(repo_url, path)
79
+ cmd = "git clone #{repo_url} #{path}"
80
+ run_process_or_die!(cmd)
81
+ end
82
+
83
+ def repo_add_dot
84
+ cmd = "git add ."
85
+ run_process_or_die!(cmd, self.pack_path.to_s)
86
+ end
87
+
88
+ def repo_exec(subcommand, commands)
89
+ commands = sanitize_commands(commands)
90
+ cmd = "git #{subcommand} #{commands}"
91
+ run_process_or_die!(cmd, self.pack_path.to_s)
92
+ end
93
+
94
+ def sanitize_commands(commands)
95
+ commands.each.inject('') do |full_command, command|
96
+ full_command << ' ' unless full_command == ''
97
+ full_command << (command.include?(' ') ? "'#{command}'" : command)
98
+ end
99
+ end
100
+
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,41 @@
1
+ module Vimpack
2
+ module Utils
3
+ module Github
4
+
5
+ def self.included(base)
6
+ base.send(:include, Vimpack::Utils::Api)
7
+ base.send(:extend, ClassMethods)
8
+ end
9
+
10
+ module ClassMethods
11
+
12
+ def octokit
13
+ @octokit ||= Octokit::Client.new
14
+ end
15
+
16
+ def search_all_repos(q, options = {})
17
+ search_repositories(CGI.escape(q), options.merge(:language => 'VimL')).delete_if do |repo|
18
+ repo.name.downcase.include?('dotfiles') ||
19
+ repo.description.downcase.include?('dotfiles')
20
+ end
21
+ end
22
+
23
+ def search_vimscript_repos(q)
24
+ search_all_repos(q).delete_if { |repo| !(repo.owner == 'vim-scripts') }
25
+ end
26
+
27
+ def respond_to?(meth)
28
+ octokit.respond_to?(meth) || super
29
+ end
30
+
31
+ def method_missing(meth, *args)
32
+ if octokit.respond_to?(meth)
33
+ return wrap_http_call { octokit.send(meth, *args) }
34
+ end
35
+ super
36
+ end
37
+
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,26 @@
1
+ module Vimpack
2
+ module Utils
3
+ module Io
4
+
5
+ def say(message, color=:green)
6
+ puts message.color(color) unless message.nil?
7
+ end
8
+
9
+ def scream(message)
10
+ say(message, :red)
11
+ end
12
+
13
+ def die!(message=nil)
14
+ scream(message)
15
+ return Trollop::die USAGE
16
+ end
17
+
18
+ def exit_with_error!(message=nil, exit_code=1)
19
+ scream(message) unless message.nil?
20
+ exit(exit_code)
21
+ end
22
+
23
+ end
24
+ end
25
+ end
26
+
@@ -0,0 +1,61 @@
1
+ module Vimpack
2
+ module Utils
3
+ module Process
4
+ include Io
5
+
6
+ class Results
7
+ attr_accessor :process, :message
8
+ def initialize(process, message=nil)
9
+ self.process = process
10
+ self.message = message
11
+ end
12
+ end
13
+
14
+ def run_process!(cmd)
15
+ child = ::ChildProcess.build(cmd)
16
+ child.io.stdout = ::Tempfile.new('child-out')
17
+ child.io.stderr = ::Tempfile.new('child-err')
18
+ child.start
19
+ child
20
+ Results.new(child)
21
+ end
22
+
23
+ def wait_for_child(child, timeout=30)
24
+ child.process.poll_for_exit(timeout.to_f)
25
+ child.process.stop unless child.process.exited?
26
+ child.process.io.stdout.close
27
+ child.process.io.stderr.close
28
+ child.process.io.stdout.open
29
+ child.process.io.stderr.open
30
+ child.message = child.process.io.stdout.read
31
+ child.message << " "
32
+ child.message << child.process.io.stderr.read
33
+ child
34
+ end
35
+
36
+ def run_process_and_wait!(cmd, dir=nil)
37
+ child = nil
38
+ within_dir(dir) do
39
+ child = run_process!(cmd)
40
+ end
41
+ child = wait_for_child(child)
42
+ end
43
+
44
+ def run_process_or_die!(cmd, dir=nil, err_msg=nil)
45
+ child = run_process_and_wait!(cmd, dir)
46
+ child.message << err_msg if err_msg
47
+ exit_with_error!("child process died:\n#{child.message}") unless child.process.exit_code == 0
48
+ child
49
+ end
50
+
51
+ def within_dir(dir=nil, &block)
52
+ orig_path = Dir.pwd
53
+ dir = dir.nil? ? orig_path : dir.to_s
54
+ ::Dir.chdir(dir)
55
+ block.call
56
+ ::Dir.chdir(orig_path)
57
+ end
58
+
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,64 @@
1
+ module Vimpack
2
+ module Utils
3
+ module Vimscripts
4
+
5
+ def self.included(base)
6
+ base.send(:include, Vimpack::Utils::Api)
7
+ base.send(:extend, ClassMethods)
8
+ end
9
+
10
+ module ClassMethods
11
+
12
+ def vimscripts_url
13
+ 'http://vim-scripts.org/api/scripts_recent.json'
14
+ end
15
+
16
+ def vimscripts
17
+ # {"n"=>"test.vim", "t"=>"utility", "s"=>"example utility script file -- used for testing vimonline", "rv"=>"1.0", "rd"=>"2001-05-28", "ra"=>"Scott Johnston", "re"=>"scrott@users.sourceforge.net"}
18
+ @vimscripts ||= Yajl.load(wrap_open(vimscripts_url))
19
+ @vimscripts.clone
20
+ end
21
+
22
+ def search_vimscripts(q, types = [], limit = 10, offset = 0)
23
+ results = q.nil? ? vimscripts : search_for_string(q, vimscripts)
24
+ results = types.empty? ? results : search_for_type(types, results)
25
+ normalize_results(limit, offset, results)
26
+ end
27
+
28
+ def normalize_results(limit, offset, results)
29
+ results[offset..limit-1].map do |script|
30
+ normalize_vimscript(script)
31
+ end
32
+ end
33
+
34
+ def search_for_type(types, results)
35
+ results.delete_if do |vimscript|
36
+ !types.include?(vimscript['t'])
37
+ end
38
+ end
39
+
40
+ def search_for_string(q, results)
41
+ q = q.downcase
42
+ results.delete_if do |vimscript|
43
+ !(vimscript['n'].downcase.include?(q) or vimscript['s'].downcase.include?(q))
44
+ end
45
+ end
46
+
47
+ def get_vimscript(name)
48
+ results = vimscripts.delete_if do |vimscript|
49
+ !(vimscript['n'] == name)
50
+ end
51
+ normalize_vimscript(results.first) rescue nil
52
+ end
53
+
54
+ def normalize_vimscript(script)
55
+ { :name => script['n'], :type => script['t'],
56
+ :description => script['s'], :script_version => script['rv'],
57
+ :author => script['ra'], :author_email => script['re']
58
+ }
59
+ end
60
+
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,4 @@
1
+ module Vimpack
2
+ # FIXME: shouldn't have to have this unless statement
3
+ VERSION = "0.0.1" unless const_defined?('VERSION')
4
+ end
data/lib/vimpack.rb ADDED
@@ -0,0 +1,46 @@
1
+ require 'fileutils'
2
+ require 'tempfile'
3
+ require 'erb'
4
+ require 'pathname'
5
+ require 'open-uri'
6
+ require 'cgi'
7
+
8
+ require "bundler/setup"
9
+ #Bundler.require :default
10
+
11
+ require 'active_model'
12
+ require 'trollop'
13
+ # TODO: term-ascicolor is required by rails/rspec/cuke
14
+ # or something in rails stack me thinks...maybe us it instead
15
+ require 'rainbow'
16
+ require 'childprocess'
17
+ # TODO: let active support figure out what json to use
18
+ require 'yajl'
19
+ require 'enviro'
20
+ require 'nokogiri'
21
+ require 'octokit'
22
+
23
+ # vimpack
24
+ module Vimpack
25
+ include Enviro::Environate
26
+
27
+ autoload :Models, 'vimpack/models'
28
+ autoload :Commands, 'vimpack/commands'
29
+ module Utils
30
+ autoload :FilePath, 'vimpack/utils/file_path'
31
+ autoload :File, 'vimpack/utils/file'
32
+ autoload :Io, 'vimpack/utils/io'
33
+ autoload :Process, 'vimpack/utils/process'
34
+ autoload :Git, 'vimpack/utils/git'
35
+ autoload :Api, 'vimpack/utils/api'
36
+ autoload :Vimscripts, 'vimpack/utils/vimscripts'
37
+ autoload :Github, 'vimpack/utils/github'
38
+ end
39
+
40
+ def self.root
41
+ @root ||= Vimpack::Utils::FilePath.new(File.join(File.dirname(__FILE__), '..'))
42
+ end
43
+
44
+ end
45
+
46
+
@@ -0,0 +1,5 @@
1
+ require 'simplecov'
2
+ SimpleCov.start do
3
+ add_filter '/features/'
4
+ add_filter '/spec/'
5
+ end
@@ -0,0 +1,32 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'simplecov_setup')
2
+ require 'vimpack'
3
+
4
+ def check_git_repo(path)
5
+ res = %x{ ( cd #{path} ; git status ; cd - )2>&1 }
6
+ res.should_not match(/Not a git repo/)
7
+ end
8
+
9
+ def check_git_submodule(submodule, repo)
10
+ name = submodule.split('/')[-1]
11
+ res = %x{ ( cd #{repo} ; git submodule ; cd - )2>&1 }
12
+ res.should match(/#{name}/)
13
+ end
14
+
15
+ def check_vimpack_remote(remote_name, url)
16
+ res = %x{ cd /tmp/vimpack_home/.vimpack ; git config -l ; cd - }
17
+ res.should match(/remote.#{Regexp.escape(remote_name)}.url=#{Regexp.escape(url)}/)
18
+ end
19
+
20
+ HOME = '/tmp/vimpack_home'
21
+ ENV['HOME'] = HOME
22
+ def remove_temp_home
23
+ ::FileUtils.rm_rf(HOME) if ::File.exists?(HOME)
24
+ ::FileUtils.mkdir(HOME)
25
+ end
26
+
27
+ RSpec.configure do |config|
28
+ config.before(:each) do
29
+ remove_temp_home
30
+ end
31
+ end
32
+