git-media 0.1.1 → 0.1.2

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.
data/README.rdoc CHANGED
@@ -14,7 +14,7 @@ Setup the attributes filter settings.
14
14
  Setup the .gitattributes file to map extensions to the filter.
15
15
 
16
16
  (in repo - once)
17
- $ echo "*.mov filter=media" > .gitattributes
17
+ $ echo "*.mov filter=media -crlf" > .gitattributes
18
18
 
19
19
  Staging files with those extensions will automatically copy them to the
20
20
  media buffer area (.git/media) until you run 'git media sync' wherein they
@@ -76,6 +76,9 @@ that is. If you want to upload & delete the local cache of media files, run:
76
76
  $ sudo gem install git-media-0.1.1.gem
77
77
 
78
78
  == Notes for Windows
79
+ It is important to switch off git smart newline character support for media files.
80
+ Use "-crlf" switch in .gitattributes (for example "*.mov filter=media -crlf") or config option "core.autocrlf = false".
81
+
79
82
  If installing on windows, you might run into a problem verifying certificates
80
83
  for S3 or something. If that happens, modify
81
84
  C:\Ruby191\lib\ruby\gems\1.9.1\gems\right_http_connection-1.2.4\lib\right_http_connection.rb
data/git-media.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{git-media}
5
- s.version = "0.1.1"
5
+ s.version = "0.1.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Scott Chacon"]
@@ -24,7 +24,9 @@ module GitMedia
24
24
  tempfile.close
25
25
 
26
26
  # calculate and print the SHA of the data
27
- puts hx = hashfunc.hexdigest
27
+ STDOUT.print hx = hashfunc.hexdigest
28
+ STDOUT.binmode
29
+ STDOUT.write("\n")
28
30
 
29
31
  # move the tempfile to our media buffer area
30
32
  media_file = File.join(media_buffer, hx)
@@ -6,8 +6,8 @@ module GitMedia
6
6
  can_download = false # TODO: read this from config and implement
7
7
 
8
8
  # read checksum size
9
- sha = STDIN.read(41)
10
- if STDIN.eof? && sha[40, 1] == "\n"
9
+ sha = STDIN.readline(64).strip # read no more than 64 bytes
10
+ if STDIN.eof? && sha.length == 40 && sha.match(/^[0-9a-fA-F]+$/) != nil
11
11
  # this is a media file
12
12
  media_file = File.join(media_buffer, sha.chomp)
13
13
  if File.exists?(media_file)
@@ -25,7 +25,8 @@ module GitMedia
25
25
  end
26
26
  end
27
27
  else
28
- # if more than 40 chars, just output
28
+ # if it is not a 40 character long hash, just output
29
+ STDERR.puts('Unknown git-media file format')
29
30
  print sha
30
31
  while data = STDIN.read(4096)
31
32
  print data
@@ -10,7 +10,7 @@ module GitMedia
10
10
  r = self.local_cache_status
11
11
  self.print_cache_status(r)
12
12
  end
13
-
13
+
14
14
  # find tree entries that are likely media references
15
15
  def self.find_references
16
16
  references = {:to_expand => [], :expanded => [], :deleted => []}
@@ -22,7 +22,7 @@ module GitMedia
22
22
  if size == tree_size.to_i
23
23
  # TODO: read in the data and verify that it's a sha + newline
24
24
  sha = File.read(fname).strip
25
- if sha.length == 40
25
+ if sha.length == 40 && sha =~ /^[0-9a-f]+$/
26
26
  references[:to_expand] << [fname, sha]
27
27
  end
28
28
  else
@@ -48,14 +48,14 @@ module GitMedia
48
48
  puts "== Expanded Media =="
49
49
  refs[:expanded].each do |file|
50
50
  size = File.size(file)
51
- puts " " + "(#{self.to_human(size)})".ljust(8) + " #{file}"
51
+ puts " " + "(#{self.to_human(size)})".ljust(8) + " #{file}"
52
52
  end
53
53
  puts
54
54
  end
55
55
  if refs[:deleted].size > 0
56
56
  puts "== Deleted Media =="
57
57
  refs[:deleted].each do |file|
58
- puts " " + " #{file}"
58
+ puts " " + " #{file}"
59
59
  end
60
60
  puts
61
61
  end
@@ -76,7 +76,7 @@ module GitMedia
76
76
  refs[:pushed].each do |sha|
77
77
  cache_file = GitMedia.media_path(sha)
78
78
  size = File.size(cache_file)
79
- puts " " + "(#{self.to_human(size)})".ljust(8) + ' ' + sha[0, 8]
79
+ puts " " + "(#{self.to_human(size)})".ljust(8) + ' ' + sha[0, 8]
80
80
  end
81
81
  puts
82
82
  end
@@ -100,8 +100,8 @@ module GitMedia
100
100
  return (size / 1024).to_s + 'k'
101
101
  else
102
102
  return (size / 1048576).to_s + 'm'
103
- end
103
+ end
104
104
  end
105
-
105
+
106
106
  end
107
- end
107
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-media
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 31
5
+ prerelease:
5
6
  segments:
6
7
  - 0
7
8
  - 1
8
- - 1
9
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Scott Chacon
@@ -14,8 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2009-06-10 00:00:00 +02:00
18
- default_executable: git-media
18
+ date: 2009-06-10 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description:
@@ -46,7 +46,6 @@ files:
46
46
  - lib/git-media/transport/scp.rb
47
47
  - lib/git-media/transport.rb
48
48
  - lib/git-media.rb
49
- has_rdoc: true
50
49
  homepage: http://github.com/schacon/git-media
51
50
  licenses: []
52
51
 
@@ -60,6 +59,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
60
59
  requirements:
61
60
  - - ">="
62
61
  - !ruby/object:Gem::Version
62
+ hash: 3
63
63
  segments:
64
64
  - 0
65
65
  version: "0"
@@ -68,13 +68,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  requirements:
69
69
  - - ">="
70
70
  - !ruby/object:Gem::Version
71
+ hash: 3
71
72
  segments:
72
73
  - 0
73
74
  version: "0"
74
75
  requirements: []
75
76
 
76
77
  rubyforge_project:
77
- rubygems_version: 1.3.7
78
+ rubygems_version: 1.8.24
78
79
  signing_key:
79
80
  specification_version: 2
80
81
  summary: "\"This is a summary! Stop yer whining\""