sublime_text_kit 0.4.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +2 -1
- data/README.md +58 -18
- data/lib/sublime_text_kit/cli.rb +49 -5
- data/lib/sublime_text_kit/project_metadata.rb +40 -0
- data/lib/sublime_text_kit/session.rb +5 -9
- data/lib/sublime_text_kit/version.rb +1 -1
- data/lib/sublime_text_kit.rb +1 -0
- data.tar.gz.sig +0 -0
- metadata +20 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: daef9d1fb25afffabeafc440ba2263086f5a6f11
|
4
|
+
data.tar.gz: ca7141c16811f8d87e38879079126a21ec47c9e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b0299ab99e1957eb5eb3c30947a7a83e1c23737d4c70da90e579e0cfa1735435fcd4a94292e8da8bf7d4a527d9d5d18708f244385a533d272bcc6c669a04891
|
7
|
+
data.tar.gz: f47dd9c9780516b952adb8851cf73aea9875c58214b414a7dcef0d43f68731ef9cbdecbca60ef2a601aad6fdf4fbb44cd2c2092291338c26b6c397728f1e5b82
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
GɃ�uq��s���G�Ft�z}/2�W��-X��I���^t6�����qẒ?�kKZ>�ma��ߢ��fH�KTܣ��[ ĝů��Qk�V�n&�/��7���(H7�@���FW?躠/��±���c�Tq�}"L5�^k/"������
|
2
|
+
�Z���Q;�+���S�F��V��xF�S[��4��c"6���D Eέ��v�(]\@dtC�@+u��a+�8𬝾�,$�3p�5�� ����%�;�+^dn!�
|
data/README.md
CHANGED
@@ -7,21 +7,23 @@
|
|
7
7
|
[](http://travis-ci.org/bkuhlmann/sublime_text_kit)
|
8
8
|
[](https://www.gittip.com/bkuhlmann)
|
9
9
|
|
10
|
-
Provides a collection of utilities that aid in Sublime Text
|
11
|
-
moment but will grow over time as new needs arise.
|
10
|
+
Provides a collection of utilities that aid in Sublime Text management.
|
12
11
|
|
13
12
|
# Features
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
- Creates project metadata (i.e. *.sublime-project files) for easy project switching via the `COMMAND+CONTROL+P`
|
15
|
+
shortcut.
|
16
|
+
- Destroys project metadata (i.e. *.sublime-project and *.sublime-workspace files).
|
17
|
+
- Rebuilds recent workspace history (via Project -> Recent Projects) from existing project files (assumes workspaces are
|
18
|
+
in a single directory) so one can easily toggle between up-to-date project information via the `COMMAND+CONTROL+P`
|
19
|
+
shortcut.
|
18
20
|
|
19
21
|
# Requirements
|
20
22
|
|
21
23
|
0. Any of the following Ruby VMs:
|
22
|
-
|
23
|
-
|
24
|
-
|
24
|
+
- [MRI 2.x.x](http://www.ruby-lang.org)
|
25
|
+
- [JRuby 1.x.x](http://jruby.org)
|
26
|
+
- [Rubinius 2.x.x](http://rubini.us)
|
25
27
|
0. [Sublime Text 2](http://www.sublimetext.com).
|
26
28
|
|
27
29
|
# Setup
|
@@ -45,7 +47,24 @@ You can define settings by creating the following file:
|
|
45
47
|
Example:
|
46
48
|
|
47
49
|
---
|
48
|
-
:
|
50
|
+
:project_roots:
|
51
|
+
- "~/Dropbox/Development/Misc"
|
52
|
+
- "~/Dropbox/Development/OSS"
|
53
|
+
- "~/Dropbox/Development/Work"
|
54
|
+
:workspace_dir: "~/Dropbox/Cache/Sublime"
|
55
|
+
|
56
|
+
The project roots are the root level directories to where project folders are located. When project metadata (i.e.
|
57
|
+
*.sublime-project) is generated, the name of the metadata file will be the same name as that of the project folder. All
|
58
|
+
project metadata, regardless of root location, is written to the same workspace directory. If using the example settings
|
59
|
+
shown above and assuming the following directory structure exists...
|
60
|
+
|
61
|
+
~/Dropbox/Development/Misc/example
|
62
|
+
~/Dropbox/Development/OSS/sublime_text_kit
|
63
|
+
|
64
|
+
...the project metadata will be created in the workspace directory as follows:
|
65
|
+
|
66
|
+
~/Dropbox/Cache/Sublime/example.sublime-project
|
67
|
+
~/Dropbox/Cache/Sublime/sublime_text_kit.sublime-project
|
49
68
|
|
50
69
|
# Usage
|
51
70
|
|
@@ -53,18 +72,18 @@ From the command line, type: stk
|
|
53
72
|
|
54
73
|
stk -e, [--edit] # Edit settings in default editor (assumes $EDITOR environment variable).
|
55
74
|
stk -h, [--help=HELP] # Show this message or get help for a command.
|
75
|
+
stk -p, [--project] # Manage project metadata.
|
56
76
|
stk -s, [--session] # Manage session data.
|
57
77
|
stk -v, [--version] # Show version.
|
58
78
|
|
59
|
-
For
|
79
|
+
For project options, type: stk --project
|
60
80
|
|
61
|
-
-
|
81
|
+
-c, [--create], [--no-create] # Create project metadata.
|
82
|
+
-D, [--destroy], [--no-destroy] # Destroy all project metadata.
|
62
83
|
|
63
|
-
|
84
|
+
For session options, type: stk --session
|
64
85
|
|
65
|
-
|
66
|
-
* When rebuilding workspaces, ensure workspaces_path (as defined via settings.yml) points to a directory containing
|
67
|
-
both *.sublime-project and *.sublime-workspace files.
|
86
|
+
-r, [--rebuild-recent-workspaces] # Rebuild recent workspaces.
|
68
87
|
|
69
88
|
# Tests
|
70
89
|
|
@@ -72,13 +91,34 @@ To test, run:
|
|
72
91
|
|
73
92
|
bundle exec rspec spec
|
74
93
|
|
94
|
+
# Workflow
|
95
|
+
|
96
|
+
The following demonstrates a common workflow that makes you more productive with Sublime Text:
|
97
|
+
|
98
|
+
0. Run: `stk -e` (define Sublime Text Kit settings for project roots and workspace directory).
|
99
|
+
0. Shutdown Sublime Text (i.e. `CONTROL+Q`).
|
100
|
+
0. Run: `stk -p -D` (optional -- start with a clean slate. WARNING: This deletes all project metadata in the workspace
|
101
|
+
dir).
|
102
|
+
0. Run: `stk -p -c` (creates project metadata so Sublime Text knows where to source the project from).
|
103
|
+
0. Run: `stk -s -r` (rebuilds Sublime Text recent workspace metadata based on the project metadata created in Step #4).
|
104
|
+
0. Launch Sublime Text
|
105
|
+
0. Type: `COMMAND+CONTROL+P` to toggle between projects. Notice that you can easily (fuzzy type) project names to jump
|
106
|
+
between them.
|
107
|
+
0. Breeze through your project workload with ease. :)
|
108
|
+
|
109
|
+
# Troubleshooting
|
110
|
+
|
111
|
+
- When rebuilding workspaces, ensure Sublime Text is shutdown or changes won't be applied.
|
112
|
+
- When rebuilding workspaces, ensure workspace_dir (as defined via settings.yml) points to a directory containing
|
113
|
+
*.sublime-project files.
|
114
|
+
|
75
115
|
# Versioning
|
76
116
|
|
77
117
|
Read [Semantic Versioning](http://semver.org) for details. Briefly, it means:
|
78
118
|
|
79
|
-
|
80
|
-
|
81
|
-
|
119
|
+
- Patch (x.y.Z) - Incremented for small, backwards compatible bug fixes.
|
120
|
+
- Minor (x.Y.z) - Incremented for new, backwards compatible public API enhancements and/or bug fixes.
|
121
|
+
- Major (X.y.z) - Incremented for any backwards incompatible public API changes.
|
82
122
|
|
83
123
|
# Contributions
|
84
124
|
|
data/lib/sublime_text_kit/cli.rb
CHANGED
@@ -11,10 +11,26 @@ module SublimeTextKit
|
|
11
11
|
# Initialize.
|
12
12
|
def initialize args = [], options = {}, config = {}
|
13
13
|
super args, options, config
|
14
|
-
@settings_file = File.join ENV
|
14
|
+
@settings_file = File.join ENV.fetch("HOME"), ".sublime", "settings.yml"
|
15
15
|
@settings = load_yaml @settings_file
|
16
16
|
end
|
17
17
|
|
18
|
+
desc "-p, [--project]", "Manage project metadata."
|
19
|
+
map %w(-p --project) => :project
|
20
|
+
method_option :create, aliases: "-c", desc: "Create project metadata.", type: :boolean, default: false
|
21
|
+
method_option :destroy, aliases: "-D", desc: "Destroy all project metadata.", type: :boolean, default: false
|
22
|
+
def project
|
23
|
+
say
|
24
|
+
|
25
|
+
case
|
26
|
+
when options[:create] then create_project_metadata
|
27
|
+
when options[:destroy] then destroy_project_metadata
|
28
|
+
else help("--project")
|
29
|
+
end
|
30
|
+
|
31
|
+
say
|
32
|
+
end
|
33
|
+
|
18
34
|
desc "-s, [--session]", "Manage session data."
|
19
35
|
map %w(-s --session) => :session
|
20
36
|
method_option :rebuild_recent_workspaces, aliases: "-r", desc: "Rebuild recent workspaces.", type: :boolean, default: false
|
@@ -22,8 +38,8 @@ module SublimeTextKit
|
|
22
38
|
say
|
23
39
|
|
24
40
|
case
|
25
|
-
|
26
|
-
|
41
|
+
when options[:rebuild_recent_workspaces] then rebuild_recent_workspaces
|
42
|
+
else help("--session")
|
27
43
|
end
|
28
44
|
|
29
45
|
say
|
@@ -49,11 +65,39 @@ module SublimeTextKit
|
|
49
65
|
|
50
66
|
private
|
51
67
|
|
68
|
+
def project_roots
|
69
|
+
@project_roots ||= @settings.fetch :project_roots, []
|
70
|
+
end
|
71
|
+
|
72
|
+
def workspace_dir
|
73
|
+
@workspace_dir ||= File.expand_path @settings.fetch(:workspace_dir)
|
74
|
+
end
|
75
|
+
|
76
|
+
def create_project_metadata
|
77
|
+
info "Creating project metadata..."
|
78
|
+
info "Workspaces Path: #{workspace_dir}"
|
79
|
+
project_roots.each do |project_root|
|
80
|
+
info "Processing project root: #{File.expand_path project_root}..."
|
81
|
+
SublimeTextKit::ProjectMetadata.create project_root, workspace_dir
|
82
|
+
end
|
83
|
+
info "Project metadata created."
|
84
|
+
end
|
85
|
+
|
86
|
+
def destroy_project_metadata
|
87
|
+
if yes? "Delete all project metadata in #{workspace_dir}?"
|
88
|
+
info "Deleting project metadata..."
|
89
|
+
SublimeTextKit::ProjectMetadata.delete workspace_dir
|
90
|
+
info "Project metadata deleted."
|
91
|
+
else
|
92
|
+
info "Project metadata deletion aborted."
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
52
96
|
def rebuild_recent_workspaces
|
53
97
|
info "Rebuilding recent workspaces..."
|
54
|
-
|
55
|
-
info "Workspaces Path: #{session.workspaces_absolute_path}"
|
98
|
+
info "Workspaces Path: #{workspace_dir}"
|
56
99
|
info "Sublime Text Session: #{SublimeTextKit::Session.session_path}"
|
100
|
+
session = SublimeTextKit::Session.new workspace_dir: workspace_dir
|
57
101
|
session.rebuild_recent_workspaces
|
58
102
|
info "Recent workspaces rebuilt."
|
59
103
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require "multi_json"
|
2
|
+
require "pathname"
|
3
|
+
|
4
|
+
module SublimeTextKit
|
5
|
+
class ProjectMetadata
|
6
|
+
attr_reader :name, :project_dir, :workspace_dir, :project_file
|
7
|
+
|
8
|
+
def self.create projects_dir, workspace_dir
|
9
|
+
projects_dir = File.expand_path projects_dir
|
10
|
+
project_paths = ::Pathname.new(projects_dir).children.select {|child| child if child.directory? }
|
11
|
+
project_paths.each { |project_dir| new(project_dir, workspace_dir).save }
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.delete workspace_dir
|
15
|
+
workspace_dir = File.expand_path workspace_dir
|
16
|
+
::Pathname.glob("#{workspace_dir}/*.sublime-*").each(&:delete)
|
17
|
+
end
|
18
|
+
|
19
|
+
def initialize project_dir, workspace_dir
|
20
|
+
@name = File.basename project_dir
|
21
|
+
@project_dir = File.expand_path project_dir
|
22
|
+
@workspace_dir = File.expand_path workspace_dir
|
23
|
+
@project_file = File.join @workspace_dir, "#{name}.sublime-project"
|
24
|
+
end
|
25
|
+
|
26
|
+
def to_h
|
27
|
+
{
|
28
|
+
folders: [
|
29
|
+
{path: "#{project_dir}"}
|
30
|
+
]
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
def save
|
35
|
+
unless File.exist? project_file
|
36
|
+
File.open(project_file, 'w') { |file| file.write MultiJson.dump(to_h, pretty: true) }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -2,10 +2,10 @@ require "multi_json"
|
|
2
2
|
|
3
3
|
module SublimeTextKit
|
4
4
|
class Session
|
5
|
-
|
5
|
+
attr_reader :workspace_dir
|
6
6
|
|
7
7
|
def self.home_path
|
8
|
-
ENV
|
8
|
+
ENV.fetch "HOME"
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.session_path
|
@@ -13,15 +13,11 @@ module SublimeTextKit
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def initialize options = {}
|
16
|
-
@
|
17
|
-
end
|
18
|
-
|
19
|
-
def workspaces_absolute_path
|
20
|
-
File.expand_path workspaces_path
|
16
|
+
@workspace_dir = File.expand_path options.fetch(:workspace_dir)
|
21
17
|
end
|
22
18
|
|
23
19
|
def workspaces
|
24
|
-
Dir["#{
|
20
|
+
Dir["#{workspace_dir}/*.sublime-project"].sort
|
25
21
|
end
|
26
22
|
|
27
23
|
def rebuild_recent_workspaces
|
@@ -40,7 +36,7 @@ module SublimeTextKit
|
|
40
36
|
end
|
41
37
|
|
42
38
|
def save_session json
|
43
|
-
File.open(self.class.session_path, 'w') { |file| file.write MultiJson.dump(json) }
|
39
|
+
File.open(self.class.session_path, 'w') { |file| file.write MultiJson.dump(json, pretty: true) }
|
44
40
|
end
|
45
41
|
end
|
46
42
|
end
|
data/lib/sublime_text_kit.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
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: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
fMlZDUGx3lQarp/vPjK+6XH7DLXjBEKqeIGBIpLthYUvDxJRp23C+T3liGSL32vg
|
31
31
|
mSpxxwmK95GDFuEy2mNPaxnazdkw8c+7DbrSpzd/CnNZkRgitxOavs8=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2014-
|
33
|
+
date: 2014-09-21 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: pry-byebug
|
@@ -200,6 +200,20 @@ dependencies:
|
|
200
200
|
- - ">="
|
201
201
|
- !ruby/object:Gem::Version
|
202
202
|
version: '0'
|
203
|
+
- !ruby/object:Gem::Dependency
|
204
|
+
name: terminal-notifier-guard
|
205
|
+
requirement: !ruby/object:Gem::Requirement
|
206
|
+
requirements:
|
207
|
+
- - ">="
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: '0'
|
210
|
+
type: :development
|
211
|
+
prerelease: false
|
212
|
+
version_requirements: !ruby/object:Gem::Requirement
|
213
|
+
requirements:
|
214
|
+
- - ">="
|
215
|
+
- !ruby/object:Gem::Version
|
216
|
+
version: '0'
|
203
217
|
- !ruby/object:Gem::Dependency
|
204
218
|
name: codeclimate-test-reporter
|
205
219
|
requirement: !ruby/object:Gem::Requirement
|
@@ -215,7 +229,8 @@ dependencies:
|
|
215
229
|
- !ruby/object:Gem::Version
|
216
230
|
version: '0'
|
217
231
|
description: Command line utilities for Sublime Text packaged as a Ruby Gem.
|
218
|
-
email:
|
232
|
+
email:
|
233
|
+
- brooke@redalchemist.com
|
219
234
|
executables:
|
220
235
|
- stk
|
221
236
|
extensions: []
|
@@ -228,6 +243,7 @@ files:
|
|
228
243
|
- bin/stk
|
229
244
|
- lib/sublime_text_kit.rb
|
230
245
|
- lib/sublime_text_kit/cli.rb
|
246
|
+
- lib/sublime_text_kit/project_metadata.rb
|
231
247
|
- lib/sublime_text_kit/session.rb
|
232
248
|
- lib/sublime_text_kit/version.rb
|
233
249
|
homepage: https://github.com/bkuhlmann/sublime_text_kit
|
@@ -250,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
250
266
|
version: '0'
|
251
267
|
requirements: []
|
252
268
|
rubyforge_project:
|
253
|
-
rubygems_version: 2.
|
269
|
+
rubygems_version: 2.4.1
|
254
270
|
signing_key:
|
255
271
|
specification_version: 4
|
256
272
|
summary: Command line utilities for Sublime Text.
|
metadata.gz.sig
CHANGED
Binary file
|