pmirror 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/features/pmirror.feature +5 -0
- data/lib/pmirror.rb +11 -6
- data/lib/pmirror/version.rb +1 -1
- metadata +1 -1
data/Gemfile.lock
CHANGED
data/features/pmirror.feature
CHANGED
@@ -7,6 +7,7 @@ Feature: My bootstrapped app kinda works
|
|
7
7
|
When I get help for "pmirror"
|
8
8
|
Then the exit status should be 0
|
9
9
|
And the banner should be present
|
10
|
+
And the banner should include the version
|
10
11
|
And the banner should document that this app takes options
|
11
12
|
And the following options should be documented:
|
12
13
|
|--pattern|
|
@@ -21,6 +22,10 @@ Feature: My bootstrapped app kinda works
|
|
21
22
|
|-e|
|
22
23
|
|-u|
|
23
24
|
|
25
|
+
Scenario: Check version
|
26
|
+
When I successfully run `pmirror --version`
|
27
|
+
Then the exit status should be 0
|
28
|
+
|
24
29
|
Scenario: Download a file
|
25
30
|
When I successfully run `pmirror -p meh -l ../foo -u http://localhost:55555`
|
26
31
|
Then the exit status should be 0
|
data/lib/pmirror.rb
CHANGED
@@ -8,25 +8,30 @@ module Pmirror
|
|
8
8
|
include Methadone::Main
|
9
9
|
include Methadone::CLILogging
|
10
10
|
include Methadone::SH
|
11
|
+
version(::Pmirror::VERSION)
|
11
12
|
|
12
13
|
main do
|
13
14
|
d "Inside main"
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
if options[:url] && options[:pattern] && options[:localdir]
|
17
|
+
download_list = get_download_list(options[:url], options[:pattern])
|
18
|
+
d "download_list: #{download_list.inspect}"
|
19
|
+
download_files(options[:localdir], download_list)
|
20
|
+
|
21
|
+
execute(options[:exec]) if options[:exec]
|
22
|
+
else
|
23
|
+
help_now!("Missing arguments")
|
24
|
+
end
|
19
25
|
|
20
26
|
end
|
21
27
|
|
22
28
|
description "Mirror files on a remote http server based on pattern match"
|
23
|
-
on("-p", "--pattern
|
29
|
+
on("-p", "--pattern PAT,PAT", Array,
|
24
30
|
"Regex to match files in remote dir, may specify multiple patterns"
|
25
31
|
)
|
26
32
|
on("-l", "--localdir DIR", "Local directory to mirror files to")
|
27
33
|
on("-e", "--exec CMD", "Execute command after completion")
|
28
34
|
on("-d", "--debug", "Enable debugging")
|
29
|
-
on("-v", "--version", "Show version")
|
30
35
|
on("-u", "--url URL,URL", Array, "Url or remote site")
|
31
36
|
|
32
37
|
def self.d(msg)
|
data/lib/pmirror/version.rb
CHANGED