rebuild 0.2.3 → 0.2.4
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 +4 -0
- data/lib/rebuild/cli.rb +8 -2
- data/lib/rebuild/repository.rb +5 -2
- 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: 4c4263ee9d23bb71f7ab20452e0357250b1e3b97
|
4
|
+
data.tar.gz: ebb90d9117d56054c1a54b179b913260bbf1d796
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5537931ae578586fd889d0f11b91d8c4f68b27d30669edf0bcca71bdabc77f1cd54f4d3d245a3887c6d6687649ce6f3f79ea67bf5bdc24d0b6d19f7fa3c3f531
|
7
|
+
data.tar.gz: bd416ed8dc3ba01d4dc5898c61a9403748d536b61174732f5370064fc23d554646ccf9950f092405af2d5add5405ec21063f8b71011bd156875cd036a26c6d0d
|
data/README.md
CHANGED
@@ -35,6 +35,10 @@ Then executes all of `/tmp/k0kubun/dotfiles/*.sh`.
|
|
35
35
|
## Options
|
36
36
|
|
37
37
|
```bash
|
38
|
+
# By default, git pull is not executed.
|
39
|
+
# If you want to synchronize repository before running scripts, add -f.
|
40
|
+
$ rebuild -f
|
41
|
+
|
38
42
|
# Repository will be cloned to ~/src/github.com/k0kubun/dotfiles
|
39
43
|
$ rebuild -d ~/src/github.com/k0kubun/dotfiles
|
40
44
|
|
data/lib/rebuild/cli.rb
CHANGED
@@ -3,11 +3,16 @@ require 'optparse'
|
|
3
3
|
|
4
4
|
module Rebuild
|
5
5
|
class CLI
|
6
|
+
DEFAULT_OPTIONS = {
|
7
|
+
update: false,
|
8
|
+
}
|
9
|
+
|
6
10
|
class << self
|
7
11
|
def start
|
8
|
-
options =
|
12
|
+
options = DEFAULT_OPTIONS
|
9
13
|
|
10
14
|
opt = OptionParser.new
|
15
|
+
opt.on('-f', '--force-update') { |v| options[:update] = true }
|
11
16
|
opt.on('-d', '--directory=VAL') { |v| options[:directory] = v }
|
12
17
|
opt.on('-s', '--scriptdir=VAL') { |v| options[:scriptdir] = v }
|
13
18
|
|
@@ -26,7 +31,7 @@ module Rebuild
|
|
26
31
|
private
|
27
32
|
|
28
33
|
def bootstrap(args, stdin, options)
|
29
|
-
repo_path = Repository.new(args.first, options
|
34
|
+
repo_path = Repository.new(args.first, options).fetch
|
30
35
|
primary_scripts = stdin
|
31
36
|
|
32
37
|
runner = Runner.new(repo_path, primary_scripts, options[:scriptdir])
|
@@ -40,6 +45,7 @@ module Rebuild
|
|
40
45
|
rebuild USER/PROJECT # execute all scripts in GitHub repo's root directory
|
41
46
|
|
42
47
|
Options:
|
48
|
+
-f, [--force-update] # By default, git pull is not executed
|
43
49
|
-d, [--directory=/path/to/clone] # Default: /tmp/USER/PROJECT
|
44
50
|
-s, [--scriptdir=/script/placed/dir] # Default: '' (root)
|
45
51
|
|
data/lib/rebuild/repository.rb
CHANGED
@@ -5,9 +5,10 @@ module Rebuild
|
|
5
5
|
class Repository
|
6
6
|
DEFAULT_DIRECTORY = '/tmp'
|
7
7
|
|
8
|
-
def initialize(path,
|
8
|
+
def initialize(path, options)
|
9
9
|
@user, @repo = path.split('/')
|
10
|
-
@directory = directory
|
10
|
+
@directory = options[:directory]
|
11
|
+
@update = options[:update]
|
11
12
|
|
12
13
|
abort "Invalid repository `#{path}`" if @repo.nil?
|
13
14
|
end
|
@@ -30,6 +31,8 @@ module Rebuild
|
|
30
31
|
end
|
31
32
|
|
32
33
|
def sync_repository
|
34
|
+
return unless @update
|
35
|
+
|
33
36
|
if dirty_repository?
|
34
37
|
puts 'Repository has unstaged changes. Sync skipped.'
|
35
38
|
else
|
data/lib/rebuild/version.rb
CHANGED