israkel 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,5 +1,6 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
+ gem 'highline', '~> 1.6.15'
3
4
  gem 'json', '~> 1.7.6'
4
5
  gem 'rake', '~> 0.9.0'
5
6
 
@@ -2,6 +2,7 @@ GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
4
  git (1.2.5)
5
+ highline (1.6.15)
5
6
  jeweler (1.8.4)
6
7
  bundler (~> 1.0)
7
8
  git (>= 1.2.5)
@@ -16,6 +17,7 @@ PLATFORMS
16
17
  ruby
17
18
 
18
19
  DEPENDENCIES
20
+ highline (~> 1.6.15)
19
21
  jeweler (~> 1.8.4)
20
22
  json (~> 1.7.6)
21
23
  rake (~> 0.9.0)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "israkel"
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Johannes Plunien"]
12
- s.date = "2013-01-18"
12
+ s.date = "2013-02-04"
13
13
  s.description = "Collection of common rake tasks for the iPhone Simulator like start/stop and some more."
14
14
  s.email = "plu@pqpq.de"
15
15
  s.extra_rdoc_files = [
@@ -35,15 +35,18 @@ Gem::Specification.new do |s|
35
35
  s.specification_version = 3
36
36
 
37
37
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
38
+ s.add_runtime_dependency(%q<highline>, ["~> 1.6.15"])
38
39
  s.add_runtime_dependency(%q<json>, ["~> 1.7.6"])
39
40
  s.add_runtime_dependency(%q<rake>, ["~> 0.9.0"])
40
41
  s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
41
42
  else
43
+ s.add_dependency(%q<highline>, ["~> 1.6.15"])
42
44
  s.add_dependency(%q<json>, ["~> 1.7.6"])
43
45
  s.add_dependency(%q<rake>, ["~> 0.9.0"])
44
46
  s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
45
47
  end
46
48
  else
49
+ s.add_dependency(%q<highline>, ["~> 1.6.15"])
47
50
  s.add_dependency(%q<json>, ["~> 1.7.6"])
48
51
  s.add_dependency(%q<rake>, ["~> 0.9.0"])
49
52
  s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
@@ -1,4 +1,5 @@
1
1
  require 'fileutils'
2
+ require 'highline/import'
2
3
  require 'json'
3
4
  require 'rake'
4
5
  require 'rake/tasklib'
@@ -7,11 +8,10 @@ module ISRakel
7
8
  class Tasks < ::Rake::TaskLib
8
9
  include ::Rake::DSL if defined?(::Rake::DSL)
9
10
 
10
- attr_accessor :name, :sdk_version
11
+ attr_accessor :name
11
12
 
12
13
  def initialize(name = :simulator)
13
14
  @name = name
14
- @sdk_version = ENV['IOS_SDK_VERSION'] || '6.0'
15
15
 
16
16
  yield self if block_given?
17
17
 
@@ -25,11 +25,15 @@ module ISRakel
25
25
  end
26
26
 
27
27
  def edit_global_preferences(&block)
28
- edit_file( File.join(simulator_preferences_path, '.GlobalPreferences.plist'), &block )
28
+ sdk_version_choice do |version|
29
+ edit_file( File.join(simulator_preferences_path(version), '.GlobalPreferences.plist'), &block )
30
+ end
29
31
  end
30
32
 
31
33
  def edit_preferences(&block)
32
- edit_file( File.join(simulator_preferences_path, 'com.apple.Preferences.plist'), &block )
34
+ sdk_version_choice do |version|
35
+ edit_file( File.join(simulator_preferences_path(version), 'com.apple.Preferences.plist'), &block )
36
+ end
33
37
  end
34
38
 
35
39
  private
@@ -43,7 +47,9 @@ module ISRakel
43
47
  def define_reset_task
44
48
  desc "Reset content and settings of the iPhone Simulator"
45
49
  task "#{name}:reset" do
46
- rm_rf simulator_support_path
50
+ sdk_version_choice do |version|
51
+ rm_rf File.join(simulator_support_path(version), '*')
52
+ end
47
53
  end
48
54
  end
49
55
 
@@ -87,15 +93,29 @@ module ISRakel
87
93
  JSON.parse( IO.popen(['plutil', '-convert', 'json', '-o', '-', path]) {|f| f.read} )
88
94
  end
89
95
 
96
+ def sdk_version_choice
97
+ if ENV['IOS_SDK_VERSION']
98
+ yield ENV['IOS_SDK_VERSION']
99
+ return
100
+ end
101
+ versions = Dir[File.join(ENV['HOME'], 'Library', 'Application Support', 'iPhone Simulator', '*')].map {|dir| File.basename(dir)}
102
+ choose do |menu|
103
+ menu.prompt = "Please select an SDK version"
104
+ menu.choices(*versions) do |version|
105
+ yield version
106
+ end
107
+ end
108
+ end
109
+
90
110
  def simulator_path
91
111
  @simulator_path ||= File.join(xcode_path, 'Platforms', 'iPhoneSimulator.platform', 'Developer', 'Applications', 'iPhone Simulator.app')
92
112
  end
93
113
 
94
- def simulator_preferences_path
95
- File.join(simulator_support_path, 'Library', 'Preferences')
114
+ def simulator_preferences_path(sdk_version)
115
+ File.join(simulator_support_path(sdk_version), 'Library', 'Preferences')
96
116
  end
97
117
 
98
- def simulator_support_path
118
+ def simulator_support_path(sdk_version)
99
119
  @simulator_support_path ||= File.join(ENV['HOME'], 'Library', 'Application Support', 'iPhone Simulator', sdk_version)
100
120
  end
101
121
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: israkel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,8 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-18 00:00:00.000000000 Z
12
+ date: 2013-02-04 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: highline
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.6.15
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 1.6.15
14
30
  - !ruby/object:Gem::Dependency
15
31
  name: json
16
32
  requirement: !ruby/object:Gem::Requirement
@@ -90,7 +106,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
106
  version: '0'
91
107
  segments:
92
108
  - 0
93
- hash: -2530798291742470515
109
+ hash: -3467155980208582955
94
110
  required_rubygems_version: !ruby/object:Gem::Requirement
95
111
  none: false
96
112
  requirements: