sublime_text_kit 9.0.0 → 9.5.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: 20ee035996f8f1e5cfb0fceeecdcf04861385ac2c768899e5d25c50b9600101e
4
- data.tar.gz: a447a9d6b628f2b111097a515b5d1bda327849b5eea2bfb623073d8728001539
3
+ metadata.gz: 76ce08b7b49d65efd07614ddebe8ea23a9dfa3d7f918007bba99ca9214065b54
4
+ data.tar.gz: a0e1e3ef9c273e3286fbe5eaaa19135fb7ad2a55079beff6e12bd24b2d6fa582
5
5
  SHA512:
6
- metadata.gz: 9009debfec855c7da7626acb5acd8dae358f7a0cf2ea2a648c51645d1871d451985e1c2fffb07637731a329c85288b8cac55ecc7780bdcdafca671ffdafb0432
7
- data.tar.gz: 0e701957958240475033720c22ed865a90265e6d581cda1cbb90855e36162d239cb2deafc563e789078ec1953745c74e282f0ec77c00a22d0a653d8e0ca36624
6
+ metadata.gz: f47203af8e63030c8f0b1ef3279a3e8587575927115065676efb30427b71db58bf8f19243ea697c090be864837709554379df28213a546e2a4984832aa13e761
7
+ data.tar.gz: 7ce7b03b23d568c978b30ba937c237fe728b499a26bcc11627e4af0fcc7f378499069180729cba07b317cd3819be791079668a2caf018acd466e4e0e833fff14
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,4 +1,4 @@
1
- # Apache License
1
+ = Apache License
2
2
 
3
3
  Version 2.0, January 2004
4
4
 
@@ -6,7 +6,7 @@ http://www.apache.org/licenses
6
6
 
7
7
  TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
8
 
9
- ## 1. Definitions
9
+ == 1. Definitions
10
10
 
11
11
  "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by
12
12
  Sections 1 through 9 of this document.
@@ -54,14 +54,14 @@ Contribution."
54
54
  "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a
55
55
  Contribution has been received by Licensor and subsequently incorporated within the Work.
56
56
 
57
- ## 2. Grant of Copyright License
57
+ == 2. Grant of Copyright License
58
58
 
59
59
  Subject to the terms and conditions of this License, each Contributor hereby grants to You a
60
60
  perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to
61
61
  reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and
62
62
  distribute the Work and such Derivative Works in Source or Object form.
63
63
 
64
- ## 3. Grant of Patent License
64
+ == 3. Grant of Patent License
65
65
 
66
66
  Subject to the terms and conditions of this License, each Contributor hereby grants to You a
67
67
  perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
@@ -74,39 +74,38 @@ a Contribution incorporated within the Work constitutes direct or contributory p
74
74
  then any patent licenses granted to You under this License for that Work shall terminate as of the
75
75
  date such litigation is filed.
76
76
 
77
- ## 4. Redistribution
77
+ == 4. Redistribution
78
78
 
79
79
  You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with
80
80
  or without modifications, and in Source or Object form, provided that You meet the following
81
81
  conditions:
82
82
 
83
- 1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
83
+ . You must give any other recipients of the Work or Derivative Works a copy of this License; and
84
84
 
85
- 2. You must cause any modified files to carry prominent notices stating that You changed the
86
- files; and
85
+ . You must cause any modified files to carry prominent notices stating that You changed the files;
86
+ and
87
87
 
88
- 3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright,
89
- patent, trademark, and attribution notices from the Source form of the Work, excluding those
90
- notices that do not pertain to any part of the Derivative Works; and
88
+ . You must retain, in the Source form of any Derivative Works that You distribute, all copyright,
89
+ patent, trademark, and attribution notices from the Source form of the Work, excluding those
90
+ notices that do not pertain to any part of the Derivative Works; and
91
91
 
92
- 4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative
93
- Works that You distribute must include a readable copy of the attribution notices contained
94
- within such NOTICE file, excluding those notices that do not pertain to any part of the
95
- Derivative Works, in at least one of the following places: within a NOTICE text file
96
- distributed as part of the Derivative Works; within the Source form or documentation, if
97
- provided along with the Derivative Works; or, within a display generated by the Derivative
98
- Works, if and wherever such third-party notices normally appear. The contents of the NOTICE
99
- file are for informational purposes only and do not modify the License. You may add Your own
100
- attribution notices within Derivative Works that You distribute, alongside or as an addendum to
101
- the NOTICE text from the Work, provided that such additional attribution notices cannot be
102
- construed as modifying the License.
92
+ . If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works
93
+ that You distribute must include a readable copy of the attribution notices contained within such
94
+ NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in
95
+ at least one of the following places: within a NOTICE text file distributed as part of the
96
+ Derivative Works; within the Source form or documentation, if provided along with the Derivative
97
+ Works; or, within a display generated by the Derivative Works, if and wherever such third-party
98
+ notices normally appear. The contents of the NOTICE file are for informational purposes only and
99
+ do not modify the License. You may add Your own attribution notices within Derivative Works that
100
+ You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such
101
+ additional attribution notices cannot be construed as modifying the License.
103
102
 
