crane 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -3
- data/lib/crane/commands/push.rb +6 -3
- data/lib/crane/version.rb +1 -1
- data/test/lib/crane/commands/test_push.rb +17 -1
- data/test/lib/crane/test_config.rb +0 -1
- metadata +14 -4
data/.gitignore
CHANGED
data/lib/crane/commands/push.rb
CHANGED
@@ -90,12 +90,15 @@ module Crane
|
|
90
90
|
elsif time_frame =~ /^[1-9]h$/
|
91
91
|
seconds = time_frame[/[1-9]/].to_i * (60 * 60)
|
92
92
|
return true if file_time > (time - seconds)
|
93
|
+
elsif time_frame =~ /^[1-9]{1,999}m$/
|
94
|
+
seconds = time_frame[/[1-9]{1,999}/].to_i * (60)
|
95
|
+
return true if file_time > (time - seconds)
|
93
96
|
elsif time_frame == "all"
|
94
97
|
return true
|
95
|
-
elsif time_frame == ""
|
96
|
-
true
|
97
98
|
end
|
98
|
-
|
99
|
+
|
100
|
+
return false unless time_frame.empty?
|
101
|
+
true
|
99
102
|
end
|
100
103
|
|
101
104
|
def get_files time_frame = "", search_folder = ""
|
data/lib/crane/version.rb
CHANGED
@@ -16,9 +16,12 @@ class TestPushCommand < Test::Unit::TestCase
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_get_todays_files
|
19
|
+
system "rm " + @lab_file_absolute
|
19
20
|
system "touch -mt " + Time.new.strftime("%Y%m%d%H%M") + " " + @lab_file_absolute
|
21
|
+
|
20
22
|
assert @obj.within_defined_interval?(@lab_file, "today")
|
21
|
-
assert !@obj.within_defined_interval?(@lab_file, "yesterday")
|
23
|
+
assert !@obj.within_defined_interval?(@lab_file, "yesterday"),
|
24
|
+
"shouldn't have a file from yesterday"
|
22
25
|
assert @obj.within_defined_interval?(@lab_file, "1h")
|
23
26
|
assert @obj.within_defined_interval?(@lab_file, "2h")
|
24
27
|
assert @obj.within_defined_interval?(@lab_file, "3h")
|
@@ -30,6 +33,19 @@ class TestPushCommand < Test::Unit::TestCase
|
|
30
33
|
assert @obj.within_defined_interval?(@lab_file, "yesterday")
|
31
34
|
assert !@obj.within_defined_interval?(@lab_file, "today")
|
32
35
|
end
|
36
|
+
|
37
|
+
def test_get_files_from_minutes_ago
|
38
|
+
system "touch -mt " + (Time.new - (60 * 2)).strftime("%Y%m%d%H%M") + " " + @lab_file_absolute
|
39
|
+
|
40
|
+
assert @obj.within_defined_interval?(@lab_file, "3m")
|
41
|
+
assert !@obj.within_defined_interval?(@lab_file, "1m")
|
42
|
+
|
43
|
+
system "touch -mt " + (Time.new - (60 * 30)).strftime("%Y%m%d%H%M") + " " + @lab_file_absolute
|
44
|
+
assert @obj.within_defined_interval?(@lab_file, "32m")
|
45
|
+
assert !@obj.within_defined_interval?(@lab_file, "20m")
|
46
|
+
|
47
|
+
|
48
|
+
end
|
33
49
|
|
34
50
|
def test_list_has_today_file
|
35
51
|
system "touch -mt " + Time.new.strftime("%Y%m%d%H%M") + " " + @lab_file_absolute
|
@@ -21,7 +21,6 @@ class TestConfig < Test::Unit::TestCase
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def test_has_ignore_files
|
24
|
-
assert Config.IGNORE_FILES.include? "crane"
|
25
24
|
assert Config.IGNORE_FILES.include? ".git"
|
26
25
|
assert Config.IGNORE_FILES.include? ".DS_Store"
|
27
26
|
assert Config.IGNORE_FILES.include? ".crane"
|
metadata
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crane
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 0.2.0
|
6
10
|
platform: ruby
|
7
11
|
authors:
|
8
12
|
- Alexandre de Oliveira
|
@@ -10,7 +14,8 @@ autorequire:
|
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
16
|
|
13
|
-
date: 2011-
|
17
|
+
date: 2011-07-02 00:00:00 -03:00
|
18
|
+
default_executable:
|
14
19
|
dependencies: []
|
15
20
|
|
16
21
|
description: |-
|
@@ -56,6 +61,7 @@ files:
|
|
56
61
|
- test/resources/configurations/crane_wrong_remote_dir
|
57
62
|
- test/resources/source_codes/today_file.rb
|
58
63
|
- test/set_test_environment.rb
|
64
|
+
has_rdoc: true
|
59
65
|
homepage: http://github.com/kurko/crane
|
60
66
|
licenses: []
|
61
67
|
|
@@ -69,17 +75,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
69
75
|
requirements:
|
70
76
|
- - ">="
|
71
77
|
- !ruby/object:Gem::Version
|
78
|
+
segments:
|
79
|
+
- 0
|
72
80
|
version: "0"
|
73
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
82
|
none: false
|
75
83
|
requirements:
|
76
84
|
- - ">="
|
77
85
|
- !ruby/object:Gem::Version
|
86
|
+
segments:
|
87
|
+
- 0
|
78
88
|
version: "0"
|
79
89
|
requirements: []
|
80
90
|
|
81
91
|
rubyforge_project: crane
|
82
|
-
rubygems_version: 1.7
|
92
|
+
rubygems_version: 1.3.7
|
83
93
|
signing_key:
|
84
94
|
specification_version: 3
|
85
95
|
summary: Send files via FTP automatically.
|