coauthor 0.1.0 → 0.1.1

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
- SHA1:
3
- metadata.gz: dc69055ef51e55f2d6a51082665cef0a9ea776aa
4
- data.tar.gz: 57cbf6ca445de204a9062b0d872865408a52fc15
2
+ SHA256:
3
+ metadata.gz: 27fa07defdb28ea82b7334346226cd3bf5aef1a8705c461f49063b752efeb6d1
4
+ data.tar.gz: dbd2fb5497a8cdbeeb373a76ded477b53ac75a44374bc2bf55a9ec8c4b709169
5
5
  SHA512:
6
- metadata.gz: d736b93e8884a367a9ec2e32dcfef3610afcadee89d776f6bb5e771c0216155d55b142982899dda2a19e2c7c0192fe1e923fed39e6a030f1d72193cdde6aca4b
7
- data.tar.gz: 628104171acbc4d20ccdac05fd3eb0193c23e7c726a8705c41422fe09787b77a3b66f3d537ea84ffe54f0424bc1a3e2c73090847dbe013ece162a7be186e8b79
6
+ metadata.gz: 8cdfc97fc4450f64341ec3a6119ec862c8c40e2fd75348675a7c9fda300f90c935b107a2b8d056732487f87c530040f14b8a055a0b6a5da235dfdfe5bf14b657
7
+ data.tar.gz: 8f8b8aaff6a95e96256d3129e9540cfd33f67639c17e2376baf51edc881d00f8708331be5b7a35fceb49cb7b0f0ab655a3ecb6449efd98865490e38e012a5223
data/.gitignore CHANGED
@@ -9,3 +9,7 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ *.gem
14
+ bin
15
+ .DS_Store
data/Gemfile.lock CHANGED
@@ -1,13 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- coauthor (0.1.0)
5
- thor
4
+ coauthor (0.1.1)
5
+ colorize (~> 0.8.1)
6
+ thor (~> 0.20.0)
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
9
10
  specs:
10
11
  coderay (1.1.2)
12
+ colorize (0.8.1)
11
13
  diff-lcs (1.3)
12
14
  method_source (0.9.0)
13
15
  pry (0.11.3)
@@ -35,7 +37,7 @@ PLATFORMS
35
37
  DEPENDENCIES
36
38
  bundler (~> 1.16)
37
39
  coauthor!
38
- pry
40
+ pry (~> 0.11.0)
39
41
  rake (~> 10.0)
40
42
  rspec (~> 3.0)
41
43
 
data/README.md CHANGED
@@ -13,16 +13,15 @@ Install with:
13
13
  ## Usage
14
14
 
15
15
  1) First thing you should do is setup a coauthor file. At this time, we support 2 coauthors.
16
-
17
- $ coauthor
18
16
 
19
- Follow the steps and setup your pair
17
+ $ coauthor # Follow the steps and setup your pair
18
+
20
19
 
21
20
  2) After that you're all set to commit. Add your files with git and run `coauthor` when you are ready to commit
22
21
 
23
22
  ## Development
24
23
 
25
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
24
+ After checking out the repo, run `bin/setup` to install dependencies.
26
25
 
27
26
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
27
 
data/coauthor.gemspec CHANGED
@@ -23,9 +23,10 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ['lib']
24
24
 
25
25
  spec.add_development_dependency 'bundler', '~> 1.16'
26
- spec.add_development_dependency 'pry'
26
+ spec.add_development_dependency 'pry', '~> 0.11.0'
27
27
  spec.add_development_dependency 'rake', '~> 10.0'
28
28
  spec.add_development_dependency 'rspec', '~> 3.0'
29
29
 
30
- spec.add_runtime_dependency 'thor'
30
+ spec.add_runtime_dependency 'colorize', '~> 0.8.1'
31
+ spec.add_runtime_dependency 'thor', '~> 0.20.0'
31
32
  end
data/lib/coauthor/cli.rb CHANGED
@@ -1,35 +1,21 @@
1
1
  require 'thor'
2
+ require 'colorize'
3
+ require 'coauthor/setup'
4
+ require 'coauthor/constants'
2
5
 
3
6
  module Coauthor
4
7
  class CLI < Thor
5
- PAIR_CONFIG_FILE = '~/.coauthors'.freeze
6
- PAIR_FILE_PATH = File.expand_path(PAIR_CONFIG_FILE)
8
+ include Constants
7
9
 
8
10
  desc 'setup', 'Create a configuration file for Github Coauthoring'
9
11
  def setup
