sublime_text_kit 9.1.0 → 9.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e18a60bcea4e410a4e2c7b68927cb76f607eb06cde37fab3a6031f141d43f3b
4
- data.tar.gz: edfc386ffd97eb1b02f56430e7b01d6e12b3c8737bc75922a4ca4ef5ffa0fe11
3
+ metadata.gz: f37030a8a701454832ce3d77994702af2bbf4f65b29e1279155b82084ade4473
4
+ data.tar.gz: ee53ad5fa9d8a5a5740adecdfaf8551cd813e91cf893db95274d8499fa889428
5
5
  SHA512:
6
- metadata.gz: b248d267aab2d9a936f5dc284b45f981df813200527ab177fd06fc80233bc0efecb9722d18029df3f3b8fa81055792da5dd48a8254fadfe7e703168368ca9128
7
- data.tar.gz: 5e7ae4fdd9331a8a1f43a18a630ce6d3a7b0788790e359b9d71ff2a3c960a026dd46fcc452909e3a942a207aef6dd2c606bdd4a6b65381690ce0b2e5840022b2
6
+ metadata.gz: 21377c7615eefce44f717e9bbd4ec1c4e6cb24133c051eb57cf68690ea5039b21341a060b28aac961c8d5299bfe04411ace20b25c4fd0cf5f70afa10cd7d0d35
7
+ data.tar.gz: b8fee030eb6cabedeca8374c694c13410cd3d714afe8de68e866231ff65ecc1ccae636b319b36a7a0e7fff2e7cfd0f09e0513e587b963069fa669d60e76fb073
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -23,7 +23,7 @@ toc::[]
23
23
 
24
24
  == Screencasts
25
25
 
