rebuild 0.2.6 → 0.3.0.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 843d1d0f29b0046ec7f29df700323c36c3cb668a
4
- data.tar.gz: b660e9192c4d421314624f029c417ed9799137bf
3
+ metadata.gz: 2bb190975faebf3bdb7ea1635a7f638d8574103e
4
+ data.tar.gz: 62ebda2b345c135607c807c400570a119fe5ca8a
5
5
  SHA512:
6
- metadata.gz: 5229f8ddb02303917fe0dae439543a339edad46daab61a5f8a1df0388d0a9f7594fc041a50e6e7c0d830fc2152a3cefb0af5007c4e6fedd7af6aeea361ecaaea
7
- data.tar.gz: 5df2f2c9bbfb6431cdfd95ed332d47703021b08fd503da0c79661075c10700264c1a124287730b0db1767c5287c04b8d0a1496716cd0a8335712ec3d4ab27c6f
6
+ metadata.gz: 2c5917e766182ba22df33535bc9eb95c048cbc739fc0410447c7f0880eb1f0d36e8bef4210e05717b923a34f8d5320aadd68bc85ddd1cbe62dc4fc372f1b0126
7
+ data.tar.gz: c3883a49f4f1858936f120a95d6cd1d073fcc5df0da31697ead33094af9ef6b49a1eb3e51cc77e291e65b8ecc7dbf8d653981895c2d4ab4b84b4f8675bbe0e44
data/lib/rebuild/cli.rb CHANGED
@@ -22,27 +22,52 @@ module Rebuild
22
22
  CommandLineTools.install unless CommandLineTools.installed?
23
23
  License.agree unless License.agreed?
24
24
 
25
- if args.any?
25
+ return if args.empty?
26
+ command = args.first
27
+
28
+ if command.include?('/')
26
29
  stdin = STDIN.gets unless STDIN.isatty
27
- bootstrap(args, stdin, options)
30
+ bootstrap(command, stdin, options)
31
+ else
32
+ run_command(command)
28
33
  end
29
34
  end
30
35
 
31
36
  private
32
37
 
33
- def bootstrap(args, stdin, options)
34
- repo_path = Repository.new(args.first, options).fetch
38
+ def bootstrap(repo, stdin, options)
39
+ repo_path = Repository.new(repo, options).fetch
35
40
  primary_scripts = stdin
36
41
 
37
42
  runner = Runner.new(repo_path, primary_scripts, options[:scriptdir])
38
43
  runner.run
39
44
  end
40
45
 
46
+ def run_command(command)
47
+ case command
48
+ when 'brew'
49
+ command_brew
50
+ else
51
+ puts "Command #{command} is not found."
52
+ puts
53
+ show_usage
54
+ end
55
+ end
56
+
57
+ def command_brew
58
+ if Homebrew.installed?
59
+ puts 'Homebrew is already installed.'
60
+ else
61
+ Homebrew.install
62
+ end
63
+ end
64
+
41
65
  def show_usage
42
66
  puts unindent(<<-EOS)
43
67
  Commands:
44
68
  rebuild # install command line tools, done
45
69
  rebuild USER/PROJECT # execute all scripts in GitHub repo's root directory
70
+ rebuild brew # start homebrew installation and press ENTER for you
46
71
 
47
72
  Options:
48
73
  -f, [--force-update] # By default, git pull is not executed
@@ -17,9 +17,9 @@ module Rebuild
17
17
  obtain_accesibility
18
18
 
19
19
  `xcode-select --install`
20
- execute_scpt('start_install')
20
+ Script.execute_scpt('start_install')
21
21
  sleep 5 until installed?
22
- execute_scpt('click_done')
22
+ Script.execute_scpt('click_done')
23
23
  end
24
24
 
25
25
  private
@@ -35,12 +35,6 @@ module Rebuild
35
35
  `sudo sqlite3 #{DATABASE} "#{sql}"`
36
36
  end
37
37
  end
38
-
39
- def execute_scpt(name)
40
- script_dir = File.expand_path('../../../script', __FILE__)
41
- script_path = File.join(script_dir, "#{name}.scpt")
42
- `sudo osascript #{script_path}`
43
- end
44
38
  end
