rebuild 0.2.2 → 0.2.3

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: 2891f67ffcdba95f4dcb3f9dd6231ce53496b72c
4
- data.tar.gz: 8ce6ba5068b06c065c3f0017096786ea2e6160d3
3
+ metadata.gz: e90940fa077799a6777ba4260970bff7522ba1cb
4
+ data.tar.gz: 8f4b8fd27c5ff75da8a3875a562793ad75f86663
5
5
  SHA512:
6
- metadata.gz: 8c7d8e88235b631955f2452a05cf5862a4cd656bd920452fae65cd023d3395d2a1aba2df366515ac5e1a25628dd2aba37658ca3121da273c601326bf23f0c6dc
7
- data.tar.gz: fa82f426ed853245657fd25c1c38842861ca2ae0adf3aa112c8267639a32c00d11818fe4aa7451cb156761bc6e7fc323b51d2265dc0e302878c7cacdd4ef2e68
6
+ metadata.gz: a498214dbf1e49904deba7075df48a1cb7e62581c8a0d86318a1ca91c25013b59f14d83a8d5284f4542a2459aab25b878e8aa504e54d3d06285554852dac65ff
7
+ data.tar.gz: d6c184e4b2cca891dde7353f4143fbd6e3a75cdce132e2fd3adb00c0a8baeba5c975fdbc468e6e4a6a90e140f3a11d75757bb43e0e9761bc4dc56aa960436de3
data/README.md CHANGED
@@ -32,6 +32,16 @@ $ rebuild k0kubun/dotfiles
32
32
  After installing command line tools, the archive of [repository](https://github.com/k0kubun/dotfiles) is unzipped to `/tmp/k0kubun/dotfiles`.
33
33
  Then executes all of `/tmp/k0kubun/dotfiles/*.sh`.
34
34
 
35
+ ## Options
36
+
37
+ ```bash
38
+ # Repository will be cloned to ~/src/github.com/k0kubun/dotfiles
39
+ $ rebuild -d ~/src/github.com/k0kubun/dotfiles
40
+
41
+ # Run /tmp/k0kubun/dotfiles/script/*.sh instead of /tmp/k0kubun/dotfiles/*.sh
42
+ $ rebuild -s script
43
+ ```
44
+
35
45
  ## Supported OS
36
46
 
37
47
  - 10.10 Yosemite
@@ -9,6 +9,7 @@ module Rebuild
9
9
 
10
10
  opt = OptionParser.new
11
11
  opt.on('-d', '--directory=VAL') { |v| options[:directory] = v }
12
+ opt.on('-s', '--scriptdir=VAL') { |v| options[:scriptdir] = v }
12
13
 
13
14
  args = opt.parse!(ARGV)
14
15
  return show_usage if args.empty? && CommandLineTools.installed?
@@ -28,17 +29,19 @@ module Rebuild
28
29
  repo_path = Repository.new(args.first, options[:directory]).fetch
29
30
  primary_scripts = stdin
30
31
 
31
- runner = Runner.new(repo_path, primary_scripts)
32
+ runner = Runner.new(repo_path, primary_scripts, options[:scriptdir])
32
33
  runner.run
33
34
  end
34
35
 
35
36
  def show_usage
36
37
  puts unindent(<<-EOS)
37
38
  Commands:
38
- rebuild USER/PROJECT # execute all scripts in GitHub repo's root directory
39
+ rebuild # install command line tools, done
40
+ rebuild USER/PROJECT # execute all scripts in GitHub repo's root directory
39
41
 
40
42
  Options:
41
- -d, [--directory=/path/to/clone] # Default: /tmp/USER/PROJECT
43
+ -d, [--directory=/path/to/clone] # Default: /tmp/USER/PROJECT
44
+ -s, [--scriptdir=/script/placed/dir] # Default: '' (root)
42
45
 
43
46
  EOS
44
47
  end
@@ -2,12 +2,15 @@ require 'rebuild'
2
2
 
3
3
  module Rebuild
4
4
  class Runner
5
- def initialize(repo_path, primary_scripts)
6
- @repo_path = repo_path
7
- @primary_scripts = primary_scripts
5
+ def initialize(repo_path, primary_scripts, scriptdir)
6
+ @repo_path = repo_path
7
+ @primary_scripts = primary_scripts
8
+ @script_directory = scriptdir
8
9
  end
9
10
 
10
11
  def run
12
+ return no_script_found if script_paths.empty?
13
+
11
14
  script_paths.each do |path|
12
15
  puts "Running #{path}..."
13
16
  system('sh', path)
@@ -17,7 +20,16 @@ module Rebuild
17
20
  private
18
21
 
19
22
  def script_paths
20
- Dir.glob(File.join(@repo_path, '*.sh'))
23
+ target = File.join(absolute_script_directory, '*.sh')
24
+ Dir.glob(target)
25
+ end
26
+
27
+ def no_script_found
28
+ puts "No *.sh found in #{absolute_script_directory}"
29
+ end
30
+
31
+ def absolute_script_directory
32
+ File.join([@repo_path, @script_directory].compact)
21
33
  end
22
34
  end
23
35
  end
@@ -1,3 +1,3 @@
1
1
  module Rebuild
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
@@ -18,6 +18,6 @@ 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 "bundler"
21
+ spec.add_development_dependency "bundler", "~> 1.4"
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
23
  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.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
@@ -14,16 +14,16 @@ dependencies:
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '1.4'
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'
26
+ version: '1.4'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement