alpaca_complete 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -54,9 +54,6 @@ if !exists('g:source_locale_complete_enable_dup')
54
54
  let g:source_locale_complete_enable_dup = 1
55
55
  endif
56
56
 
57
- if !executable('alpaca_complete')
58
- finish
59
- endif
60
57
  "}}}
61
58
 
62
59
  function! s:source.initialize()
@@ -120,7 +117,7 @@ function! s:source.get_complete_words(cur_keyword_pos, cur_keyword_str)"{{{
120
117
  endfunction"}}}
121
118
 
122
119
  function! s:check_recache()
123
- if !exists('b:rails_root')| return -1 |endif
120
+ if !exists('b:rails_root')||!executable('alpaca_complete')| return -1 |endif
124
121
 
125
122
  if !has_key(s:complete_list, s:get_cache_name())
126
123
  call s:caching()
@@ -13,10 +13,9 @@ class Object
13
13
  end
14
14
 
15
15
  module AlpacaComplete
16
- Version = "0.1.1"
16
+ Version = "0.1.3"
17
17
 
18
18
  autoload :LocaleComplete, 'AlpacaComplete/locale_complete'
19
- autoload :Dictionary, 'AlpacaComplete/dictionary'
20
19
  autoload :Utils, 'AlpacaComplete/utils'
21
20
  autoload :Detect, 'AlpacaComplete/detect'
22
21
  end
data/spec/version_spec.rb CHANGED
@@ -1,5 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe AlpacaComplete::Version do
4
- it { should == "0.1.1" }
4
+ before do
5
+ version = File.open("VERSION").read
6
+ @version = version.gsub("\r", '')
7
+ end
8
+ it { should == @version }
5
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alpaca_complete
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -96,16 +96,12 @@ files:
96
96
  - VERSION
97
97
  - alpaca_complete.gemspec
98
98
  - autoload/neocomplcache/sources/locale_complete.vim
99
- - autoload/neocomplcache/sources/yaml_complete.vim
100
99
  - bin/alpaca_complete
101
- - dictionary/migration_3_2_1.yml
102
100
  - lib/AlpacaComplete.rb
103
101
  - lib/AlpacaComplete/detect.rb
104
- - lib/AlpacaComplete/dictionary.rb
105
102
  - lib/AlpacaComplete/locale_complete.rb
106
103
  - lib/AlpacaComplete/utils.rb
107
104
  - spec/detect_spec.rb
108
- - spec/dictionary_spec.rb
109
105
  - spec/locale_complete_spec.rb
110
106
  - spec/spec_helper.rb
111
107
  - spec/supports/dict/existent.yml
@@ -177,7 +173,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
177
173
  version: '0'
178
174
  segments:
179
175
  - 0
180
- hash: -2551976939518646737
176
+ hash: -458434146859851818
181
177
  required_rubygems_version: !ruby/object:Gem::Requirement
182
178
  none: false
183
179
  requirements:
