From 0b22cf9344adaab0048aea20efe1489ead5e8aa6 Mon Sep 17 00:00:00 2001 From: Yegorov Date: Tue, 23 Jan 2018 01:04:16 +0300 Subject: [PATCH] Add check runtime dependences, fix readme and yandex.gemspec --- README.md | 19 ++++++++++++++----- bin/yadisk | 5 +++++ lib/yadisk/check_runtime.rb | 14 ++++++++++++++ yadisk.gemspec | 7 ++++--- 4 files changed, 37 insertions(+), 8 deletions(-) mode change 100644 => 100755 bin/yadisk create mode 100644 lib/yadisk/check_runtime.rb diff --git a/README.md b/README.md index ed4203c..c01a835 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,28 @@ Yadisk ====== -Tool for download - +Command line tool for download file from Yandex.Disk through share link ## Install ``` -gem install yadisk +$ gem install yadisk ``` For development: ``` -gem install --dev yadisk +$ gem install --dev yadisk +``` + +## How use + +``` +# Save to current directory +$ yadisk https://yadi.sk/i/UFD + +# Save to other directory +$ yadisk https://yadi.sk/i/UFD /path/to/directory ``` ## Test @@ -21,7 +30,7 @@ gem install --dev yadisk For run test use: ``` -rspec +$ rspec ``` ## Contribution diff --git a/bin/yadisk b/bin/yadisk old mode 100644 new mode 100755 index f0567a4..2835736 --- a/bin/yadisk +++ b/bin/yadisk @@ -1,3 +1,8 @@ #!/usr/bin/env ruby # handle ARGV, and execute Yadisk::Main class + +require 'yadisk' +require 'yadisk/check_runtime' + +Yadisk::CheckRuntime.check_wget diff --git a/lib/yadisk/check_runtime.rb b/lib/yadisk/check_runtime.rb new file mode 100644 index 0000000..0ec0c9b --- /dev/null +++ b/lib/yadisk/check_runtime.rb @@ -0,0 +1,14 @@ +require "io/console" + +module Yadisk + class CheckRuntime + def self.check_wget + output = IO.popen("which wget").read + if output.empty? + puts "Please install wget or add it to 'PATH' and try again\n" + abort + end + end + end +end + diff --git a/yadisk.gemspec b/yadisk.gemspec index 3522a95..ca7bd4d 100644 --- a/yadisk.gemspec +++ b/yadisk.gemspec @@ -5,15 +5,16 @@ require_relative 'lib/yadisk/version' Gem::Specification.new do |s| s.name = 'yadisk' - s.version = Yadisk::VERSION # '0.0.1' + s.version = Yadisk::VERSION s.date = '2018-01-25' s.summary = "Download file from Yandex.Disk through share link" s.description = "Command line tool for download file from Yandex.Disk through share link" s.author = "Artem Yegorov" s.email = 'yegorov0725@yandex.ru' - s.files = ["lib/yadisk.rb", "lib/yadisk/version.rb"] + s.files = ["lib/yadisk.rb", "lib/yadisk/check_runtime.rb", "lib/yadisk/version.rb"] + s.platform = Gem::Platform::RUBY s.executables << 'yadisk' - s.add_development_dependency 'rspec', '~> 3.7.0' + s.add_development_dependency 'rspec', ['~> 3.7.0', '< 4.0'] s.homepage = 'https://github.com/yegorov/yadisk' s.license = 'MIT' end