changit 1.0.0 → 1.1.0
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/.travis.yml +5 -0
- data/Rakefile +1 -1
- data/bin/changit +1 -2
- data/lib/changit/cli.rb +11 -11
- data/lib/changit/version.rb +1 -1
- data/lib/changit.rb +6 -3
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed97cc2cbe08e2875e99619ee6b6d6c0cc33fb86
|
4
|
+
data.tar.gz: 066ec16b9929eb3687e8db78bca4bb3929ff3053
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 918e71f96aaf575ae870cb80175b924600dcf9f56d9e94988bdfd7c439d980731cb20d7f1d359d8d7c6dabeb184e41a62aca0645b3d85d088dfd0f97a0f7c0b6
|
7
|
+
data.tar.gz: 8ca399d6d76d903c1475d0a5472f189dd7b446d46b4166cb793714c31d00c77d4f2d628f00b6efd1869f90f282290df260c004f52a66b6d1b34fe3dc248e0dd0
|
data/.travis.yml
ADDED
data/Rakefile
CHANGED
data/bin/changit
CHANGED
data/lib/changit/cli.rb
CHANGED
@@ -2,31 +2,33 @@ require 'optparse'
|
|
2
2
|
|
3
3
|
module Changit
|
4
4
|
class CLI
|
5
|
+
attr_reader :options
|
6
|
+
|
5
7
|
def initialize
|
6
|
-
options = {}
|
7
|
-
options[:target_paths] = []
|
8
|
+
@options = {}
|
9
|
+
@options[:target_paths] = []
|
8
10
|
|
9
11
|
opt_parser = OptionParser.new do |opt|
|
10
12
|
opt.banner = "Usage: changit [OPTIONS]"
|
11
13
|
opt.separator ""
|
12
14
|
opt.separator "Options"
|
13
15
|
|
14
|
-
opt.on("-s","--source SOURCE","Which gitconfig file to copy from") do |src_path|
|
15
|
-
options[:src_path] = src_path
|
16
|
+
opt.on("-s", "--source SOURCE","Which gitconfig file to copy from") do |src_path|
|
17
|
+
@options[:src_path] = src_path
|
16
18
|
end
|
17
19
|
|
18
|
-
opt.on("-t","--target TARGET","Which directory to copy the config to."\
|
20
|
+
opt.on("-t", "--target TARGET","Which directory to copy the config to."\
|
19
21
|
" To copy to different directories, pass more than one -t argument each for one directory"
|
20
22
|
) do |target_path|
|
21
|
-
options[:target_paths] << target_path
|
23
|
+
@options[:target_paths] << target_path
|
22
24
|
end
|
23
25
|
|
24
|
-
opt.on("-v","--version","Show version number") do
|
26
|
+
opt.on("-v", "--version","Show version number") do
|
25
27
|
puts Changit::VERSION
|
26
28
|
exit
|
27
29
|
end
|
28
30
|
|
29
|
-
opt.on("-h","--help","Show CLI options") do
|
31
|
+
opt.on("-h", "--help","Show CLI options") do
|
30
32
|
puts opt_parser
|
31
33
|
exit
|
32
34
|
end
|
@@ -34,9 +36,7 @@ module Changit
|
|
34
36
|
|
35
37
|
opt_parser.parse!
|
36
38
|
|
37
|
-
options[:target_paths] = nil if options[:target_paths].empty?
|
38
|
-
options
|
39
|
+
@options[:target_paths] = nil if @options[:target_paths].empty?
|
39
40
|
end
|
40
41
|
end
|
41
42
|
end
|
42
|
-
|
data/lib/changit/version.rb
CHANGED
data/lib/changit.rb
CHANGED
@@ -9,12 +9,15 @@ require 'changit/config_writer'
|
|
9
9
|
require 'changit/cli'
|
10
10
|
|
11
11
|
module Changit
|
12
|
-
def self.run
|
12
|
+
def self.run
|
13
|
+
# Initialize the CLI and fetch the parameters
|
14
|
+
options = Changit::CLI.new.options
|
15
|
+
|
13
16
|
# File to copy from
|
14
|
-
config = ConfigReader.new(search_path:
|
17
|
+
config = ConfigReader.new(search_path: options[:src_path]).read
|
15
18
|
|
16
19
|
# First, search directories inside the current pwd and make sure they contain a .git dir
|
17
|
-
files_to_write_to = GitDirFinder.new(search_paths:
|
20
|
+
files_to_write_to = GitDirFinder.new(search_paths: options[:target_paths]).find_all
|
18
21
|
|
19
22
|
# Then, copy the gitconfig file content to each .git/config file in these directories
|
20
23
|
ConfigWriter.new(config, files_to_write_to).write
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: changit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aaooki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: An over-engineered tool to change git config for multiple projects at
|
14
14
|
once.
|
@@ -20,6 +20,7 @@ extensions: []
|
|
20
20
|
extra_rdoc_files: []
|
21
21
|
files:
|
22
22
|
- ".gitignore"
|
23
|
+
- ".travis.yml"
|
23
24
|
- LICENSE
|
24
25
|
- README.md
|
25
26
|
- Rakefile
|
@@ -55,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
56
|
version: '0'
|
56
57
|
requirements: []
|
57
58
|
rubyforge_project:
|
58
|
-
rubygems_version: 2.
|
59
|
+
rubygems_version: 2.6.8
|
59
60
|
signing_key:
|
60
61
|
specification_version: 4
|
61
62
|
summary: An over-engineered tool to change git config for multiple projects at once.
|