rebuild 0.0.3 → 0.0.4.pre

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: 32d8f3986b2460753c6177e2e6fa880602ae5153
4
- data.tar.gz: d8d6c24730d5ab5d2165935da69e1d22e6ee918a
3
+ metadata.gz: 161e98d3124980dad705d57d12bf58f4a16dfea3
4
+ data.tar.gz: 8704a6e0a69dd76caac6f4b9260fbd3694a35165
5
5
  SHA512:
6
- metadata.gz: a0acc0af2387ef5191506e89c6f26c06597684d23ab481fc9e1eaabaf058d11b8347548b91194bdc124ff6bb614c96f7c9cadb66772f3730bbc635039c1e8158
7
- data.tar.gz: 7aa663821dd74082d6a214c9740c807565a9f93b26c6fa29516a1841be126907109b27962534f0e0387483989bed55dce0b8e361ec1430090ad2f5d891817406
6
+ metadata.gz: 05123b168b5b6c6283aab7e7a7920c739852f9cad42eba2cf72520078e8945a8b7154a16d66c44b444e6a6ad08f277baa5e6b91f9b418ec070a0397704759478
7
+ data.tar.gz: 6b6f59b63d8db6c416cff9f5ffcc4ec298a1c5b0f6829d1016be0a244a9d19170a2ac3b64915dfe4edd1fca72925cfbac3647ffd7c5ac386cb706c61941be66d
data/README.md CHANGED
@@ -22,7 +22,7 @@ Then executes all of `/tmp/k0kubun/dotfiles/*.sh`.
22
22
  - revision lock
23
23
  - clone directory change option
24
24
  - support script directory to put scripts
25
- - automatic xcode-select
25
+ - automatic xcode-select --install
26
26
 
27
27
  ## License
28
28
 
@@ -1,7 +1,29 @@
1
1
  require 'rebuild'
2
+ require 'open3'
2
3
 
3
4
  module Rebuild
4
5
  class Bootstrap
5
- # Coming soon...
6
+ def installed?
7
+ system('xcode-select -p > /dev/null')
8
+ end
9
+
10
+ def install
11
+ return if installed?
12
+
13
+ `xcode-select --install`
14
+ execute_scpt('click_install')
15
+ execute_scpt('click_agree')
16
+
17
+ sleep 5 until installed?
18
+ execute_scpt('click_finish')
19
+ end
20
+
21
+ private
22
+
23
+ def execute_scpt(name)
24
+ script_dir = File.expand_path('../../../script', __FILE__)
25
+ script_path = File.join(script_dir, "#{name}.scpt")
26
+ `osascript #{script_path}`
27
+ end
6
28
  end
7
29
  end
data/lib/rebuild/cli.rb CHANGED
@@ -5,7 +5,13 @@ module Rebuild
5
5
  class CLI
6
6
  class << self
7
7
  def start
8
- return show_usage if ARGV.length != 1
8
+ bootstrap = Bootstrap.new
9
+ if bootstrap.installed?
10
+ show_usage if ARGV.empty?
11
+ else
12
+ bootstrap.install
13
+ end
14
+ return if ARGV.empty?
9
15
 
10
16
  repo_path = Repository.new(ARGV.first).fetch
11
17
  primary_scripts = STDIN.gets unless STDIN.isatty
@@ -1,3 +1,3 @@
1
1
  module Rebuild
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4.pre'
3
3
  end
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env osascript
2
+
3
+ -- Second: Click Agree Button
4
+ delay 2.0
5
+
6
+ set timeoutSeconds to 2.0
7
+ set uiScript to "click UI Element 3 of window 1 of application process \"Install Command Line Developer Tools\""
8
+ my doWithTimeout(uiScript, timeoutSeconds)
9
+
10
+ on doWithTimeout(uiScript, timeoutSeconds)
11
+ set endDate to (current date) + timeoutSeconds
12
+ repeat
13
+ try
14
+ run script "tell application \"System Events\"
15
+ " & uiScript & "
16
+ end tell"
17
+ exit repeat
18
+ on error errorMessage
19
+ if ((current date) > endDate) then
20
+ error "Can not " & uiScript
21
+ end if
22
+ end try
23
+ end repeat
24
+ end doWithTimeout
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env osascript
2
+
3
+ -- Third: Click Finish Button
4
+ set timeoutSeconds to 2.0
5
+ set uiScript to "click UI Element 1 of window 1 of application process \"Install Command Line Developer Tools\""
6
+ my doWithTimeout(uiScript, timeoutSeconds)
7
+
8
+ on doWithTimeout(uiScript, timeoutSeconds)
9
+ set endDate to (current date) + timeoutSeconds
10
+ repeat
11
+ try
12
+ run script "tell application \"System Events\"
13
+ " & uiScript & "
14
+ end tell"
15
+ exit repeat
16
+ on error errorMessage
17
+ if ((current date) > endDate) then
18
+ error "Can not " & uiScript
19
+ end if
20
+ end try
21
+ end repeat
22
+ end doWithTimeout
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env osascript
2
+
3
+ -- Fist: Click Install Button
4
+ delay 2.0
5
+
6
+ set timeoutSeconds to 2.0
7
+ set uiScript to "click UI Element 4 of window 1 of application process \"Install Command Line Developer Tools\""
8
+ my doWithTimeout(uiScript, timeoutSeconds)
9
+
10
+ on doWithTimeout(uiScript, timeoutSeconds)
11
+ set endDate to (current date) + timeoutSeconds
12
+ repeat
13
+ try
14
+ run script "tell application \"System Events\"
15
+ " & uiScript & "
16
+ end tell"
17
+ exit repeat
18
+ on error errorMessage
19
+ if ((current date) > endDate) then
20
+ error "Can not " & uiScript
21
+ end if
22
+ end try
23
+ end repeat
24
+ end doWithTimeout
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rebuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
@@ -73,6 +73,9 @@ files:
73
73
  - lib/rebuild/runner.rb
74
74
  - lib/rebuild/version.rb
75
75
  - rebuild.gemspec
76
+ - script/click_agree.scpt
77
+ - script/click_finish.scpt
78
+ - script/click_install.scpt
76
79
  homepage: https://github.com/k0kubun/rebuild
77
80
  licenses:
78
81
  - MIT
@@ -88,9 +91,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
88
91
  version: '0'
89
92
  required_rubygems_version: !ruby/object:Gem::Requirement
90
93
  requirements:
91
- - - ">="
94
+ - - ">"
92
95
  - !ruby/object:Gem::Version
93
- version: '0'
96
+ version: 1.3.1
94
97
  requirements: []
95
98
  rubyforge_project:
96
99
  rubygems_version: 2.2.2