quickpress 0.2.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a6edfa1e92e412d704094506d439edc28591591
4
- data.tar.gz: c4cac17e84ef4669867f4982482bebc4ac64f6fa
3
+ metadata.gz: 40b673beba96bf76b39b66a801dafb71a84c04e5
4
+ data.tar.gz: c51ba3b1893e37cbe79108da2683411e9068fe07
5
5
  SHA512:
6
- metadata.gz: e7eb9fec72e5d5540d36231df0c0748a3b3d2f4c27ee4851e0e60901d518341d3a59c2872112b67822dc7bd04bee268bceb1f062b3338b7cb349e55e77d94aed
7
- data.tar.gz: 8b00ca90979ff3caa1d59c1704fb2286df55534a297ab5aff5c554ef031aa3718475a46f620e0f4479d2f6a1cc8d219bf3cc816a429db5dc4ba58af96eb41f87
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 => categories
744
+ :category => cats
732
745
  }
733
746
  })
734
747
  end
@@ -1,5 +1,5 @@
1
1
  module Quickpress
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  VERSION_MAJOR = VERSION.split('.')[0]
4
4
  VERSION_MINOR = VERSION.split('.')[1]
5
5
  VERSION_PATCH = VERSION.split('.')[2]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quickpress
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre Dantas