sublime_sunippetter 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -38,18 +38,20 @@ First, you create Sunippetfile manually or following command.
38
38
 
39
39
  Second, you have to edit Sunippetfile.
40
40
 
41
- # encoding: utf-8
41
+ ~~~ruby
42
+ # encoding: utf-8
42
43
 
43
- # set output path. default=current directory
44
- output_path 'C:/Users/user_name/AppData/Roaming/Sublime Text 2/Packages/User'
44
+ # set output path. default=current directory
45
+ output_path 'C:/Users/user_name/AppData/Roaming/Sublime Text 2/Packages/User'
45
46
 
46
- # set sunippet scope. default=source.ruby
47
- scope "source.ruby"
47
+ # set sunippet scope. default=source.ruby
48
+ scope "source.ruby"
48
49
 
49
- # if two args method
50
- add :hoge, :args1, :args2
51
- # if no args method
52
- add :hige
50
+ # if two args method
51
+ add :hoge, :args1, :args2
52
+ # if no args method
53
+ add :hige
54
+ ~~~
53
55
 
54
56
  Third, you have to do is execute command suni.
55
57
 
@@ -59,6 +61,7 @@ Result => generate hoge.sublime-snippet, hige.sublime-snippet
59
61
 
60
62
  This Sample Sunppet Contens are ...
61
63
 
64
+ ~~~xml
62
65
  <snippet>
