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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e90940fa077799a6777ba4260970bff7522ba1cb
4
- data.tar.gz: 8f4b8fd27c5ff75da8a3875a562793ad75f86663
3
+ metadata.gz: 4c4263ee9d23bb71f7ab20452e0357250b1e3b97
4
+ data.tar.gz: ebb90d9117d56054c1a54b179b913260bbf1d796
5
5
  SHA512:
6
- metadata.gz: a498214dbf1e49904deba7075df48a1cb7e62581c8a0d86318a1ca91c25013b59f14d83a8d5284f4542a2459aab25b878e8aa504e54d3d06285554852dac65ff
7
- data.tar.gz: d6c184e4b2cca891dde7353f4143fbd6e3a75cdce132e2fd3adb00c0a8baeba5c975fdbc468e6e4a6a90e140f3a11d75757bb43e0e9761bc4dc56aa960436de3
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
 
@@ -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[:directory]).fetch
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
 
@@ -5,9 +5,10 @@ module Rebuild
5
5
  class Repository
6
6
  DEFAULT_DIRECTORY = '/tmp'
7
7
 
8
- def initialize(path, directory)
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
@@ -1,3 +1,3 @@
1
1
  module Rebuild
2
- VERSION = '0.2.3'
2
+ VERSION = '0.2.4'
3
3
  end
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.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun