gradesfirst 0.6.0 → 0.6.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.
- data/Gemfile +1 -0
- data/Gemfile.lock +4 -0
- data/gradesfirst.gemspec +2 -1
- data/lib/gradesfirst/cli.rb +2 -0
- data/lib/gradesfirst/code_talk_command.rb +31 -10
- data/lib/gradesfirst/command.rb +10 -6
- data/lib/gradesfirst/config.rb +33 -0
- data/lib/gradesfirst/pair_command.rb +31 -8
- data/test/code_talk_command_test.rb +5 -1
- data/test/command_test.rb +8 -0
- data/test/config_test.rb +46 -0
- data/test/fixtures/.env +3 -0
- data/test/fixtures/code_talk.txt +6 -6
- data/test/fixtures/pair.txt +3 -3
- data/test/pair_command_test.rb +5 -1
- data/test/test_helper.rb +1 -0
- metadata +22 -3
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -12,6 +12,9 @@ GEM
|
|
12
12
|
debugger-ruby_core_source (~> 1.2.4)
|
13
13
|
debugger-linecache (1.2.0)
|
14
14
|
debugger-ruby_core_source (1.2.4)
|
15
|
+
dotenv (0.11.1)
|
16
|
+
dotenv-deployment (~> 0.0.2)
|
17
|
+
dotenv-deployment (0.0.2)
|
15
18
|
http_magic (0.1.1)
|
16
19
|
method_source (0.8.2)
|
17
20
|
minitest (4.7.5)
|
@@ -34,6 +37,7 @@ PLATFORMS
|
|
34
37
|
ruby
|
35
38
|
|
36
39
|
DEPENDENCIES
|
40
|
+
dotenv
|
37
41
|
http_magic (~> 0.1)
|
38
42
|
minitest (~> 4.7.0)
|
39
43
|
pry
|
data/gradesfirst.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.platform = Gem::Platform::RUBY
|
3
3
|
s.name = "gradesfirst"
|
4
|
-
s.version = "0.6.
|
4
|
+
s.version = "0.6.1"
|
5
5
|
s.summary = "GradesFirst command line utility for developers."
|
6
6
|
s.description = "This utility will help manage the various tasks developers need to do on their workstation such as database updates."
|
7
7
|
s.license = "MIT"
|
@@ -24,5 +24,6 @@ Gem::Specification.new do |s|
|
|
24
24
|
|
25
25
|
s.add_dependency('thor', '~> 0.18.1')
|
26
26
|
s.add_dependency('http_magic', '~> 0.1.2')
|
27
|
+
s.add_dependency('dotenv', '~> 0.11.1')
|
27
28
|
s.add_development_dependency('minitest', '~> 4.7.0')
|
28
29
|
end
|
data/lib/gradesfirst/cli.rb
CHANGED
@@ -21,6 +21,7 @@ module GradesFirst
|
|
21
21
|
end
|
22
22
|
|
23
23
|
desc 'codetalk', GradesFirst::CodeTalkCommand.description
|
24
|
+
long_desc GradesFirst::CodeTalkCommand.long_description
|
24
25
|
def codetalk
|
25
26
|
execute GradesFirst::CodeTalkCommand
|
26
27
|
end
|
@@ -32,6 +33,7 @@ module GradesFirst
|
|
32
33
|
end
|
33
34
|
|
34
35
|
desc 'pair', GradesFirst::PairCommand.description
|
36
|
+
long_desc GradesFirst::PairCommand.long_description
|
35
37
|
def pair
|
36
38
|
execute GradesFirst::PairCommand
|
37
39
|
end
|
@@ -8,6 +8,36 @@ module GradesFirst
|
|
8
8
|
'Show the next dates for code talks.'
|
9
9
|
end
|
10
10
|
|
11
|
+
# Description of the "gf codetalk" command that will be used in the
|
12
|
+
# commandline help to provide a complete description.
|
13
|
+
def self.long_description
|
14
|
+
<<-LONG_DESCRIPTION
|
15
|
+
Code talk dates are calculated based on a zero day date and the list
|
16
|
+
of people who can give code talks. The dates are based on a simple
|
17
|
+
rotation.
|
18
|
+
|
19
|
+
In order for this command to work correctly, the environment variables
|
20
|
+
GF_DAY_ZERO and GF_CODE_TALKERS need to be properly defined. These can
|
21
|
+
be actual environment variables, a .env file, or .env.master file. The
|
22
|
+
.env file can be in the current directory or the home directory. The
|
23
|
+
.env.master file must be in the current directory. The precedence order
|
24
|
+
is environment variables, .env in the current directory, .env in the
|
25
|
+
home directory, and .env.master in the current directory. It is
|
26
|
+
recommended that .env.master be committed to source control and the
|
27
|
+
other options used to override .env.master.
|
28
|
+
|
29
|
+
GF_DAY_ZERO is a date in a valid Ruby date string format.
|
30
|
+
|
31
|
+
GF_CODE_TALKERS is a pipe (|) delimited list of names.
|
32
|
+
|
33
|
+
Examples:
|
34
|
+
|
35
|
+
GF_DAY_ZERO="2014-3-10 00:00:00"
|
36
|
+
|
37
|
+
GF_CODE_TALKERS="Anthony Crumley|Tom Miller|Andrew Sellers"
|
38
|
+
LONG_DESCRIPTION
|
39
|
+
end
|
40
|
+
|
11
41
|
# Performs the gf codetalk command with show the code talk assignments
|
12
42
|
# for the next round of talks.
|
13
43
|
def execute
|
@@ -31,16 +61,7 @@ module GradesFirst
|
|
31
61
|
end
|
32
62
|
|
33
63
|
def code_talkers
|
34
|
-
|
35
|
-
"Anthony Crumley",
|
36
|
-
"Tom Miller",
|
37
|
-
"Andrew Sellers",
|
38
|
-
"Matt Turney",
|
39
|
-
"Zac Williams",
|
40
|
-
"Ben Holley",
|
41
|
-
"Chris Collins",
|
42
|
-
"Evan Travers"
|
43
|
-
].sort
|
64
|
+
config.code_talkers.sort
|
44
65
|
end
|
45
66
|
|
46
67
|
def next_code_talkers
|
data/lib/gradesfirst/command.rb
CHANGED
@@ -2,12 +2,12 @@ require 'gradesfirst'
|
|
2
2
|
|
3
3
|
module GradesFirst
|
4
4
|
|
5
|
-
# Base class for all command objects
|
5
|
+
# Base class for all command objects
|
6
6
|
class Command
|
7
7
|
|
8
8
|
private
|
9
9
|
|
10
|
-
# Retrieves the current git branch
|
10
|
+
# Retrieves the current git branch
|
11
11
|
def current_branch
|
12
12
|
`git rev-parse --abbrev-ref HEAD`
|
13
13
|
end
|
@@ -17,7 +17,7 @@ module GradesFirst
|
|
17
17
|
PivotalTracker.stories[story_id].get
|
18
18
|
end
|
19
19
|
|
20
|
-
# Extracts a PivotalTracker story id from a branch if one is present
|
20
|
+
# Extracts a PivotalTracker story id from a branch if one is present
|
21
21
|
def story_id(branch = current_branch)
|
22
22
|
if branch =~ /[0-9]+$/
|
23
23
|
branch.match(/[0-9]+$/)[0]
|
@@ -26,10 +26,14 @@ module GradesFirst
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
#
|
30
|
-
|
29
|
+
# Configuration for the current project
|
30
|
+
def config
|
31
|
+
@configuration ||= GradesFirst::Config.new
|
32
|
+
end
|
33
|
+
|
34
|
+
# The beginning date of a sprint
|
31
35
|
def day_zero
|
32
|
-
|
36
|
+
config.day_zero
|
33
37
|
end
|
34
38
|
end
|
35
39
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'dotenv'
|
2
|
+
|
3
|
+
module GradesFirst
|
4
|
+
class Config
|
5
|
+
def initialize
|
6
|
+
Dotenv.load(*GradesFirst::Config.load_paths)
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.load_paths
|
10
|
+
@@load_paths ||= [".env", "~/.env", ".env.master"]
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.load_paths=(paths)
|
14
|
+
@@load_paths = paths
|
15
|
+
end
|
16
|
+
|
17
|
+
def code_talkers
|
18
|
+
ENV["GF_CODE_TALKERS"].to_s.split("|")
|
19
|
+
end
|
20
|
+
|
21
|
+
def day_zero
|
22
|
+
if ENV["GF_DAY_ZERO"].nil?
|
23
|
+
Time.now
|
24
|
+
else
|
25
|
+
Time.parse(ENV["GF_DAY_ZERO"])
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def developers
|
30
|
+
ENV["GF_DEVELOPERS"].to_s.split("|")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -11,6 +11,36 @@ module GradesFirst
|
|
11
11
|
'Show the current developer pairings.'
|
12
12
|
end
|
13
13
|
|
14
|
+
# Description of the "gf pair" Thor commeand that will be used in the
|
15
|
+
# commandline help to provide a complete description.
|
16
|
+
def self.long_description
|
17
|
+
<<-LONG_DESCRIPTION
|
18
|
+
Developer pairings are calculated based on a zero day date and the list
|
19
|
+
people who are developers. The actual pairings are made by a round robin
|
20
|
+
tournament algorithm.
|
21
|
+
|
22
|
+
In order for this command to work correctly, the environment variables
|
23
|
+
GF_DAY_ZERO and GF_DEVELOPERS need to be properly defined. These can
|
24
|
+
be actual environment variables, a .env file, or .env.master file. The
|
25
|
+
.env file can be in the current directory or the home directory. The
|
26
|
+
.env.master file must be in the current directory. The precedence order
|
27
|
+
is environment variables, .env in the current directory, .env in the
|
28
|
+
home directory, and .env.master in the current directory. It is
|
29
|
+
recommended that .env.master be committed to source control and the
|
30
|
+
other options used to override .env.master.
|
31
|
+
|
32
|
+
GF_DAY_ZERO is a date in a valid Ruby date string format.
|
33
|
+
|
34
|
+
GF_DEVELOPERS is a pipe (|) delimited list of names.
|
35
|
+
|
36
|
+
Examples:
|
37
|
+
|
38
|
+
GF_DAY_ZERO="2014-3-10 00:00:00"
|
39
|
+
|
40
|
+
GF_DEVELOPERS="Anthony Crumley|Tom Miller|Andrew Sellers"
|
41
|
+
LONG_DESCRIPTION
|
42
|
+
end
|
43
|
+
|
14
44
|
# Performs the gf pair Thor command which determines the current
|
15
45
|
# developer pairings.
|
16
46
|
def execute
|
@@ -31,14 +61,7 @@ module GradesFirst
|
|
31
61
|
def developers
|
32
62
|
return @developers unless @developers.nil?
|
33
63
|
|
34
|
-
@developers =
|
35
|
-
"Anthony Crumley",
|
36
|
-
"Tom Miller",
|
37
|
-
"Andrew Sellers",
|
38
|
-
"Matt Turney",
|
39
|
-
"Zac Williams",
|
40
|
-
"Ben Holley"
|
41
|
-
].sort
|
64
|
+
@developers = config.developers.sort
|
42
65
|
@developers << nil if @developers.length.odd?
|
43
66
|
|
44
67
|
@developers
|
@@ -15,7 +15,11 @@ describe GradesFirst::CodeTalkCommand do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
specify '#execute schedules code talks correctly' do
|
18
|
-
|
18
|
+
config = OpenStruct.new(
|
19
|
+
code_talkers: @code_talkers,
|
20
|
+
day_zero: Time.parse("2014-3-10 00:00:00")
|
21
|
+
)
|
22
|
+
@command.stub :config, config do
|
19
23
|
@command.stub :today, Date.parse("2014-3-25") do
|
20
24
|
@command.execute
|
21
25
|
assert_equal(
|
data/test/command_test.rb
CHANGED
@@ -9,4 +9,12 @@ describe GradesFirst::Command do
|
|
9
9
|
specify '#story_id returns nil if not story id' do
|
10
10
|
assert_nil GradesFirst::Command.new.send(:story_id, 'abc')
|
11
11
|
end
|
12
|
+
|
13
|
+
specify '#day_zero is the beginning of our first sprint' do
|
14
|
+
assert_equal(
|
15
|
+
Time.parse("2014-3-10 00:00:00"),
|
16
|
+
GradesFirst::Command.new.send(:day_zero),
|
17
|
+
'Day zero should be March 10, 2014'
|
18
|
+
)
|
19
|
+
end
|
12
20
|
end
|
data/test/config_test.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'gradesfirst/config'
|
3
|
+
|
4
|
+
describe GradesFirst::Config do
|
5
|
+
specify '#code_talkers is the list of code talkers' do
|
6
|
+
code_talkers = [
|
7
|
+
"Anthony Crumley",
|
8
|
+
"Tom Miller",
|
9
|
+
"Andrew Sellers",
|
10
|
+
"Matt Turney",
|
11
|
+
"Zac Williams",
|
12
|
+
"Ben Holley",
|
13
|
+
"Chris Collins",
|
14
|
+
"Evan Travers"
|
15
|
+
]
|
16
|
+
assert_equal(
|
17
|
+
code_talkers,
|
18
|
+
GradesFirst::Config.new.code_talkers,
|
19
|
+
'Configuration should return a code talker list.'
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
specify '#day_zero is the beginning of our first sprint' do
|
24
|
+
assert_equal(
|
25
|
+
Time.parse("2014-3-10 00:00:00"),
|
26
|
+
GradesFirst::Config.new.day_zero,
|
27
|
+
'Day zero should be March 10, 2014'
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
specify '#developers is the list of developers' do
|
32
|
+
developers = [
|
33
|
+
"Anthony Crumley",
|
34
|
+
"Tom Miller",
|
35
|
+
"Andrew Sellers",
|
36
|
+
"Matt Turney",
|
37
|
+
"Zac Williams",
|
38
|
+
"Ben Holley"
|
39
|
+
]
|
40
|
+
assert_equal(
|
41
|
+
developers,
|
42
|
+
GradesFirst::Config.new.developers,
|
43
|
+
'Configuration should return a developer list.'
|
44
|
+
)
|
45
|
+
end
|
46
|
+
end
|
data/test/fixtures/.env
ADDED
data/test/fixtures/code_talk.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
03/25/2014 Tue -
|
2
|
-
03/27/2014 Thu -
|
3
|
-
04/01/2014 Tue -
|
4
|
-
04/03/2014 Thu -
|
5
|
-
04/08/2014 Tue -
|
6
|
-
04/10/2014 Thu -
|
1
|
+
03/25/2014 Tue - Superman
|
2
|
+
03/27/2014 Thu - Wonder Woman
|
3
|
+
04/01/2014 Tue - Cat Woman
|
4
|
+
04/03/2014 Thu - Ironman
|
5
|
+
04/08/2014 Tue - Mickey Mouse
|
6
|
+
04/10/2014 Thu - Minnie Mouse
|
data/test/fixtures/pair.txt
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
Cat Woman and Wonder Woman
|
2
|
+
Superman and Mickey Mouse
|
3
|
+
Minnie Mouse and Ironman
|
data/test/pair_command_test.rb
CHANGED
@@ -15,7 +15,11 @@ describe GradesFirst::PairCommand do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
specify '#execute pairs developers correctly' do
|
18
|
-
|
18
|
+
config = OpenStruct.new(
|
19
|
+
developers: @developers,
|
20
|
+
day_zero: Time.parse("2014-3-10 00:00:00")
|
21
|
+
)
|
22
|
+
@command.stub :config, config do
|
19
23
|
@command.stub :now, Time.parse("2014-3-25 00:00:00") do
|
20
24
|
@command.execute
|
21
25
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gradesfirst
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-07-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: 0.1.2
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: dotenv
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.11.1
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.11.1
|
46
62
|
- !ruby/object:Gem::Dependency
|
47
63
|
name: minitest
|
48
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,6 +98,7 @@ files:
|
|
82
98
|
- lib/gradesfirst/code_talk_command.rb
|
83
99
|
- lib/gradesfirst/command.rb
|
84
100
|
- lib/gradesfirst/commit_message_command.rb
|
101
|
+
- lib/gradesfirst/config.rb
|
85
102
|
- lib/gradesfirst/pair_command.rb
|
86
103
|
- lib/gradesfirst/task_add_command.rb
|
87
104
|
- lib/gradesfirst/task_cli.rb
|
@@ -96,6 +113,8 @@ files:
|
|
96
113
|
- test/code_talk_command_test.rb
|
97
114
|
- test/command_test.rb
|
98
115
|
- test/commit_message_command_test.rb
|
116
|
+
- test/config_test.rb
|
117
|
+
- test/fixtures/.env
|
99
118
|
- test/fixtures/code_talk.txt
|
100
119
|
- test/fixtures/commit_message.txt
|
101
120
|
- test/fixtures/gf_branch.txt
|
@@ -141,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
160
|
version: 1.3.6
|
142
161
|
requirements: []
|
143
162
|
rubyforge_project:
|
144
|
-
rubygems_version: 1.8.
|
163
|
+
rubygems_version: 1.8.23.2
|
145
164
|
signing_key:
|
146
165
|
specification_version: 3
|
147
166
|
summary: GradesFirst command line utility for developers.
|