63
66
  <content><![CDATA[
64
67
  hoge ${1:args1}, ${2:args2}
@@ -67,9 +70,11 @@ This Sample Sunppet Contens are ...
67
70
  <scope>source.ruby</scope>
68
71
  <description>hoge method</description>
69
72
  </snippet>
73
+ ~~~
70
74
 
71
75
  And
72
76
 
77
+ ~~~xml
73
78
  <snippet>
74
79
  <content><![CDATA[
75
80
  hige
@@ -78,6 +83,7 @@ And
78
83
  <scope>source.ruby</scope>
79
84
  <description>hige method</description>
80
85
  </snippet>
86
+ ~~~
81
87
 
82
88
  in 'C:/Users/user_name/AppData/Roaming/Sublime Text 2/Packages/User' directory.
83
89
 
@@ -85,6 +91,10 @@ in 'C:/Users/user_name/AppData/Roaming/Sublime Text 2/Packages/User' directory.
85
91
 
86
92
  <img src="./doc_image/sublime_sunippetter.gif" />
87
93
 
94
+ ## History
95
+ * version 0.0.3 : question can use. for ex 'blank?'.
96
+ * version 0.0.1 : first release.
97
+
88
98
  ## Contributing
89
99
 
90
100
  1. Fork it
@@ -1,3 +1,3 @@
1
1
  module SublimeSunippetter
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -47,7 +47,7 @@ module SublimeSunippetter
47
47
  dsl.instance_eval sunippet_define
48
48
  dsl.target_methods.each do |m|
49
49
  snippet = get_snippet(m.method_name , get_args_names(m) , dsl._scope)
50
- File.open("#{dsl._output_path}/#{m.method_name}.sublime-snippet", "w") {|f|f.puts snippet}
50
+ File.open("#{dsl._output_path}/#{m.method_name.to_s.tr('?', '')}.sublime-snippet", "w") {|f|f.puts snippet}
51
51
  end
52
52
  end
53
53
 
@@ -1,68 +1,68 @@
1
- # encoding: utf-8
2
- require_relative "../lib/sublime_sunippetter"
3
- require "spec_helper"
4
-
5
- describe SublimeSunippetter::Core do
6
- cases_init = [
7
- {
8
- case_no: 1,
9
- expected: SublimeSunippetter::Core::DEFINE_FILE_TEMPLATE
10
- },
11
- ]
12
-
13
- cases_init.each do |c|
14
- it "#init case_no=#{c[:case_no]} generate #{SublimeSunippetter::Core::DEFINE_FILE}" do
15
- # given
16
- sunippet = SublimeSunippetter::Core.new
17
-
18
- # when
19
- sunippet.init
20
-
21
- # then
22
- actual = File.open("#{SublimeSunippetter::Core::DEFINE_FILE}") {|f|f.read}
23
- expect(actual).to eq(c[:expected])
24
- end
25
- end
26
-
27
- GENERATE_SUNIPPETS_CASE =<<-EOS
28
- output_path "#{File.absolute_path('.')}"
29
- scope "source.java"
30
- add :hoge, :args1, :args2
31
- add :hige
32
- EOS
33
-
34
- cases_generate_sunippets = [
35
- {
36
- case_no: 1,
37
- sunippetdefine: GENERATE_SUNIPPETS_CASE,
38
- output_file_names: ["hoge.sublime-snippet", "hige.sublime-snippet"],
39
- }
40
- ]
41
-
42
- context do
43
- before do
44
- File.open("./#{SublimeSunippetter::Core::DEFINE_FILE}", "w") {|f|f.puts GENERATE_SUNIPPETS_CASE}
45
- end
46
-
47
- cases_generate_sunippets.each do |c|
48
-
49
- it "#generate_sunippets case_no=#{c[:case_no]}" do
50
- # given
51
- sunippet = SublimeSunippetter::Core.new
52
-
53
- # when
54
- sunippet.generate_sunippets
55
-
56
- # then
57
- c[:output_file_names].each do |f|
58
- FileTest.exist?("./#{f}").should be_true
59
- File.delete("./#{f}")
60
- end
61
- end
62
- end
63
- end
64
-
65
- after(:each) do
66
- File.delete("#{SublimeSunippetter::Core::DEFINE_FILE}") if File.exists?("#{SublimeSunippetter::Core::DEFINE_FILE}")
67
- end
1
+ # encoding: utf-8
2
+ require_relative "../lib/sublime_sunippetter"
3
+ require "spec_helper"
4
+
5
+ describe SublimeSunippetter::Core do
6
+ cases_init = [
7
+ {
8
+ case_no: 1,
9
+ expected: SublimeSunippetter::Core::DEFINE_FILE_TEMPLATE
10
+ },
11
+ ]
12
+
13
+ cases_init.each do |c|
14
+ it "#init case_no=#{c[:case_no]} generate #{SublimeSunippetter::Core::DEFINE_FILE}" do
15
+ # given
16
+ sunippet = SublimeSunippetter::Core.new
17
+
18
+ # when
19
+ sunippet.init
20
+
21
+ # then
22
+ actual = File.open("#{SublimeSunippetter::Core::DEFINE_FILE}") {|f|f.read}
23
+ expect(actual).to eq(c[:expected])
24
+ end
25
+ end
26
+
27
+ GENERATE_SUNIPPETS_CASE =<<-EOS
28
+ output_path "#{File.absolute_path('.')}"
29
+ scope "source.java"
30
+ add :hoge, :args1, :args2
31
+ add :hige?
32
+ EOS
33
+
34
+ cases_generate_sunippets = [
35
+ {
36
+ case_no: 1,
37
+ sunippetdefine: GENERATE_SUNIPPETS_CASE,
38
+ output_file_names: ["hoge.sublime-snippet", "hige.sublime-snippet"],
39
+ }
40
+ ]
41
+
42
+ context do
43
+ before do
44
+ File.open("./#{SublimeSunippetter::Core::DEFINE_FILE}", "w") {|f|f.puts GENERATE_SUNIPPETS_CASE}
45
+ end
46
+
47
+ cases_generate_sunippets.each do |c|
48
+
49
+ it "#generate_sunippets case_no=#{c[:case_no]}" do
50
+ # given
51
+ sunippet = SublimeSunippetter::Core.new
52
+
53
+ # when
54
+ sunippet.generate_sunippets
55
+
56
+ # then
57
+ c[:output_file_names].each do |f|
58
+ FileTest.exist?("./#{f}").should be_true
59
+ File.delete("./#{f}")
60
+ end
61
+ end
62
+ end
63
+ end
64
+
65
+ after(:each) do
66
+ File.delete("#{SublimeSunippetter::Core::DEFINE_FILE}") if File.exists?("#{SublimeSunippetter::Core::DEFINE_FILE}")
67
+ end
68
68
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sublime_sunippetter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-25 00:00:00.000000000 Z
12
+ date: 2014-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &22951308 !ruby/object:Gem::Requirement
16
+ requirement: &26357748 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.18.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *22951308
24
+ version_requirements: *26357748
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &28942056 !ruby/object:Gem::Requirement
27
+ requirement: &26357448 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '1.3'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *28942056
35
+ version_requirements: *26357448
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &28908420 !ruby/object:Gem::Requirement
38
+ requirement: &26357220 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *28908420
46
+ version_requirements: *26357220
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &23167164 !ruby/object:Gem::Requirement
49
+ requirement: &26356896 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 2.14.1
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *23167164
57
+ version_requirements: *26356896
58
58
  description: SublimeSunippetter is generate Sublime Text2 simple sunippet from Sunippetfile
59
59
  DSL.
60
60
  email: