-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c805f30
commit 2b34ab1
Showing
8 changed files
with
229 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
source 'https://rubygems.org' | ||
gem 'net-http', '~> 0.1.0' | ||
gem 'nokogiri', '~> 1.13.1' | ||
gem 'reverse_markdown', '~> 2.1.1' | ||
gem 'reverse_markdown', '~> 2.1.1' | ||
gem 'rubyzip', '~> 2.3.2' |
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
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/env ruby | ||
# -*- coding: utf-8 -*- | ||
|
||
$lib = File.expand_path('../lib', File.dirname(__FILE__)) | ||
$LOAD_PATH.unshift($lib) | ||
|
||
require "ZMediumFetcher" | ||
require "Helper" | ||
require "optparse" | ||
|
||
class Main | ||
def initialize | ||
fetcher = ZMediumFetcher.new | ||
ARGV << '-h' if ARGV.empty? | ||
OptionParser.new do |opts| | ||
opts.banner = "Usage: ZMediumFetcher [options]" | ||
|
||
opts.on('-uUSERNAME', '--username=USERNAME', 'test') do |username| | ||
Helper.checkNewVersion() | ||
|
||
pathPolicy = PathPolicy.new("#{File.expand_path('../', File.dirname(__FILE__))}", "Output") | ||
fetcher.downloadPostsByUsername(username, pathPolicy) | ||
end | ||
|
||
opts.on('-pPOST_URL', '--postURL=POST_URL', 'test') do |postURL| | ||
Helper.checkNewVersion() | ||
|
||
pathPolicy = PathPolicy.new("#{File.expand_path('../', File.dirname(__FILE__))}", "Output") | ||
fetcher.downloadPost(postURL, pathPolicy) | ||
end | ||
|
||
opts.on('-n', '--new', 'Update to latest version') do |postURL| | ||
if Helper.compareVersion(Helper.getRemoteVersionFromGithub(), Helper.getLocalVersionFromGemspec()) | ||
Helper.downloadLatestVersion() | ||
else | ||
puts "You're using the latest version :)" | ||
end | ||
end | ||
|
||
end.parse! | ||
|
||
Helper.logLatestRunVersion() | ||
end | ||
end | ||
|
||
begin | ||
puts "#https://github.com/ZhgChgLi/ZMediumToMarkdown" | ||
puts "You have read and agree with the Disclaimer." | ||
Main.new() | ||
puts "Execute Successfully!!!" | ||
puts "#https://github.com/ZhgChgLi/ZMediumToMarkdown" | ||
puts "#Thanks for using this tool." | ||
puts "#If this is helpful, please help to star the repo or recommend it to your friends." | ||
rescue => e | ||
puts "#Error: #{e.class} #{e.message}\n" | ||
puts e.backtrace | ||
puts "#Please feel free to open an Issue or submit a fix/contribution via Pull Request on:\n" | ||
puts "#https://github.com/ZhgChgLi/ZMediumToMarkdown\n" | ||
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
Oops, something went wrong.