xcselect 0.0.13 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/bin/xcselect CHANGED
@@ -73,6 +73,7 @@ class Main
73
73
  exit
74
74
  end
75
75
 
76
+ # fix this to take an optional arg
76
77
  def open_xcode
77
78
  # TODO: Add conditionall code to look for a project
78
79
  # and if there isn't one then just open xcode
@@ -83,11 +84,12 @@ class Main
83
84
  `open -a "#{xcodepath}" "#{open_project}"`
84
85
  end
85
86
 
86
- # don't show line to ask for sudo pass
87
+ # don't show line to ask for sudo pass unless needed
87
88
  def self.require_sudo_pass?
88
89
  `sudo -n echo 1 2>&1`.chomp != "1"
89
90
  end
90
91
 
92
+ # change the current xcode
91
93
  def set_current xc
92
94
  cmd = "sudo xcode-select -switch #{xc.folder}"
93
95
  if Main.require_sudo_pass?
@@ -111,6 +113,7 @@ class Main
111
113
  def select_line x
112
114
  "#{x.version} (#{x.build}) #{x.folder} #{'[current]'.red if x.eql? current}"
113
115
  end
116
+
114
117
  def show_menu
115
118
  puts "Please Select an Xcode install ?\n\n"
116
119
  i = 0;
@@ -1,3 +1,3 @@
1
1
  module Xcselect
2
- VERSION = "0.0.13"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -47,7 +47,7 @@ class Xcode
47
47
 
48
48
  def self.current_xcode_path
49
49
  path = self.current_xcode
50
- if path =~ /(.*Xcode.app)/
50
+ if path =~ /(.*Xcode(.*DP.*).app)/
51
51
  path = $1
52
52
  else
53
53
  path += "/Applications/Xcode.app"
data/lib/xcselect.rb CHANGED
@@ -4,7 +4,5 @@ module Xcselect
4
4
  require "xcselect/xcode"
5
5
  require "xcselect/version"
6
6
  require "xcselect/dir_extension"
7
- require "xcselect/xcapp"
8
- require "xcselect/xcsimulator"
9
7
 
10
8
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
+ - 1
7
8
  - 0
8
- - 13
9
- version: 0.0.13
9
+ version: 0.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kim Hunter
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-05-10 00:00:00 +10:00
17
+ date: 2012-07-18 00:00:00 +10:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -38,9 +38,7 @@ files:
38
38
  - lib/xcselect.rb
39
39
  - lib/xcselect/dir_extension.rb
40
40
  - lib/xcselect/version.rb
41
- - lib/xcselect/xcapp.rb
42
41
  - lib/xcselect/xcode.rb
43
- - lib/xcselect/xcsimulator.rb
44
42
  - pkg/xcselect-0.0.1.gem
45
43
  - pkg/xcselect-0.0.10.gem
46
44
  - pkg/xcselect-0.0.11.gem
@@ -1,21 +0,0 @@
1
- module Xcselect
2
-
3
- class XcApp
4
-
5
- attr_accessor :simulator
6
- attr_accessor :path
7
- attr_reader :app_name
8
-
9
- def initialize(sim, path)
10
- @simulator = sim
11
- @path = path
12
- @app_name = File.basename Dir["#{path}/*.app"].first.sub /\.app$/, ''
13
- end
14
-
15
- def to_s
16
- "<#{self.class}: #{app_name}>"
17
- end
18
- end
19
-
20
-
21
- end
@@ -1,41 +0,0 @@
1
- module Xcselect
2
-
3
-
4
- class XcSimulator
5
- attr_reader :path
6
- attr_reader :apps
7
-
8
- def initialize(path)
9
- @path = path
10
- @ver = path.sub /.*\//, ''
11
- @apps = load_apps
12
- end
13
-
14
- def app_folder_path
15
- "#{@path}/Applications"
16
- end
17
-
18
- def load_apps
19
- base_path = app_folder_path
20
- Dir.entries_nodots(base_path).map {|p| XcApp.new self, "#{base_path}/#{p}" }
21
- end
22
-
23
- def to_s
24
- "<#{self.class}: #{@ver} Apps:#{@apps.size}}>"
25
- end
26
-
27
- def self.get_sims
28
- self.find_sim_versions.map {|p| XcSimulator.new "#{self.simulators_base_path}/#{p}" }
29
- end
30
-
31
- def self.find_sim_versions
32
- Dir.entries_nodots(self.simulators_base_path).select {|p| p =~ /[0-9]/ }
33
- end
34
-
35
- def self.simulators_base_path
36
- File.expand_path "~/Library/Application Support/iPhone Simulator"
37
- end
38
-
39
- end
40
-
41
- end