vircs 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ pkg
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format p
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use --create 1.9.3@vircs
data/.travis.yml ADDED
@@ -0,0 +1,2 @@
1
+ rvm:
2
+ - 1.9.3
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vircs.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,47 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ vircs (1.0.2)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ coderay (1.0.7)
10
+ diff-lcs (1.1.3)
11
+ growl (1.0.3)
12
+ guard (1.4.0)
13
+ listen (>= 0.4.2)
14
+ thor (>= 0.14.6)
15
+ guard-rspec (1.2.1)
16
+ guard (>= 1.1)
17
+ listen (0.5.2)
18
+ method_source (0.8)
19
+ pry (0.9.10)
20
+ coderay (~> 1.0.5)
21
+ method_source (~> 0.8)
22
+ slop (~> 3.3.1)
23
+ rake (0.9.2.2)
24
+ rb-fsevent (0.9.2)
25
+ rspec (2.8.0)
26
+ rspec-core (~> 2.8.0)
27
+ rspec-expectations (~> 2.8.0)
28
+ rspec-mocks (~> 2.8.0)
29
+ rspec-core (2.8.0)
30
+ rspec-expectations (2.8.0)
31
+ diff-lcs (~> 1.1.2)
32
+ rspec-mocks (2.8.0)
33
+ slop (3.3.3)
34
+ thor (0.16.0)
35
+
36
+ PLATFORMS
37
+ ruby
38
+
39
+ DEPENDENCIES
40
+ growl
41
+ guard
42
+ guard-rspec
43
+ pry
44
+ rake
45
+ rb-fsevent
46
+ rspec
47
+ vircs!
data/Guardfile ADDED
@@ -0,0 +1,9 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'rspec', :version => 2 do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+ end
9
+
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Jeremy W. Rowe
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,108 @@
1
+ # Vircs
2
+
3
+ Vircs is a simple way of managing vim configuration files, allowing you the 'awesome' vim user to switch between a grouping of vim configuration files. (great for pairing). This is achieved by tracking, linking and unlinking vim files and folders in a common location.
4
+
5
+ ## ATTENTION!
6
+ Vircs can be destructive if you are not careful. Please read carefully, and don't hold me responsible, I back up my configuration files with git, I suggest you do the same. (with or without this tool) :) Vircs unlinks and links files/folders when switching between configuration sets. So if you haven't moved all of your .vim files into a vircs directory, they could get deleted if similarly named files are in the vircs configuration set. I warned you.
7
+
8
+ ## Installation
9
+ $ gem install vircs
10
+
11
+ or
12
+
13
+ clone the project, and then run `rake vircs:install` if you don't want to install via ruby gems (this might be prefered if running rvm)
14
+
15
+ To use vircs place the source files for vircs anywhere you wish to. (defaults location is ~/.vims).
16
+
17
+ * Create folders in the vircs folder including all of your vim
18
+ configuration in them.
19
+ EX:
20
+ /path/to/vircs/folder/config1
21
+ /path/to/vircs/folder/config2
22
+ /path/to/vircs/folder/config3
23
+
24
+ * make sure you have a .vircs file with the file path in which you
25
+ wish to store your vim configuration files in it. Defaults to
26
+ ~/.vims if one is not found. (rake vircs:install will create ~/.vims for you)
27
+
28
+ Example ~/.vircs file contents: ~/.my_super_awesome_vim_configurations
29
+
30
+ Example vircs folder structure
31
+
32
+ └── .vircs
33
+ ├── pat
34
+ │   ├── .foobartest
35
+ │   ├── .gvimrc
36
+ │   └── .vimrc
37
+ ├── sam
38
+ │   └── .gvimrc
39
+ └── vircs.current
40
+
41
+ Where 'pat' is a folder with vim configuration files for the 'pat' configuration set, and 'sam' is a folder
42
+ for the 'sam' configuration set.
43
+
44
+ ## Usage
45
+
46
+ [![Build Status](https://secure.travis-ci.org/jeremywrowe/vircs.png)](http://travis-ci.org/jeremywrowe/vircs)
47
+
48
+ COMMANDS
49
+
50
+ usage: lists this lovely help file :)
51
+ EX: vircs usage
52
+
53
+ list: lists all of the available vim configurations
54
+ EX: vircs list
55
+
56
+ use: switchs to the supplied vim configuration
57
+ EX: vircs use foo
58
+ (this will switch to the foo configuration)
59
+
60
+ current: displays the current vim configuration
61
+ EX: vircs current
62
+
63
+ dir: shows you where your configuration files are stored
64
+
65
+ prompt_info: displays the current vim configuration as follows "vircs:configx"
66
+ where configx is the current configuration
67
+ EX: vircs prompt_info
68
+
69
+ version: gem version
70
+
71
+ --------------------------------------------------
72
+
73
+ ## Contributing
74
+
75
+ 1. Fork it
76
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
77
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
78
+ 4. Push to the branch (`git push origin my-new-feature`)
79
+ 5. Create new Pull Request
80
+
81
+ ## License
82
+
83
+ What follows is the modified MIT License that applies to
84
+ vircs
85
+
86
+ Copyright © 2012 Jeremy Rowe
87
+
88
+ Permission is hereby granted, free of charge, to any person obtaining a
89
+ copy of this software and associated documentation files (the
90
+ “Software”), to deal in the Software without restriction, including
91
+ without limitation the rights to use, copy, modify, merge, publish,
92
+ distribute, sub-license, and/or sell copies of the Software, and to
93
+ permit persons to whom the Software is furnished to do so, subject to
94
+ the following conditions:
95
+
96
+ The above copyright notice, and every other copyright notice found in
97
+ this software, and all the attributions in every file, and this
98
+ permission notice shall be included in all copies or substantial
99
+ portions of the Software.
100
+
101
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS
102
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
103
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
104
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
105
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
106
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
107
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
108
+
data/Rakefile ADDED
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require 'bundler/setup'
4
+ require 'rspec/core/rake_task'
5
+ require 'fileutils'
6
+
7
+ include FileUtils::Verbose
8
+
9
+ desc 'Default: run specs.'
10
+ task :default => :spec
11
+
12
+ $here = File.expand_path(File.dirname(__FILE__))
13
+ VIRCS_EXE = "vircs"
14
+ README = "README.md"
15
+
16
+ desc "Run specs"
17
+ RSpec::Core::RakeTask.new {|t|}
18
+
19
+ namespace :vircs do
20
+
21
+ desc "Install Vircs"
22
+ task :install do
23
+ dest_dir = File.expand_path(File.join(home, ".vims"))
24
+ mkdir_p dest_dir
25
+ cp File.expand_path(File.join($here, VIRCS_EXE)), dest_dir
26
+ cp File.expand_path(File.join($here, README)), dest_dir
27
+ puts "\nInstallation almost complete, there is one last thing that needs to be done:"
28
+ puts "\tPlease add #{dest_dir} to your path!"
29
+ puts "\tOh yeah! Enjoy!"
30
+ end
31
+
32
+ private
33
+ def home
34
+ home_vars = ["HOME", "HOMEPATH"]
35
+ home = home_vars.detect {|h| ENV[h] != nil}
36
+ ENV[home]
37
+ end
38
+
39
+ end
data/bin/vircs ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ require 'vircs'
3
+
4
+ module Vircs
5
+
6
+ end
7
+
8
+
9
+ config_reader = Vircs::ConfigurationReader.new
10
+ instance = Vircs::Virc.new config_reader.configuration_path
11
+ if ARGV.size > 0
12
+ begin
13
+ command = ARGV.shift
14
+ instance.send(command, ARGV)
15
+ rescue Exception => e
16
+ puts e.message
17
+ end
18
+ else
19
+ instance.usage
20
+ end
21
+
data/lib/vircs.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'vircs/version'
2
+ require 'vircs/configuration_reader'
3
+ require 'vircs/virc'
4
+ module Vircs
5
+ end
@@ -0,0 +1,35 @@
1
+ module Vircs
2
+ class ConfigurationReader
3
+ def has_configuration?
4
+ read_vircs_file do |answer|
5
+ return !answer.nil?
6
+ end
7
+ end
8
+
9
+ def configuration_path
10
+ read_vircs_file do |answer|
11
+ return answer
12
+ end
13
+ end
14
+
15
+ private
16
+ def read_vircs_file(&block)
17
+ begin
18
+ yield File.read(File.join ENV['HOME'], '.vircs').strip
19
+ rescue
20
+ if default_path
21
+ yield default_path
22
+ else
23
+ yield nil
24
+ end
25
+ end
26
+ end
27
+
28
+ def default_path
29
+ @default_path ||= begin
30
+ path = File.join ENV['HOME'], '.vims'
31
+ File.exists?(path) ? path : nil
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1 @@
1
+ module Vircs; VERSION = "1.0.2"; end
data/lib/vircs/virc.rb ADDED
@@ -0,0 +1,144 @@
1
+ module Vircs
2
+ class Virc
3
+ require 'fileutils'
4
+ include FileUtils
5
+
6
+ def initialize(_execution_path=nil)
7
+ unless _execution_path
8
+ _execution_path = File.expand_path(File.dirname(__FILE__))
9
+ _execution_path = File.expand_path(File.dirname(File.readlink(__FILE__))) if File.symlink?(__FILE__)
10
+ end
11
+ @execution_path = _execution_path
12
+ end
13
+
14
+ def execution_path
15
+ @execution_path
16
+ end
17
+
18
+ def usage(*args)
19
+ usage = <<-USG
20
+ |===============================================================
21
+ |
22
+ | VIRCS - vim config management
23
+ |
24
+ |===============================================================
25
+ |
26
+ | usage: lists this lovely help file :)
27
+ | EX: vircs usage
28
+ |
29
+ | list: lists all of the available vim configurations
30
+ | EX: vircs list
31
+ |
32
+ | use: switchs to the supplied vim configuration
33
+ | EX: vircs use foo
34
+ | (this will switch to the foo configuration)
35
+ |
36
+ | current: displays the current vim configuration
37
+ | EX: vircs current
38
+ |
39
+ | dir: shows you where your configuration files are stored
40
+ |
41
+ | prompt_info: displays the current vim configuration as follows "vircs:config_x"
42
+ | where config_x is the current configuration
43
+ | EX: vircs prompt_info
44
+ |
45
+ | version: gem version
46
+ USG
47
+ $stdout.puts usage.gsub("|", "")
48
+ end
49
+
50
+
51
+ def list(*args)
52
+ args.flatten!
53
+ Dir[execution_path+"/*"].each do |p|
54
+ if File.directory?(p)
55
+ config = p.split("/").last
56
+ config += "*" if config == current(true)
57
+ puts config
58
+ end
59
+ end
60
+ end
61
+
62
+ def use(*args)
63
+ args.flatten!
64
+ if args.size == 1
65
+ config = args[0]
66
+ check_for(config)
67
+ unlink_current
68
+ setup_links(config)
69
+ save_current(config)
70
+ else
71
+ usage
72
+ end
73
+ end
74
+
75
+ def dir(*args)
76
+ $stdout.puts execution_path
77
+ end
78
+
79
+ def version(*args)
80
+ $stdout.puts Vircs::VERSION
81
+ end
82
+
83
+ def current(args)
84
+ path = File.read(File.join(execution_path, "vircs.current")).split("\n").first
85
+ if args
86
+ path
87
+ else
88
+ puts path
89
+ end
90
+ end
91
+
92
+ def prompt_info(args)
93
+ puts "virc:" + File.read(File.join(execution_path, "vircs.current"))
94
+ end
95
+
96
+ def method_missing(m, *args, &block)
97
+ usage
98
+ end
99
+
100
+ private
101
+
102
+ def check_for(name)
103
+ raise "Could not find '#{name}' directory in [#{execution_path}]. Perhaps do a 'virc list'" unless Dir.glob(execution_path+"/**").include?("#{execution_path}/#{name}")
104
+ end
105
+
106
+ def save_current(config)
107
+ File.open(File.join(execution_path, "vircs.current"), "w") {|f| f.puts config}
108
+ end
109
+
110
+ def unlink_current
111
+ Dir.entries("#{ENV['HOME']}").each do |path|
112
+ path = File.expand_path(File.join(ENV['HOME'], path))
113
+ next if path[-1] == '.'
114
+ if File.symlink? path
115
+ link_path = File.readlink(path)
116
+ includes_base = link_path.start_with?(execution_path)
117
+ if includes_base
118
+ File.unlink(path)
119
+ $stdout.puts "Removed [#{path}]"
120
+ end
121
+ end
122
+ end
123
+ end
124
+
125
+ def setup_links(vim_config)
126
+ vim_config_path = File.join(execution_path, vim_config)
127
+ Dir.entries("#{vim_config_path}").each do |path|
128
+ next if path[-1] == '.' or path == vim_config_path
129
+ begin
130
+ dest_path = File.join(ENV["HOME"], path)
131
+ path = File.join(vim_config_path, path) unless path.start_with? vim_config_path
132
+ File.symlink path, dest_path
133
+ puts "Added [#{dest_path}]"
134
+ rescue Exception => e
135
+ puts "#{e.message}. Continuing" if debug
136
+ end
137
+ end
138
+ end
139
+
140
+ def debug
141
+ ENV["debug"] || ENV["DEBUG"]
142
+ end
143
+ end
144
+ end
@@ -0,0 +1,40 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/spec_helper.rb")
2
+
3
+ module Vircs
4
+ describe ConfigurationReader do
5
+
6
+ describe "#configuration_path" do
7
+ it "provides the configuration path when there is one present" do
8
+ File.should_receive(:read).with(File.join(ENV['HOME'], '.vircs')).and_return "/foo/man/shoe"
9
+ subject.configuration_path.should eq "/foo/man/shoe"
10
+ end
11
+
12
+ it "provides a trimmed down path if there is extra spaces at the end of the path string" do
13
+ File.should_receive(:read).with(File.join(ENV['HOME'], '.vircs')).and_return "/foo/man/shoe "
14
+ subject.configuration_path.should eq "/foo/man/shoe"
15
+ end
16
+ it "provides a trimmed down path if there are extra spaces at the beginning of the path string" do
17
+ File.should_receive(:read).with(File.join(ENV['HOME'], '.vircs')).and_return " /foo/man/shoe"
18
+ subject.configuration_path.should eq "/foo/man/shoe"
19
+ end
20
+ it "defaults to the .vims path when a path can not be found" do
21
+ File.should_receive(:read).with(File.join(ENV['HOME'], '.vircs')).and_throw Errno::ENOENT.new
22
+ File.should_receive(:exists?).and_return true
23
+ subject.configuration_path.should eq File.join(ENV['HOME'], '.vims')
24
+ end
25
+ end
26
+
27
+ describe "#configuration_path_exists?" do
28
+ it "is true when a configuration file exists" do
29
+ File.should_receive(:read).with(File.join(ENV['HOME'], '.vircs')).and_return "/foo/man/shoe"
30
+ subject.has_configuration?.should eq true
31
+ end
32
+
33
+ it "is false when a configuration file does not exist" do
34
+ File.should_receive(:read).with(File.join(ENV['HOME'], '.vircs')).and_throw Errno::ENOENT.new
35
+ File.should_receive(:exists?).and_return false
36
+ subject.has_configuration?.should eq false
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,22 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/spec_helper.rb")
2
+
3
+ module Vircs
4
+ describe Virc do
5
+ context "#current" do
6
+ it "returns the currently set vim config if set and args are set" do
7
+ File.should_receive(:read).and_return("foo")
8
+ subject.current("some args").should eq("foo")
9
+ end
10
+
11
+ it "displays the currently set vim config if set and args are nil" do
12
+ File.should_receive(:read).and_return("foo")
13
+ capture(:stdout) { subject.current(nil) }.should eq("foo\n")
14
+ end
15
+
16
+ it "throws an exception if the current vim config is not set" do
17
+ File.should_receive(:read).and_raise("FROM DOWN TOWN")
18
+ expect { subject.current("some args") }.to raise_error("FROM DOWN TOWN")
19
+ end
20
+ end
21
+ end
22
+ end
File without changes
File without changes
File without changes
File without changes
data/spec/list_spec.rb ADDED
@@ -0,0 +1,30 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/spec_helper.rb")
2
+
3
+ module Vircs
4
+ describe Virc do
5
+ describe "#list" do
6
+ context "the directory is set to the current directory" do
7
+
8
+ subject { Virc.new File.expand_path(File.dirname(__FILE__) + '/..') }
9
+
10
+ it "lists all of the folders in the same directory as vircs" do
11
+ subject.stub_chain(:current).and_return("none_of_the_above")
12
+ capture(:stdout) { subject.list }.should eq("bin\nlib\nspec\n")
13
+ end
14
+
15
+ it "lists all of the folders in the same directory as vircs with current *'ed" do
16
+ subject.stub_chain(:current).and_return("spec")
17
+ capture(:stdout) { subject.list }.should eq("bin\nlib\nspec*\n")
18
+ end
19
+ end
20
+
21
+ context "configured path for vircs" do
22
+ subject { Virc.new File.expand_path(File.dirname(__FILE__) + '/../lib') }
23
+ it "lists all of the folders when the non standard path is specified in .vircs file" do
24
+ subject.stub_chain(:current).and_return("none_of_the_above")
25
+ capture(:stdout) { subject.list }.should eq("vircs\n")
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,16 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/spec_helper.rb")
2
+
3
+ module Vircs
4
+ describe Virc do
5
+ context "#prompt_info" do
6
+ it "raises an error when .current file doesn't exist" do
7
+ File.should_receive(:read).and_raise("File not found")
8
+ expect { subject.prompt_info(nil) }.to raise_error("File not found")
9
+ end
10
+ it "displays the current configuration" do
11
+ File.should_receive(:read).and_return("12345")
12
+ capture(:stdout){ subject.prompt_info(:foo) }.should eq("virc:12345\n")
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,27 @@
1
+ $LOAD_PATH << File.join(File.dirname(__FILE__), "..", "lib")
2
+ require 'vircs'
3
+
4
+ require 'stringio'
5
+ require 'pry'
6
+
7
+ def capture(*streams)
8
+ streams.map! { |stream| stream.to_s }
9
+ begin
10
+ result = StringIO.new
11
+ streams.each { |stream| eval "$#{stream} = result" }
12
+ yield
13
+ ensure
14
+ streams.each { |stream| eval("$#{stream} = #{stream.upcase}") }
15
+ end
16
+ result.string
17
+ end
18
+
19
+ def usage_pattern
20
+ /^.*?VIRCS - vim config management.*?SETUP.*?COMMANDS.*?usage:.*?list:.*?use:.*?current:.*?prompt_info.*$/m
21
+ end
22
+
23
+ RSpec.configure do |config|
24
+ config.treat_symbols_as_metadata_keys_with_true_values = true
25
+ config.run_all_when_everything_filtered = true
26
+ config.filter_run :focus
27
+ end
@@ -0,0 +1,15 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/spec_helper.rb")
2
+
3
+ module Vircs
4
+ describe Virc do
5
+ context "#usage" do
6
+ it "displays the porper usage" do
7
+ capture(:stdout) { subject.usage }.should =~ usage_pattern
8
+ end
9
+
10
+ it "displays usage when an improper command is provided" do
11
+ capture(:stdout) { subject.some_random_missing_method }.should =~ usage_pattern
12
+ end
13
+ end
14
+ end
15
+ end
data/spec/use_spec.rb ADDED
@@ -0,0 +1,39 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/spec_helper.rb")
2
+
3
+ module Vircs
4
+ describe Virc do
5
+ context "#use" do
6
+ context "with args" do
7
+ let(:args) { "foo" }
8
+ it "saves the current config" do
9
+ subject.should_receive(:check_for).with("foo")
10
+ subject.should_receive(:unlink_current)
11
+ subject.should_receive(:setup_links).with("foo")
12
+ subject.should_receive(:save_current).with("foo")
13
+ capture(:stdout) { subject.use(args) }.should == ""
14
+ end
15
+
16
+ it "saves the current configuration when files are present" do
17
+ subject = Virc.new File.expand_path('examples', File.dirname(__FILE__))
18
+ subject.should_receive(:check_for).with("flinstone")
19
+ subject.should_receive(:unlink_current)
20
+ # subject.setup_links: is called but we want it to execute
21
+ # but without actually creating symbolic links
22
+ File.stub(:symlink)
23
+ subject.should_receive(:save_current).with("flinstone")
24
+ capture(:stdout) { subject.use("flinstone") }.should =~ /Added\s+\[.+\/bambam\]/
25
+ end
26
+
27
+ it "raises an exception when the supplied folder is not present" do
28
+ subject.stub_chain(:check_for).and_raise("KA-BOOM")
29
+ expect { subject.use(args) }.to raise_error("KA-BOOM")
30
+ end
31
+ end
32
+ context "without args" do
33
+ it "shows usage when no args are provided" do
34
+ capture(:stdout) { subject.use }.should =~ usage_pattern
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,9 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/spec_helper.rb")
2
+
3
+ module Vircs
4
+ describe Virc do
5
+ it "should display the version" do
6
+ capture(:stdout) { subject.version }.should eq(Vircs::VERSION + "\n")
7
+ end
8
+ end
9
+ end
data/vircs ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ require 'vircs'
3
+
4
+ module Vircs
5
+
6
+ end
7
+
8
+
9
+ config_reader = Vircs::ConfigurationReader.new
10
+ instance = Vircs::Virc.new config_reader.configuration_path
11
+ if ARGV.size > 0
12
+ begin
13
+ command = ARGV.shift
14
+ instance.send(command, ARGV)
15
+ rescue Exception => e
16
+ puts e.message
17
+ end
18
+ else
19
+ instance.usage
20
+ end
21
+
data/vircs.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/vircs/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Jeremy W. Rowe"]
6
+ gem.email = ["jeremy.w.rowe@gmail.com"]
7
+ gem.summary = %q{A simplistic approach to managing vim configuration files.}
8
+
9
+ gem.files = `git ls-files`.split($\)
10
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
11
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
12
+ gem.name = "vircs"
13
+ gem.bindir = 'bin'
14
+ gem.executables = ['vircs']
15
+ gem.default_executable = 'vircs'
16
+ gem.require_paths = ["lib"]
17
+ gem.version = Vircs::VERSION
18
+
19
+ gem.add_development_dependency('rake')
20
+ gem.add_development_dependency('rspec')
21
+ gem.add_development_dependency('guard')
22
+ gem.add_development_dependency('guard-rspec')
23
+ gem.add_development_dependency('rb-fsevent')
24
+ gem.add_development_dependency('growl')
25
+ gem.add_development_dependency('pry')
26
+ end
metadata ADDED
@@ -0,0 +1,205 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vircs
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jeremy W. Rowe
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-09-30 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rspec
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: guard
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: guard-rspec
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: rb-fsevent
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: growl
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: pry
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ description:
127
+ email:
128
+ - jeremy.w.rowe@gmail.com
129
+ executables:
130
+ - vircs
131
+ extensions: []
132
+ extra_rdoc_files: []
133
+ files:
134
+ - .gitignore
135
+ - .rspec
136
+ - .rvmrc
137
+ - .travis.yml
138
+ - Gemfile
139
+ - Gemfile.lock
140
+ - Guardfile
141
+ - LICENSE
142
+ - README.md
143
+ - Rakefile
144
+ - bin/vircs
145
+ - lib/vircs.rb
146
+ - lib/vircs/configuration_reader.rb
147
+ - lib/vircs/version.rb
148
+ - lib/vircs/virc.rb
149
+ - spec/configuration_reader_spec.rb
150
+ - spec/current_spec.rb
151
+ - spec/examples/flinstone/bambam
152
+ - spec/examples/flinstone/wilma
153
+ - spec/examples/fred/barefoot
154
+ - spec/examples/fred/caveman
155
+ - spec/list_spec.rb
156
+ - spec/prompt_info_spec.rb
157
+ - spec/spec_helper.rb
158
+ - spec/usage_spec.rb
159
+ - spec/use_spec.rb
160
+ - spec/version_spec.rb
161
+ - vircs
162
+ - vircs.gemspec
163
+ homepage:
164
+ licenses: []
165
+ post_install_message:
166
+ rdoc_options: []
167
+ require_paths:
168
+ - lib
169
+ required_ruby_version: !ruby/object:Gem::Requirement
170
+ none: false
171
+ requirements:
172
+ - - ! '>='
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ segments:
176
+ - 0
177
+ hash: -702391878186625004
178
+ required_rubygems_version: !ruby/object:Gem::Requirement
179
+ none: false
180
+ requirements:
181
+ - - ! '>='
182
+ - !ruby/object:Gem::Version
183
+ version: '0'
184
+ segments:
185
+ - 0
186
+ hash: -702391878186625004
187
+ requirements: []
188
+ rubyforge_project:
189
+ rubygems_version: 1.8.24
190
+ signing_key:
191
+ specification_version: 3
192
+ summary: A simplistic approach to managing vim configuration files.
193
+ test_files:
194
+ - spec/configuration_reader_spec.rb
195
+ - spec/current_spec.rb
196
+ - spec/examples/flinstone/bambam
197
+ - spec/examples/flinstone/wilma
198
+ - spec/examples/fred/barefoot
199
+ - spec/examples/fred/caveman
200
+ - spec/list_spec.rb
201
+ - spec/prompt_info_spec.rb
202
+ - spec/spec_helper.rb
203
+ - spec/usage_spec.rb
204
+ - spec/use_spec.rb
205
+ - spec/version_spec.rb