changit 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 076d3ca051c1b061e2e66ed520eb75a205b76a61
4
- data.tar.gz: 87ccbdfcacf49c8c95774a46879444673395f3f6
3
+ metadata.gz: ed97cc2cbe08e2875e99619ee6b6d6c0cc33fb86
4
+ data.tar.gz: 066ec16b9929eb3687e8db78bca4bb3929ff3053
5
5
  SHA512:
6
- metadata.gz: a970bd68cba72a8d36261f86148aa1519daf53f5753380e74758b8d3c8f657e108dca0169a2bf94dd5bbede8d518c1b7339c18a6cd50fa162a05202f0ae53a88
7
- data.tar.gz: 6942d0f4a470de75778a5dfda520ab5a20b6d9198a85fcb8218375c33e621ab080332d7f5db63a4173b32dabfc348caded4b924d8d3455889293f72f5954e93d
6
+ metadata.gz: 918e71f96aaf575ae870cb80175b924600dcf9f56d9e94988bdfd7c439d980731cb20d7f1d359d8d7c6dabeb184e41a62aca0645b3d85d088dfd0f97a0f7c0b6
7
+ data.tar.gz: 8ca399d6d76d903c1475d0a5472f189dd7b446d46b4166cb793714c31d00c77d4f2d628f00b6efd1869f90f282290df260c004f52a66b6d1b34fe3dc248e0dd0
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.0
4
+ - 2.0.0
5
+ - 1.9.2
data/Rakefile CHANGED
@@ -7,4 +7,4 @@ Rake::TestTask.new(:test) do |t|
7
7
  t.test_files = FileList['test/**/*_test.rb']
8
8
  end
9
9
 
10
- task :default => :spec
10
+ task :default => :test
data/bin/changit CHANGED
@@ -2,5 +2,4 @@
2
2
 
3
3
  require 'changit'
4
4
 
5
- options = Changit::CLI.new
6
- Changit.run(options[:src_path], options[:target_paths])
5
+ Changit.run
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
-
@@ -1,3 +1,3 @@
1
1
  module Changit
2
- VERSION='1.0.0'
2
+ VERSION='1.1.0'
3
3
  end
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(src_file, target_files)
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: src_file).read
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: target_files).find_all
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.0.0
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: 2016-12-04 00:00:00.000000000 Z
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.5.1
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.