45
39
  end
46
40
  end
@@ -0,0 +1,15 @@
1
+ require 'rebuild'
2
+
3
+ module Rebuild
4
+ class Homebrew
5
+ class << self
6
+ def installed?
7
+ system('which brew')
8
+ end
9
+
10
+ def install
11
+ Script.execute_exp('homebrew')
12
+ end
13
+ end
14
+ end
15
+ end
@@ -8,15 +8,7 @@ module Rebuild
8
8
  end
9
9
 
10
10
  def agree
11
- execute_exp('agree_license')
12
- end
13
-
14
- private
15
-
16
- def execute_exp(name)
17
- script_dir = File.expand_path('../../../script', __FILE__)
18
- script_path = File.join(script_dir, "#{name}.exp")
19
- `sudo expect -f #{script_path}`
11
+ Script.execute_exp('agree_license')
20
12
  end
21
13
  end
22
14
  end
@@ -0,0 +1,23 @@
1
+ require 'rebuild'
2
+
3
+ module Rebuild
4
+ class Script
5
+ class << self
6
+ def execute_scpt(name)
7
+ script_path = File.join(script_dir, "#{name}.scpt")
8
+ `sudo osascript #{script_path}`
9
+ end
10
+
11
+ def execute_exp(name)
12
+ script_path = File.join(script_dir, "#{name}.exp")
13
+ `sudo expect -f #{script_path}`
14
+ end
15
+
16
+ private
17
+
18
+ def script_dir
19
+ File.expand_path('../../../script', __FILE__)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,3 +1,3 @@
1
1
  module Rebuild
2
- VERSION = '0.2.6'
2
+ VERSION = '0.3.0.pre'
3
3
  end
data/lib/rebuild.rb CHANGED
@@ -3,6 +3,7 @@ require 'rebuild/command_line_tools'
3
3
  require 'rebuild/license'
4
4
  require 'rebuild/repository'
5
5
  require 'rebuild/runner'
6
+ require 'rebuild/script'
6
7
  require 'rebuild/version'
7
8
 
8
9
  module Rebuild
data/rebuild.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "pry", "~> 0.10.1"
22
- spec.add_development_dependency "bundler", "~> 1.7.4"
21
+ spec.add_development_dependency "pry", "~> 0.10"
22
+ spec.add_development_dependency "bundler", "~> 1.7"
23
23
  spec.add_development_dependency "rake", "~> 10.0"
24
24
  end
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env expect -f
2
+
3
+ set timeout -1
4
+ spawn ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
5
+
6
+ expect {
7
+ "Press RETURN to continue or any other key to abort"
8
+ {
9
+ send "\r"
10
+ exp_continue
11
+ }
12
+ }
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.2.6
4
+ version: 0.3.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.10.1
19
+ version: '0.10'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.10.1
26
+ version: '0.10'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.7.4
33
+ version: '1.7'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.7.4
40
+ version: '1.7'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -73,13 +73,16 @@ files:
73
73
  - lib/rebuild.rb
74
74
  - lib/rebuild/cli.rb
75
75
  - lib/rebuild/command_line_tools.rb
76
+ - lib/rebuild/homebrew.rb
76
77
  - lib/rebuild/license.rb
77
78
  - lib/rebuild/repository.rb
78
79
  - lib/rebuild/runner.rb
80
+ - lib/rebuild/script.rb
79
81
  - lib/rebuild/version.rb
80
82
  - rebuild.gemspec
81
83
  - script/agree_license.exp
82
84
  - script/click_done.scpt
85
+ - script/homebrew.exp
83
86
  - script/start_install.scpt
84
87
  homepage: https://github.com/k0kubun/rebuild
85
88
  licenses:
@@ -96,9 +99,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
99
  version: '0'
97
100
  required_rubygems_version: !ruby/object:Gem::Requirement
98
101
  requirements:
99
- - - ">="
102
+ - - ">"
100
103
  - !ruby/object:Gem::Version
101
- version: '0'
104
+ version: 1.3.1
102
105
  requirements: []
103
106
  rubyforge_project:
104
107
  rubygems_version: 2.2.2