ffsr 1.1.3
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 +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +35 -0
- data/README.md +33 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/ffsr +6 -0
- data/ffsr.gemspec +41 -0
- data/lib/ffsr.rb +76 -0
- data/lib/ffsr/CommandLineErrorHandler.rb +22 -0
- data/lib/ffsr/OptParse.rb +39 -0
- data/lib/ffsr/version.rb +3 -0
- metadata +105 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 2719b3f8c8c8c1f13238bd5b0f29c1429ab314940afaf507fcac26879b00022a
|
|
4
|
+
data.tar.gz: 3de6d433124a81fade65f6afcefb84390764e055c9e7689a03a4ee1750805fb1
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: c12cb5539fb9c2b4cf0a305a051484fbfc09443f1d901d32d8c7003ea4f7cfacc6e2a6f5fa017b712b6abbdd32023142b514fabeca8a57016e9525c1d9872917
|
|
7
|
+
data.tar.gz: a10bf5c733129e454a56156cb45ca28bfa33f593e81c33bc5e73c2f274d362acc585a44588878c9d6b7621f621946d3bc26b6aed4e0a002d3945712c17ce3d0e
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
ffsr (1.1.3)
|
|
5
|
+
|
|
6
|
+
GEM
|
|
7
|
+
remote: https://rubygems.org/
|
|
8
|
+
specs:
|
|
9
|
+
diff-lcs (1.3)
|
|
10
|
+
rake (10.5.0)
|
|
11
|
+
rspec (3.8.0)
|
|
12
|
+
rspec-core (~> 3.8.0)
|
|
13
|
+
rspec-expectations (~> 3.8.0)
|
|
14
|
+
rspec-mocks (~> 3.8.0)
|
|
15
|
+
rspec-core (3.8.0)
|
|
16
|
+
rspec-support (~> 3.8.0)
|
|
17
|
+
rspec-expectations (3.8.3)
|
|
18
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
19
|
+
rspec-support (~> 3.8.0)
|
|
20
|
+
rspec-mocks (3.8.0)
|
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
22
|
+
rspec-support (~> 3.8.0)
|
|
23
|
+
rspec-support (3.8.0)
|
|
24
|
+
|
|
25
|
+
PLATFORMS
|
|
26
|
+
x64-mingw32
|
|
27
|
+
|
|
28
|
+
DEPENDENCIES
|
|
29
|
+
bundler (~> 2.0)
|
|
30
|
+
ffsr!
|
|
31
|
+
rake (~> 10.0)
|
|
32
|
+
rspec (~> 3.0)
|
|
33
|
+
|
|
34
|
+
BUNDLED WITH
|
|
35
|
+
2.0.1
|
data/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Ffsr
|
|
2
|
+
|
|
3
|
+
FFSR is a helper tool that facilitates the work with FreeFileSync in batch mode. It is capable to run in sequence several FFS batch files given on the command line. FFSR accepts arguments with wilcards.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'ffsr'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
$ bundle
|
|
16
|
+
|
|
17
|
+
Or install it yourself as:
|
|
18
|
+
|
|
19
|
+
$ gem install ffsr
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
FFSR command line is
|
|
24
|
+
|
|
25
|
+
ffsr executablefile files
|
|
26
|
+
|
|
27
|
+
executablefile is a path pointing to the executable fo FreeFileSync
|
|
28
|
+
files are the FFS batch files to be processed by FreeFileSync
|
|
29
|
+
|
|
30
|
+
Examples
|
|
31
|
+
|
|
32
|
+
ffsr "c:\program files\FreeFileSync\FreeFileSync.exe" archive.ffs_batch
|
|
33
|
+
ffsr "c:\program files\FreeFileSync\FreeFileSync.exe" g:\FFS\*.ffs_bacth
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "ffsr"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/ffsr
ADDED
data/ffsr.gemspec
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "ffsr/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "ffsr"
|
|
8
|
+
spec.version = Ffsr::VERSION
|
|
9
|
+
spec.authors = ["imc"]
|
|
10
|
+
spec.email = ["imc@okto7.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{Simple starter of FFS batch files.}
|
|
13
|
+
spec.description = %q{This is simple starter of FFS batch files.}
|
|
14
|
+
spec.homepage = "http://gitrepos.okto7.com/ffsr"
|
|
15
|
+
|
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
18
|
+
if spec.respond_to?(:metadata)
|
|
19
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
20
|
+
|
|
21
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
22
|
+
spec.metadata["source_code_uri"] = "http://gitrepos.okto7.com/ffsr"
|
|
23
|
+
spec.metadata["changelog_uri"] = "http://gitrepos.okto7.com/ffsr/CHANGELOG"
|
|
24
|
+
else
|
|
25
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
|
26
|
+
"public gem pushes."
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Specify which files should be added to the gem when it is released.
|
|
30
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
31
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
32
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
33
|
+
end
|
|
34
|
+
spec.bindir = "exe"
|
|
35
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
36
|
+
spec.require_paths = ["lib"]
|
|
37
|
+
|
|
38
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
|
39
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
40
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
41
|
+
end
|
data/lib/ffsr.rb
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
require "ffsr/version"
|
|
2
|
+
require 'optparse'
|
|
3
|
+
require 'ffsr/CommandLineErrorHandler'
|
|
4
|
+
require 'ffsr/OptParse'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Ffsr
|
|
8
|
+
class Error < StandardError; end
|
|
9
|
+
# Your code goes here...
|
|
10
|
+
|
|
11
|
+
# applcation definition
|
|
12
|
+
APPNAME = 'ffsr'
|
|
13
|
+
IDSW_NUMBER = 109218
|
|
14
|
+
|
|
15
|
+
NORMAL_EXIT = 0
|
|
16
|
+
OPTION_ERROR = 1
|
|
17
|
+
|
|
18
|
+
# main program begins here
|
|
19
|
+
class Mainclass
|
|
20
|
+
def main
|
|
21
|
+
# primary parse of the commandline options
|
|
22
|
+
begin
|
|
23
|
+
options = OptParse.parse(ARGV)
|
|
24
|
+
raise CommandLineErrorHandler.new('No program and/or files are given') if ARGV.size < 2
|
|
25
|
+
rescue CommandLineErrorHandler => e
|
|
26
|
+
e.printMessage
|
|
27
|
+
options[:opterrors] += 1
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
ConditionalExit(options)
|
|
31
|
+
|
|
32
|
+
program, *files = ARGV
|
|
33
|
+
|
|
34
|
+
# check existence of the program
|
|
35
|
+
begin
|
|
36
|
+
raise CommandLineErrorHandler.new("The program executable \'#{program}\' does not exist") if File.file?(program) == false
|
|
37
|
+
rescue CommandLineErrorHandler => e
|
|
38
|
+
e.printMessage
|
|
39
|
+
options[:opterrors] += 1
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
ConditionalExit(options)
|
|
43
|
+
|
|
44
|
+
# check if the file is executable
|
|
45
|
+
begin
|
|
46
|
+
raise CommandLineErrorHandler.new("\'#{program}\' is not an executable file") if File.executable?(program) == false
|
|
47
|
+
rescue CommandLineErrorHandler => e
|
|
48
|
+
e.printMessage
|
|
49
|
+
options[:opterrors] += 1
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
ConditionalExit(options)
|
|
53
|
+
|
|
54
|
+
# work here
|
|
55
|
+
files.each do |f|
|
|
56
|
+
puts program + ' ' + f if options[:verbose] != nil && options[:verbose] == true
|
|
57
|
+
r = true
|
|
58
|
+
r = system(program,f) if options[:dryrun] == nil || options[:dryrun] != true
|
|
59
|
+
puts "Synchronization of #{f} did not proceed" if r == nil
|
|
60
|
+
puts "Synchronization of #{f} was not successful" if r == false
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
NORMAL_EXIT
|
|
64
|
+
end # main
|
|
65
|
+
|
|
66
|
+
# ConditionalExit
|
|
67
|
+
# This function exits program if there were command line errors
|
|
68
|
+
def ConditionalExit(options)
|
|
69
|
+
if options[:opterrors] > 0
|
|
70
|
+
pp options
|
|
71
|
+
exit OPTION_ERROR
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end # Mainclass
|
|
75
|
+
|
|
76
|
+
end # end module
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module Ffsr
|
|
2
|
+
# exception handler for class OptParse and class OptPostprocess
|
|
3
|
+
class CommandLineErrorHandler < StandardError
|
|
4
|
+
attr_reader :message, :subject
|
|
5
|
+
|
|
6
|
+
def initialize(message, subject = '')
|
|
7
|
+
@message = message
|
|
8
|
+
@subject = subject
|
|
9
|
+
super()
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def printMessage
|
|
13
|
+
mess = @message
|
|
14
|
+
if @subject.length > 0
|
|
15
|
+
mess += ': ' + @subject
|
|
16
|
+
else
|
|
17
|
+
mess += '.'
|
|
18
|
+
end
|
|
19
|
+
puts mess
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module Ffsr
|
|
2
|
+
# command line options - This variable is used to transfer information between option processing
|
|
3
|
+
# and posprocessing.
|
|
4
|
+
# hashes
|
|
5
|
+
# :opterrors - counter of errors in parsing and postprocessing
|
|
6
|
+
|
|
7
|
+
class OptParse
|
|
8
|
+
def self.parse(argv)
|
|
9
|
+
options = {:opterrors => 0}
|
|
10
|
+
opterrors = 0
|
|
11
|
+
|
|
12
|
+
opt_parser = OptionParser.new do |opt|
|
|
13
|
+
opt.banner = 'Usage: ffsr FFSR_batch_files [options]'
|
|
14
|
+
|
|
15
|
+
opt.on('--dry-run', 'Does everything as usual except creating output files') do
|
|
16
|
+
options[:dryrun] = true
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
opt.on_tail('-V', '--verbose', 'Verbose output') do
|
|
20
|
+
options[:verbose] = true
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
opt.on_tail('-v', '--version', 'Show version') do
|
|
24
|
+
puts APPNAME + ' ' + VERSION
|
|
25
|
+
exit NORMAL_EXIT
|
|
26
|
+
end
|
|
27
|
+
end # opt_parser = OptionParser.new do |opt|
|
|
28
|
+
begin
|
|
29
|
+
opt_parser.parse!
|
|
30
|
+
rescue => e
|
|
31
|
+
puts 'Errors on the command line'
|
|
32
|
+
opterrors += 1
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
options[:opterrors] = opterrors
|
|
36
|
+
options
|
|
37
|
+
end # parse
|
|
38
|
+
end # class Optparse
|
|
39
|
+
end
|
data/lib/ffsr/version.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: ffsr
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.1.3
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- imc
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2019-07-01 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '2.0'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '2.0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '3.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '3.0'
|
|
55
|
+
description: This is simple starter of FFS batch files.
|
|
56
|
+
email:
|
|
57
|
+
- imc@okto7.com
|
|
58
|
+
executables:
|
|
59
|
+
- ffsr
|
|
60
|
+
extensions: []
|
|
61
|
+
extra_rdoc_files: []
|
|
62
|
+
files:
|
|
63
|
+
- ".gitignore"
|
|
64
|
+
- ".rspec"
|
|
65
|
+
- ".travis.yml"
|
|
66
|
+
- Gemfile
|
|
67
|
+
- Gemfile.lock
|
|
68
|
+
- README.md
|
|
69
|
+
- Rakefile
|
|
70
|
+
- bin/console
|
|
71
|
+
- bin/setup
|
|
72
|
+
- exe/ffsr
|
|
73
|
+
- ffsr.gemspec
|
|
74
|
+
- lib/ffsr.rb
|
|
75
|
+
- lib/ffsr/CommandLineErrorHandler.rb
|
|
76
|
+
- lib/ffsr/OptParse.rb
|
|
77
|
+
- lib/ffsr/version.rb
|
|
78
|
+
homepage: http://gitrepos.okto7.com/ffsr
|
|
79
|
+
licenses: []
|
|
80
|
+
metadata:
|
|
81
|
+
allowed_push_host: https://rubygems.org
|
|
82
|
+
homepage_uri: http://gitrepos.okto7.com/ffsr
|
|
83
|
+
source_code_uri: http://gitrepos.okto7.com/ffsr
|
|
84
|
+
changelog_uri: http://gitrepos.okto7.com/ffsr/CHANGELOG
|
|
85
|
+
post_install_message:
|
|
86
|
+
rdoc_options: []
|
|
87
|
+
require_paths:
|
|
88
|
+
- lib
|
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
|
+
requirements:
|
|
91
|
+
- - ">="
|
|
92
|
+
- !ruby/object:Gem::Version
|
|
93
|
+
version: '0'
|
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
|
+
requirements:
|
|
96
|
+
- - ">="
|
|
97
|
+
- !ruby/object:Gem::Version
|
|
98
|
+
version: '0'
|
|
99
|
+
requirements: []
|
|
100
|
+
rubyforge_project:
|
|
101
|
+
rubygems_version: 2.7.6.2
|
|
102
|
+
signing_key:
|
|
103
|
+
specification_version: 4
|
|
104
|
+
summary: Simple starter of FFS batch files.
|
|
105
|
+
test_files: []
|