neobundle 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 350829563c57e414fb95e1ed8429f6bd516f895f
4
- data.tar.gz: 77170cadbd091451248eb29787cf7286deb48b06
3
+ metadata.gz: 2aefb45def0d65d413a8284f14977efe9a5182f8
4
+ data.tar.gz: c21f0faccf35b7dca1025c901523c32c892848df
5
5
  SHA512:
6
- metadata.gz: b2a610737b1bdc2672185702f098f34c1b8ddd1a7c4177399785f23b57f03166f49093d231df920ebbeed723039cb22dbf0162b439709ec57e27ca16e3b11775
7
- data.tar.gz: cbb2f04444ef8c21f8b8baf46a48880b1503af037c6bfc21e3cfcf4e777d596ba88571e0e3a63acb6a37578bcf69cd3d758127282556b49bd02a4d8acfdea3cc
6
+ metadata.gz: 96f0c084333464bdf26db0b3e07dbee4f5a527aa64097e67e33786c5e938c3f3abf538def2aee4fd45d6705dea180879a37770c4aff76e683cd9cc958dfc4148
7
+ data.tar.gz: 5584b4802699004611e910431d9c6cc07746ef2463a4f897fb3d8f9f6d345c47a71cb9bc995bbd0a859c6a2829f4db791a5e6bbf6eeb0a1dfdc758dfc0cf90e1
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ ## [0.2.0](https://github.com/mrk21/neobundle-cmd/tree/v0.2.0) - 2014-07-26
4
+
5
+ * Future [#22](https://github.com/mrk21/neobundle-cmd/issues/22): Make the help message into detail
6
+ * Future [#21](https://github.com/mrk21/neobundle-cmd/issues/21): In the Vim script execution, stop outputting an empty string
7
+ * Future [#20](https://github.com/mrk21/neobundle-cmd/issues/20): Change the command return value
8
+ * Future [#19](https://github.com/mrk21/neobundle-cmd/issues/19): Add the newly `-v` option for displaying the version, and add the description of the `--help` option and `--version` option to the help message
9
+ * Future [#18](https://github.com/mrk21/neobundle-cmd/issues/18): Ameliorate the Vim script execution
10
+ * Future [#17](https://github.com/mrk21/neobundle-cmd/issues/17): Rename to the `--bundlefile` option from the `--vimrc` option
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # NeoBundle
1
+ # NeoBundle CMD
2
2
 
3
3
  [NeoBundle](https://github.com/Shougo/neobundle.vim "Shougo/neobundle.vim") command line tools.
4
4
 
@@ -54,7 +54,7 @@ The structure of the command line is shown below:
54
54
 
55
55
  ```bash
56
56
  $ neobundle [--help] [--version]
57
- [--vim=<path>] [--vimrc=<path>]
57
+ [--vim=<path>] [--bundlefile=<path>] [--verbose=<level>]
58
58
  <command>
59
59
  ```
60
60
 
@@ -62,8 +62,8 @@ $ neobundle [--help] [--version]
62
62
 
63
63
  #### install
64
64
 
65
- This command will install the Vim plugins by the NeoBundle which is described the `vimrc`.
66
- It equals the `:NeoBundleInstall` vim command.
65
+ This command will install the Vim plugins by the NeoBundle which is described the bundle file.
66
+ It equals the `:NeoBundleInstall` Vim command.
67
67
 
68
68
  ```bash
69
69
  $ neobundle install
@@ -72,7 +72,7 @@ $ neobundle install
72
72
  #### clean
73
73
 
74
74
  This command will delete the Vim plugins which is unused.
75
- It equals the `:NeoBundleClean!` vim command.
75
+ It equals the `:NeoBundleClean!` Vim command.
76
76
 
77
77
  ```bash
78
78
  $ neobundle clean
@@ -80,8 +80,8 @@ $ neobundle clean
80
80
 
81
81
  #### list
82
82
 
83
- This command will enumerate the Vim plugins by the NeoBundle which is described the `vimrc`.
84
- It equals the `:NeoBundleList` vim command.
83
+ This command will enumerate the Vim plugins by the NeoBundle which is described the bundle file.
84
+ It equals the `:NeoBundleList` Vim command.
85
85
 
86
86
  ```bash
87
87
  $ neobundle list
@@ -91,21 +91,21 @@ $ neobundle list
91
91
 
92
92
  #### --vim
93
93
 
94
- This option designates the vim command location.
94
+ This option designates the `vim` command location.
95
95
 
96
96
  ```bash
97
- --vim=<path>
97
+ -c <path>, --vim=<path>
98
98
  ```
99
99
 
100
100
  The default value is `vim`, and this case is searched from the `PATH` environment variable by the system.
101
101
  Also, this value is able to overriden by the `NEOBUNDLE_CMD_VIM` environment variable.
102
102
 
103
- #### --vimrc
103
+ #### --bundlefile
104
104
 
105
- This option designates the vimrc location.
105
+ This option designates the bundle file location.
106
106
 
107
107
  ```bash
108
- --vimrc=<path>
108
+ -f <path>, --bundlefile=<path>
109
109
  ```
110
110
 
111
111
  The default value is shown below:
@@ -115,7 +115,30 @@ The default value is shown below:
115
115
  | Mac OS X and Linux | $HOME/.vimrc |
116
116
  | Windows | %USERPROFILE%\\\_vimrc |
117
117
 
118
- Also, this value is able to overriden by the `NEOBUNDLE_CMD_VIMRC` environment variable.
118
+ Also, this value is able to overriden by the `NEOBUNDLE_CMD_BUNDLEFILE` environment variable.
119
+
120
+ #### --verbose
121
+
122
+ This option is the Vim script log level. In the ordinary, do not need to use this option,
123
+ but for example, when wanted to trace the errors of the bundle file, this option will assist.
124
+
125
+ ```bash
126
+ -V <level>, --verbose=<level>
127
+ ```
128
+
129
+ The default value is 0.
130
+
131
+ ### return value
132
+
133
+ This command return value is listed below:
134
+
135
+ | value | state |
136
+ | ----- | ----- |
137
+ | 0 | Success |
138
+ | 1 | Error |
139
+ | 2 | No operation |
140
+
141
+ *NOTE: The "No operation" return value will be returned when the command of the `install` or `clean` did nothing.*
119
142
 
120
143
  ## Contributing
121
144
 
@@ -3,11 +3,11 @@ require 'rake/pathmap'
3
3
 
4
4
  module NeoBundle
5
5
  class Error < StandardError; def status; 1 end end
6
- class VimscriptError < Error; def status; 2 end end
7
- class NeoBundleNotFoundError < Error; def status; 3 end end
8
- class OperationAlreadyCompletedError < Error; def status; 4 end end
9
- class CommandLineError < Error; def status; 5 end end
10
- class VimCommandError < Error; def status; 6 end end
6
+ class VimCommandError < Error; end
7
+ class VimscriptError < Error; end
8
+ class NeoBundleError < Error; end
9
+ class CommandLineError < Error; end
10
+ class OperationAlreadyCompletedError < Error; def status; 2 end end
11
11
  end
12
12
 
13
13
  Dir[__FILE__.pathmap('%X/*.rb')].each do |rb|
@@ -20,7 +20,7 @@ module NeoBundle
20
20
  rescue Exception => e
21
21
  $stderr.puts e.inspect
22
22
  $stderr.puts e.backtrace
23
- exit 255
23
+ exit 1
24
24
  else
25
25
  exit 0
26
26
  end
@@ -31,37 +31,16 @@ module NeoBundle
31
31
  command: nil,
32
32
  config: {}
33
33
  }
34
- opt = OptionParser.new
35
- opt.version = NeoBundle::VERSION
36
- opt.banner = <<-SH.gsub(/^( {2}){4}/,'')
37
- Usage: neobundle [--help] [--version]
38
- [--vim=<path>] [--vimrc=<path>]
39
- <command>
40
-
41
- commands:
42
- install:
43
- $ neobundle install
44
-
45
- clean:
46
- $ neobundle clean
47
-
48
- list:
49
- $ neobundle list
50
-
51
- options:
52
- SH
53
-
54
- opt.on('--vim=<path>','Path to the vim command.'){|v| @arguments[:config][:vim] = v}
55
- opt.on('--vimrc=<path>','Path to the vimrc.'){|v| @arguments[:config][:vimrc] = v}
56
- opt.order!(args)
57
-
34
+ parser = self.option_parser
35
+ parser.order!(args)
58
36
  command = args.shift.to_s.intern
37
+
59
38
  case command
60
39
  when :install, :clean, :list then
61
40
  @arguments[:command] = command
62
- opt.parse!(args)
41
+ parser.permute!(args)
63
42
  when :'', :help then
64
- opt.parse(['--help'])
43
+ parser.permute(['--help'])
65
44
  else
66
45
  raise NeoBundle::CommandLineError, 'Invalid command: %s' % command
67
46
  end
@@ -73,5 +52,110 @@ module NeoBundle
73
52
  runner = Runner.new(self.arguments[:config])
74
53
  runner.send(self.arguments[:command])
75
54
  end
55
+
56
+ protected
57
+
58
+ def option_parser
59
+ desc = lambda do |str|
60
+ lines = str.split(/\n/)
61
+ indent = lines.map{|v| v.match(/^ +/).to_a[0].to_s.length}.min
62
+ lines.map{|v| v[indent..-1].rstrip}.join("\n")
63
+ end
64
+
65
+ summary = lambda do |parser, name, description, pos|
66
+ result = ' '*100
67
+ result[0] = name.to_s
68
+ result[pos+1] = desc[description]
69
+ result = parser.summary_indent + result.rstrip
70
+ parser.separator result
71
+ end
72
+
73
+ parser = OptionParser.new
74
+ parser.summary_indent = ' '*3
75
+ parser.summary_width = 25
76
+ parser.version = NeoBundle::VERSION
77
+ parser.banner = desc[<<-DESC]
78
+ Usage: neobundle [--help] [--version]
79
+ [--vim=<path>] [--bundlefile=<path>] [--verbose=<level>]
80
+ <command>
81
+ DESC
82
+
83
+ parser.separator ''
84
+ parser.separator 'commands:'
85
+ begin
86
+ pos = 9
87
+
88
+ summary[parser, :install, <<-DESC, pos]
89
+ Install the Vim plugins
90
+ DESC
91
+
92
+ summary[parser, :clean, <<-DESC, pos]
93
+ Delete the unused Vim plugins
94
+ DESC
95
+
96
+ summary[parser, :list, <<-DESC, pos]
97
+ Enumerate the Vim plugins
98
+ DESC
99
+
100
+ summary[parser, :help, <<-DESC, pos]
101
+ Show this message
102
+ DESC
103
+ end
104
+
105
+ parser.separator ''
106
+ parser.separator 'options:'
107
+ begin
108
+ parser.on('-c <path>', '--vim=<path>', String, desc[<<-DESC]) do |v|
109
+ Path to the vim command
110
+ DESC
111
+ @arguments[:config][:vim] = v
112
+ end
113
+
114
+ parser.on('-f <path>', '--bundlefile=<path>', String, desc[<<-DESC]) do |v|
115
+ Path to the bundle file
116
+ DESC
117
+ @arguments[:config][:bundlefile] = v
118
+ end
119
+
120
+ parser.on('-V <level>', '--verbose=<level>', Integer, desc[<<-DESC]) do |v|
121
+ Show the detail log
122
+ DESC
123
+ @arguments[:config][:verbose] = v
124
+ end
125
+ end
126
+
127
+ parser.separator ''
128
+ begin
129
+ parser.on('-h', '--help', 'Show this message') do
130
+ puts parser.help
131
+ exit
132
+ end
133
+
134
+ parser.on('-v', '--version', 'Show version') do
135
+ puts parser.ver
136
+ exit
137
+ end
138
+ end
139
+
140
+ parser.separator ''
141
+ parser.separator 'return value:'
142
+ begin
143
+ pos = 3
144
+
145
+ summary[parser, '0', <<-DESC, pos]
146
+ Success
147
+ DESC
148
+
149
+ summary[parser, '1', <<-DESC, pos]
150
+ Error
151
+ DESC
152
+
153
+ summary[parser, '2', <<-DESC, pos]
154
+ No operation
155
+ DESC
156
+ end
157
+
158
+ return parser
159
+ end
76
160
  end
77
161
  end
@@ -7,13 +7,14 @@ module NeoBundle
7
7
  def self.default_config(platform = RUBY_PLATFORM)
8
8
  config = {
9
9
  vim: ENV['NEOBUNDLE_CMD_VIM'] || 'vim',
10
- vimrc: ENV['NEOBUNDLE_CMD_VIMRC'],
10
+ bundlefile: ENV['NEOBUNDLE_CMD_BUNDLEFILE'],
11
+ verbose: 0,
11
12
  }
12
13
  case platform
13
14
  when /darwin/,/linux/ then
14
- config[:vimrc] ||= File.join(ENV['HOME'], '.vimrc')
15
+ config[:bundlefile] ||= File.join(ENV['HOME'], '.vimrc')
15
16
  when /mswin(?!ce)|mingw|cygwin|bccwin/ then
16
- config[:vimrc] ||= File.join(ENV['HOME'], '_vimrc')
17
+ config[:bundlefile] ||= File.join(ENV['HOME'], '_vimrc')
17
18
  end
18
19
  config
19
20
  end
@@ -23,7 +24,7 @@ module NeoBundle
23
24
  begin
24
25
  self.script.exec('NeoBundleList')
25
26
  rescue NeoBundle::VimscriptError
26
- raise NeoBundle::NeoBundleNotFoundError, 'NeoBundle not found!'
27
+ raise NeoBundle::NeoBundleError, 'NeoBundle not found!'
27
28
  end
28
29
  end
29
30
 
@@ -1,3 +1,3 @@
1
1
  module NeoBundle
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -1,18 +1,20 @@
1
1
  require 'shellwords'
2
+ require 'open3'
3
+ require 'tempfile'
4
+ require 'erb'
2
5
 
3
6
  module NeoBundle
4
7
  class Vimscript
5
- MARK = '[neobundle-cmd/vim-script/command-part]'
6
-
7
8
  def initialize(config={})
8
9
  @config = {
9
10
  vim: 'vim',
10
- vimrc: 'NONE',
11
+ bundlefile: nil,
12
+ verbose: 0,
11
13
  }
12
14
  @config.merge!(config)
13
15
  begin
14
- result = %x[#{'%{vim} --version' % self.escaped_config}]
15
- unless result =~ /^VIM - Vi IMproved / and $? == 0 then
16
+ out, err, status = Open3.capture3('%s --version' % Shellwords.escape(@config[:vim]))
17
+ unless out =~ /^VIM - Vi IMproved / and status == 0 then
16
18
  raise NeoBundle::VimCommandError, 'command is not vim!'
17
19
  end
18
20
  rescue SystemCallError
@@ -22,59 +24,49 @@ module NeoBundle
22
24
 
23
25
  def exec(cmd, io=nil)
24
26
  raise NeoBundle::VimscriptError, 'Command is empty!' if cmd.to_s.strip.empty?
25
- command = (<<-SH % self.escaped_config).gsub(/\s+/,' ').strip
26
- %{vim} -u %{vimrc} -U NONE -i NONE -e -s -V1
27
- -c "
28
- try |
29
- echo '#{MARK}' |
30
- #{cmd} |
31
- echo '#{MARK}' |
32
- echo '' |
33
- finally |
34
- q! |
35
- endtry
27
+ is_displaying_log = @config[:verbose] > 0
28
+ $stderr.puts '### Command: %s' % cmd if is_displaying_log
29
+
30
+ log_file = Tempfile.open('neobundle-cmd_vimscript_exec')
31
+ command = ERB.new(<<-SH).result(binding).gsub(/\s+/,' ').strip
32
+ <%= Shellwords.escape @config[:vim] %> -u NONE -U NONE -i NONE -N -e -s -V1
33
+ --cmd "
34
+ <% unless @config[:bundlefile].to_s.strip.empty? then %>
35
+ set verbosefile=<%= log_file.path %> |
36
+ <%= @config[:verbose] %>verbose source <%= @config[:bundlefile] %> |
37
+ set verbosefile= |
38
+ <% end %>
39
+ <%= cmd %>
36
40
  "
37
- -c "
38
- echo '#{MARK}' |
39
- echo '' |
40
- q
41
+ --cmd "
42
+ qall!
41
43
  "
42
44
  SH
43
- r,w = IO.pipe
44
- process = Process.detach spawn(command, out: w, err: w)
45
45
 
46
- Thread.new do
47
- process.join
48
- r.close
49
- w.close
46
+ log_thread = Thread.new do
47
+ while true do
48
+ line = log_file.gets.to_s.chomp
49
+ $stderr.puts line unless line.empty?
50
+ end
50
51
  end
51
52
 
52
- begin
53
- result = []
54
- is_outputting = false
55
-
56
- loop do
57
- line = r.gets.rstrip
58
- if line == MARK then
59
- is_outputting = !is_outputting
60
- elsif is_outputting then
61
- io.puts line unless io.nil?
62
- result.push line
63
- end
64
- end
65
- rescue IOError
66
- result = result.join("\n")
67
- raise NeoBundle::VimscriptError, result if process.value != 0
68
- result
53
+ stdin, stdout, stderr, process = Open3.popen3(command)
54
+ result = []
55
+
56
+ stderr.each_line do |line|
57
+ line = line.chomp
58
+ next if line.empty?
59
+ io.puts line unless io.nil?
60
+ result.push line
69
61
  end
70
- end
71
-
72
- protected
73
-
74
- def escaped_config
75
- result = @config.clone
76
- result[:vim] = Shellwords.escape result[:vim]
77
- result[:vimrc] = Shellwords.escape result[:vimrc]
62
+
63
+ process.join
64
+ log_thread.kill
65
+ log_file.close
66
+ $stderr.print "\n\n" if is_displaying_log
67
+
68
+ result = result.join("\n")
69
+ raise NeoBundle::VimscriptError, result if process.value != 0
78
70
  result
79
71
  end
80
72
  end
@@ -0,0 +1,2 @@
1
+ source $_neobundle_root/spec/fixtures/vimrc/base.vim
2
+ echo $_neobundle_echo_message
@@ -31,7 +31,7 @@ module NeoBundle
31
31
  before { $stderr = $stdout = StringIO.new }
32
32
  after { $stderr = STDERR; $stdout = STDOUT }
33
33
 
34
- ['', 'help', '--help', '-h', '--version'].each do |args|
34
+ ['', 'help', '--help', '-h', '--version', '-h'].each do |args|
35
35
  describe '"%s"' % args do
36
36
  let(:args){args}
37
37
  it { expect{subject}.to raise_error(SystemExit) }
@@ -40,13 +40,15 @@ module NeoBundle
40
40
  end
41
41
 
42
42
  describe 'options' do
43
- let(:args){'--vim=path1 --vimrc=path3 install --vimrc=path4 --vim=path2'}
43
+ let(:args){'--vim=path1 --bundlefile=path3 --verbose=1 install -V 2 -f path4 -c path2'}
44
+
44
45
  it do
45
46
  is_expected.to eq(
46
47
  command: :install,
47
48
  config: {
48
49
  vim: 'path2',
49
- vimrc: 'path4'
50
+ bundlefile: 'path4',
51
+ verbose: 2,
50
52
  }
51
53
  )
52
54
  end
@@ -87,12 +89,12 @@ module NeoBundle
87
89
 
88
90
  context 'when the `NeoBundle::Error` was thrown' do
89
91
  let(:exception){raise NeoBundle::VimscriptError, 'VimscriptError message'}
90
- it { expect(subject[0]).to eq(2) }
92
+ it { expect(subject[0]).to eq(1) }
91
93
  it { expect(subject[1]).to eq('VimscriptError message') }
92
94
 
93
95
  context 'when the `NeoBundle::Error` was thrown' do
94
96
  let(:exception){raise NeoBundle::OperationAlreadyCompletedError, 'OperationAlreadyCompletedError'}
95
- it { expect(subject[0]).to eq(4) }
97
+ it { expect(subject[0]).to eq(2) }
96
98
  it { expect(subject[1]).to eq('') }
97
99
  end
98
100
  end
@@ -105,7 +107,7 @@ module NeoBundle
105
107
 
106
108
  context 'when the unknown exception was thrown' do
107
109
  let(:exception){raise StandardError, 'StandardError message'}
108
- it { expect(subject[0]).to eq(255) }
110
+ it { expect(subject[0]).to eq(1) }
109
111
  it { expect(subject[1]).to match(/^#<StandardError: StandardError message>/) }
110
112
  end
111
113
  end
@@ -4,7 +4,7 @@ module NeoBundle
4
4
  describe NeoBundle::Runner do
5
5
  subject { Runner.new({}, self.script) }
6
6
 
7
- let(:script){Vimscript.new(vimrc: './spec/fixtures/vimrc/with_neobundle.vim')}
7
+ let(:script){Vimscript.new(bundlefile: './spec/fixtures/vimrc/with_neobundle.vim')}
8
8
 
9
9
  before do
10
10
  ENV['_neobundle_root'] = Dir.pwd
@@ -17,8 +17,8 @@ module NeoBundle
17
17
  it { expect{subject}.to_not raise_error }
18
18
 
19
19
  context 'when the NeoBundle was not installed' do
20
- let(:script){Vimscript.new(vimrc: './spec/fixtures/vimrc/base.vim')}
21
- it { expect{subject}.to raise_error(NeoBundle::NeoBundleNotFoundError, 'NeoBundle not found!') }
20
+ let(:script){Vimscript.new(bundlefile: './spec/fixtures/vimrc/base.vim')}
21
+ it { expect{subject}.to raise_error(NeoBundle::NeoBundleError, 'NeoBundle not found!') }
22
22
  end
23
23
 
24
24
  describe '#install()' do
@@ -88,12 +88,12 @@ module NeoBundle
88
88
 
89
89
  before do
90
90
  ENV['NEOBUNDLE_CMD_VIM'] = nil
91
- ENV['NEOBUNDLE_CMD_VIMRC'] = nil
91
+ ENV['NEOBUNDLE_CMD_BUNDLEFILE'] = nil
92
92
  end
93
93
 
94
94
  after do
95
95
  ENV['NEOBUNDLE_CMD_VIM'] = nil
96
- ENV['NEOBUNDLE_CMD_VIMRC'] = nil
96
+ ENV['NEOBUNDLE_CMD_BUNDLEFILE'] = nil
97
97
  end
98
98
 
99
99
  context 'when the platform was "Mac OS X"' do
@@ -101,20 +101,22 @@ module NeoBundle
101
101
  it do
102
102
  is_expected.to eq(
103
103
  vim: 'vim',
104
- vimrc: File.expand_path('~/.vimrc')
104
+ bundlefile: File.expand_path('~/.vimrc'),
105
+ verbose: 0,
105
106
  )
106
107
  end
107
108
 
108
109
  context 'with options' do
109
110
  before do
110
111
  ENV['NEOBUNDLE_CMD_VIM'] = 'path/to/vim'
111
- ENV['NEOBUNDLE_CMD_VIMRC'] = 'path/to/vimrc'
112
+ ENV['NEOBUNDLE_CMD_BUNDLEFILE'] = 'path/to/vimrc'
112
113
  end
113
114
 
114
115
  it do
115
116
  is_expected.to eq(
116
117
  vim: 'path/to/vim',
117
- vimrc: 'path/to/vimrc'
118
+ bundlefile: 'path/to/vimrc',
119
+ verbose: 0,
118
120
  )
119
121
  end
120
122
  end
@@ -125,7 +127,8 @@ module NeoBundle
125
127
  it do
126
128
  is_expected.to eq(
127
129
  vim: 'vim',
128
- vimrc: File.expand_path('~/.vimrc')
130
+ bundlefile: File.expand_path('~/.vimrc'),
131
+ verbose: 0,
129
132
  )
130
133
  end
131
134
  end
@@ -135,7 +138,8 @@ module NeoBundle
135
138
  it do
136
139
  is_expected.to eq(
137
140
  vim: 'vim',
138
- vimrc: File.expand_path('~/_vimrc')
141
+ bundlefile: File.expand_path('~/_vimrc'),
142
+ verbose: 0,
139
143
  )
140
144
  end
141
145
  end
@@ -38,7 +38,7 @@ module NeoBundle
38
38
  let(:cmd){'echo 1'}
39
39
  let(:io){nil}
40
40
 
41
- it { is_expected.to eq(ENV['OS'].nil? ? '1' : "\n1\n") }
41
+ it { is_expected.to eq('1') }
42
42
 
43
43
  context 'when the `cmd` was empty' do
44
44
  ['""', 'nil', '" \n "'].each do |empty_cmd|
@@ -54,6 +54,44 @@ module NeoBundle
54
54
  it { expect{subject}.to raise_error(NeoBundle::VimscriptError, /E492:/) }
55
55
  end
56
56
 
57
+ describe 'bundle file output' do
58
+ subject do
59
+ super()
60
+ self.verbose_io.rewind
61
+ self.verbose_io.read.chomp
62
+ end
63
+
64
+ let(:config) do
65
+ {
66
+ verbose: self.verbose_level,
67
+ bundlefile: './spec/fixtures/vimrc/echo_log.vim'
68
+ }
69
+ end
70
+
71
+ let(:verbose_level){0}
72
+ let(:verbose_io){StringIO.new('','r+')}
73
+ let(:message){'echo message'}
74
+
75
+ before do
76
+ $stderr = self.verbose_io
77
+ ENV['_neobundle_root'] = Dir.pwd
78
+ ENV['_neobundle_echo_message'] = self.message
79
+ end
80
+
81
+ after do
82
+ $stderr = STDERR
83
+ ENV['_neobundle_root'] = nil
84
+ ENV['_neobundle_echo_message'] = nil
85
+ end
86
+
87
+ it { is_expected.to eq(self.message) }
88
+
89
+ context 'when verbose level was 1' do
90
+ let(:verbose_level){1}
91
+ it { is_expected.to eq(['### Command: %s' % self.cmd, self.message, "\n"].join("\n")) }
92
+ end
93
+ end
94
+
57
95
  describe 'IO output' do
58
96
  subject do
59
97
  super()
@@ -64,7 +102,7 @@ module NeoBundle
64
102
  let(:cmd){'echo 1 | echo 2'}
65
103
  let(:io){StringIO.new('','r+')}
66
104
 
67
- it { is_expected.to eq(ENV['OS'].nil? ? "1\n2\n" : "\n1\n\n2\n\n") }
105
+ it { is_expected.to eq("1\n2\n") }
68
106
  end
69
107
  end
70
108
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neobundle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuichi Murata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-22 00:00:00.000000000 Z
11
+ date: 2014-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -64,6 +64,7 @@ files:
64
64
  - ".gitmodules"
65
65
  - ".rspec"
66
66
  - ".travis.yml"
67
+ - CHANGELOG.md
67
68
  - Gemfile
68
69
  - LICENSE.txt
69
70
  - README.md
@@ -80,6 +81,7 @@ files:
80
81
  - spec/fixtures/vim-command/non_vim2.bat
81
82
  - spec/fixtures/vim-command/non_vim2.rb
82
83
  - spec/fixtures/vimrc/base.vim
84
+ - spec/fixtures/vimrc/echo_log.vim
83
85
  - spec/fixtures/vimrc/with_neobundle.vim
84
86
  - spec/neobundle/command_line_spec.rb
85
87
  - spec/neobundle/runner_spec.rb
@@ -116,6 +118,7 @@ test_files:
116
118
  - spec/fixtures/vim-command/non_vim2.bat
117
119
  - spec/fixtures/vim-command/non_vim2.rb
118
120
  - spec/fixtures/vimrc/base.vim
121
+ - spec/fixtures/vimrc/echo_log.vim
119
122
  - spec/fixtures/vimrc/with_neobundle.vim
120
123
  - spec/neobundle/command_line_spec.rb
121
124
  - spec/neobundle/runner_spec.rb