26
- [link=https://www.alchemists.io/screencasts/sublime_text_kit.html]
26
+ [link=https://www.alchemists.io/screencasts/sublime_text_kit]
27
27
  image::https://www.alchemists.io/images/screencasts/sublime_text_kit/cover-original.png[Screencast,role=focal_point]
28
28
 
29
29
  == Requirements
@@ -100,7 +100,8 @@ For session options, type: `sublime_text_kit --help --session`
100
100
  For snippet options, type: `sublime_text_kit --help --snippets`
101
101
 
102
102
  ....
103
- -m, [--markdown], [--no-markdown] # Print snippets in Markdown format.
103
+ -a, [--ascii-doc], [--no-ascii-doc] # Print snippets in ASCII Doc format.
104
+ -m, [--markdown], [--no-markdown] # Print snippets in Markdown format.
104
105
  ....
105
106
 
106
107
  === Customization
@@ -198,4 +199,4 @@ Read link:CHANGES.adoc[CHANGES] for details.
198
199
 
199
200
  == Credits
200
201
 
201
- Engineered by link:https://www.alchemists.io/team/brooke_kuhlmann.html[Brooke Kuhlmann].
202
+ Engineered by link:https://www.alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
@@ -5,6 +5,8 @@ require "sublime_text_kit/metadata/base"
5
5
  require "sublime_text_kit/metadata/project_metadata"
6
6
  require "sublime_text_kit/metadata/workspace_metadata"
7
7
  require "sublime_text_kit/snippets/snippet"
8
+ require "sublime_text_kit/snippets/collector"
9
+ require "sublime_text_kit/snippets/printers/ascii_doc"
8
10
  require "sublime_text_kit/snippets/printers/markdown"
9
11
  require "sublime_text_kit/session"
10
12
  require "sublime_text_kit/cli"
@@ -19,6 +19,7 @@ module SublimeTextKit
19
19
  def initialize args = [], options = {}, config = {}
20
20
  super args, options, config
21
21
  @markdown_printer = Snippets::Printers::Markdown.new
22
+ @ascii_doc_printer = Snippets::Printers::ASCIIDoc.new
22
23
  end
23
24
 
24
25
  desc "-u, [--update]", "Update Sublime Text with current settings."
@@ -44,6 +45,11 @@ module SublimeTextKit
44
45
 
45
46
  desc "-p, [--snippets]", "Print user defined snippets."
46
47
  map %w[-p --snippets] => :snippets
48
+ method_option :ascii_doc,
49
+ aliases: "-a",
50
+ desc: "Print snippets in ASCII Doc format.",
51
+ type: :boolean,
52
+ default: false
47
53
  method_option :markdown,
48
54
  aliases: "-m",
49
55
  desc: "Print snippets in Markdown format.",
@@ -51,7 +57,12 @@ module SublimeTextKit
51
57
  default: false
52
58
  def snippets
53
59
  say
54
- options.markdown? ? markdown_printer.call : help("--snippets")
60
+
61
+ if options.ascii_doc? then ascii_doc_printer.call
62
+ elsif options.markdown? then markdown_printer.call
63
+ else help "--snippets"
64
+ end
65
+
55
66
  say
56
67
  end
57
68
 
@@ -63,9 +74,9 @@ module SublimeTextKit
63
74
  def metadata
64
75
  say
65
76
 
66
- if options[:create] then create_metadata
67
- elsif options[:destroy] then destroy_metadata
68
- elsif options[:rebuild] then rebuild_metadata
77
+ if options.create? then create_metadata
78
+ elsif options.destroy? then destroy_metadata
79
+ elsif options.rebuild? then rebuild_metadata
69
80
  else help "--metadata"
70
81
  end
71
82
 
@@ -108,7 +119,7 @@ module SublimeTextKit
108
119
 
109
120
  private
110
121
 
111
- attr_reader :markdown_printer
122
+ attr_reader :ascii_doc_printer, :markdown_printer
112
123
 
113
124
  def project_roots
114
125
  @project_roots ||= self.class.configuration.to_h.fetch :project_roots, []
@@ -5,7 +5,7 @@ module SublimeTextKit
5
5
  module Identity
6
6
  NAME = "sublime_text_kit"
7
7
  LABEL = "Sublime Text Kit"
8
- VERSION = "9.1.0"
8
+ VERSION = "9.2.0"
9
9
  VERSION_LABEL = "#{LABEL} #{VERSION}"
10
10
  end
11
11
  end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "pathname"
4
+ require "rexml/document"
5
+
6
+ module SublimeTextKit
7
+ module Snippets
8
+ class Collector
9
+ DEFAULT_USER_PATH = "Library/Application Support/Sublime Text 3/Packages/User"
10
+
11
+ def initialize model: Snippet, user_path: DEFAULT_USER_PATH, environment: ENV
12
+ @model = model
13
+ @user_path = user_path
14
+ @environment = environment
15
+ end
16
+
17
+ def home_path
18
+ Pathname environment.fetch("HOME")
19
+ end
20
+
21
+ def root_path
22
+ home_path.join user_path
23
+ end
24
+
25
+ def call
26
+ root_path.glob("*.sublime-snippet")
27
+ .map { |path| model.new REXML::Document.new(path.read) }
28
+ .sort_by(&:description)
29
+ end
30
+
31
+ private
32
+
33
+ attr_reader :model, :user_path, :environment
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rexml/document"
4
+
5
+ module SublimeTextKit
6
+ module Snippets
7
+ module Printers
8
+ class ASCIIDoc
9
+ def initialize collector: Collector.new
10
+ @collector = collector
11
+ end
12
+
13
+ def call
14
+ collector.call.each do |snippet|
15
+ puts "* #{snippet.description} - `#{snippet.trigger}`\n"
16
+ end
17
+ end
18
+
19
+ private
20
+
21
+ attr_reader :collector
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,41 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "rexml/document"
4
-
5
3
  module SublimeTextKit
6
4
  module Snippets
7
5
  module Printers
8
6
  class Markdown
9
- DEFAULT_USER_PATH = "Library/Application Support/Sublime Text 3/Packages/User"
10
-
11
- def initialize user_path = DEFAULT_USER_PATH, environment: ENV
12
- @user_path = user_path
13
- @environment = environment
14
- end
15
-
16
- def home_path
17
- Pathname environment.fetch("HOME")
18
- end
19
-
20
- def root_path
21
- home_path.join user_path
7
+ def initialize collector: Collector.new
8
+ @collector = collector
22
9
  end
23
10
 
24
11
  def call
25
- snippets.sort_by(&:description).each do |snippet|
12
+ collector.call.each do |snippet|
26
13
  puts "- #{snippet.description} - `#{snippet.trigger}`\n"
27
14
  end
28
15
  end
29
16
 
30
17
  private
31
18
 
32
- attr_reader :user_path, :environment
33
-
34
- def snippets
35
- root_path.glob("*.sublime-snippet").map do |path|
36
- Snippet.new REXML::Document.new(File.open(path))
37
- end
38
- end
19
+ attr_reader :collector
39
20
  end
40
21
  end
41
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sublime_text_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.1.0
4
+ version: 9.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -28,7 +28,7 @@ cert_chain:
28
28
  2XV8FRa7/JimI07sPLC13eLY3xd/aYTi85Z782KIA4j0G8XEEWAX0ouBhlXPocZv
29
29
  QWc=
30
30
  -----END CERTIFICATE-----
31
- date: 2020-04-01 00:00:00.000000000 Z
31
+ date: 2020-04-11 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: runcom
@@ -274,6 +274,8 @@ files:
274
274
  - lib/sublime_text_kit/metadata/project_metadata.rb
275
275
  - lib/sublime_text_kit/metadata/workspace_metadata.rb
276
276
  - lib/sublime_text_kit/session.rb
277
+ - lib/sublime_text_kit/snippets/collector.rb
278
+ - lib/sublime_text_kit/snippets/printers/ascii_doc.rb
277
279
  - lib/sublime_text_kit/snippets/printers/markdown.rb
278
280
  - lib/sublime_text_kit/snippets/snippet.rb
279
281
  homepage: https://www.alchemists.io/projects/sublime_text_kit
metadata.gz.sig CHANGED
Binary file