Module: GitMedia
- Defined in:
- lib/git-media/transport/s3.rb,
lib/git-media.rb,
lib/git-media/sync.rb,
lib/git-media/clear.rb,
lib/git-media/status.rb,
lib/git-media/transport.rb,
lib/git-media/filter-clean.rb,
lib/git-media/filter-smudge.rb,
lib/git-media/transport/scp.rb,
lib/git-media/transport/local.rb
Overview
git-media.transport local git-media.localpath /opt/media
Defined Under Namespace
Modules: Application, Clear, FilterClean, FilterSmudge, Status, Sync, Transport
Class Method Summary
collapse
Class Method Details
9
10
11
12
13
14
|
# File 'lib/git-media.rb', line 9
def self.get_media_buffer
@@git_dir ||= `git rev-parse --git-dir`.chomp
media_buffer = File.join(@@git_dir, 'media/objects')
FileUtils.mkdir_p(media_buffer) if !File.exist?(media_buffer)
return media_buffer
end
|
.get_pull_transport ⇒ Object
68
69
70
|
# File 'lib/git-media.rb', line 68
def self.get_pull_transport
self.get_transport
end
|
.get_push_transport ⇒ Object
TODO: select the proper transports based on settings
22
23
24
|
# File 'lib/git-media.rb', line 22
def self.get_push_transport
self.get_transport
end
|
.get_transport ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/git-media.rb', line 26
def self.get_transport
case `git config git-media.transport`.chomp
when ""
raise "git-media.transport not set"
when "scp"
user = `git config git-media.scpuser`.chomp
host = `git config git-media.scphost`.chomp
path = `git config git-media.scppath`.chomp
if user === ""
raise "git-media.scpuser not set for scp transport"
end
if host === ""
raise "git-media.scphost not set for scp transport"
end
if path === ""
raise "git-media.scppath not set for scp transport"
end
GitMedia::Transport::Scp.new(user, host, path)
when "local"
path = `git config git-media.localpath`.chomp
if path === ""
raise "git-media.localpath not set for local transport"
end
GitMedia::Transport::Local.new(path)
when "s3"
bucket = `git config git-media.s3bucket`.chomp
key = `git config git-media.s3key`.chomp
secret = `git config git-media.s3secret`.chomp
if bucket === ""
raise "git-media.s3bucket not set for s3 transport"
end
if key === ""
raise "git-media.s3key not set for s3 transport"
end
if secret === ""
raise "git-media.s3secret not set for s3 transport"
end
GitMedia::Transport::S3.new(bucket, key, secret)
end
end
|
16
17
18
19
|
# File 'lib/git-media.rb', line 16
def self.media_path(sha)
buf = self.get_media_buffer
File.join(buf, sha)
end
|