snipmate_to_yas 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7da3b2f0ddc6097a57059958b6aa33a51ab4f046
4
+ data.tar.gz: 12c2910194e5ad2cc04f10a44fc10c90d2d4523e
5
+ SHA512:
6
+ metadata.gz: 53ff0194115cab40ea1db4f7fe4f1e8e22e55b52f25f24382159e52973683acc98032d87d007869cfd9632b02edfe2cbe0d9fbc52b268fb7b188bd99a25af50d
7
+ data.tar.gz: e5545f3561127e4f6b0e41576d4546e3320a42926cc9901820948060fd8565c1d656cb62566dfc1caad589877331c106ef3daf8e1624d2f29bd5e8f917c93529
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rubocop.yml ADDED
@@ -0,0 +1,15 @@
1
+ Metrics/AbcSize:
2
+ Exclude:
3
+ - test/**/*_test.rb
4
+ Metrics/ClassLength:
5
+ Exclude:
6
+ - test/**/*_test.rb
7
+ Metrics/LineLength:
8
+ Exclude:
9
+ - test/**/*_test.rb
10
+ Metrics/MethodLength:
11
+ Exclude:
12
+ - test/**/*_test.rb
13
+ Style/Documentation:
14
+ Exclude:
15
+ - test/**/*_test.rb
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in snipmate_to_yas.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 cartolari
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,135 @@
1
+ # SnipmateToYas
2
+
3
+ This gem converts [SnipMate](https://github.com/garbas/vim-snipmate) snippets
4
+ into [YASnippet](https://github.com/capitaomorte/yasnippet) snippets.
5
+
6
+ _For a repository with already converted snippets please check
7
+ [yasnippet-vim-snippets](https://github.com/cartolari/yasnippet-vim-snippets)._
8
+
9
+ This gem was built mostly to convert the
10
+ [vim-snippets](https://github.com/honza/vim-snippets) library to a format
11
+ compatible with Emacs but it works with any Snipmate snippet.
12
+
13
+ Here is how a sample taken from vim-snippets would be converted (note how the
14
+ interpolation the code between backticks is handled):
15
+
16
+ ```
17
+ snippet cla-
18
+ class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < DelegateClass(${2:ParentClass})
19
+ def initialize(${3:args})
20
+ super(${4:del_obj})
21
+
22
+ ${0}
23
+ end
24
+ end
25
+ ```
26
+
27
+ and how it'll be converted to YASnippet
28
+
29
+ ```
30
+ # name: cla-
31
+ # key: cla-
32
+ # --
33
+ class ${1:`(s-replace " " "" (s-titleized-words (file-name-base (or (buffer-file-name) ""))))`} < DelegateClass(${2:ParentClass})
34
+ def initialize(${3:args})
35
+ super(${4:del_obj})
36
+
37
+ $0
38
+ end
39
+ end
40
+ ```
41
+
42
+ ## Installation and usage
43
+
44
+ To install the library run:
45
+
46
+ $ gem install snipmate_to_yas
47
+
48
+ To convert a single snippet run:
49
+
50
+ $ snipmate_to_yas /snippets/folder/ruby.snippets /your-converted-snippets-folder
51
+
52
+ Or to convert all snippets run this simple shell script:
53
+
54
+ ```bash
55
+ for f in $(find /snippets/folder -name '*.snippets' -type f); do
56
+ mode_name=$(basename "$f" .snippets)
57
+ snipmate_to_yas "$f" /your-converted-snippets-folder
58
+ done
59
+ ```
60
+
61
+
62
+ In the emacs side you need
63
+ [YASnippet](https://github.com/capitaomorte/yasnippet) and
64
+ [s.el](https://github.com/magnars/s.el), which is required for some
65
+ interpolations.
66
+
67
+ Also you need to load the converted snippets. To do this add the following to
68
+ your Emacs init file:
69
+
70
+ ```elisp
71
+ (add-to-list 'yas-snippet-dirs "/your-converted-snippets-folder")
72
+ ```
73
+
74
+ For more information in how to load snippets check the YASnippet docs.
75
+
76
+ ## How the snippets get converted
77
+
78
+ Before using this it's important to know some differences between SnipMate and
79
+ YASnippet.
80
+
81
+ Snipmate read multiple snippets from a single file while YASnippet use one
82
+ folder per snippet with one snippet per file.
83
+
84
+ So suppose you'd convert the ruby snippets and the snippets file contained the
85
+ following tow snippets:
86
+
87
+ ```
88
+ # /my/vim/snippets/ruby.snippets
89
+
90
+ snippet enc
91
+ # encoding: utf-8
92
+ snippet #!
93
+ #!/usr/bin/env ruby
94
+ # encoding: utf-8
95
+ ```
96
+
97
+ the following files'd be generated:
98
+
99
+
100
+ /target/folder/ruby-mode/enc
101
+ ```
102
+ # name: enc
103
+ # key: enc
104
+ # --
105
+ # encoding: utf-8
106
+ ```
107
+
108
+ /target/folder/ruby-mode/#!
109
+
110
+ ```
111
+ # name: #!
112
+ # key: #!
113
+ # --
114
+ #!/usr/bin/env ruby
115
+ # encoding: utf-8
116
+ ```
117
+
118
+ The mode names are not always equal, for example in Vim we have the cpp-mode
119
+ while in Emacs we have the c++-mode. So the snippets from a file called
120
+ cpp.snippets would be saved in a folder called c++-mode and not cpp-mode.
121
+
122
+ The snippet interpolations in SnipMate use vim-script, while the interpolations
123
+ in YASnippet use Elisp. This is handled by this script in a extremely simple
124
+ way, but most interpolations should work. If you found some error please let me
125
+ know.
126
+
127
+ ## Contributing
128
+
129
+ Bug reports and pull requests are welcome on GitHub at
130
+ https://github.com/cartolari/snipmate_to_yas
131
+
132
+ ## License
133
+
134
+ The gem is available as open source under the terms of the
135
+ [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << 'test'
6
+ t.libs << 'lib'
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task default: :test
data/bin/console ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'snipmate_to_yas'
5
+
6
+ require 'pry'
7
+ Pry.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'snipmate_to_yas'
4
+
5
+ cli = SnipmateToYas::Cli
6
+ cli.RUN(ARGV)
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'snipmate_to_yas'
4
+
5
+ cli = SnipmateToYas::Cli
6
+ cli.new(ARGV).run
@@ -0,0 +1,27 @@
1
+ require 'fileutils'
2
+
3
+ module SnipmateToYas
4
+ ## Cli wrapper for snipmate to yas
5
+ class Cli
6
+ def initialize(args, out = STDOUT)
7
+ @args = args
8
+ @out = out
9
+ end
10
+
11
+ def run
12
+ if @args.length != 2 || @args.join('').strip == '--help'
13
+ @out.puts 'USAGE: snipmate_to_yas snipmate.snippets target_yas_dir'
14
+ return
15
+ end
16
+ generate_snippets
17
+ end
18
+
19
+ protected
20
+
21
+ def generate_snippets
22
+ mode_name = File.basename(@args.first, '.*')
23
+ snippets = Snipmate::Parser.new(mode_name, open(@args.first).read).parse
24
+ SnippetFsWriter.new(snippets, @args.last).write
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,43 @@
1
+ module SnipmateToYas
2
+ ## Represents a snippet mode and its corresponding mode name in Vim or Emacs
3
+ class Mode
4
+ attr_accessor :parent
5
+ attr_accessor :vim_name
6
+
7
+ # Modes that have a different name between Vim and Emacs
8
+ VIM_TO_EMACS_MODE_MAP = {
9
+ 'cpp' => 'c++',
10
+ 'cs' => 'csharp',
11
+ 'javascript' => 'js'
12
+ }
13
+
14
+ # Modes that may have multiple implementations in Emacs, like the ruby-mode
15
+ # which have the alternative enhanced ruby mode
16
+ EMACS_MODE_ALIASES = {
17
+ 'clojure' => ['cider-repl-mode'],
18
+ 'js' => ['js2'],
19
+ 'ruby' => ['enh-ruby']
20
+ }
21
+
22
+ def initialize(name)
23
+ @vim_name = name
24
+ @parent = Mode.from_vim('_') unless name == '_'
25
+ end
26
+
27
+ def self.from_emacs(mode_name)
28
+ new(VIM_TO_EMACS_MODE_MAP.key(mode_name) || mode_name)
29
+ end
30
+
31
+ def self.from_vim(mode_name)
32
+ new(mode_name)
33
+ end
34
+
35
+ def emacs_name
36
+ VIM_TO_EMACS_MODE_MAP[@vim_name] || @vim_name
37
+ end
38
+
39
+ def aliases
40
+ EMACS_MODE_ALIASES[emacs_name] || []
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,23 @@
1
+ module SnipmateToYas
2
+ module Snipmate
3
+ ## A list of snipmate snippets, generally contained in a file
4
+ class Collection
5
+ include Enumerable
6
+
7
+ attr_reader :mode
8
+
9
+ def initialize(mode, snippets = [])
10
+ @mode = mode
11
+ @snippets = snippets
12
+ end
13
+
14
+ def each(&block)
15
+ @snippets.each(&block)
16
+ end
17
+
18
+ def last
19
+ @snippets.last
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,55 @@
1
+ module SnipmateToYas
2
+ module Snipmate
3
+ ## Default interpolation converter, contains some interpolation mappings of
4
+ ## snippets found in honza/vim-snippets library
5
+ class DefaultInterpolationConverter
6
+ # rubocop:disable Metrics/LineLength
7
+ INTERPOLATIONS_MAP = {
8
+ 'g:snips_author' => '"Name"',
9
+ 'g:snips_email' => '"Email"',
10
+ 'g:snips_github' => '"Github user"',
11
+
12
+ 'strftime("%B %d, %Y")' => '(format-time-string "%B %d, %Y")',
13
+ 'strftime("%H:%M")' => '(format-time-string "%H:%M")',
14
+ 'strftime("%Y")' => '(format-time-string "%Y")',
15
+ 'strftime("%Y-%m-%d %H:%M")' => '(format-time-string "%Y-%m-%d %H:%M")',
16
+ 'strftime("%Y-%m-%d")' => '(format-time-string "%Y-%m-%d")',
17
+ 'strftime("%Y/%m/%d")' => '(format-time-string "%Y/%m/%d")',
18
+ 'strftime("%d %B, %Y")' => '(format-time-string "%d %B, %Y")',
19
+ 'strftime("%d/%m/%y %H:%M:%S")' => '(format-time-string "%d/%m/%y %H:%M:%S")',
20
+ # This produces a Full ISO 8601 formatted date
21
+ # It is the `diso` snippet from _.snippets
22
+ # Taken from http://ergoemacs.org/emacs/elisp_datetime.html on 2016-09-24T17:15:00+03:00
23
+ 'strftime("%Y-%m-%dT%H:%M:%S")' => '(concat (format-time-string "%Y-%m-%dT%H:%M:%S") ((lambda (x) (concat (substring x 0 3) ":" (substring x 3 5))) (format-time-string "%z")))',
24
+
25
+ "vim_snippets#Filename('$1.py', 'foo.py')" => '(file-name-nondirectory (buffer-file-name))',
26
+ %q{substitute(substitute(vim_snippets#Filename(), '_spec$', '', ''), '\(_\|^\)\(.\)', '\u\2', 'g')} =>
27
+ '(replace-regexp-in-string "Spec" "" (s-replace " " "" (s-titleized-words (file-name-base (or (buffer-file-name) "")))) nil t)',
28
+ %q{substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')} => '(s-replace " " "" (s-titleized-words (file-name-base (or (buffer-file-name) ""))))',
29
+ %q{substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')} => '(file-name-base)',
30
+
31
+ %q{system("grep \`id -un\` /etc/passwd | cut -d \":\" -f5 | cut -d \",\" -f1")} => '',
32
+ 'vim_snippets#Filename("$1")' => '(file-name-base)',
33
+ 'vim_snippets#Filename("$1.h")' => '(concat (file-name-base) ".h")',
34
+ "vim_snippets#Filename('$1')" => '(file-name-base)',
35
+ "vim_snippets#Filename('$1', 'ClassName')" => '(file-name-base)',
36
+ "vim_snippets#Filename('$1Delegate', 'MyProtocol')" => '(concat (file-name-base) "Delegate")',
37
+ "vim_snippets#Filename('$1', 'name')" => '(file-name-base)',
38
+ "vim_snippets#Filename('$1', 'NSObject')" => '(file-name-base)',
39
+ "vim_snippets#Filename('$1', '$1_t')" => '(concat (file-name-base) "_t")',
40
+ 'vim_snippets#Filename("$1", "untitled")' => '(file-name-base)',
41
+ 'vim_snippets#Filename("$2", "untitled")' => '(file-name-base)',
42
+ 'vim_snippets#Filename("$3", "untitled")' => '(file-name-base)',
43
+ "vim_snippets#Filename('', 'fqdn')" => '(file-name-base)',
44
+ "vim_snippets#Filename('', 'my')" => '(file-name-base)',
45
+ "vim_snippets#Filename('', 'name')" => '(file-name-base)',
46
+ "vim_snippets#Filename('', 'someClass')" => '(file-name-base)'
47
+ }
48
+ # rubocop:enable Metrics/LineLength
49
+
50
+ def convert(snippet)
51
+ INTERPOLATIONS_MAP[snippet]
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,52 @@
1
+ module SnipmateToYas
2
+ module Snipmate
3
+ ## Converts a string with multiple Snipmate snippets to an array of
4
+ # YASSnippets.
5
+ # This string generally is the content of a Snipmate snippets file.
6
+ class Parser
7
+ PARENT_MODE_REGEXP = /^extends (?<mode>\w+)$/
8
+
9
+ def initialize(mode_name, snippets_text)
10
+ @mode_name = mode_name
11
+ @snippets_text = snippets_text
12
+ end
13
+
14
+ def parse
15
+ Snipmate::Collection.new(parse_mode, snippets)
16
+ end
17
+
18
+ protected
19
+
20
+ def parse_mode
21
+ Mode.from_vim(@mode_name).tap do |mode|
22
+ mode.parent = Mode.from_vim(parent_mode) if parent_mode
23
+ end
24
+ end
25
+
26
+ def parent_mode
27
+ parent_mode = @snippets_text.lines.find do |snippet|
28
+ snippet.match(PARENT_MODE_REGEXP)
29
+ end
30
+ return unless parent_mode
31
+ parent_mode.match(PARENT_MODE_REGEXP)[:mode]
32
+ end
33
+
34
+ def snippets
35
+ snippet_list.split(/^snippet/).map do |snip|
36
+ next nil if snip.strip.empty?
37
+ parse_snippet "snippet #{snip}"
38
+ end.compact
39
+ end
40
+
41
+ def snippet_list
42
+ @snippets_text.lines.reject do |snippet|
43
+ snippet.match(/^#.*$/) || snippet.match(PARENT_MODE_REGEXP)
44
+ end.join('')
45
+ end
46
+
47
+ def parse_snippet(snippet)
48
+ Snipmate::SingleParser.new(snippet).convert
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,92 @@
1
+ require 'erb'
2
+ require 'snipmate_to_yas/snipmate/default_interpolation_converter'
3
+
4
+ module SnipmateToYas
5
+ module Snipmate
6
+ ## Parses a single vim snipmate snippet
7
+ class SingleParser
8
+ EMPTY_PLACEHOLDER_REGEXP = /\$\{(?<index>\d+)\}/
9
+ HEADING_LINE = /^snippet\s+(?<key>[^\s]+)\s+(?<name>.*)$/
10
+ INTERPOLATION_REGEXP = /`(?<interpolation>[^`]+)`/
11
+ SNIPPET = <<-EOF.strip_heredoc.chomp
12
+ # name: <%= name %>
13
+ # key: <%= key %>
14
+ # --
15
+ <%= body %>
16
+ EOF
17
+ TEMPLATE = ERB.new(SNIPPET)
18
+
19
+ def initialize(snipmate_snippet, interpolation_converter = nil)
20
+ fail(ArgumentError, 'snippet must not be nil') if snipmate_snippet.nil?
21
+
22
+ @snipmate_snippet = snipmate_snippet
23
+ @interpolation_converter =
24
+ interpolation_converter || DefaultInterpolationConverter.new
25
+ end
26
+
27
+ def convert
28
+ validate_snippet
29
+ Yas::Snippet.new(text: TEMPLATE.result(binding), expand_key: key)
30
+ end
31
+
32
+ protected
33
+
34
+ def validate_snippet
35
+ fail(
36
+ ArgumentError,
37
+ "Snippet '#{@snipmate_snippet}' is not in recognizable format"
38
+ ) unless @snipmate_snippet.match(HEADING_LINE)
39
+
40
+ fail(
41
+ ArgumentError, "Snippet '#{@snipmate_snippet}' must contain a body"
42
+ ) if body.empty?
43
+ end
44
+
45
+ def name
46
+ return heading_tokens[:name] unless heading_tokens[:name].empty?
47
+ heading_tokens[:key]
48
+ end
49
+
50
+ def key
51
+ heading_tokens[:key]
52
+ end
53
+
54
+ def heading_tokens
55
+ @snipmate_snippet.lines.first.match(HEADING_LINE)
56
+ end
57
+
58
+ def body
59
+ remove_braces_from_empty_placeholders(
60
+ convert_interpolations(raw_body)
61
+ ).chomp
62
+ end
63
+
64
+ def remove_braces_from_empty_placeholders(snippet)
65
+ snippet.gsub(EMPTY_PLACEHOLDER_REGEXP) do
66
+ "$#{Regexp.last_match[:index]}"
67
+ end
68
+ end
69
+
70
+ def convert_interpolations(snippet)
71
+ snippet.gsub(INTERPOLATION_REGEXP) do
72
+ interpolation =
73
+ @interpolation_converter.convert(Regexp.last_match[:interpolation])
74
+
75
+ interpolation.nil? ? '' : "`#{interpolation}`"
76
+ end
77
+ end
78
+
79
+ def raw_body
80
+ @snipmate_snippet.lines.drop(1).map do |line|
81
+ line.gsub(/^#{detect_indentation}/, '')
82
+ end.join('')
83
+ end
84
+
85
+ def detect_indentation
86
+ match = @snipmate_snippet.lines[1].match(/^(?<indentation>\s+).*$/)
87
+ return match[:indentation] if match
88
+ ''
89
+ end
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,51 @@
1
+ module SnipmateToYas
2
+ ## Writes a list of snippets to the file system
3
+ class SnippetFsWriter
4
+ def initialize(snippets, base_directory)
5
+ @snippets = snippets
6
+ @base_directory = base_directory
7
+ @snippets_directory = File.join(
8
+ base_directory, "#{@snippets.mode.emacs_name}-mode"
9
+ )
10
+ end
11
+
12
+ def write
13
+ FileUtils.mkdir_p(@snippets_directory)
14
+ write_snippets
15
+ write_yas_parents
16
+ write_aliases_links
17
+ end
18
+
19
+ protected
20
+
21
+ def write_snippets
22
+ @snippets.each do |snippet|
23
+ path = File.join(@snippets_directory, filename(snippet.expand_key))
24
+ File.open(path, 'w') { |f| f << snippet.text }
25
+ end
26
+ end
27
+
28
+ def write_yas_parents
29
+ parent_mode = @snippets.mode.parent
30
+ return unless parent_mode
31
+
32
+ path = File.join(@snippets_directory, '.yas-parents')
33
+ File.open(path, 'w') { |f| f << "#{parent_mode.emacs_name}-mode" }
34
+ end
35
+
36
+ def write_aliases_links
37
+ @snippets.mode.aliases.each do |mode_alias|
38
+ File.symlink(
39
+ "#{@snippets.mode.emacs_name}-mode",
40
+ File.join(@base_directory, "#{mode_alias}-mode")
41
+ )
42
+ end
43
+ end
44
+
45
+ ## Cleaned up filename from +key+
46
+ def filename(key)
47
+ return '_' if key.match(/^\.$/)
48
+ key.gsub(%r{[\x00\/\\:\*\?\"<>\|]}, '_')
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,7 @@
1
+ ## Custom string extensions
2
+ class String
3
+ # Remove leading white spaces from a HERE document
4
+ def strip_heredoc
5
+ gsub(/^#{scan(/^\s*/).min_by(&:length)}/, '')
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ ## SnipmateToYas root module
2
+ module SnipmateToYas
3
+ VERSION = '0.1.1'
4
+ end
@@ -0,0 +1,14 @@
1
+ module SnipmateToYas
2
+ module Yas
3
+ ## A single YASnippet snippet
4
+ class Snippet
5
+ attr_accessor :expand_key, :text
6
+
7
+ def initialize(attrs = {})
8
+ attrs.each do |key, value|
9
+ send("#{key}=", value)
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ require 'snipmate_to_yas/string'
2
+ require 'snipmate_to_yas/version'
3
+
4
+ require 'snipmate_to_yas/mode'
5
+ require 'snipmate_to_yas/yas/snippet'
6
+ require 'snipmate_to_yas/snipmate/single_parser'
7
+ require 'snipmate_to_yas/snipmate/collection'
8
+ require 'snipmate_to_yas/snipmate/parser'
9
+ require 'snipmate_to_yas/snippet_fs_writer'
10
+ require 'snipmate_to_yas/cli'
11
+
12
+ ## Holds SnipmateToYas snippet conversion utilities
13
+ module SnipmateToYas
14
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'snipmate_to_yas/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'snipmate_to_yas'
8
+ spec.version = SnipmateToYas::VERSION
9
+ spec.authors = ['cartolari']
10
+ spec.email = ['bruno.cartolari@gmail.com']
11
+
12
+ spec.summary = 'Convert snippets from Vim Snipmate to Emacs YASnippet'
13
+ spec.homepage = 'http://github.com/cartolari/snipmate_to_yas'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.bindir = 'exe'
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ['lib']
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.10'
24
+ spec.add_development_dependency 'fakefs', '~> 0.6'
25
+ spec.add_development_dependency 'minitest', '~> 5.8'
26
+ spec.add_development_dependency 'pry-byebug', '~> 3.2'
27
+ spec.add_development_dependency 'rake', '~> 10.0'
28
+ end
metadata ADDED
@@ -0,0 +1,137 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: snipmate_to_yas
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - cartolari
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-09-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: fakefs
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.6'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.8'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.8'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry-byebug
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.2'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.2'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ description:
84
+ email:
85
+ - bruno.cartolari@gmail.com
86
+ executables:
87
+ - snipmate_to_yas
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".rubocop.yml"
93
+ - Gemfile
94
+ - LICENSE.txt
95
+ - README.md
96
+ - Rakefile
97
+ - bin/console
98
+ - bin/setup
99
+ - bin/snipmate_to_yas
100
+ - exe/snipmate_to_yas
101
+ - lib/snipmate_to_yas.rb
102
+ - lib/snipmate_to_yas/cli.rb
103
+ - lib/snipmate_to_yas/mode.rb
104
+ - lib/snipmate_to_yas/snipmate/collection.rb
105
+ - lib/snipmate_to_yas/snipmate/default_interpolation_converter.rb
106
+ - lib/snipmate_to_yas/snipmate/parser.rb
107
+ - lib/snipmate_to_yas/snipmate/single_parser.rb
108
+ - lib/snipmate_to_yas/snippet_fs_writer.rb
109
+ - lib/snipmate_to_yas/string.rb
110
+ - lib/snipmate_to_yas/version.rb
111
+ - lib/snipmate_to_yas/yas/snippet.rb
112
+ - snipmate_to_yas.gemspec
113
+ homepage: http://github.com/cartolari/snipmate_to_yas
114
+ licenses:
115
+ - MIT
116
+ metadata: {}
117
+ post_install_message:
118
+ rdoc_options: []
119
+ require_paths:
120
+ - lib
121
+ required_ruby_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ requirements: []
132
+ rubyforge_project:
133
+ rubygems_version: 2.5.1
134
+ signing_key:
135
+ specification_version: 4
136
+ summary: Convert snippets from Vim Snipmate to Emacs YASnippet
137
+ test_files: []