jekyll-compose 0.7.0 → 0.8.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
- data/lib/jekyll-compose.rb +1 -0
- data/lib/jekyll-compose/file_creator.rb +5 -5
- data/lib/jekyll-compose/file_editor.rb +42 -0
- data/lib/jekyll-compose/version.rb +1 -1
- data/lib/jekyll/commands/post.rb +3 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ca9572a408add00659eda3cf8a665db468237f764891adc47e99e12402d189d
|
4
|
+
data.tar.gz: a93e1531716af74a8c3cf3b014654c32d84cca05a6261613c29b7e4ff0a82ed1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6791215e2abbcd23e6e9a83e8fa0002e2f3d6a1f9326655b30bd674d937a1b76d655a8ccfc3963da80cd81afa82a1c15e7b69ac2cdd83f0fdb9ce93b3933561
|
7
|
+
data.tar.gz: ecfc55570fbae9dd1d71940ec0a7019c25497f445118c3fd4973ef42b1d318f6dfa600d6c835aad364393cb0dfff9de0d4bee430698aaf6d3ab2693dec8fd451
|
data/lib/jekyll-compose.rb
CHANGED
@@ -16,6 +16,11 @@ module Jekyll
|
|
16
16
|
write_file
|
17
17
|
end
|
18
18
|
|
19
|
+
def file_path
|
20
|
+
return file.path if root.nil? || root.empty?
|
21
|
+
return File.join(root, file.path)
|
22
|
+
end
|
23
|
+
|
19
24
|
private
|
20
25
|
|
21
26
|
def validate_should_write!
|
@@ -34,11 +39,6 @@ module Jekyll
|
|
34
39
|
|
35
40
|
puts "New #{file.resource_type} created at #{file_path}."
|
36
41
|
end
|
37
|
-
|
38
|
-
def file_path
|
39
|
-
return file.path if root.nil? || root.empty?
|
40
|
-
return File.join(root, file.path)
|
41
|
-
end
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# This class is aimed to open the created file in the selected editor.
|
4
|
+
# To use this feature specify at Jekyll config:
|
5
|
+
#
|
6
|
+
# ```
|
7
|
+
# jekyll_compose:
|
8
|
+
# auto_open: true
|
9
|
+
# ```
|
10
|
+
#
|
11
|
+
# And make sure, that you have JEKYLL_EDITOR or EDITOR environment variables set up.
|
12
|
+
# This will allow to open the file in your default editor automatically.
|
13
|
+
|
14
|
+
module Jekyll
|
15
|
+
module Compose
|
16
|
+
class FileEditor
|
17
|
+
class << self
|
18
|
+
def open_editor(filepath)
|
19
|
+
run_editor(post_editor, File.expand_path(filepath)) if post_editor
|
20
|
+
end
|
21
|
+
|
22
|
+
def run_editor(editor_name, filepath)
|
23
|
+
system("#{editor_name} #{filepath}")
|
24
|
+
end
|
25
|
+
|
26
|
+
def post_editor
|
27
|
+
return unless auto_open?
|
28
|
+
ENV['JEKYLL_EDITOR'] || ENV['EDITOR']
|
29
|
+
end
|
30
|
+
|
31
|
+
def auto_open?
|
32
|
+
jekyll_compose_config && jekyll_compose_config['auto_open']
|
33
|
+
end
|
34
|
+
|
35
|
+
def jekyll_compose_config
|
36
|
+
@jekyll_compose_config ||= Jekyll.configuration['jekyll_compose']
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
data/lib/jekyll/commands/post.rb
CHANGED
@@ -31,7 +31,9 @@ module Jekyll
|
|
31
31
|
|
32
32
|
post = PostFileInfo.new params
|
33
33
|
|
34
|
-
Compose::FileCreator.new(post, params.force?, params.source)
|
34
|
+
file_creator = Compose::FileCreator.new(post, params.force?, params.source)
|
35
|
+
file_creator.create!
|
36
|
+
Compose::FileEditor.open_editor(file_creator.file_path)
|
35
37
|
end
|
36
38
|
|
37
39
|
class PostArgParser < Compose::ArgParser
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-compose
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Parker Moore
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- lib/jekyll-compose.rb
|
91
91
|
- lib/jekyll-compose/arg_parser.rb
|
92
92
|
- lib/jekyll-compose/file_creator.rb
|
93
|
+
- lib/jekyll-compose/file_editor.rb
|
93
94
|
- lib/jekyll-compose/file_info.rb
|
94
95
|
- lib/jekyll-compose/file_mover.rb
|
95
96
|
- lib/jekyll-compose/movement_arg_parser.rb
|
@@ -119,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
120
|
version: '0'
|
120
121
|
requirements: []
|
121
122
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.7.
|
123
|
+
rubygems_version: 2.7.6
|
123
124
|
signing_key:
|
124
125
|
specification_version: 4
|
125
126
|
summary: Streamline your writing in Jekyll with these commands.
|