104
103
  You may add Your own copyright statement to Your modifications and may provide additional or
105
104
  different license terms and conditions for use, reproduction, or distribution of Your modifications,
106
105
  or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of
107
106
  the Work otherwise complies with the conditions stated in this License.
108
107
 
109
- ## 5. Submission of Contributions
108
+ == 5. Submission of Contributions
110
109
 
111
110
  Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the
112
111
  Work by You to the Licensor shall be under the terms and conditions of this License, without any
@@ -114,13 +113,13 @@ additional terms or conditions. Notwithstanding the above, nothing herein shall
114
113
  the terms of any separate license agreement you may have executed with Licensor regarding such
115
114
  Contributions.
116
115
 
117
- ## 6. Trademarks
116
+ == 6. Trademarks
118
117
 
119
118
  This License does not grant permission to use the trade names, trademarks, service marks, or product
120
119
  names of the Licensor, except as required for reasonable and customary use in describing the origin
121
120
  of the Work and reproducing the content of the NOTICE file.
122
121
 
123
- ## 7. Disclaimer of Warranty
122
+ == 7. Disclaimer of Warranty
124
123
 
125
124
  Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each
126
125
  Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -129,7 +128,7 @@ TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. Y
129
128
  responsible for determining the appropriateness of using or redistributing the Work and assume any
130
129
  risks associated with Your exercise of permissions under this License.
131
130
 
132
- ## 8. Limitation of Liability
131
+ == 8. Limitation of Liability
133
132
 
134
133
  In no event and under no legal theory, whether in tort (including negligence), contract, or
135
134
  otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or
@@ -139,7 +138,7 @@ License or out of the use or inability to use the Work (including but not limite
139
138
  loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial
140
139
  damages or losses), even if such Contributor has been advised of the possibility of such damages.
141
140
 
142
- ## 9. Accepting Warranty or Additional Liability
141
+ == 9. Accepting Warranty or Additional Liability
143
142
 
144
143
  While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee
145
144
  for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights
@@ -151,11 +150,11 @@ additional liability.
151
150
 
152
151
  END OF TERMS AND CONDITIONS
153
152
 