10
- puts Dir.pwd
11
- credentials = []
12
- 2.times do |n|
13
- detail = {}
14
- puts "Enter commiter #{n + 1}'s name:"
15
- detail['name'] = STDIN.gets.chomp
16
- puts "Enter commiter #{n + 1}'s email:"
17
- detail['email'] = STDIN.gets.chomp
18
- credentials << detail
19
- end
20
-
21
- File.open(PAIR_FILE_PATH, 'w+') do |file|
22
- file.puts
23
- credentials.each do |detail|
24
- file.write("\nCo-authored-by: #{detail['name']} <#{detail['email']}>")
25
- end
26
- end
12
+ Coauthor::Setup.new.call
27
13
  end
28
14
 
29
15
  desc 'commit', 'Default command. Make a commit with the coauthor configuration'
30
16
  def commit
31
- return puts system("git commit --template #{PAIR_CONFIG_FILE}") if File.file?(PAIR_FILE_PATH)
32
- puts `echo "Run coauthor setup before committing with coauthor"`
17
+ return system("git commit --template #{PAIR_CONFIG_FILE}") if File.file?(PAIR_FILE_PATH)
18
+ puts `echo "Run coauthor setup before committing with Coauthor"`
33
19
  end
34
20
  default_task :commit
35
21
  end
@@ -0,0 +1,6 @@
1
+ module Coauthor
2
+ module Constants
3
+ PAIR_CONFIG_FILE = '~/.coauthorrc'.freeze
4
+ PAIR_FILE_PATH = File.expand_path(PAIR_CONFIG_FILE)
5
+ end
6
+ end
@@ -0,0 +1,48 @@
1
+ require 'coauthor/constants'
2
+
3
+ module Coauthor
4
+ class Setup
5
+ include Constants
6
+ attr_accessor :credentials
7
+
8
+ def initialize
9
+ @credentials = []
10
+ end
11
+
12
+ def call
13
+ gather_coauthor_info
14
+ write_coauthor_file
15
+ rescue SystemExit, Interrupt
16
+ puts "\n...Setup cancelled".colorize(:red)
17
+ end
18
+
19
+ private
20
+
21
+ def gather_coauthor_info
22
+ puts 'Welcome to Coauthor Setup'.colorize(:blue)
23
+ 2.times do |n|
24
+ detail = {}
25
+ color = info_color(n + 1)
26
+ print "Enter commiter #{n + 1}'s name: ".colorize(color)
27
+ detail['name'] = STDIN.gets.chomp
28
+ print "Enter commiter #{n + 1}'s email: ".colorize(color)
29
+ detail['email'] = STDIN.gets.chomp
30
+ credentials << detail
31
+ end
32
+ end
33
+
34
+ def info_color(iter)
35
+ iter.even? ? :magenta : :yellow
36
+ end
37
+
38
+ def write_coauthor_file
39
+ File.open(PAIR_FILE_PATH, 'w+') do |file|
40
+ file.puts
41
+ credentials.each do |detail|
42
+ file.write("\nCo-authored-by: #{detail['name']} <#{detail['email']}>")
43
+ end
44
+ end
45
+ puts "...DONE! Coauthor file written to #{PAIR_CONFIG_FILE}\n".colorize(:green)
46
+ end
47
+ end
48
+ end
@@ -1,3 +1,3 @@
1
1
  module Coauthor
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coauthor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Vogel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-25 00:00:00.000000000 Z
11
+ date: 2018-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: pry
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 0.11.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 0.11.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -66,24 +66,39 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: colorize
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.8.1
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.8.1
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: thor
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - ">="
87
+ - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: '0'
89
+ version: 0.20.0
76
90
  type: :runtime
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - ">="
94
+ - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: '0'
96
+ version: 0.20.0
83
97
  description: Command line tool to set up and use Github Coauthoring
84
98
  email:
85
99
  - andrewpvogel@gmail.com
86
- executables: []
100
+ executables:
101
+ - coauthor
87
102
  extensions: []
88
103
  extra_rdoc_files: []
89
104
  files:
@@ -95,12 +110,12 @@ files:
95
110
  - LICENSE.txt
96
111
  - README.md
97
112
  - Rakefile
98
- - bin/coauthor
99
- - bin/console
100
- - bin/setup
101
113
  - coauthor.gemspec
114
+ - exe/coauthor
102
115
  - lib/coauthor.rb
103
116
  - lib/coauthor/cli.rb
117
+ - lib/coauthor/constants.rb
118
+ - lib/coauthor/setup.rb
104
119
  - lib/coauthor/version.rb
105
120
  homepage: https://github.com/avogel3/coauthor
106
121
  licenses:
@@ -122,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
137
  version: '0'
123
138
  requirements: []
124
139
  rubyforge_project:
125
- rubygems_version: 2.6.13
140
+ rubygems_version: 2.7.7
126
141
  signing_key:
127
142
  specification_version: 4
128
143
  summary: Easily setup Github Coauthoring
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "coauthor"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
File without changes