filbunke 1.1.15 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/filbunke.gemspec +5 -2
- data/lib/filbunke/client.rb +28 -5
- data/lib/filbunke.rb +6 -0
- metadata +18 -4
data/Rakefile
CHANGED
@@ -12,7 +12,8 @@ begin
|
|
12
12
|
gem.authors = ["Wouter de Bie"]
|
13
13
|
gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
14
14
|
gem.files.exclude 'pkg'
|
15
|
-
gem.executables = ['filbunked']
|
15
|
+
gem.executables = ['filbunked']
|
16
|
+
gem.add_dependency 'json', '>= 1.1.7'
|
16
17
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
17
18
|
end
|
18
19
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
data/filbunke.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{filbunke}
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Wouter de Bie"]
|
12
|
-
s.date = %q{2010-11-
|
12
|
+
s.date = %q{2010-11-17}
|
13
13
|
s.default_executable = %q{filbunked}
|
14
14
|
s.description = %q{Filbunke client and library}
|
15
15
|
s.email = %q{wouter@deltaprojects.se}
|
@@ -47,11 +47,14 @@ Gem::Specification.new do |s|
|
|
47
47
|
|
48
48
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
49
49
|
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
50
|
+
s.add_runtime_dependency(%q<json>, [">= 1.1.7"])
|
50
51
|
else
|
51
52
|
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
53
|
+
s.add_dependency(%q<json>, [">= 1.1.7"])
|
52
54
|
end
|
53
55
|
else
|
54
56
|
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
57
|
+
s.add_dependency(%q<json>, [">= 1.1.7"])
|
55
58
|
end
|
56
59
|
end
|
57
60
|
|
data/lib/filbunke/client.rb
CHANGED
@@ -1,8 +1,3 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'net/http'
|
3
|
-
require 'fileutils'
|
4
|
-
require 'digest/md5'
|
5
|
-
|
6
1
|
module Filbunke
|
7
2
|
class Client
|
8
3
|
|
@@ -10,10 +5,13 @@ module Filbunke
|
|
10
5
|
|
11
6
|
UPDATES_ACTION = 'updates'
|
12
7
|
FILES_ACTION = 'files'
|
8
|
+
LAST_CHECKPOINT_ACTION = 'last_checkpoint'
|
9
|
+
TOUCH_ACTION = 'touch'
|
13
10
|
URL_KEY = 'url'
|
14
11
|
FROM_CHECKPOINT_KEY = 'from_checkpoint'
|
15
12
|
HASH_KEY = 'hash'
|
16
13
|
|
14
|
+
|
17
15
|
def initialize(repository, logger, callbacks = [])
|
18
16
|
@repository = repository
|
19
17
|
@logger = logger
|
@@ -83,6 +81,31 @@ module Filbunke
|
|
83
81
|
end
|
84
82
|
end
|
85
83
|
|
84
|
+
def touch_repository!
|
85
|
+
touch_http = Net::HTTP.new(@repository.host, @repository.port)
|
86
|
+
touch_http.start do |http|
|
87
|
+
touch_path = "/#{UPDATES_ACTION}/#{@repository.name}/#{TOUCH_ACTION}"
|
88
|
+
request = Net::HTTP::Put.new(touch_path)
|
89
|
+
response = http.request(request)
|
90
|
+
if response.code.to_i != 204
|
91
|
+
raise "Failed to touch repository: #{@repository.name}"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def last_checkpoint
|
97
|
+
last_checkpoint_http = Net::HTTP.new(@repository.host, @repository.port)
|
98
|
+
last_checkpoint_http.start do |http|
|
99
|
+
last_checkpoint_path = "/#{UPDATES_ACTION}/#{@repository.name}/#{LAST_CHECKPOINT_ACTION}"
|
100
|
+
request = Net::HTTP::Get.new(last_checkpoint_path)
|
101
|
+
response = http.request(request)
|
102
|
+
if response.code.to_i != 200
|
103
|
+
raise "Failed to get last checkpoint for repository: #{@repository.name}"
|
104
|
+
end
|
105
|
+
return response.body.chomp.to_i
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
86
109
|
private
|
87
110
|
|
88
111
|
def file_needs_update?(file, local_file_path)
|
data/lib/filbunke.rb
CHANGED
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 1.
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 1.2.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Wouter de Bie
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-11-
|
17
|
+
date: 2010-11-17 00:00:00 +01:00
|
18
18
|
default_executable: filbunked
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -29,6 +29,20 @@ dependencies:
|
|
29
29
|
version: "0"
|
30
30
|
type: :development
|
31
31
|
version_requirements: *id001
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: json
|
34
|
+
prerelease: false
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
segments:
|
40
|
+
- 1
|
41
|
+
- 1
|
42
|
+
- 7
|
43
|
+
version: 1.1.7
|
44
|
+
type: :runtime
|
45
|
+
version_requirements: *id002
|
32
46
|
description: Filbunke client and library
|
33
47
|
email: wouter@deltaprojects.se
|
34
48
|
executables:
|