154
- Copyright 2014 [Alchemists](https://www.alchemists.io).
153
+ Copyright 2014 link:https://www.alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
155
154
 
156
155
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
157
- compliance with the License. You may obtain a [copy](http://www.apache.org/licenses/LICENSE-2.0) of
158
- the License.
156
+ compliance with the License. You may obtain a link:https://www.apache.org/licenses/LICENSE-2.0[copy]
157
+ of the License.
159
158
 
160
159
  Unless required by applicable law or agreed to in writing, software distributed under the License is
161
160
  distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
@@ -0,0 +1,202 @@
1
+ :toc: macro
2
+ :toclevels: 5
3
+ :figure-caption!:
4
+
5
+ = Sublime Text Kit
6
+
7
+ [link=http://badge.fury.io/rb/sublime_text_kit]
8
+ image::https://badge.fury.io/rb/sublime_text_kit.svg[Gem Version]
9
+ [link=https://www.alchemists.io/projects/code_quality]
10
+ image::https://img.shields.io/badge/code_style-alchemists-brightgreen.svg[Alchemists Style Guide]
11
+ [link=https://circleci.com/gh/bkuhlmann/sublime_text_kit]
12
+ image::https://circleci.com/gh/bkuhlmann/sublime_text_kit.svg?style=svg[Circle CI Status]
13
+
14
+ A command line interface for managing Sublime Text metadata.
15
+
16
+ toc::[]
17
+
18
+ == Features
19
+
20
+ * Provides project metadata (i.e. `.sublime-project` and `.sublime-workspace` files) management for
21
+ project switching via the `CONTROL+COMMAND+P` shortcut.
22
+ * Rebuilds project history (Project -> Recent Projects) from existing project files (assumes project
23
+ metadata is in a directory) so one can easily toggle between up-to-date project information via
24
+ the `CONTROL+COMMAND+P` shortcut.
25
+
26
+ == Screencasts
27
+
28
+ [link=https://www.alchemists.io/screencasts/sublime_text_kit]
29
+ image::https://www.alchemists.io/images/screencasts/sublime_text_kit/cover.svg[Screencast,600,240,role=focal_point]
30
+
31
+ == Requirements
32
+
33
+ . link:https://www.ruby-lang.org[Ruby]
34
+ . link:https://www.sublimetext.com[Sublime Text]
35
+
36
+ == Setup
37
+
38
+ To install, run:
39
+
40
+ [source,bash]
41
+ ----
42
+ gem install sublime_text_kit
43
+ ----
44
+
45
+ == Usage
46
+
47
+ === Command Line Interface (CLI)
48
+
49
+ From the command line, type: `sublime_text_kit`
50
+
51
+ ....
52
+ sublime_text_kit -c, [--config] # Manage gem configuration.
53
+ sublime_text_kit -h, [--help=COMMAND] # Show this message or get help for a command.
54
+ sublime_text_kit -m, [--metadata] # Manage project/workspace metadata.
55
+ sublime_text_kit -p, [--snippets] # Print user defined snippets.
56
+ sublime_text_kit -s, [--session] # Manage session metadata.
57
+ sublime_text_kit -u, [--update] # Update Sublime Text with current settings.
58
+ sublime_text_kit -v, [--version] # Show gem version.
59
+ ....
60
+
61
+ For configuration options, type: `sublime_text_kit --help --config`
62
+
63
+ ....
64
+ -e, [--edit], [--no-edit] # Edit gem configuration.
65
+ -i, [--info], [--no-info] # Print gem configuration.
66
+ ....
67
+
68
+ For metadata options, type: `sublime_text_kit --help --metadata`
69
+
70
+ ....
71
+ -c, [--create], [--no-create] # Create metadata.
72
+ -D, [--destroy], [--no-destroy] # Destroy metadata.
73
+ -R, [--rebuild], [--no-rebuild] # Rebuild metadata.
74
+ ....
75
+
76
+ For session options, type: `sublime_text_kit --help --session`
77
+
78
+ ....
79
+ -R, [--rebuild], [--no-rebuild] # Rebuild session metadata.
80
+ ....
81
+
82
+ For snippet options, type: `sublime_text_kit --help --snippets`
83
+
84
+ ....
85
+ -a, [--ascii-doc], [--no-ascii-doc] # Print snippets in ASCII Doc format.
86
+ -m, [--markdown], [--no-markdown] # Print snippets in Markdown format.
87
+ ....
88
+
89
+ === Customization
90
+
91
+ This gem can be configured via a global configuration:
92
+ `~/.config/sublime_text_kit/configuration.yml`. It can also be configured via
93
+ link:https://www.alchemists.io/projects/xdg[XDG] environment variables.
94
+
95
+ An example configuration could be:
96
+
97
+ [source,yaml]
98
+ ----
99
+ :project_roots:
100
+ - "~/Dropbox/Development/Misc"
101
+ - "~/Dropbox/Development/OSS"
102
+ - "~/Dropbox/Development/Work"
103
+ :metadata_dir: "~/Dropbox/Cache/Sublime"
104
+ ----
105
+
106
+ Feel free to take this configuration, modify, and save as your own custom `+configuration.yml+`.
107
+
108
+ The project roots define the root level directories where project folders are located. When project
109
+ metadata (i.e. `.sublime-project`, `.sublime-workspace`) is generated, the name of the metadata file
110
+ will be the same name as that of the project folder. All project metadata, regardless of root
111
+ location, is written to the same metadata directory. If using the example settings shown above and
112
+ assuming the following directory structure exists…
113
+
114
+ ....
115
+ ~/Dropbox/Development/Misc/example
116
+ ~/Dropbox/Development/OSS/sublime_text_kit
117
+ ....
118
+
119
+ …the project metadata will be created in the workspace directory as follows:
120
+
121
+ ....
122
+ ~/Dropbox/Cache/Sublime/example.sublime-project
123
+ ~/Dropbox/Cache/Sublime/example.sublime-workspace
124
+ ~/Dropbox/Cache/Sublime/sublime_text_kit.sublime-project
125
+ ~/Dropbox/Cache/Sublime/sublime_text_kit.sublime-workspace
126
+ ....
127
+
128
+ === Workflow
129
+
130
+ The following demonstrates a default Sublime Text setup:
131
+
132
+ . Run: `sublime_text_kit --config --edit` (define Sublime Text Kit settings for project roots and
133
+ metadata directory).
134
+ . Shutdown Sublime Text (i.e. `CONTROL+Q`).
135
+ . Run: `sublime_text_kit --metadata --create` (creates project metadata and rebuilds the session
136
+ metadata so Sublime Text has a complete project history from which to jump through via the
137
+ `CONTROL+COMMMAND+P` shortcut).
138
+ . Launch Sublime Text and use the `CONTROL+COMMAND+P` keyboard shortcut to toggle between
139
+ projects. Notice that you can (fuzzy type) project names to jump between them.
140
+ . Breeze through your project workload with ease. 😉
141
+
142
+ === Troubleshooting
143
+
144
+ * When rebuilding workspaces, ensure Sublime Text is shutdown or changes won’t be applied.
145
+ * When rebuilding workspaces, ensure workspace_dir (as defined via settings.yml) points to a
146
+ directory containing `.sublime-project` and `.sublime-workspace` files.
147
+
148
+ == Development
149
+
150
+ To contribute, run:
151
+
152
+ [source,bash]
153
+ ----
154
+ git clone https://github.com/bkuhlmann/sublime_text_kit.git
155
+ cd sublime_text_kit
156
+ bin/setup
157
+ ----
158
+
159
+ You can also use the IRB console for direct access to all objects:
160
+
161
+ [source,bash]
162
+ ----
163
+ bin/console
164
+ ----
165
+
166
+ == Tests
167
+
168
+ To test, run:
169
+
170
+ [source,bash]
171
+ ----
172
+ bundle exec rake
173
+ ----
174
+
175
+ == Versioning
176
+
177
+ Read link:https://semver.org[Semantic Versioning] for details. Briefly, it means:
178
+
179
+ * Major (X.y.z) - Incremented for any backwards incompatible public API changes.
180
+ * Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
181
+ * Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
182
+
183
+ == Code of Conduct
184
+
185
+ Please note that this project is released with a link:CODE_OF_CONDUCT.adoc[CODE OF CONDUCT]. By
186
+ participating in this project you agree to abide by its terms.
187
+
188
+ == Contributions
189
+
190
+ Read link:CONTRIBUTING.adoc[CONTRIBUTING] for details.
191
+
192
+ == License
193
+
194
+ Read link:LICENSE.adoc[LICENSE] for details.
195
+
196
+ == History
197
+
198
+ Read link:CHANGES.adoc[CHANGES] for details.
199
+
200
+ == Credits
201
+
202
+ Engineered by link:https://www.alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
@@ -5,5 +5,5 @@ require "sublime_text_kit"
5
5
  require "sublime_text_kit/cli"
6
6
  require "sublime_text_kit/identity"
7
7
 
8
- Process.setproctitle SublimeTextKit::Identity.version_label
8
+ Process.setproctitle SublimeTextKit::Identity::VERSION_LABEL
9
9
  SublimeTextKit::CLI.start
@@ -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"
@@ -9,16 +9,17 @@ module SublimeTextKit
9
9
  class CLI < Thor
10
10
  include Thor::Actions
11
11
 
12
- package_name Identity.version_label
12
+ package_name Identity::VERSION_LABEL
13
13
 
14
14
  def self.configuration
15
- Runcom::Config.new "#{Identity.name}/configuration.yml"
15
+ Runcom::Config.new "#{Identity::NAME}/configuration.yml"
16
16
  end
17
17
 
18
18
  # Initialize.
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
 
@@ -97,7 +108,7 @@ module SublimeTextKit
97
108
  desc "-v, [--version]", "Show gem version."
98
109
  map %w[-v --version] => :version
99
110
  def version
100
- say Identity.version_label
111
+ say Identity::VERSION_LABEL
101
112
  end
102
113
 
103
114
  desc "-h, [--help=COMMAND]", "Show this message or get help for a command."
@@ -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, []
@@ -3,20 +3,9 @@
3
3
  module SublimeTextKit
4
4
  # Gem identity information.
5
5
  module Identity
6
- def self.name
7
- "sublime_text_kit"
8
- end
9
-
10
- def self.label
11
- "Sublime Text Kit"
12
- end
13
-
14
- def self.version
15
- "9.0.0"
16
- end
17
-
18
- def self.version_label
19
- "#{label} #{version}"
20
- end
6
+ NAME = "sublime_text_kit"
7
+ LABEL = "Sublime Text Kit"
8
+ VERSION = "9.5.0"
9
+ VERSION_LABEL = "#{LABEL} #{VERSION}"
21
10
  end
22
11
  end
@@ -4,10 +4,6 @@ module SublimeTextKit
4
4
  module Metadata
5
5
  # Processes project metadata.
6
6
  class Project < Base
7
- def initialize project_dir, metadata_dir
8
- super project_dir, metadata_dir
9
- end
10
-
11
7
  def file_extension
12
8
  "sublime-project"
13
9
  end
@@ -4,10 +4,6 @@ module SublimeTextKit
4
4
  module Metadata
5
5
  # Processes workspace metadata.
6
6
  class Workspace < Base
7
- def initialize project_dir, metadata_dir
8
- super project_dir, metadata_dir
9
- end
10
-
11
7
  def file_extension
12
8
  "sublime-workspace"
13
9
  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,18 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sublime_text_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.0.0
4
+ version: 9.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIC/jCCAeagAwIBAgIBAjANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
14
- a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0xOTAyMTcxNjAxMTFaFw0yMDAyMTcx
15
- NjAxMTFaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
13
+ MIIC/jCCAeagAwIBAgIBAzANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
14
+ a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0yMDAzMTUxNDQ1MzJaFw0yMTAzMTUx
15
+ NDQ1MzJaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
16
16
  IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6l1qpXTiomH1RfMRloyw7MiE
17
17
  xyVx/x8Yc3EupdH7uhNaTXQGyORN6aOY//1QXXMHIZ9tW74nZLhesWMSUMYy0XhB
18
18
  brs+KkurHnc9FnEJAbG7ebGvl/ncqZt72nQvaxpDxvuCBHgJAz+8i5wl6FhLw+oT
@@ -20,15 +20,15 @@ cert_chain:
20
20
  D5vkU0YlAm1r98BymuJlcQ1qdkVEI1d48ph4kcS0S0nv1RiuyVb6TCAR3Nu3VaVq
21
21
  3fPzZKJLZBx67UvXdbdicWPiUR75elI4PXpLIic3xytaF52ZJYyKZCNZJhNwfQID
22
22
  AQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU0nzow9vc
23
- 2CdikiiE3fJhP/gY4ggwDQYJKoZIhvcNAQELBQADggEBANgfX7kPZkJvsbdWMvbe
24
- DUUYxRTqTUzCDpLd2p3sQvgLMKjTNSKt6CFq/kh+98b6RCgO6DqiVfxvOEq02dvf
25
- ebMN/ylQqan2FgiAs1rpP0/D4C0MlBjoDktsT+2IyLol1KmkDB20ExJ4Sf1GRNdA
26
- hpWOtcgqHtmrc7xzgB6BuyoYufrKKUlCO3ewTM4C375D2qO7hIdKuMOO3CdPMtSk
27
- OrWpbzCL+nbbXqeoqiHgZaUvcyyQrGj5sQRxMTzuMXzzQxtHnuTuKrcz16HMTX/O
28
- dKvURM+1PwDCzC5tvRwjhUJIizau6+MtkFCvJHmaAj1aZL3odcPejHj5Hxt/0CUW
29
- y84=
23
+ 2CdikiiE3fJhP/gY4ggwDQYJKoZIhvcNAQELBQADggEBAIHhAlD3po4sTYqacXaQ
24
+ XI9jIhrfMy//2PgbHWcETtlJPBeNUbbSNBABcllUHKqYsVDlSvSmss034KSWNR8F
25
+ bF1GcloicyvcCC4y6IoW4it0COAcdeaaxkxiBSgKdQFpff9REnDlIKK4uQ9lLxIo
26
+ Y2G5xubiziKZkyfWFuSr67PIjW3Bu673D1JVBArhA1qbgQmYQcy1CkGOjo+iO8Nf
27
+ 7u/QSfBHb+r/bXhKscDgPpnKwbUmvgO2+94zJG9KsrmIydlzYfsD09aXKx0t6Xy4
28
+ 2XV8FRa7/JimI07sPLC13eLY3xd/aYTi85Z782KIA4j0G8XEEWAX0ouBhlXPocZv
29
+ QWc=
30
30
  -----END CERTIFICATE-----
31
- date: 2020-01-01 00:00:00.000000000 Z
31
+ date: 2020-11-15 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: runcom
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '6.0'
39
+ version: '6.4'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '6.0'
46
+ version: '6.4'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: thor
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -64,42 +64,56 @@ dependencies:
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '0.6'
67
+ version: '0.7'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '0.6'
74
+ version: '0.7'
75
+ - !ruby/object:Gem::Dependency
76
+ name: bundler-leak
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '0.2'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '0.2'
75
89
  - !ruby/object:Gem::Dependency
76
90
  name: gemsmith
77
91
  requirement: !ruby/object:Gem::Requirement
78
92
  requirements:
79
93
  - - "~>"
80
94
  - !ruby/object:Gem::Version
81
- version: '14.0'
95
+ version: '14.8'
82
96
  type: :development
83
97
  prerelease: false
84
98
  version_requirements: !ruby/object:Gem::Requirement
85
99
  requirements:
86
100
  - - "~>"
87
101
  - !ruby/object:Gem::Version
88
- version: '14.0'
102
+ version: '14.8'
89
103
  - !ruby/object:Gem::Dependency
90
- name: git-cop
104
+ name: git-lint
91
105
  requirement: !ruby/object:Gem::Requirement
92
106
  requirements:
93
107
  - - "~>"
94
108
  - !ruby/object:Gem::Version
95
- version: '4.0'
109
+ version: '1.3'
96
110
  type: :development
97
111
  prerelease: false
98
112
  version_requirements: !ruby/object:Gem::Requirement
99
113
  requirements:
100
114
  - - "~>"
101
115
  - !ruby/object:Gem::Version
102
- version: '4.0'
116
+ version: '1.3'
103
117
  - !ruby/object:Gem::Dependency
104
118
  name: guard-rspec
105
119
  requirement: !ruby/object:Gem::Requirement
@@ -120,28 +134,28 @@ dependencies:
120
134
  requirements:
121
135
  - - "~>"
122
136
  - !ruby/object:Gem::Version
123
- version: '0.12'
137
+ version: '0.13'
124
138
  type: :development
125
139
  prerelease: false
126
140
  version_requirements: !ruby/object:Gem::Requirement
127
141
  requirements:
128
142
  - - "~>"
129
143
  - !ruby/object:Gem::Version
130
- version: '0.12'
144
+ version: '0.13'
131
145
  - !ruby/object:Gem::Dependency
132
146
  name: pry-byebug
133
147
  requirement: !ruby/object:Gem::Requirement
134
148
  requirements:
135
149
  - - "~>"
136
150
  - !ruby/object:Gem::Version
137
- version: '3.7'
151
+ version: '3.9'
138
152
  type: :development
139
153
  prerelease: false
140
154
  version_requirements: !ruby/object:Gem::Requirement
141
155
  requirements:
142
156
  - - "~>"
143
157
  - !ruby/object:Gem::Version
144
- version: '3.7'
158
+ version: '3.9'
145
159
  - !ruby/object:Gem::Dependency
146
160
  name: rake
147
161
  requirement: !ruby/object:Gem::Requirement
@@ -162,56 +176,56 @@ dependencies:
162
176
  requirements:
163
177
  - - "~>"
164
178
  - !ruby/object:Gem::Version
165
- version: '5.4'
179
+ version: '6.0'
166
180
  type: :development
167
181
  prerelease: false
168
182
  version_requirements: !ruby/object:Gem::Requirement
169
183
  requirements:
170
184
  - - "~>"
171
185
  - !ruby/object:Gem::Version
172
- version: '5.4'
186
+ version: '6.0'
173
187
  - !ruby/object:Gem::Dependency
174
188
  name: rspec
175
189
  requirement: !ruby/object:Gem::Requirement
176
190
  requirements:
177
191
  - - "~>"
178
192
  - !ruby/object:Gem::Version
179
- version: '3.9'
193
+ version: '3.10'
180
194
  type: :development
181
195
  prerelease: false
182
196
  version_requirements: !ruby/object:Gem::Requirement
183
197
  requirements:
184
198
  - - "~>"
185
199
  - !ruby/object:Gem::Version
186
- version: '3.9'
200
+ version: '3.10'
187
201
  - !ruby/object:Gem::Dependency
188
202
  name: rubocop
189
203
  requirement: !ruby/object:Gem::Requirement
190
204
  requirements:
191
205
  - - "~>"
192
206
  - !ruby/object:Gem::Version
193
- version: '0.78'
207
+ version: '1.3'
194
208
  type: :development
195
209
  prerelease: false
196
210
  version_requirements: !ruby/object:Gem::Requirement
197
211
  requirements:
198
212
  - - "~>"
199
213
  - !ruby/object:Gem::Version
200
- version: '0.78'
214
+ version: '1.3'
201
215
  - !ruby/object:Gem::Dependency
202
216
  name: rubocop-performance
203
217
  requirement: !ruby/object:Gem::Requirement
204
218
  requirements:
205
219
  - - "~>"
206
220
  - !ruby/object:Gem::Version
207
- version: '1.5'
221
+ version: '1.8'
208
222
  type: :development
209
223
  prerelease: false
210
224
  version_requirements: !ruby/object:Gem::Requirement
211
225
  requirements:
212
226
  - - "~>"
213
227
  - !ruby/object:Gem::Version
214
- version: '1.5'
228
+ version: '1.8'
215
229
  - !ruby/object:Gem::Dependency
216
230
  name: rubocop-rake
217
231
  requirement: !ruby/object:Gem::Requirement
@@ -232,40 +246,40 @@ dependencies:
232
246
  requirements:
233
247
  - - "~>"
234
248
  - !ruby/object:Gem::Version
235
- version: '1.37'
249
+ version: '2.0'
236
250
  type: :development
237
251
  prerelease: false
238
252
  version_requirements: !ruby/object:Gem::Requirement
239
253
  requirements:
240
254
  - - "~>"
241
255
  - !ruby/object:Gem::Version
242
- version: '1.37'
256
+ version: '2.0'
243
257
  - !ruby/object:Gem::Dependency
244
258
  name: simplecov
245
259
  requirement: !ruby/object:Gem::Requirement
246
260
  requirements:
247
261
  - - "~>"
248
262
  - !ruby/object:Gem::Version
249
- version: '0.17'
263
+ version: '0.19'
250
264
  type: :development
251
265
  prerelease: false
252
266
  version_requirements: !ruby/object:Gem::Requirement
253
267
  requirements:
254
268
  - - "~>"
255
269
  - !ruby/object:Gem::Version
256
- version: '0.17'
257
- description:
270
+ version: '0.19'
271
+ description:
258
272
  email:
259
273
  - brooke@alchemists.io
260
274
  executables:
261
275
  - sublime_text_kit
262
276
  extensions: []
263
277
  extra_rdoc_files:
264
- - README.md
265
- - LICENSE.md
278
+ - README.adoc
279
+ - LICENSE.adoc
266
280
  files:
267
- - LICENSE.md
268
- - README.md
281
+ - LICENSE.adoc
282
+ - README.adoc
269
283
  - bin/sublime_text_kit
270
284
  - lib/sublime_text_kit.rb
271
285
  - lib/sublime_text_kit/cli.rb
@@ -274,16 +288,19 @@ files:
274
288
  - lib/sublime_text_kit/metadata/project_metadata.rb
275
289
  - lib/sublime_text_kit/metadata/workspace_metadata.rb
276
290
  - lib/sublime_text_kit/session.rb
291
+ - lib/sublime_text_kit/snippets/collector.rb
292
+ - lib/sublime_text_kit/snippets/printers/ascii_doc.rb
277
293
  - lib/sublime_text_kit/snippets/printers/markdown.rb
278
294
  - lib/sublime_text_kit/snippets/snippet.rb
279
- homepage: https://github.com/bkuhlmann/sublime_text_kit
295
+ homepage: https://www.alchemists.io/projects/sublime_text_kit
280
296
  licenses:
281
297
  - Apache-2.0
282
298
  metadata:
283
- source_code_uri: https://github.com/bkuhlmann/sublime_text_kit
284
- changelog_uri: https://github.com/bkuhlmann/sublime_text_kit/blob/master/CHANGES.md
285
299
  bug_tracker_uri: https://github.com/bkuhlmann/sublime_text_kit/issues
286
- post_install_message:
300
+ changelog_uri: https://www.alchemists.io/projects/sublime_text_kit/changes.html
301
+ documentation_uri: https://www.alchemists.io/projects/sublime_text_kit
302
+ source_code_uri: https://github.com/bkuhlmann/sublime_text_kit
303
+ post_install_message:
287
304
  rdoc_options: []
288
305
  require_paths:
289
306
  - lib
@@ -298,8 +315,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
298
315
  - !ruby/object:Gem::Version
299
316
  version: '0'
300
317
  requirements: []
301
- rubygems_version: 3.1.2
302
- signing_key:
318
+ rubygems_version: 3.1.4
319
+ signing_key:
303
320
  specification_version: 4
304
321
  summary: A command line interface for managing Sublime Text metadata.
305
322
  test_files: []
metadata.gz.sig CHANGED
Binary file
data/README.md DELETED
@@ -1,184 +0,0 @@
1
- <p align="center">
2
- <img src="sublime_text_kit.png" alt="Sublime Text Kit Icon"/>
3
- </p>
4
-
5
- # Sublime Text Kit
6
-
7
- [![Gem Version](https://badge.fury.io/rb/sublime_text_kit.svg)](http://badge.fury.io/rb/sublime_text_kit)
8
- [![Code Climate Maintainability](https://api.codeclimate.com/v1/badges/ad83a2a96bf791ff47b7/maintainability)](https://codeclimate.com/github/bkuhlmann/sublime_text_kit/maintainability)
9
- [![Code Climate Test Coverage](https://api.codeclimate.com/v1/badges/ad83a2a96bf791ff47b7/test_coverage)](https://codeclimate.com/github/bkuhlmann/sublime_text_kit/test_coverage)
10
- [![Circle CI Status](https://circleci.com/gh/bkuhlmann/sublime_text_kit.svg?style=svg)](https://circleci.com/gh/bkuhlmann/sublime_text_kit)
11
-
12
- A command line interface for managing Sublime Text metadata.
13
-
14
- <!-- Tocer[start]: Auto-generated, don't remove. -->
15
-
16
- ## Table of Contents
17
-
18
- - [Features](#features)
19
- - [Screencasts](#screencasts)
20
- - [Requirements](#requirements)
21
- - [Setup](#setup)
22
- - [Usage](#usage)
23
- - [Command Line Interface (CLI)](#command-line-interface-cli)
24
- - [Customization](#customization)
25
- - [Workflow](#workflow)
26
- - [Troubleshooting](#troubleshooting)
27
- - [Tests](#tests)
28
- - [Versioning](#versioning)
29
- - [Code of Conduct](#code-of-conduct)
30
- - [Contributions](#contributions)
31
- - [License](#license)
32
- - [History](#history)
33
- - [Credits](#credits)
34
-
35
- <!-- Tocer[finish]: Auto-generated, don't remove. -->
36
-
37
- ## Features
38
-
39
- - Provides project metadata (i.e. *.sublime-project and *.sublime-workspace files) management for
40
- project switching via the `CONTROL+COMMAND+P` shortcut.
41
- - Rebuilds project history (Project -> Recent Projects) from existing project files (assumes project
42
- metadata is in a directory) so one can easily toggle between up-to-date project information via
43
- the `CONTROL+COMMAND+P` shortcut.
44
-
45
- ## Screencasts
46
-
47
- [![asciicast](https://asciinema.org/a/278653.svg)](https://asciinema.org/a/278653)
48
-
49
- ## Requirements
50
-
51
- 1. [Ruby 2.6.x](https://www.ruby-lang.org).
52
- 1. [Sublime Text 3](https://www.sublimetext.com).
53
-
54
- ## Setup
55
-
56
- Type the following to install:
57
-
58
- gem install sublime_text_kit
59
-
60
- ## Usage
61
-
62
- ### Command Line Interface (CLI)
63
-
64
- From the command line, type: `sublime_text_kit`
65
-
66
- sublime_text_kit -c, [--config] # Manage gem configuration.
67
- sublime_text_kit -h, [--help=COMMAND] # Show this message or get help for a command.
68
- sublime_text_kit -m, [--metadata] # Manage project/workspace metadata.
69
- sublime_text_kit -p, [--snippets] # Print user defined snippets.
70
- sublime_text_kit -s, [--session] # Manage session metadata.
71
- sublime_text_kit -u, [--update] # Update Sublime Text with current settings.
72
- sublime_text_kit -v, [--version] # Show gem version.
73
-
74
- For configuration options, type: `sublime_text_kit --help --config`
75
-
76
- -e, [--edit], [--no-edit] # Edit gem configuration.
77
- -i, [--info], [--no-info] # Print gem configuration.
78
-
79
- For metadata options, type: `sublime_text_kit --help --metadata`
80
-
81
- -c, [--create], [--no-create] # Create metadata.
82
- -D, [--destroy], [--no-destroy] # Destroy metadata.
83
- -R, [--rebuild], [--no-rebuild] # Rebuild metadata.
84
-
85
- For session options, type: `sublime_text_kit --help --session`
86
-
87
- -R, [--rebuild], [--no-rebuild] # Rebuild session metadata.
88
-
89
- For snippet options, type: `sublime_text_kit --help --snippets`
90
-
91
- -m, [--markdown], [--no-markdown] # Print snippets in Markdown format.
92
-
93
- ### Customization
94
-
95
- This gem can be configured via a global configuration:
96
-
97
- ~/.config/sublime_text_kit/configuration.yml
98
-
99
- It can also be configured via [XDG](https://github.com/bkuhlmann/xdg) environment variables.
100
-
101
- An example configuration could be:
102
-
103
- :project_roots:
104
- - "~/Dropbox/Development/Misc"
105
- - "~/Dropbox/Development/OSS"
106
- - "~/Dropbox/Development/Work"
107
- :metadata_dir: "~/Dropbox/Cache/Sublime"
108
-
109
- Feel free to take this configuration, modify, and save as your own custom `configuration.yml`.
110
-
111
- The project roots define the root level directories where project folders are located. When project
112
- metadata (i.e. `*.sublime-project`, `*.sublime-workspace`) is generated, the name of the metadata
113
- file will be the same name as that of the project folder. All project metadata, regardless of root
114
- location, is written to the same metadata directory. If using the example settings shown above and
115
- assuming the following directory structure exists...
116
-
117
- ~/Dropbox/Development/Misc/example
118
- ~/Dropbox/Development/OSS/sublime_text_kit
119
-
120
- ...the project metadata will be created in the workspace directory as follows:
121
-
122
- ~/Dropbox/Cache/Sublime/example.sublime-project
123
- ~/Dropbox/Cache/Sublime/example.sublime-workspace
124
- ~/Dropbox/Cache/Sublime/sublime_text_kit.sublime-project
125
- ~/Dropbox/Cache/Sublime/sublime_text_kit.sublime-workspace
126
-
127
- ### Workflow
128
-
129
- The following demonstrates a default Sublime Text setup:
130
-
131
- 1. Run: `sublime_text_kit --config --edit` (define Sublime Text Kit settings for project roots and
132
- metadata directory).
133
- 1. Shutdown Sublime Text (i.e. `CONTROL+Q`).
134
- 1. Run: `sublime_text_kit --metadata --create` (creates project metadata and rebuilds the session
135
- metadata so Sublime Text has a complete project history from which to jump through via the
136
- `CONTROL+COMMMAND+P` shortcut).
137
- 1. Launch Sublime Text and use the `CONTROL+COMMAND+P` keyboard shortcut to toggle between projects.
138
- Notice that you can (fuzzy type) project names to jump between them.
139
- 1. Breeze through your project workload with ease. :)
140
-
141
- ### Troubleshooting
142
-
143
- - When rebuilding workspaces, ensure Sublime Text is shutdown or changes won't be applied.
144
- - When rebuilding workspaces, ensure workspace_dir (as defined via settings.yml) points to a
145
- directory containing `*.sublime-project` and `*.sublime-workspace` files.
146
-
147
- ## Tests
148
-
149
- To test, run:
150
-
151
- bundle exec rake
152
-
153
- ## Versioning
154
-
155
- Read [Semantic Versioning](https://semver.org) for details. Briefly, it means:
156
-
157
- - Major (X.y.z) - Incremented for any backwards incompatible public API changes.
158
- - Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
159
- - Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
160
-
161
- ## Code of Conduct
162
-
163
- Please note that this project is released with a [CODE OF CONDUCT](CODE_OF_CONDUCT.md). By
164
- participating in this project you agree to abide by its terms.
165
-
166
- ## Contributions
167
-
168
- Read [CONTRIBUTING](CONTRIBUTING.md) for details.
169
-
170
- ## License
171
-
172
- Copyright 2014 [Alchemists](https://www.alchemists.io).
173
- Read [LICENSE](LICENSE.md) for details.
174
-
175
- ## History
176
-
177
- Read [CHANGES](CHANGES.md) for details.
178
- Built with [Gemsmith](https://github.com/bkuhlmann/gemsmith).
179
-
180
- ## Credits
181
-
182
- Developed by [Brooke Kuhlmann](https://www.alchemists.io) at
183
- [Alchemists](https://www.alchemists.io).
184
-