Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request 71
- Loading branch information
Showing
6 changed files
with
65 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,38 @@ | ||
# frozen_string_literal: true | ||
|
||
class Jekyll::Compose::ArgParser | ||
attr_reader :args, :options, :config | ||
def initialize(args, options) | ||
@args = args | ||
@options = options | ||
@config = Jekyll.configuration(options) | ||
end | ||
module Jekyll | ||
module Compose | ||
class ArgParser | ||
attr_reader :args, :options, :config | ||
def initialize(args, options) | ||
@args = args | ||
@options = options | ||
@config = Jekyll.configuration(options) | ||
end | ||
|
||
def validate! | ||
raise ArgumentError, "You must specify a name." if args.empty? | ||
end | ||
def validate! | ||
raise ArgumentError, "You must specify a name." if args.empty? | ||
end | ||
|
||
def type | ||
options["extension"] || Jekyll::Compose::DEFAULT_TYPE | ||
end | ||
def type | ||
options["extension"] || Jekyll::Compose::DEFAULT_TYPE | ||
end | ||
|
||
def layout | ||
options["layout"] || Jekyll::Compose::DEFAULT_LAYOUT | ||
end | ||
def layout | ||
options["layout"] || Jekyll::Compose::DEFAULT_LAYOUT | ||
end | ||
|
||
def title | ||
args.join " " | ||
end | ||
def title | ||
args.join " " | ||
end | ||
|
||
def force? | ||
!!options["force"] | ||
end | ||
def force? | ||
!!options["force"] | ||
end | ||
|
||
def source | ||
config["source"].gsub(%r!^#{Regexp.quote(Dir.pwd)}!, "") | ||
def source | ||
config["source"].gsub(%r!^#{Regexp.quote(Dir.pwd)}!, "") | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
# frozen_string_literal: true | ||
|
||
class Jekyll::Compose::FileInfo | ||
attr_reader :params | ||
def initialize(params) | ||
@params = params | ||
end | ||
module Jekyll | ||
module Compose | ||
class FileInfo | ||
attr_reader :params | ||
def initialize(params) | ||
@params = params | ||
end | ||
|
||
def file_name | ||
name = Jekyll::Utils.slugify params.title | ||
"#{name}.#{params.type}" | ||
end | ||
def file_name | ||
name = Jekyll::Utils.slugify params.title | ||
"#{name}.#{params.type}" | ||
end | ||
|
||
def content(custom_front_matter = {}) | ||
front_matter = YAML.dump({ | ||
"layout" => params.layout, | ||
"title" => params.title, | ||
}.merge(custom_front_matter)) | ||
def content(custom_front_matter = {}) | ||
front_matter = YAML.dump({ | ||
"layout" => params.layout, | ||
"title" => params.title, | ||
}.merge(custom_front_matter)) | ||
|
||
front_matter + "---\n" | ||
front_matter + "---\n" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ def move_file | |
end | ||
|
||
private | ||
|
||
def from | ||
movement.from | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters