fourflusher 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b9b1b16d80d85f6951d9677e82ee5fa4ca8799b
4
- data.tar.gz: 0988f174ba49fa20ed9f589d5c9e06413ab8d832
3
+ metadata.gz: 3daec683248c7e25334b3d3b27784440c9d228ab
4
+ data.tar.gz: 4222dea58e1f34e25af99b4ac77072b6818e9d49
5
5
  SHA512:
6
- metadata.gz: 4a22323c2beb75d477040ccad026f74b2f011f3893be39422d5077a4b4fcfa229fd8a12588dfa0fdbae18aa8f4e2f1ddbad096e7edecf4be46684d9849f84656
7
- data.tar.gz: 0e38f04530f78e9893f9d26b015d4b2e080aa0add5792321ff15bdd30dda31c9ef2922c3719426137804debbfb3e41e8e4323d5efcb7f8934f3fd8ed922fa906
6
+ metadata.gz: b17adb522493ab65b9840f7dc1d1f765308f530d9ee84c92b7bcf51037a60d103c64be6e611100bdcb7d331d50ef05eefa4d01e65e369d57462390f10a575be9
7
+ data.tar.gz: 2bee43e31e70dfa845dc4d131b7a7701cd5f810dc3c287ecee37e662127dff0cb38ff11380185c61ac619138c00ca66d5749c6277ed12cf701eada479ac9344c
@@ -1,4 +1,5 @@
1
1
  require 'fourflusher/simctl'
2
+ require 'rubygems/version'
2
3
 
3
4
  module Fourflusher
4
5
  # Metadata about an installed Xcode simulator
@@ -10,10 +11,14 @@ module Fourflusher
10
11
 
11
12
  def self.match(line, os_name, os_version)
12
13
  sims = []
13
- @@sim_regex.match(line) { |m| sims << Simulator.new(m, os_name, os_version) }
14
+ @@sim_regex.match(line) { |m| sims << Simulator.new(m, os_name, Gem::Version.new(os_version)) }
14
15
  sims
15
16
  end
16
17
 
18
+ def compatible?(other_version)
19
+ other_version <= os_version
20
+ end
21
+
17
22
  def to_s
18
23
  "#{@name} (#{@id}) - #{@os_name} #{@os_version}"
19
24
  end
@@ -55,11 +60,11 @@ module Fourflusher
55
60
  @os_regex = /^-- (?<os_name>.*?) (?<os_version>[0-9].[0-9]) --$/
56
61
  end
57
62
 
58
- def simulator(filter)
59
- usable_simulators(filter).first
63
+ def simulator(filter, minimum_version = '1.0')
64
+ usable_simulators(filter, minimum_version).first
60
65
  end
61
66
 
62
- def usable_simulators(filter = nil)
67
+ def usable_simulators(filter = nil, minimum_version = '1.0')
63
68
  os_name = ''
64
69
  os_version = ''
65
70
  sims = []
@@ -73,7 +78,8 @@ module Fourflusher
73
78
  end
74
79
 
75
80
  return sims if filter.nil?
76
- sims.select { |sim| sim.name == filter }
81
+ minimum_version = Gem::Version.new(minimum_version)
82
+ sims.select { |sim| sim.name == filter && sim.compatible?(minimum_version) }
77
83
  end
78
84
  end
79
85
  end
@@ -1,3 +1,3 @@
1
1
  module Fourflusher
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fourflusher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boris Bügling
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-18 00:00:00.000000000 Z
11
+ date: 2015-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler