xcselect 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/bin/xcselect CHANGED
@@ -76,8 +76,10 @@ class Main
76
76
  # TODO: Add conditionall code to look for a project
77
77
  # and if there isn't one then just open xcode
78
78
  xcodepath = "#{Xcode.current_xcode_path}"
79
+ projects = Dir["*.xcodeproj"]
80
+ open_project = projects.size > 0 ? projects.first : ""
79
81
  puts "Opening Xcode in #{xcodepath}"
80
- `open -a #{xcodepath} *.xcodeproj`
82
+ `open -a #{xcodepath} #{open_project}`
81
83
  end
82
84
 
83
85
  # don't show line to ask for sudo pass
data/bin/xcsim ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
4
+
5
+ require "fileutils"
6
+ require 'xcselect'
7
+
8
+ include Xcselect
9
+
10
+
11
+
12
+
13
+ puts XcSimulator.get_sims
@@ -0,0 +1,9 @@
1
+ # module Xcselect
2
+
3
+ class Dir
4
+ def self.entries_nodots path
5
+ Dir.entries(path).select { |p| !(p =~ /^\.\.?$/) }
6
+ end
7
+ end
8
+
9
+ # end
@@ -1,3 +1,3 @@
1
1
  module Xcselect
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
@@ -0,0 +1,21 @@
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
@@ -0,0 +1,41 @@
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
data/lib/xcselect.rb CHANGED
@@ -3,5 +3,8 @@ module Xcselect
3
3
 
4
4
  require "xcselect/xcode"
5
5
  require "xcselect/version"
6
+ require "xcselect/dir_extension"
7
+ require "xcselect/xcapp"
8
+ require "xcselect/xcsimulator"
6
9
 
7
10
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 9
9
- version: 0.0.9
8
+ - 10
9
+ version: 0.0.10
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: 2011-12-16 00:00:00 +10:00
17
+ date: 2011-12-29 00:00:00 +10:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -23,6 +23,7 @@ email:
23
23
  - bigkm1@gmail.com
24
24
  executables:
25
25
  - xcselect
26
+ - xcsim
26
27
  extensions: []
27
28
 
28
29
  extra_rdoc_files: []
@@ -33,9 +34,13 @@ files:
33
34
  - README.md
34
35
  - Rakefile
35
36
  - bin/xcselect
37
+ - bin/xcsim
36
38
  - lib/xcselect.rb
39
+ - lib/xcselect/dir_extension.rb
37
40
  - lib/xcselect/version.rb
41
+ - lib/xcselect/xcapp.rb
38
42
  - lib/xcselect/xcode.rb
43
+ - lib/xcselect/xcsimulator.rb
39
44
  - pkg/xcselect-0.0.1.gem
40
45
  - pkg/xcselect-0.0.3.gem
41
46
  - pkg/xcselect-0.0.4.gem