rebuild 0.2.1 → 0.2.2
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 +4 -4
- data/README.md +1 -1
- data/gempush.rb +5 -0
- data/lib/rebuild/cli.rb +15 -5
- data/lib/rebuild/command_line_tools.rb +13 -8
- data/lib/rebuild/repository.rb +22 -7
- data/lib/rebuild/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2891f67ffcdba95f4dcb3f9dd6231ce53496b72c
|
4
|
+
data.tar.gz: 8ce6ba5068b06c065c3f0017096786ea2e6160d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c7d8e88235b631955f2452a05cf5862a4cd656bd920452fae65cd023d3395d2a1aba2df366515ac5e1a25628dd2aba37658ca3121da273c601326bf23f0c6dc
|
7
|
+
data.tar.gz: fa82f426ed853245657fd25c1c38842861ca2ae0adf3aa112c8267639a32c00d11818fe4aa7451cb156761bc6e7fc323b51d2265dc0e302878c7cacdd4ef2e68
|
data/README.md
CHANGED
data/gempush.rb
ADDED
data/lib/rebuild/cli.rb
CHANGED
@@ -1,24 +1,31 @@
|
|
1
1
|
require 'rebuild'
|
2
|
+
require 'optparse'
|
2
3
|
|
3
4
|
module Rebuild
|
4
5
|
class CLI
|
5
6
|
class << self
|
6
7
|
def start
|
7
|
-
|
8
|
+
options = {}
|
9
|
+
|
10
|
+
opt = OptionParser.new
|
11
|
+
opt.on('-d', '--directory=VAL') { |v| options[:directory] = v }
|
12
|
+
|
13
|
+
args = opt.parse!(ARGV)
|
14
|
+
return show_usage if args.empty? && CommandLineTools.installed?
|
8
15
|
|
9
16
|
CommandLineTools.install unless CommandLineTools.installed?
|
10
17
|
License.agree unless License.agreed?
|
11
18
|
|
12
|
-
if
|
19
|
+
if args.any?
|
13
20
|
stdin = STDIN.gets unless STDIN.isatty
|
14
|
-
bootstrap(
|
21
|
+
bootstrap(args, stdin, options)
|
15
22
|
end
|
16
23
|
end
|
17
24
|
|
18
25
|
private
|
19
26
|
|
20
|
-
def bootstrap(args, stdin)
|
21
|
-
repo_path = Repository.new(args.first).fetch
|
27
|
+
def bootstrap(args, stdin, options)
|
28
|
+
repo_path = Repository.new(args.first, options[:directory]).fetch
|
22
29
|
primary_scripts = stdin
|
23
30
|
|
24
31
|
runner = Runner.new(repo_path, primary_scripts)
|
@@ -30,6 +37,9 @@ module Rebuild
|
|
30
37
|
Commands:
|
31
38
|
rebuild USER/PROJECT # execute all scripts in GitHub repo's root directory
|
32
39
|
|
40
|
+
Options:
|
41
|
+
-d, [--directory=/path/to/clone] # Default: /tmp/USER/PROJECT
|
42
|
+
|
33
43
|
EOS
|
34
44
|
end
|
35
45
|
|
@@ -2,8 +2,11 @@ require 'rebuild'
|
|
2
2
|
|
3
3
|
module Rebuild
|
4
4
|
class CommandLineTools
|
5
|
-
DATABASE
|
6
|
-
|
5
|
+
DATABASE = '/Library/Application\ Support/com.apple.TCC/TCC.db'
|
6
|
+
SUPPORTED_TERMINALS = %w[
|
7
|
+
com.apple.Terminal
|
8
|
+
com.googlecode.iterm2
|
9
|
+
]
|
7
10
|
|
8
11
|
class << self
|
9
12
|
def installed?
|
@@ -23,12 +26,14 @@ module Rebuild
|
|
23
26
|
|
24
27
|
# Enable Security & Privacy > Privacy > Accessibility for Terminal.app.
|
25
28
|
def obtain_accesibility
|
26
|
-
puts
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
puts 'Require accessibility for terminal to click buttons'
|
30
|
+
SUPPORTED_TERMINALS.each do |bundle_identifier|
|
31
|
+
sql = <<-SQL
|
32
|
+
INSERT OR REPLACE INTO access
|
33
|
+
VALUES('kTCCServiceAccessibility','#{bundle_identifier}',0,1,0,NULL);
|
34
|
+
SQL
|
35
|
+
`sudo sqlite3 #{DATABASE} "#{sql}"`
|
36
|
+
end
|
32
37
|
end
|
33
38
|
|
34
39
|
def execute_scpt(name)
|
data/lib/rebuild/repository.rb
CHANGED
@@ -3,12 +3,11 @@ require 'fileutils'
|
|
3
3
|
|
4
4
|
module Rebuild
|
5
5
|
class Repository
|
6
|
-
|
7
|
-
FETCH_DIRECTORY = '/tmp'
|
6
|
+
DEFAULT_DIRECTORY = '/tmp'
|
8
7
|
|
9
|
-
def initialize(path)
|
8
|
+
def initialize(path, directory)
|
10
9
|
@user, @repo = path.split('/')
|
11
|
-
@
|
10
|
+
@directory = directory
|
12
11
|
|
13
12
|
abort "Invalid repository `#{path}`" if @repo.nil?
|
14
13
|
end
|
@@ -26,7 +25,7 @@ module Rebuild
|
|
26
25
|
private
|
27
26
|
|
28
27
|
def clone_repository
|
29
|
-
FileUtils.mkdir_p(
|
28
|
+
FileUtils.mkdir_p(upper_directory)
|
30
29
|
`git clone #{github_repository} #{repo_path}`
|
31
30
|
end
|
32
31
|
|
@@ -54,11 +53,27 @@ module Rebuild
|
|
54
53
|
end
|
55
54
|
|
56
55
|
def repo_path
|
57
|
-
File.join(
|
56
|
+
File.join(upper_directory, root_directory)
|
57
|
+
end
|
58
|
+
|
59
|
+
def root_directory
|
60
|
+
if @directory
|
61
|
+
@directory.gsub(/\/$/, '').match(/[^\/]+$/).to_s
|
62
|
+
else
|
63
|
+
@repo
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def upper_directory
|
68
|
+
if @directory
|
69
|
+
@directory.gsub(/[^\/]+\/?$/, '')
|
70
|
+
else
|
71
|
+
user_path
|
72
|
+
end
|
58
73
|
end
|
59
74
|
|
60
75
|
def user_path
|
61
|
-
File.join(
|
76
|
+
File.join(DEFAULT_DIRECTORY, @user)
|
62
77
|
end
|
63
78
|
end
|
64
79
|
end
|
data/lib/rebuild/version.rb
CHANGED
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.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
@@ -55,6 +55,7 @@ files:
|
|
55
55
|
- README.md
|
56
56
|
- Rakefile
|
57
57
|
- bin/rebuild
|
58
|
+
- gempush.rb
|
58
59
|
- lib/rebuild.rb
|
59
60
|
- lib/rebuild/cli.rb
|
60
61
|
- lib/rebuild/command_line_tools.rb
|