xcode-installer 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Y2VmNDYyM2JlYWVmMGM0NGQyNTY5Zjc1NmE1ZmJjZjEyM2VkY2YwZA==
4
+ N2RmZDI1MzgyMjhhZjkxMGYzM2E1YjliODcwOGJmYzk3ODc5YTNiZA==
5
5
  data.tar.gz: !binary |-
6
- NmY3NzQyZDExOTU5OTIyY2I1NDRhNjYyYTJmMDk5NmM3ZWEyYjE5NQ==
6
+ YmQ0YmI4NjAyMDhlMWI2OTJhZjdiY2UxNGZhNzcyMWFmNzVkNDk3OA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MDE0ODU0YThhMjZhZDQxMDg1MzA5ZGYwNGM2NmU0ZWQ1ZGU5NmIyYzg2OGM0
10
- ZWEzNDNhNDk1YTA0OTkxNGYxZjg1ZWM2MTliNGRlZGUzZTg5ZjI5N2MyYzNm
11
- YjMxMDgxNWFjY2UyZWEzMDRmN2JiZTk5Yzc4YTE4NmViOTgzOTI=
9
+ ZDI3MTcyYWFjYjRjNTIzZmVhNGQxMDhiYjIyM2U4YmE0NTdiYWNjODZlMzdl
10
+ ZGRiNjg5ZDdmMGRhZDFjODdhNzNlYzA4ZDBhZmE1YjZhNGQ4ZDcwODViNmJj
11
+ NGZhZjk2MjIzY2NhNzJmNmEyZGM4ODBiMDlhZDlhN2JlYzYwMWE=
12
12
  data.tar.gz: !binary |-
13
- MmVmY2Q2NmZkZDBkNjIwMDE5NTQxZmE0ZDYwMGY0ODljYjMzZTA2MGI2Yjc3
14
- ODhhOThhZGJjYmUyMWU0ZjA0ZGQ1OWYwMDY2NmFlYWM3ODNmYjNjYWE4ODEw
15
- NDYxNjg4NTdlMjU0ZDVkNjE4MzU2MmVkYWE2YjViZTUyMjU2OWE=
13
+ MzI5NTY1NjEzMzYxOTVlZjM5OGY3ZWViZjkzYjhjZDM5MGMzMWUyMmExODEz
14
+ YjA2NTlmNWMyODVlZDdlY2FhZTE1MDYyOTcwYzYzYTE5YjUzZjI3MDIxNjcw
15
+ YjFlYjgxMGRjNDA4MTQ2YWNkNDNiOWNmYjdkN2IwZWRkMTQ3ZTY=
data/HISTORY.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.2.1 (2013-10-24)
2
+
3
+ * faster file copy (and working progress bar) for install command
4
+
1
5
  ## 0.2.0 (2013-10-22)
2
6
 
3
7
  * install command working (shows progress bar)
@@ -14,13 +14,14 @@ require 'ruby-progressbar'
14
14
 
15
15
  module XcodeInstaller
16
16
  class Install
17
- attr_accessor :release, :version_suffix, :copied_kb, :copied_file_count, :progress_bar
17
+ attr_accessor :release, :version_suffix, :copied_kb, :copied_file_count, :progress_bar, :verbose
18
18
 
19
19
  def initialize
20
20
  @copied_kb = 0
21
21
  end
22
22
 
23
23
  def action(args, options)
24
+ @verbose = options.verbose
24
25
  mgr = XcodeInstaller::ReleaseManager.new
25
26
  @release = mgr.get_release(options.release, options.pre_release)
26
27
  @version_suffix = "-#{@release['version']}"
@@ -34,8 +35,7 @@ module XcodeInstaller
34
35
  return
35
36
  end
36
37
  dmg_file = files[0]
37
- # TODO: if verbose...
38
- # puts dmg_file
38
+ puts dmg_file if @verbose
39
39
 
40
40
  # Mount disk image
41
41
  mountpoint = '/Volumes/Xcode'
@@ -49,7 +49,7 @@ module XcodeInstaller
49
49
  # TODO: Dynamically determine .app file name (DP releases have the version embedded)
50
50
  copy("#{mountpoint}/Xcode.app", destination)
51
51
 
52
- # system "hdiutil detach -quiet #{mountpoint}"
52
+ system "hdiutil detach -quiet #{mountpoint}"
53
53
  end
54
54
 
55
55
  def dmg_file_name
@@ -59,45 +59,14 @@ module XcodeInstaller
59
59
  def copy(source_path, destination_path)
60
60
  # Copy into /Applications
61
61
  # puts 'Copying Xcode.app into Applications directory (this can take a little while)'
62
- # TODO: wrap debug output with verbose checks
63
62
  puts "#{source_path} -> #{destination_path}"
64
- # system "cp -R #{source_path} #{destination_path}"
65
63
 
66
- total_kb = dir_size(source_path)
67
- # puts total_kb
68
-
69
- # puts File.stat(source_path).size
70
-
71
- @progress_bar = ProgressBar.create(:title => "Copying", :starting_at => 0, :total => @release['app_size_extracted'])
64
+ total_files = `find #{source_path} -print | wc -l`
65
+ puts "total_files: #{total_files}" if @verbose
66
+ @progress_bar = ProgressBar.create(:title => "Copying", :starting_at => 0, :total => total_files.to_i)
72
67
  @copied_file_count = 0
73
68
  cp_r(source_path, destination_path, {})
74
69
  @progress_bar.finish
75
-
76
- # block_size = File.stat(source_path).blksize
77
- # puts @copied_kb
78
-
79
- # in_name = "src_file.txt"
80
- # out_name = "dest_file.txt"
81
-
82
- # in_file = File.new(in_name, "r")
83
- # out_file = File.new(out_name, "w")
84
-
85
- # in_size = File.size(in_name)
86
- # batch_bytes = ( in_size / 100 ).ceil
87
- # total = 0
88
- # p_bar = ProgressBar.new('Copying', 100)
89
-
90
- # buffer = in_file.sysread(batch_bytes)
91
- # while total < in_size do
92
- # out_file.syswrite(buffer)
93
- # p_bar.inc
94
- # total += batch_bytes
95
- # if (in_size - total) < batch_bytes
96
- # batch_bytes = (in_size - total)
97
- # end
98
- # buffer = in_file.sysread(batch_bytes)
99
- # end
100
- # p_bar.finish
101
70
  end
102
71
 
103
72
  # Exmaple output of the du command:
@@ -108,13 +77,8 @@ module XcodeInstaller
108
77
  end
109
78
 
110
79
  def accumulate_kbytes(path)
111
- # @progress_bar.log path
112
- # @progress_bar.increment
113
- # @copied_kb += File.stat(path).size if File.exists?(path)
114
- @copied_file_count++
115
- if @copied_file_count.modulo(10000) == 0
116
- @progress_bar.progress = dir_size("/Applications/Xcode-5.app")
117
- end
80
+ @copied_file_count = copied_file_count + 1
81
+ @progress_bar.progress = @copied_file_count.to_i
118
82
  end
119
83
 
120
84
  ##########################################################################
@@ -1,5 +1,5 @@
1
1
  module XcodeInstaller
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
 
4
4
  class UnsuccessfulAuthenticationError < RuntimeError; end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcode-installer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Chatelain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-23 00:00:00.000000000 Z
11
+ date: 2013-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander