ZMediumToMarkdown 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d175f065345508536bf819ab29db376b591c978d3b32872496f5d8a80d2fb518
4
- data.tar.gz: eeb5c3c303a1daef3e05bce586240d0195f3d32999208b784530a175fe58b89e
3
+ metadata.gz: f4927555e3c7d6f021e1c989a83e03a095f613d28fc482d3f08599d16229dbc0
4
+ data.tar.gz: 77753af16833d4927574a3a170b3d046f35688c1a7146b85a857ca6fcad35851
5
5
  SHA512:
6
- metadata.gz: 6b12ca00410c8946e1736fac5c328b892d5b4d8b08d5074101bb16ac869ad5ef92d7884201a19a0fcadf2e11a9450b407f0573382e81cfa875090768a27822ed
7
- data.tar.gz: 396a75a07a19283d6ce215b32da304ad4f90c72131c87903b8edf04e53ac1e3cf902e61877469367dce4b749fe979c292101cfe12b167290446d3da94826a28e
6
+ metadata.gz: 55d662074d29bae6267a7982f3f03c61264b6a5628f2ca15aa9b06a70d3d8d329505f5c833700b8580743719885afe99fb090e3d50ea7a720c5848d56a557e6f
7
+ data.tar.gz: 5a3ac99f7b8ea47bc24f8f2f48b8f5147fa86d2f8bba920be4592be08ae6f2b7434a545ec353fc879f65ca4ac34dc5285273c17f97f58a66d345072db678863b
@@ -15,18 +15,18 @@ class Main
15
15
  OptionParser.new do |opts|
16
16
  opts.banner = "Usage: ZMediumFetcher [options]"
17
17
 
18
- opts.on('-uUSERNAME', '--username=USERNAME', 'test') do |username|
19
- Helper.checkNewVersion()
20
-
18
+ opts.on('-uUSERNAME', '--username=USERNAME', 'Downloading all posts from user') do |username|
21
19
  pathPolicy = PathPolicy.new("#{File.expand_path('../', File.dirname(__FILE__))}", "Output")
22
20
  fetcher.downloadPostsByUsername(username, pathPolicy)
21
+
22
+ Helper.printNewVersionMessageIfExists()
23
23
  end
24
24
 
25
- opts.on('-pPOST_URL', '--postURL=POST_URL', 'test') do |postURL|
26
- Helper.checkNewVersion()
27
-
25
+ opts.on('-pPOST_URL', '--postURL=POST_URL', 'Downloading single post') do |postURL|
28
26
  pathPolicy = PathPolicy.new("#{File.expand_path('../', File.dirname(__FILE__))}", "Output")
29
27
  fetcher.downloadPost(postURL, pathPolicy)
28
+
29
+ Helper.printNewVersionMessageIfExists()
30
30
  end
31
31
 
32
32
  opts.on('-n', '--new', 'Update to latest version') do |postURL|
data/lib/Helper.rb CHANGED
@@ -96,7 +96,7 @@ class Helper
96
96
  result
97
97
  end
98
98
 
99
- def self.checkNewVersion()
99
+ def self.printNewVersionMessageIfExists()
100
100
  if Helper.compareVersion(Helper.getRemoteVersionFromGithub(), Helper.getLocalVersionFromGemspec())
101
101
  puts "##########################################################"
102
102
  puts "##### New Version Available!!! #####"
@@ -118,27 +118,6 @@ class Helper
118
118
  end
119
119
  end
120
120
 
121
- def self.logLatestRunVersion()
122
- version = Helper.getLocalVersionFromGemspec()
123
- rootPath = File.expand_path('../', File.dirname(__FILE__))
124
-
125
- File.open("#{rootPath}/.latestRunVersion" , 'w+') do |file|
126
- file.puts(version.to_string())
127
- end
128
- end
129
-
130
- def self.getLocalVersionFromFile()
131
- rootPath = File.expand_path('../', File.dirname(__FILE__))
132
- result = File.read("#{rootPath}/.latestRunVersion")
133
-
134
- if !result.nil?
135
- versions = result.split(".")
136
- Version.new(versions[0],versions[1],versions[2])
137
- else
138
- nil
139
- end
140
- end
141
-
142
121
  def self.getRemoteVersionFromGithub()
143
122
  apiPath = 'https://api.github.com/repos/ZhgChgLi/ZMediumToMarkdown/releases'
144
123
  versions = JSON.parse(Request.URL(apiPath).body).sort { |a,b| b["id"] <=> a["id"] }
@@ -212,12 +212,9 @@ class ZMediumFetcher
212
212
  progress.printLog()
213
213
 
214
214
  absolutePath = postPathPolicy.getAbsolutePath("#{postPath}.md")
215
-
216
- # if user latest use's version is < latest local version than force download (don't skip, make sure bug fixed can be influenced)
217
- forceDownload = Helper.compareVersion(Helper.getLocalVersionFromGemspec(), Helper.getLocalVersionFromFile())
218
215
 
219
216
  # if markdown file is exists and last modification time is >= latestPublishedAt(last update post time on medium)
220
- if forceDownload == false && File.file?(absolutePath) && File.mtime(absolutePath) >= postInfo.latestPublishedAt
217
+ if File.file?(absolutePath) && File.mtime(absolutePath) >= postInfo.latestPublishedAt
221
218
  # Already downloaded and nothing has changed!, Skip!
222
219
  progress.currentPostParagraphIndex = paragraphs.length
223
220
  progress.message = "Skip, Post already downloaded and nothing has changed!"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ZMediumToMarkdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ZhgChgLi