File tree Expand file tree Collapse file tree 6 files changed +12
-27
lines changed
Expand file tree Collapse file tree 6 files changed +12
-27
lines changed Original file line number Diff line number Diff line change 22
33module Jekyll
44 module Compose
5+ DEFAULT_TYPE = "md"
6+ DEFAULT_LAYOUT = "post"
57 end
68end
79
Original file line number Diff line number Diff line change @@ -19,13 +19,8 @@ def self.init_with_program(prog)
1919 def self . process ( args = [ ] , options = { } )
2020 raise ArgumentError . new ( 'You must specify a name.' ) if args . empty?
2121
22- <<<<<<< HEAD
23- type = options [ "type" ] || "md"
24- layout = options [ "layout" ] || "post"
25- =======
26- type = options [ "type" ] . nil? ? Jekyll ::Compose ::DEFAULT_TYPE : options [ "type" ]
27- layout = options [ "layout" ] . nil? ? Jekyll ::Compose ::DEFAULT_LAYOUT : options [ "layout" ]
28- >>>>>>> move type and layout values to contants
22+ type = options [ "type" ] || Jekyll ::Compose ::DEFAULT_TYPE
23+ layout = options [ "layout" ] || Jekyll ::Compose ::DEFAULT_LAYOUT
2924
3025 title = args . shift
3126 name = title . gsub ( ' ' , '-' ) . downcase
Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ def self.init_with_program(prog)
2020 def self . process ( args = [ ] , options = { } )
2121 raise ArgumentError . new ( 'You must specify a name.' ) if args . empty?
2222
23- type = options [ "type" ] . nil? ? Jekyll ::Compose ::DEFAULT_TYPE : options [ "type" ]
24- layout = options [ "layout" ] . nil? ? Jekyll ::Compose ::DEFAULT_LAYOUT : options [ "layout" ]
23+ type = options [ "type" ] || Jekyll ::Compose ::DEFAULT_TYPE
24+ layout = options [ "layout" ] || Jekyll ::Compose ::DEFAULT_LAYOUT
2525
2626 date = options [ "date" ] . nil? ? Time . now : DateTime . parse ( options [ "date" ] )
2727
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 22 let ( :name ) { 'A test post' }
33 let ( :args ) { [ name ] }
44 let ( :drafts_dir ) { Pathname . new source_dir ( '_drafts' ) }
5- let ( :path ) { drafts_dir . join ( 'a-test-post.markdown ' ) }
5+ let ( :path ) { drafts_dir . join ( 'a-test-post.md ' ) }
66
77 before ( :all ) do
88 FileUtils . mkdir_p source_dir unless File . directory? source_dir
2525
2626 it 'writes a helpful success message' do
2727 output = capture_stdout { described_class . process ( args ) }
28- expect ( output ) . to eql ( "New draft created at ./_drafts/a-test-post.markdown .\n " )
28+ expect ( output ) . to eql ( "New draft created at ./_drafts/a-test-post.md .\n " )
2929 end
3030
3131 it 'errors with no arguments' do
3636
3737 context 'when the draft already exists' do
3838 let ( :name ) { 'An existing draft' }
39- let ( :path ) { drafts_dir . join ( 'an-existing-draft.markdown ' ) }
39+ let ( :path ) { drafts_dir . join ( 'an-existing-draft.md ' ) }
4040
4141 before ( :each ) do
4242 FileUtils . touch path
4545 it 'raises an error' do
4646 expect ( -> {
4747 capture_stdout { described_class . process ( args ) }
48- } ) . to raise_error ( "A draft already exists at ./_drafts/an-existing-draft.markdown " )
48+ } ) . to raise_error ( "A draft already exists at ./_drafts/an-existing-draft.md " )
4949 end
5050
5151 it 'overwrites if --force is given' do
Original file line number Diff line number Diff line change 22 let ( :name ) { 'A test post' }
33 let ( :args ) { [ name ] }
44 let ( :posts_dir ) { Pathname . new source_dir ( '_posts' ) }
5- let ( :filename ) { "#{ Time . now . strftime ( '%Y-%m-%d' ) } -a-test-post.markdown " }
5+ let ( :filename ) { "#{ Time . now . strftime ( '%Y-%m-%d' ) } -a-test-post.md " }
66 let ( :path ) { posts_dir . join ( filename ) }
77
88 before ( :all ) do
3737
3838 context 'when the post already exists' do
3939 let ( :name ) { 'An existing post' }
40- let ( :filename ) { "#{ Time . now . strftime ( '%Y-%m-%d' ) } -an-existing-post.markdown " }
40+ let ( :filename ) { "#{ Time . now . strftime ( '%Y-%m-%d' ) } -an-existing-post.md " }
4141
4242 before ( :each ) do
4343 FileUtils . touch path
You can’t perform that action at this time.
0 commit comments