quickpress 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/quickpress.rb +16 -3
- data/lib/quickpress/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40b673beba96bf76b39b66a801dafb71a84c04e5
|
4
|
+
data.tar.gz: c51ba3b1893e37cbe79108da2683411e9068fe07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a48627317c82a5c7ee0ae5e90a1fa85cf38bbdf8044cc1fc7637299ddebb3a9f549636517076869b7cd3e42157ae641e82c82c0e3aef3e70f65d6831b99d160a
|
7
|
+
data.tar.gz: 72c0717e9e074361611e4ec81e85235f63fbc323b2a913f95d180f746180491a24bc97d4fb83da59ba87c5dac18b67f707cac4dcf623b7a6342021a1893f1ae8
|
data/lib/quickpress.rb
CHANGED
@@ -692,11 +692,25 @@ module Quickpress
|
|
692
692
|
|
693
693
|
link = nil
|
694
694
|
|
695
|
+
old_title = nil
|
696
|
+
case what
|
697
|
+
when :post
|
698
|
+
post = @@wp.get_post id
|
699
|
+
old_title = post["post_title"]
|
700
|
+
|
701
|
+
when :page
|
702
|
+
page = @@wp.get_page id
|
703
|
+
old_title = page["post_title"]
|
704
|
+
end
|
705
|
+
|
695
706
|
title = $options[:title]
|
696
707
|
if title.nil?
|
697
708
|
title = CLI::get("New Title:", true)
|
698
709
|
end
|
699
710
|
|
711
|
+
# Falling back to current title if empty
|
712
|
+
title = old_title if title.empty?
|
713
|
+
|
700
714
|
date = Quickpress::date $options[:date]
|
701
715
|
status = Quickpress::status $options[:status]
|
702
716
|
|
@@ -718,8 +732,7 @@ module Quickpress
|
|
718
732
|
categories = CLI::tab_complete("Post categories:", @@wp.categories)
|
719
733
|
end
|
720
734
|
|
721
|
-
cats =
|
722
|
-
categories.split(',').each { |c| cats << c.lstrip.strip }
|
735
|
+
cats = categories.split(',').map { |c| c.lstrip.strip }
|
723
736
|
|
724
737
|
CLI::with_status("Editing post...") do
|
725
738
|
link = @@wp.edit_post(:post_id => id,
|
@@ -728,7 +741,7 @@ module Quickpress
|
|
728
741
|
:post_title => title,
|
729
742
|
:post_status => status,
|
730
743
|
:terms_names => {
|
731
|
-
:category =>
|
744
|
+
:category => cats
|
732
745
|
}
|
733
746
|
})
|
734
747
|
end
|
data/lib/quickpress/version.rb
CHANGED