@@ -1,129 +0,0 @@
1
- "=============================================================================
2
- " FILE: yaml_complete.Vim
3
- " AUTHOR: Hiroyuki Ishii <alprhcp666@gmail.com>
4
- " Last Modified: 2012-09-26
5
- " License: MIT license {{{
6
- " Permission is hereby granted, free of charge, to any person obtaining
7
- " a copy of this software and associated documentation files (the
8
- " "Software"), to deal in the Software without restriction, including
9
- " without limitation the rights to use, copy, modify, merge, publish,
10
- " distribute, sublicense, and/or sell copies of the Software, and to
11
- " permit persons to whom the Software is furnished to do so, subject to
12
- " the following conditions:
13
- "
14
- " The above copyright notice and this permission notice shall be included
15
- " in all copies or substantial portions of the Software.
16
- "
17
- " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18
- " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
- " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
- " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21
- " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
- " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23
- " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
- " }}}
25
- "=============================================================================
26
-
27
- let s:save_cpo = &cpo
28
- set cpo&vim
29
-
30
- let s:source = {
31
- \ 'name' : 'yaml_complete_locale',
32
- \ 'kind' : 'ftplugin',
33
- \ 'filetypes' : { 'ruby' : 1, 'eruby' : 1 },
34
- \}
35
- if !exists('g:source_yaml_dir')
36
- " TODO error
37
- let g:source_yaml_dir = ''
38
- endif
39
-
40
- if !exists('g:source_yaml_complete_length')
41
- let g:source_yaml_complete_length = 2
42
- endif
43
-
44
- if !exists('g:source_yaml_complete_rank')
45
- let g:source_yaml_complete_rank = 200
46
- endif
47
-
48
- function! s:source.initialize()
49
- " TODO chaching
50
- " call neocomplcache#set_completion_length('yaml_complete', g:source_alpaca_rails_length)
51
- " call neocomplcache#set_dictionary_helper(g:neocomplcache_source_rank,
52
- " \ 'yaml_complete', g:source_yaml_complete_rank)
53
- endfunction
54
-
55
- function! s:source.finalize()
56
- " TODO chaching
57
- endfunction
58
-
59
- function! s:source.get_keyword_pos(cur_text)
60
- if a:cur_text =~ '\s*[a-zA-Z._:]'
61
- let cur_pos = match(a:cur_text, '[a-zA-Z:_]\+[a-zA-Z._:]*$')
62
- return cur_pos < 0 ? -1 : cur_pos
63
- end
64
-
65
- return -1
66
- endfunction
67
-
68
- function! s:get_rails_type()
69
- let filepath = expand("%:p")
70
- if filepath =~ 'models/[a-zA-Z_]\+.rb$'
71
- return "models"
72
- elseif filepath =~ 'views\/[a-zA-Z_]\+.rb$'
73
- return "views"
74
- elseif filepath =~ 'controllers\/[a-zA-Z_]\+.rb$'
75
- return "controllers"
76
- elseif filepath =~ 'db\/migrate\/[a-zA-Z0-9_]\+.rb$'
77
- return "migrate"
78
- elseif filepath =~ 'spec\/[a-zA-Z0-9_/]\+_spec.rb$'
79
- return "rspec"
80
- endif
81
-
82
- return 0
83
- endfunction
84
-
85
- function! s:source.get_complete_words(cur_keyword_pos, cur_keyword_str)
86
- let line = a:cur_keyword_str
87
-
88
- let input_first = match(line, '[a-zA-Z._:]*$')
89
- let input_obj = line[input_first :]
90
-
91
- if input_obj ==# '' || input_obj ==# "\s"
92
- return []
93
- endif
94
-
95
- let cmd = s:get_rails_type()
96
-
97
- return []
98
- " " RoRの補完プラグインを使う
99
- " TODO alpaca_completeでyamlデータ読み込み
100
- " webapi#json_parseでdictにする
101
- " let = neocomplcache#system( 'alpaca_complete -d ' . expand("%:p") )
102
- " let mf0 = s:get_dict_yaml(
103
- " let mf_list = split(mf0, '\n')
104
- " let result = []
105
- " for locale_name in mf_list
106
- " " s:get_locate() => ja + "."
107
- " let complete_pos = strlen(s:get_locate()) + 1
108
- " let result = add(result, {
109
- " \ "word" : locale_name[complete_pos :],
110
- " \ "abbr" : locale_name[complete_pos :],
111
- " \ "kind" : "[locale]"
112
- " \})
113
- " endfor
114
-
115
- " return neocomplcache#keyword_filter(result, input_obj)
116
- endfunction
117
-
118
- function! neocomplcache#sources#yaml_complete#define()
119
- return s:source
120
- endfunction
121
-
122
- function! neocomplcache#sources#yaml_complete#get_cur_text()
123
- return [line('.')]
124
- endfunction
125
-
126
- let &cpo = s:save_cpo
127
- unlet s:save_cpo
128
-
129
- " vimfoldmethod=marker
@@ -1,13 +0,0 @@
1
- migration:
2
- methods:
3
- -
4
- word: create_table
5
- arguments:
6
- -
7
- word: :id
8
- arguments:
9
- -
10
- true,
11
- false
12
- valiables:
13
- constant:
@@ -1,18 +0,0 @@
1
- module AlpacaComplete::Dictionary
2
- NEWEST_VERSION = "3.2"
3
- DICTIONARY_PATH = 'dictionary'
4
- extend AlpacaComplete::Utils
5
-
6
-
7
- def self.switch_dict(type, version=NEWEST_VERSION)
8
- case type
9
- when "migration"
10
- "migration_3_2_1"
11
- end
12
- end
13
-
14
- def self.load_dictionary(type, version=NEWEST_VERSION)
15
- file_name = switch_dict(type, version)
16
- load_yaml("#{DICTIONARY_PATH}/#{file_name}.yml")
17
- end
18
- end
@@ -1,14 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe AlpacaComplete::Dictionary do
4
- context :switch_dict do
5
- type = AlpacaComplete::Dictionary.switch_dict("migration", "3.2")
6
- type.should == "migration_3_2_1"
7
- end
8
-
9
- context :load_dictionary do
10
- dict = AlpacaComplete::Dictionary.load_dictionary("migration", "3.2")
11
- puts '----------------------------------------'
12
- puts dict
13
- end
14
- end