depends-client 0.2.0.beta2 → 0.2.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -18,19 +18,18 @@ gem install depends-client
18
18
  2. Setup ~/.depends/config.rb
19
19
 
20
20
  ```ruby
21
- api_key '<YOUR KEY HERE>'
22
- server 'https://depends.aws.af.cm'
21
+ depend config --key <your key here>
23
22
  ```
24
23
 
25
24
  3. Define a Depends file at the root of your source repository. The format is as follows:
26
25
  As of this release <code>source</code> is not longer necessary. The default location is always used.
27
26
 
28
27
  ```ruby
29
- depend 'Qt', :version => '4', :destination => 'External/Qt'
30
- depend 'SevenZipSharp', :version => '4', :destination => 'External/SevenZipSharp'
31
- depend 'Sqlite', :version => '4', :destination => 'External/Sqlite'
32
- depend 'Xerces', :version => '4', :destination => 'External/Xerces'
33
- depend 'Xsd', :version => '4', :destination => 'External/Xsd'
28
+ depend 'Qt', version: '4', destination: 'External/Qt'
29
+ depend 'SevenZipSharp', version: '4', destination: 'External/SevenZipSharp'
30
+ depend 'Sqlite', version: '4', destination: 'External/Sqlite'
31
+ depend 'Xerces', version: '4', destination: 'External/Xerces'
32
+ depend 'Xsd', version: '4', destination: 'External/Xsd'
34
33
 
35
34
  ```
36
35
 
@@ -45,7 +44,7 @@ depend
45
44
 
46
45
  _We also recomend that you add depends destinations to your gitignore and hgignore files._
47
46
 
48
- Your done, packages are download, extracted and installed per the instructions in your gem file
47
+ You're done! Packages are downloaded, extracted and installed per the instructions in your gem file.
49
48
 
50
49
 
51
50
  The Future
@@ -49,12 +49,12 @@ module Depends
49
49
  ignore.delete(line.chomp)
50
50
  end
51
51
  end
52
- File.open(file, 'a') { |f|
52
+ File.open(file, 'a') do |f|
53
53
  ignore.each do |i|
54
54
  f.puts ""
55
55
  f.puts i
56
56
  end
57
- }
57
+ end
58
58
  end
59
59
  end
60
60
 
@@ -76,7 +76,7 @@ module Depends
76
76
  def download_extract
77
77
  say "Downloading and extracting missing dependencies..."
78
78
  @def.dependencies.each do |dep|
79
- file_name = "#{dep[:name]}-#{dep['number']}.zip"
79
+ file_name = "#{Util.depend_name_with_version(dep)}.zip"
80
80
  cache_file = File.join(Depends::Config.cache,file_name)
81
81
  cache_directory = File.join(Depends::Config.cache,File.basename(file_name,'.zip'))
82
82
 
@@ -96,7 +96,7 @@ module Depends
96
96
 
97
97
  def link
98
98
  @def.dependencies.each do |dep|
99
- source = File.join(Depends::Config.cache,File.basename("#{dep[:name]}-#{dep['number']}",'.zip'))
99
+ source = File.join(Depends::Config.cache,File.basename(Util.depend_name_with_version(dep),'.zip'))
100
100
  base_dir = File.dirname(dep[:destination])
101
101
  FileUtils.mkdir_p(base_dir) unless File.exist? base_dir
102
102
  say "Linking #{source} to #{dep[:destination]}"
@@ -42,9 +42,9 @@ module Depends
42
42
 
43
43
  def build_package(options)
44
44
  upload_dir = File.join(Depends::Config.cache,'upload')
45
- FileUtils.mkdir_p upload_dir unless File.exist? upload_dir
45
+ FileUtils.mkdir_p upload_dir
46
46
  dest_file = File.join(upload_dir, "#{options.dep}-#{options.num}.zip")
47
- FileUtils.rm dest_file if File.exist? dest_file
47
+ FileUtils.rm_f
48
48
  source_path = File.expand_path(options.source)
49
49
  Zip::ZipFile.open(dest_file, Zip::ZipFile::CREATE) { |zipfile|
50
50
  Dir["#{source_path}/**/*"].each do |file|
@@ -34,9 +34,7 @@ module Depends
34
34
 
35
35
  def download_depend_version(name,version)
36
36
  dest_file = File.join(Depends::Config.cache, "#{name}-#{version}.zip")
37
-
38
- request = Nestful.get "#{source_url}/depends/#{name}/version/#{version}/download.url", :headers => headers
39
- uri = URI.parse(request)
37
+ uri = get_downlad_uri(name,version)
40
38
  http = Net::HTTP.new(uri.host, uri.port)
41
39
  http.use_ssl = true
42
40
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
@@ -59,7 +57,7 @@ module Depends
59
57
  end
60
58
 
61
59
  temp_file.close
62
- File.unlink dest_file if File.exists?(dest_file)
60
+ FileUtils.rm_f dest_file
63
61
  FileUtils.mkdir_p File.dirname(dest_file)
64
62
  FileUtils.mv temp_file.path, dest_file, :force => true
65
63
  end
@@ -89,6 +87,11 @@ module Depends
89
87
  depend
90
88
  end
91
89
 
90
+ private
91
+ def get_downlad_uri(name,version)
92
+ request = Nestful.get "#{source_url}/depends/#{name}/version/#{version}/download.url", :headers => headers
93
+ uri = URI.parse(request)
94
+ end
92
95
 
93
96
  end
94
97
  end
data/lib/depends/util.rb CHANGED
@@ -30,5 +30,9 @@ module Depends
30
30
  source
31
31
  end
32
32
  end
33
+
34
+ def self.depend_name_with_version(dep)
35
+ "#{dep[:name]}-#{dep['number']}"
36
+ end
33
37
  end
34
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: depends-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.beta2
4
+ version: 0.2.0.beta3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-11-28 00:00:00.000000000 Z
13
+ date: 2013-01-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nestful