vimmer 0.1.0
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/.autotest +1 -0
- data/.gitignore +4 -0
- data/.rspec +2 -0
- data/.rvmrc +5 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +67 -0
- data/README.mdown +31 -0
- data/Rakefile +19 -0
- data/autotest/discover.rb +1 -0
- data/bin/vimmer +3 -0
- data/cucumber.yml +5 -0
- data/features/install.feature +29 -0
- data/features/setup.feature +16 -0
- data/features/step_definitions/environment_context_steps.rb +11 -0
- data/features/step_definitions/plugin_assertion_steps.rb +10 -0
- data/features/step_definitions/plugin_context_steps.rb +6 -0
- data/features/support/curl +14 -0
- data/features/support/git +10 -0
- data/features/support/hooks.rb +7 -0
- data/features/support/setup.rb +5 -0
- data/features/support/vimmer_stub.rb +32 -0
- data/features/uninstall_plugin.feature +19 -0
- data/lib/vimmer/cli.rb +47 -0
- data/lib/vimmer/installers/github.rb +62 -0
- data/lib/vimmer/installers.rb +7 -0
- data/lib/vimmer/settings.rb +96 -0
- data/lib/vimmer/version.rb +3 -0
- data/lib/vimmer.rb +60 -0
- data/spec/install/github_spec.rb +118 -0
- data/spec/settings_spec.rb +26 -0
- data/spec/spec_helper.rb +21 -0
- data/vimmer.gemspec +32 -0
- metadata +229 -0
data/.autotest
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'autotest/growl'
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rvmrc
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
vimmer (0.0.1)
|
5
|
+
thor
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
aruba (0.2.6)
|
11
|
+
background_process
|
12
|
+
cucumber (~> 0.9.4)
|
13
|
+
autotest (4.4.2)
|
14
|
+
autotest-fsevent (0.2.3)
|
15
|
+
sys-uname
|
16
|
+
autotest-growl (0.2.6)
|
17
|
+
background_process (1.2)
|
18
|
+
builder (2.1.2)
|
19
|
+
cucumber (0.9.4)
|
20
|
+
builder (~> 2.1.2)
|
21
|
+
diff-lcs (~> 1.1.2)
|
22
|
+
gherkin (~> 2.2.9)
|
23
|
+
json (~> 1.4.6)
|
24
|
+
term-ansicolor (~> 1.0.5)
|
25
|
+
diff-lcs (1.1.2)
|
26
|
+
fakefs (0.2.1)
|
27
|
+
fuubar (0.0.2)
|
28
|
+
rspec (~> 2.0)
|
29
|
+
rspec-instafail (~> 0.1.4)
|
30
|
+
ruby-progressbar (~> 0.0.9)
|
31
|
+
gherkin (2.2.9)
|
32
|
+
json (~> 1.4.6)
|
33
|
+
term-ansicolor (~> 1.0.5)
|
34
|
+
json (1.4.6)
|
35
|
+
rr (1.0.2)
|
36
|
+
rspec (2.0.1)
|
37
|
+
rspec-core (~> 2.0.1)
|
38
|
+
rspec-expectations (~> 2.0.1)
|
39
|
+
rspec-mocks (~> 2.0.1)
|
40
|
+
rspec-core (2.0.1)
|
41
|
+
rspec-expectations (2.0.1)
|
42
|
+
diff-lcs (>= 1.1.2)
|
43
|
+
rspec-instafail (0.1.4)
|
44
|
+
rspec-mocks (2.0.1)
|
45
|
+
rspec-core (~> 2.0.1)
|
46
|
+
rspec-expectations (~> 2.0.1)
|
47
|
+
ruby-progressbar (0.0.9)
|
48
|
+
sys-uname (0.8.4)
|
49
|
+
term-ansicolor (1.0.5)
|
50
|
+
thor (0.14.4)
|
51
|
+
|
52
|
+
PLATFORMS
|
53
|
+
ruby
|
54
|
+
|
55
|
+
DEPENDENCIES
|
56
|
+
aruba
|
57
|
+
autotest
|
58
|
+
autotest-fsevent
|
59
|
+
autotest-growl
|
60
|
+
bundler (>= 1.0.0)
|
61
|
+
cucumber
|
62
|
+
fakefs
|
63
|
+
fuubar
|
64
|
+
rr
|
65
|
+
rspec (~> 2.0.0)
|
66
|
+
thor
|
67
|
+
vimmer!
|
data/README.mdown
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Vimmer: Easily manage your Vim plugins #
|
2
|
+
|
3
|
+
Vimmer makes it easy to install, remove and update Vim plugins from the following sources:
|
4
|
+
|
5
|
+
- Github
|
6
|
+
- Vim.org (coming soon)
|
7
|
+
|
8
|
+
N.B. Vimmer is a work in process. This is an early alpha release for those who want to give it a try and are willing to submit feedback. I am offering it with NO GUARANTEES. If you're still with me, you can submit your feedback at [https://github.com/densitypop/Vimmer/issues](https://github.com/densitypop/Vimmer/issues). Thank you!
|
9
|
+
|
10
|
+
## Installation and Usage ##
|
11
|
+
|
12
|
+
Installing Vimmer is as simple as running:
|
13
|
+
|
14
|
+
gem install vimmer
|
15
|
+
|
16
|
+
### Dependencies ###
|
17
|
+
|
18
|
+
Vimmer depends on the Pathogen plugin for managing Vim's runtime path. Using Pathogen, Vimmer will install plugins into ~/.vim/bundle. Installing a plugin is as simple as running:
|
19
|
+
|
20
|
+
vimmer install https://github.com/tpope/vim-fugitive.git
|
21
|
+
|
22
|
+
Restart Vim and you're done! For details on installing Pathogen see [Pathogen on Vim.org](http://www.vim.org/scripts/script.php?script_id=2332). Note: I am planning to automatically setup Pathogen during the Vimmer install process.
|
23
|
+
|
24
|
+
## Contributing to Vimmer ##
|
25
|
+
|
26
|
+
1. Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
27
|
+
2. Check out the [issue tracker](http://github.com/densitypop/Vimmer/issues) to make sure someone already hasn't requested it and/or contributed it
|
28
|
+
3. Fork the project
|
29
|
+
4. Write some tests/Cukes; implement until you're happy. This is important to make sure I don't accidentally break your fix in the future
|
30
|
+
5. Send me a pull request
|
31
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'cucumber/rake/task'
|
4
|
+
|
5
|
+
Bundler::GemHelper.install_tasks
|
6
|
+
|
7
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
8
|
+
t.cucumber_opts = "features --format pretty"
|
9
|
+
end
|
10
|
+
|
11
|
+
RSpec::Core::RakeTask.new(:spec)
|
12
|
+
|
13
|
+
task :default => [:features, :spec]
|
14
|
+
|
15
|
+
namespace :relish do
|
16
|
+
task :push do
|
17
|
+
`relish push joefiorini/vimmer`
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Autotest.add_discovery { "rspec2" }
|
data/bin/vimmer
ADDED
data/cucumber.yml
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
Feature: Install plugin
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given a directory named ".vimmer"
|
5
|
+
And a bundle path set for my system
|
6
|
+
|
7
|
+
Scenario: Install from Github
|
8
|
+
Given I have no plugins installed
|
9
|
+
When I successfully run "vimmer install 'https://github.com/tpope/vim-awesomemofo.git'"
|
10
|
+
Then a plugin named "vim-awesomemofo" should be installed
|
11
|
+
And the stdout should contain "vim-awesomemofo has been installed"
|
12
|
+
|
13
|
+
Scenario: Install from Github with bad URL
|
14
|
+
Given I have no plugins installed
|
15
|
+
When I run "vimmer install 'https://github.com/tpope/not-found.git'"
|
16
|
+
Then I should still not have any plugins installed
|
17
|
+
And it should fail with:
|
18
|
+
"""
|
19
|
+
The plugin not-found could not be found
|
20
|
+
"""
|
21
|
+
|
22
|
+
Scenario: Install from Github with a non-Github URL
|
23
|
+
Given I have no plugins installed
|
24
|
+
When I run "vimmer install 'http://example.com/bad'"
|
25
|
+
Then I should still not have any plugins installed
|
26
|
+
And it should fail with:
|
27
|
+
"""
|
28
|
+
The URL http://example.com/bad is invalid.
|
29
|
+
"""
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Feature: Setup
|
2
|
+
|
3
|
+
Scenario: Run without .vimmer directory
|
4
|
+
Given no directory named ".vimmer"
|
5
|
+
When I successfully run "vimmer install 'https://github.com/tpope/vim-awesomemofo.git'"
|
6
|
+
Then a directory named ".vimmer" should exist
|
7
|
+
And the file ".vimmer/config" should contain "bundle_path: ~/.vim/bundle"
|
8
|
+
|
9
|
+
Scenario: Run with .vimmer directory (doesn't overwrite)
|
10
|
+
Given a directory named ".vimmer"
|
11
|
+
And a file named ".vimmer/config" with:
|
12
|
+
"""
|
13
|
+
bundle_path: ~/.vim/custom_bundle
|
14
|
+
"""
|
15
|
+
When I successfully run "vimmer install 'https://github.com/tpope/vim-awesomemofo.git'"
|
16
|
+
Then the file ".vimmer/config" should contain "bundle_path: ~/.vim/custom_bundle"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Given /^a bundle path set for my system$/ do
|
2
|
+
bundle_path = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "tmp", "aruba", "bundle"))
|
3
|
+
Given 'a file named ".vimmer/config" with:', "bundle_path: #{bundle_path}"
|
4
|
+
end
|
5
|
+
|
6
|
+
Given /^no directory named "([^"]*)"$/ do |directory|
|
7
|
+
in_current_dir do
|
8
|
+
FileUtils.rm_rf(directory)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Then /^a plugin named "([^"]*)" should be installed$/ do |name|
|
2
|
+
@vimmer.installed_plugins.should include(name)
|
3
|
+
@vimmer.plugin_store[name].should =~ %r{https://github.com/tpope/vim-awesomemofo.git}
|
4
|
+
end
|
5
|
+
|
6
|
+
Then /^I should still not have any plugins installed$/ do
|
7
|
+
@vimmer.installed_plugins.should be_empty
|
8
|
+
@vimmer.plugin_store.should == {}
|
9
|
+
end
|
10
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class VimmerStub
|
2
|
+
|
3
|
+
def installed_plugins
|
4
|
+
bundle_path.entries.map do |entry|
|
5
|
+
next if entry.to_s =~ /^\.\.?$/
|
6
|
+
|
7
|
+
entry = bundle_path.join(entry)
|
8
|
+
if entry.directory?
|
9
|
+
entry.split.last.to_s
|
10
|
+
end
|
11
|
+
end.compact
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
def plugin_store
|
16
|
+
if plugin_store_file.exist?
|
17
|
+
YAML.load_file(plugin_store_file)
|
18
|
+
else
|
19
|
+
{}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def plugin_store_file
|
24
|
+
Pathname.new("tmp/aruba/.vimmer/plugins.yml")
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
def bundle_path
|
29
|
+
Pathname.new("tmp/aruba/bundle")
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Feature: Uninstall plugin
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given a directory named ".vimmer"
|
5
|
+
And a bundle path set for my system
|
6
|
+
And I have no plugins installed
|
7
|
+
|
8
|
+
Scenario: Uninstall from Github
|
9
|
+
When I successfully run "vimmer install 'https://github.com/tpope/vim-awesomemofo.git'"
|
10
|
+
And I successfully run "vimmer uninstall 'vim-awesomemofo'"
|
11
|
+
Then I should still not have any plugins installed
|
12
|
+
|
13
|
+
Scenario: Attempt to uninstall a plugin that is not installed
|
14
|
+
When I run "vimmer uninstall not_installed"
|
15
|
+
Then it should fail with:
|
16
|
+
"""
|
17
|
+
The plugin not_installed is not installed.
|
18
|
+
"""
|
19
|
+
|
data/lib/vimmer/cli.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'vimmer'
|
3
|
+
|
4
|
+
module Vimmer
|
5
|
+
class CLI < Thor
|
6
|
+
|
7
|
+
desc "install PATH", "Installs plugin available at path PATH"
|
8
|
+
def install(path)
|
9
|
+
setup
|
10
|
+
begin
|
11
|
+
installer = Vimmer::Installers::Github.new(:path => path)
|
12
|
+
installer.install
|
13
|
+
rescue Vimmer::InvalidPathError => e
|
14
|
+
$stderr.puts "The URL #{e.path} is invalid."
|
15
|
+
exit 1
|
16
|
+
rescue Vimmer::PluginNotFoundError
|
17
|
+
$stderr.puts "The plugin #{installer.plugin_name} could not be found"
|
18
|
+
exit 1
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
desc "uninstall NAME", "Removes plugin named NAME"
|
24
|
+
def uninstall(name)
|
25
|
+
unless Vimmer.plugin?(name)
|
26
|
+
$stderr.puts "The plugin #{name} is not installed."
|
27
|
+
exit 1
|
28
|
+
end
|
29
|
+
installer = Vimmer::Installers::Github.new(:name => name)
|
30
|
+
installer.uninstall
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def setup
|
36
|
+
Vimmer.setup
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
def method_missing(name, *args)
|
41
|
+
$stderr.puts 'Could not find command "%s".' % name
|
42
|
+
exit 1
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Vimmer
|
2
|
+
module Installers
|
3
|
+
class Github
|
4
|
+
attr_reader :path, :plugin_name
|
5
|
+
|
6
|
+
def initialize(args={})
|
7
|
+
if args[:path]
|
8
|
+
initialize_with_path(args[:path])
|
9
|
+
elsif args[:name]
|
10
|
+
initialize_with_name(args[:name])
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
def install
|
16
|
+
if path_exists?
|
17
|
+
git_clone(path, File.join(Vimmer.bundle_path, plugin_name))
|
18
|
+
Vimmer.add_plugin(plugin_name, path)
|
19
|
+
puts "#{plugin_name} has been installed"
|
20
|
+
else
|
21
|
+
raise Vimmer::PluginNotFoundError
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
def uninstall
|
27
|
+
FileUtils.rm_rf(File.join(Vimmer.bundle_path, plugin_name))
|
28
|
+
Vimmer.remove_plugin(plugin_name)
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
def path_exists?
|
33
|
+
`curl --head -w %{http_code} -o /dev/null #{remove_extension(path)} 2> /dev/null`.chomp == "200"
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def git_clone(path, install_to)
|
40
|
+
output = `git clone #{path} #{install_to}`
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
def initialize_with_path(path)
|
45
|
+
raise Vimmer::InvalidPathError.new(path) unless path =~ %r{^https://github.com/[a-zA-Z0-9\-_\+%]+/([a-zA-Z0-9\-_\+]+).git$}
|
46
|
+
@plugin_name = $1
|
47
|
+
@path = path
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
def initialize_with_name(name)
|
52
|
+
@path = Vimmer.plugins[name]
|
53
|
+
@plugin_name = name
|
54
|
+
end
|
55
|
+
|
56
|
+
def remove_extension(path)
|
57
|
+
path.gsub(/\.git$/, '')
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
module Vimmer
|
5
|
+
class Settings
|
6
|
+
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@config = load_config(config_file)
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
def [](key)
|
14
|
+
value = @config[key.to_s]
|
15
|
+
if value && (File.directory?(value) || File.file?(value))
|
16
|
+
Pathname.new(value)
|
17
|
+
else
|
18
|
+
value
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
def config_file
|
24
|
+
config_root.join("config")
|
25
|
+
end
|
26
|
+
|
27
|
+
def plugin_store_file
|
28
|
+
@plugin_store_file ||= config_root.join("plugins.yml")
|
29
|
+
end
|
30
|
+
|
31
|
+
def config_root
|
32
|
+
Pathname.new(ENV['VIMMER_HOME'] || File.join(Gem.user_home, ".vimmer"))
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
def create_vimmer_home!
|
37
|
+
FileUtils.mkdir_p(config_root.to_s)
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
def create_default_config_file!
|
42
|
+
return if File.exist?(config_file.to_s)
|
43
|
+
write_default_config_file
|
44
|
+
@config = load_config(config_file)
|
45
|
+
end
|
46
|
+
|
47
|
+
def write_default_config_file
|
48
|
+
File.open(config_file.to_s, "w") do |f|
|
49
|
+
f << "bundle_path: ~/.vim/bundle"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
def add_plugin(name, path)
|
55
|
+
existing_plugins = plugins.dup
|
56
|
+
existing_plugins.merge!(name => path)
|
57
|
+
|
58
|
+
write_to_manifest(existing_plugins)
|
59
|
+
end
|
60
|
+
|
61
|
+
def remove_plugin(name)
|
62
|
+
existing_plugins = plugins.dup
|
63
|
+
existing_plugins.delete(name)
|
64
|
+
|
65
|
+
write_to_manifest(existing_plugins)
|
66
|
+
end
|
67
|
+
|
68
|
+
def plugins
|
69
|
+
@plugins = if !File.exist?(plugin_store_file.to_s)
|
70
|
+
write_to_manifest({})
|
71
|
+
end
|
72
|
+
|
73
|
+
read_from_manifest
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
def read_from_manifest
|
78
|
+
YAML.load_file(plugin_store_file.to_s)
|
79
|
+
end
|
80
|
+
|
81
|
+
def write_to_manifest(hash)
|
82
|
+
File.open(plugin_store_file.to_s, "w") do |f|
|
83
|
+
f << hash.to_yaml
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def load_config(config_file)
|
88
|
+
if File.exist?(config_file)
|
89
|
+
YAML.load_file(config_file)
|
90
|
+
else
|
91
|
+
{}
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
end
|
data/lib/vimmer.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
module Vimmer
|
2
|
+
|
3
|
+
autoload :Installers, 'vimmer/installers'
|
4
|
+
autoload :Settings, 'vimmer/settings'
|
5
|
+
autoload :PluginPath, 'vimmer/plugin_path'
|
6
|
+
autoload :Plugin, 'vimmer/plugin'
|
7
|
+
|
8
|
+
class PluginNotFoundError < StandardError; end
|
9
|
+
class InvalidPathError < StandardError
|
10
|
+
attr_accessor :path
|
11
|
+
|
12
|
+
def initialize(path)
|
13
|
+
@path = path
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
def bundle_path
|
19
|
+
settings[:bundle_path]
|
20
|
+
end
|
21
|
+
module_function :bundle_path
|
22
|
+
|
23
|
+
|
24
|
+
def settings
|
25
|
+
@settings ||= Settings.new
|
26
|
+
end
|
27
|
+
module_function :settings
|
28
|
+
|
29
|
+
|
30
|
+
def add_plugin(name, path)
|
31
|
+
settings.add_plugin(name, path)
|
32
|
+
end
|
33
|
+
module_function :add_plugin
|
34
|
+
|
35
|
+
|
36
|
+
def remove_plugin(name)
|
37
|
+
settings.remove_plugin(name)
|
38
|
+
end
|
39
|
+
module_function :remove_plugin
|
40
|
+
|
41
|
+
|
42
|
+
def plugin?(name)
|
43
|
+
plugins.key?(name)
|
44
|
+
end
|
45
|
+
module_function :plugin?
|
46
|
+
|
47
|
+
def plugins
|
48
|
+
settings.plugins
|
49
|
+
end
|
50
|
+
module_function :plugins
|
51
|
+
|
52
|
+
|
53
|
+
def setup
|
54
|
+
settings.create_vimmer_home!
|
55
|
+
settings.create_default_config_file!
|
56
|
+
end
|
57
|
+
module_function :setup
|
58
|
+
|
59
|
+
|
60
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Vimmer::Installers
|
4
|
+
|
5
|
+
describe "When installing from Github" do
|
6
|
+
|
7
|
+
FOUND_URL = "https://github.com/tpope/vim-awesomemofo.git"
|
8
|
+
NOT_FOUND_URL = "https://github.com/tpope/not-found.git"
|
9
|
+
|
10
|
+
context "with a non-existant URL" do
|
11
|
+
|
12
|
+
let(:installer) { Github.new(:path => NOT_FOUND_URL) }
|
13
|
+
|
14
|
+
before do
|
15
|
+
stub(installer).path_exists? { false }
|
16
|
+
stub(installer).git_clone
|
17
|
+
end
|
18
|
+
|
19
|
+
specify "the installer should raise an exception" do
|
20
|
+
lambda { installer.install }.should raise_error(Vimmer::PluginNotFoundError)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
context "with a good URL" do
|
26
|
+
|
27
|
+
let(:installer) { Github.new(:path => FOUND_URL) }
|
28
|
+
|
29
|
+
before do
|
30
|
+
stub(installer).git_clone
|
31
|
+
stub(installer).path_exists? { true }
|
32
|
+
end
|
33
|
+
|
34
|
+
specify "the installer should not raise an exception" do
|
35
|
+
lambda { installer.install }.should_not raise_error
|
36
|
+
end
|
37
|
+
|
38
|
+
specify "the installer calculates the plugin's name" do
|
39
|
+
installer.plugin_name.should == "vim-awesomemofo"
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
context "with a malformed URL" do
|
45
|
+
|
46
|
+
subject { Github.new(:path => "https://foo.com/bar") }
|
47
|
+
|
48
|
+
specify "the installer should raise an exception" do
|
49
|
+
lambda { subject }.should raise_error(Vimmer::InvalidPathError)
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
it "provides access to the path" do
|
55
|
+
Github.new(:path => FOUND_URL).
|
56
|
+
path.should == FOUND_URL
|
57
|
+
end
|
58
|
+
|
59
|
+
it "adds plugin to list of installed plugins" do
|
60
|
+
|
61
|
+
installer = Github.new(:path => FOUND_URL)
|
62
|
+
|
63
|
+
stub(installer).path_exists? { true }
|
64
|
+
stub(installer).git_clone
|
65
|
+
|
66
|
+
installer.install
|
67
|
+
|
68
|
+
Vimmer.plugins["vim-awesomemofo"].should == FOUND_URL
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
def stub_for_install!(installer)
|
73
|
+
|
74
|
+
stub(Vimmer).bundle_path do
|
75
|
+
Pathname.new("tmp/bundle")
|
76
|
+
end
|
77
|
+
|
78
|
+
stub(installer).git_clone do
|
79
|
+
FileUtils.mkdir_p(Vimmer.bundle_path.join("vim-awesomemofo", "plugins"))
|
80
|
+
FileUtils.touch(Vimmer.bundle_path.join("vim-awesomemofo", "plugins", "vim-awesomemofo.vim"))
|
81
|
+
end
|
82
|
+
|
83
|
+
stub(installer).path_exists? { true }
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
|
88
|
+
it "installs the plugin" do
|
89
|
+
|
90
|
+
installer = Github.new(:path => FOUND_URL)
|
91
|
+
|
92
|
+
stub_for_install! installer
|
93
|
+
|
94
|
+
installer.install
|
95
|
+
|
96
|
+
plugin_path = Vimmer.bundle_path.join("vim-awesomemofo")
|
97
|
+
File.directory?(plugin_path.to_s).should be_true
|
98
|
+
File.directory?(plugin_path.join("plugins").to_s).should be_true
|
99
|
+
File.file?(plugin_path.join("plugins", "vim-awesomemofo.vim")).should be_true
|
100
|
+
end
|
101
|
+
|
102
|
+
it "uninstalls the plugin" do
|
103
|
+
|
104
|
+
installer = Github.new(:name => "vim-awesomemofo")
|
105
|
+
|
106
|
+
stub_for_install! installer
|
107
|
+
|
108
|
+
installer.install
|
109
|
+
|
110
|
+
installer.uninstall
|
111
|
+
|
112
|
+
plugin_path = Vimmer.bundle_path.join("vim-awesomemofo")
|
113
|
+
File.directory?(plugin_path.to_s).should be_false
|
114
|
+
File.directory?(plugin_path.join("plugins").to_s).should be_false
|
115
|
+
end
|
116
|
+
|
117
|
+
|
118
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ".vimmer/" do
|
4
|
+
|
5
|
+
let(:settings) { Vimmer::Settings.new }
|
6
|
+
|
7
|
+
it "can be moved with an environment variable" do
|
8
|
+
ENV['VIMMER_HOME'] = app_root.join("tmp", ".vimmer").to_s
|
9
|
+
settings.config_root.relative_path_from(app_root).to_s.should == "tmp/.vimmer"
|
10
|
+
settings.config_file.relative_path_from(app_root).to_s.should == "tmp/.vimmer/config"
|
11
|
+
ENV['VIMMER_HOME'] = nil
|
12
|
+
end
|
13
|
+
|
14
|
+
it "creates the .vimmer directory" do
|
15
|
+
settings.create_vimmer_home!
|
16
|
+
settings.config_root.should exist
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
it "creates the config file" do
|
21
|
+
settings.create_default_config_file!
|
22
|
+
settings.config_file.should exist
|
23
|
+
File.read(settings.config_file).should =~ /bundle_path: ~\/.vim\/bundle/
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
|
3
|
+
$:.unshift File.expand_path('..', __FILE__)
|
4
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
5
|
+
|
6
|
+
require 'vimmer'
|
7
|
+
|
8
|
+
require 'fakefs/spec_helpers'
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
|
12
|
+
config.mock_with :rr
|
13
|
+
|
14
|
+
config.include FakeFS::SpecHelpers
|
15
|
+
|
16
|
+
def app_root
|
17
|
+
Pathname.new(File.join(__FILE__, "..", "tmp", ".vimmer"))
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
end
|
data/vimmer.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "vimmer/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "vimmer"
|
7
|
+
s.version = Vimmer::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Joe Fiorini"]
|
10
|
+
s.email = ["joe@densitypop.com"]
|
11
|
+
s.homepage = "http://rubygems.org/gems/vimmer"
|
12
|
+
s.summary = %q{Automated Vim plugin management}
|
13
|
+
s.description = %q{Install, update and remove Vim plugins without changing directories using this simple command line utility.}
|
14
|
+
|
15
|
+
s.rubyforge_project = "vimmer"
|
16
|
+
|
17
|
+
s.add_dependency "thor"
|
18
|
+
|
19
|
+
s.add_development_dependency "bundler", ">=1.0.0"
|
20
|
+
s.add_development_dependency "rspec", "~> 2.0.0"
|
21
|
+
s.add_development_dependency "cucumber"
|
22
|
+
s.add_development_dependency "autotest"
|
23
|
+
s.add_development_dependency "fuubar"
|
24
|
+
s.add_development_dependency "fakefs"
|
25
|
+
s.add_development_dependency "aruba"
|
26
|
+
s.add_development_dependency "rr"
|
27
|
+
|
28
|
+
s.files = `git ls-files`.split("\n")
|
29
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
30
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
31
|
+
s.require_paths = ["lib"]
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,229 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vimmer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Joe Fiorini
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-11-22 00:00:00 -05:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: thor
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
type: :runtime
|
32
|
+
version_requirements: *id001
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: bundler
|
35
|
+
prerelease: false
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 1
|
43
|
+
- 0
|
44
|
+
- 0
|
45
|
+
version: 1.0.0
|
46
|
+
type: :development
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rspec
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ~>
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
segments:
|
57
|
+
- 2
|
58
|
+
- 0
|
59
|
+
- 0
|
60
|
+
version: 2.0.0
|
61
|
+
type: :development
|
62
|
+
version_requirements: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: cucumber
|
65
|
+
prerelease: false
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
74
|
+
type: :development
|
75
|
+
version_requirements: *id004
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: autotest
|
78
|
+
prerelease: false
|
79
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
segments:
|
85
|
+
- 0
|
86
|
+
version: "0"
|
87
|
+
type: :development
|
88
|
+
version_requirements: *id005
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: fuubar
|
91
|
+
prerelease: false
|
92
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
version: "0"
|
100
|
+
type: :development
|
101
|
+
version_requirements: *id006
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: fakefs
|
104
|
+
prerelease: false
|
105
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
segments:
|
111
|
+
- 0
|
112
|
+
version: "0"
|
113
|
+
type: :development
|
114
|
+
version_requirements: *id007
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: aruba
|
117
|
+
prerelease: false
|
118
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
119
|
+
none: false
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
segments:
|
124
|
+
- 0
|
125
|
+
version: "0"
|
126
|
+
type: :development
|
127
|
+
version_requirements: *id008
|
128
|
+
- !ruby/object:Gem::Dependency
|
129
|
+
name: rr
|
130
|
+
prerelease: false
|
131
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
132
|
+
none: false
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
segments:
|
137
|
+
- 0
|
138
|
+
version: "0"
|
139
|
+
type: :development
|
140
|
+
version_requirements: *id009
|
141
|
+
description: Install, update and remove Vim plugins without changing directories using this simple command line utility.
|
142
|
+
email:
|
143
|
+
- joe@densitypop.com
|
144
|
+
executables:
|
145
|
+
- vimmer
|
146
|
+
extensions: []
|
147
|
+
|
148
|
+
extra_rdoc_files: []
|
149
|
+
|
150
|
+
files:
|
151
|
+
- .autotest
|
152
|
+
- .gitignore
|
153
|
+
- .rspec
|
154
|
+
- .rvmrc
|
155
|
+
- Gemfile
|
156
|
+
- Gemfile.lock
|
157
|
+
- README.mdown
|
158
|
+
- Rakefile
|
159
|
+
- autotest/discover.rb
|
160
|
+
- bin/vimmer
|
161
|
+
- cucumber.yml
|
162
|
+
- features/install.feature
|
163
|
+
- features/setup.feature
|
164
|
+
- features/step_definitions/environment_context_steps.rb
|
165
|
+
- features/step_definitions/plugin_assertion_steps.rb
|
166
|
+
- features/step_definitions/plugin_context_steps.rb
|
167
|
+
- features/support/curl
|
168
|
+
- features/support/git
|
169
|
+
- features/support/hooks.rb
|
170
|
+
- features/support/setup.rb
|
171
|
+
- features/support/vimmer_stub.rb
|
172
|
+
- features/uninstall_plugin.feature
|
173
|
+
- lib/vimmer.rb
|
174
|
+
- lib/vimmer/cli.rb
|
175
|
+
- lib/vimmer/installers.rb
|
176
|
+
- lib/vimmer/installers/github.rb
|
177
|
+
- lib/vimmer/settings.rb
|
178
|
+
- lib/vimmer/version.rb
|
179
|
+
- spec/install/github_spec.rb
|
180
|
+
- spec/settings_spec.rb
|
181
|
+
- spec/spec_helper.rb
|
182
|
+
- vimmer.gemspec
|
183
|
+
has_rdoc: true
|
184
|
+
homepage: http://rubygems.org/gems/vimmer
|
185
|
+
licenses: []
|
186
|
+
|
187
|
+
post_install_message:
|
188
|
+
rdoc_options: []
|
189
|
+
|
190
|
+
require_paths:
|
191
|
+
- lib
|
192
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
194
|
+
requirements:
|
195
|
+
- - ">="
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
segments:
|
198
|
+
- 0
|
199
|
+
version: "0"
|
200
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
202
|
+
requirements:
|
203
|
+
- - ">="
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
segments:
|
206
|
+
- 0
|
207
|
+
version: "0"
|
208
|
+
requirements: []
|
209
|
+
|
210
|
+
rubyforge_project: vimmer
|
211
|
+
rubygems_version: 1.3.7
|
212
|
+
signing_key:
|
213
|
+
specification_version: 3
|
214
|
+
summary: Automated Vim plugin management
|
215
|
+
test_files:
|
216
|
+
- features/install.feature
|
217
|
+
- features/setup.feature
|
218
|
+
- features/step_definitions/environment_context_steps.rb
|
219
|
+
- features/step_definitions/plugin_assertion_steps.rb
|
220
|
+
- features/step_definitions/plugin_context_steps.rb
|
221
|
+
- features/support/curl
|
222
|
+
- features/support/git
|
223
|
+
- features/support/hooks.rb
|
224
|
+
- features/support/setup.rb
|
225
|
+
- features/support/vimmer_stub.rb
|
226
|
+
- features/uninstall_plugin.feature
|
227
|
+
- spec/install/github_spec.rb
|
228
|
+
- spec/settings_spec.rb
|
229
|
+
- spec/spec_helper.rb
|