rebuild 0.3.1 → 0.3.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 +7 -0
- data/lib/rebuild/cli.rb +2 -2
- data/lib/rebuild/command_line_tools.rb +3 -0
- data/lib/rebuild/logger.rb +10 -0
- data/lib/rebuild/runner.rb +22 -3
- data/lib/rebuild/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9fdcc09677d6ab49d227c5b4a978498af058ba99
|
|
4
|
+
data.tar.gz: d1b805d6e750eb4a40008ae8994aec305d8730f4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5dbe1af4dc3033dd024037c83ee2b5349e6616b3b500d1e4b03cdefef78eb7c93aff1a6b64da30cef3011d552537fb8b2dcf3fa96d0031591dc45c0b9b1f51cc
|
|
7
|
+
data.tar.gz: d03a0d50cac8d0aadc9b9752fedb524b2324b332b6f4e555120d2399f7344df0559d6feb81bba1b0da865edebdacc61e6e15013eb9dd12473b84c5e750dde459
|
data/README.md
CHANGED
|
@@ -44,6 +44,13 @@ $ rebuild -d ~/src/github.com/k0kubun/dotfiles
|
|
|
44
44
|
|
|
45
45
|
# Run /tmp/k0kubun/dotfiles/script/*.sh instead of /tmp/k0kubun/dotfiles/*.sh
|
|
46
46
|
$ rebuild -s script
|
|
47
|
+
|
|
48
|
+
# You can choose which script to run first by shell pipeline
|
|
49
|
+
echo "first.sh second.sh" | rebuild
|
|
50
|
+
rebuild <<-EOS
|
|
51
|
+
first.sh
|
|
52
|
+
second.sh
|
|
53
|
+
EOS
|
|
47
54
|
```
|
|
48
55
|
|
|
49
56
|
## Supported OS
|
data/lib/rebuild/cli.rb
CHANGED
|
@@ -29,7 +29,7 @@ module Rebuild
|
|
|
29
29
|
command = args.first
|
|
30
30
|
|
|
31
31
|
if command.include?('/')
|
|
32
|
-
stdin = STDIN.
|
|
32
|
+
stdin = STDIN.read unless STDIN.isatty
|
|
33
33
|
bootstrap(command, stdin, options)
|
|
34
34
|
else
|
|
35
35
|
run_command(command)
|
|
@@ -40,7 +40,7 @@ module Rebuild
|
|
|
40
40
|
|
|
41
41
|
def bootstrap(repo, stdin, options)
|
|
42
42
|
repo_path = Repository.new(repo, options).fetch
|
|
43
|
-
primary_scripts = stdin
|
|
43
|
+
primary_scripts = (stdin || '').split
|
|
44
44
|
|
|
45
45
|
runner = Runner.new(repo_path, primary_scripts, options[:scriptdir])
|
|
46
46
|
runner.run
|
|
@@ -16,10 +16,13 @@ module Rebuild
|
|
|
16
16
|
def install
|
|
17
17
|
obtain_accesibility
|
|
18
18
|
|
|
19
|
+
Logger.info('Running command line tools installation...')
|
|
19
20
|
`xcode-select --install`
|
|
21
|
+
|
|
20
22
|
Script.execute_scpt('start_install')
|
|
21
23
|
sleep 5 until installed?
|
|
22
24
|
Script.execute_scpt('click_done')
|
|
25
|
+
Logger.success('Finished to install command line tools')
|
|
23
26
|
end
|
|
24
27
|
|
|
25
28
|
private
|
data/lib/rebuild/logger.rb
CHANGED
|
@@ -3,6 +3,7 @@ require 'rebuild'
|
|
|
3
3
|
module Rebuild
|
|
4
4
|
class Logger
|
|
5
5
|
COLOR_CODE = {
|
|
6
|
+
red: 31,
|
|
6
7
|
green: 32,
|
|
7
8
|
cyan: 36,
|
|
8
9
|
}
|
|
@@ -16,8 +17,17 @@ module Rebuild
|
|
|
16
17
|
puts cyan(text)
|
|
17
18
|
end
|
|
18
19
|
|
|
20
|
+
def fatal(text)
|
|
21
|
+
puts red("Error: #{text}")
|
|
22
|
+
exit(1)
|
|
23
|
+
end
|
|
24
|
+
|
|
19
25
|
private
|
|
20
26
|
|
|
27
|
+
def red(text)
|
|
28
|
+
color_with(text, :red)
|
|
29
|
+
end
|
|
30
|
+
|
|
21
31
|
def green(text)
|
|
22
32
|
color_with(text, :green)
|
|
23
33
|
end
|
data/lib/rebuild/runner.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'rebuild'
|
|
2
|
+
require 'set'
|
|
2
3
|
|
|
3
4
|
module Rebuild
|
|
4
5
|
class Runner
|
|
@@ -11,9 +12,10 @@ module Rebuild
|
|
|
11
12
|
def run
|
|
12
13
|
return no_script_found if script_paths.empty?
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
ordered_scripts.each do |script|
|
|
16
|
+
absolute_path = File.join(absolute_script_directory, script)
|
|
17
|
+
Logger.info("Running #{absolute_path}...")
|
|
18
|
+
system('sh', absolute_path)
|
|
17
19
|
end
|
|
18
20
|
|
|
19
21
|
Logger.finish("Finished to rebuild #{absolute_script_directory}")
|
|
@@ -21,6 +23,23 @@ module Rebuild
|
|
|
21
23
|
|
|
22
24
|
private
|
|
23
25
|
|
|
26
|
+
def ordered_scripts
|
|
27
|
+
inexistent_scripts = @primary_scripts - existent_scripts
|
|
28
|
+
if inexistent_scripts.any?
|
|
29
|
+
Logger.fatal("#{inexistent_scripts.join(', ')} can't be found in #{absolute_script_directory}")
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
@primary_scripts + (existent_scripts - @primary_scripts)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def existent_scripts
|
|
36
|
+
target = File.join(absolute_script_directory, '*.sh')
|
|
37
|
+
|
|
38
|
+
Dir.glob(target).map do |full_path|
|
|
39
|
+
File.basename(full_path)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
24
43
|
def script_paths
|
|
25
44
|
target = File.join(absolute_script_directory, '*.sh')
|
|
26
45
|
Dir.glob(target)
|
data/lib/rebuild/version.rb
CHANGED