fourflusher 0.3.2 → 1.0.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: 360c1493bcc1fcc20d80a9af59bbb5b60200ad53
4
- data.tar.gz: a2a4429a7f76c9706d87bc28c707a816e1d18cdc
3
+ metadata.gz: 9e241d7369f92a28c82655eabe7a195a046367ff
4
+ data.tar.gz: bf4abf44b2c2727b442d7420eba20539c0764e3e
5
5
  SHA512:
6
- metadata.gz: 22134cb079e8cfbbbeb70330d778a95a0f42ff1f36d70f345b8addc4265e152361df525b89a4847731132af13821930a4c7f754ff6d7864f548da468e95e3068
7
- data.tar.gz: 4c04fca2b89f1685286ac28cdd71f65aac289c0ca76c4451f2c6ceb9aeb216d215fef07b70acf5ac911913a54bd5fed3630a41689d517e04d5bcb445717b55e6
6
+ metadata.gz: f96dc7dd394a1918b4ad6f8f71ae30e2d0144a1d03a9dbb1b779ecf97ddd7dd23153b54e65ac2d6d76b0ce20d611eae15fe01b0ece69ac2b3243ce3b4ba3dfce
7
+ data.tar.gz: 010b434ef1d31a6c82e0a5bf1d57a9b5c2159dc34ff918f6c7df6b794717275e2cdac8e84501dde514832192dec2131388d900389a01e6a77b738ce5207c7356
@@ -1,5 +1,5 @@
1
1
  Metrics/AbcSize:
2
- Max: 25
2
+ Max: 35
3
3
 
4
4
  Metrics/CyclomaticComplexity:
5
5
  Max: 10
data/README.md CHANGED
@@ -2,10 +2,6 @@
2
2
 
3
3
  A library for interacting with Xcode simulators.
4
4
 
5
- ## Usage
6
-
7
- TODO: Write usage instructions here
8
-
9
5
  ## Installation
10
6
 
11
7
  Add this line to your application's Gemfile:
@@ -6,7 +6,6 @@ module Fourflusher
6
6
  class Simulator
7
7
  attr_reader :id
8
8
  attr_reader :name
9
- attr_reader :os_name
10
9
  attr_reader :os_version
11
10
 
12
11
  def self.match(line, os_name, os_version)
@@ -15,6 +14,10 @@ module Fourflusher
15
14
  sims
16
15
  end
17
16
 
17
+ def os_name
18
+ @os_name.downcase.to_sym
19
+ end
20
+
18
21
  def compatible?(other_version)
19
22
  other_version <= os_version
20
23
  end
@@ -60,11 +63,11 @@ module Fourflusher
60
63
  @os_regex = /^-- (?<os_name>.*?) (?<os_version>[0-9][0-9]?\.[0-9]) --$/
61
64
  end
62
65
 
63
- def simulator(filter, minimum_version = '1.0')
64
- usable_simulators(filter, minimum_version).first
66
+ def simulator(filter, os_name = :ios, minimum_version = '1.0')
67
+ usable_simulators(filter, os_name, minimum_version).first
65
68
  end
66
69
 
67
- def usable_simulators(filter = nil, minimum_version = '1.0')
70
+ def usable_simulators(filter = nil, os = :ios, minimum_version = '1.0')
68
71
  os_name = ''
69
72
  os_version = ''
70
73
  sims = []
@@ -77,9 +80,19 @@ module Fourflusher
77
80
  sims += Simulator.match(line, os_name, os_version)
78
81
  end
79
82
 
83
+ oses = sims.map(&:os_name).uniq
84
+ os = os.downcase.to_sym
85
+ fail "Invalid OS `#{os}`, valid values are #{oses.join(', ')}" unless oses.include?(os)
86
+
80
87
  return sims if filter.nil?
81
88
  minimum_version = Gem::Version.new(minimum_version)
82
- sims.select { |sim| sim.name == filter && sim.compatible?(minimum_version) }
89
+ sims = sims.select { |sim| sim.os_name == os && sim.compatible?(minimum_version) }
90
+
91
+ return [sims.first] if filter == :oldest
92
+
93
+ found_sims = sims.select { |sim| sim.name == filter }
94
+ return found_sims if found_sims.count > 0
95
+ sims.select { |sim| sim.name.start_with?(filter) }
83
96
  end
84
97
  end
85
98
  end
@@ -1,3 +1,3 @@
1
1
  module Fourflusher
2
- VERSION = '0.3.2'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -3,8 +3,8 @@ require 'fourflusher/find'
3
3
  module Fourflusher
4
4
  # Executes `simctl` commands
5
5
  class SimControl
6
- def destination(filter, minimum_version = '1.0')
7
- sim = simulator(filter, minimum_version)
6
+ def destination(filter, os = :ios, minimum_version = '1.0')
7
+ sim = simulator(filter, os, minimum_version)
8
8
  fail "Simulator #{filter} is not available." if sim.nil?
9
9
  ['-destination', "id=#{sim.id}"]
10
10
  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.3.2
4
+ version: 1.0.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: 2016-06-16 00:00:00.000000000 Z
11
+ date: 2016-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler