startling 0.0.5 → 0.0.6

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: 17935770cd88048b4d21b0e6a1228dbc893f1e10
4
- data.tar.gz: 2daa700a446e7b6296dcfd24153e4ffc0e385f7f
3
+ metadata.gz: b26b3cd09c416dd020682a1731d63bcf931d8c56
4
+ data.tar.gz: bd084e7429476ee0fee565fc0f74701875727f04
5
5
  SHA512:
6
- metadata.gz: e3e44fe9f1b40cbc973ff5dd67eced7c15373ff87953ebe089214b7ac9928a3bf0ed0eda0f29df7b410e57916848c6e78ca3618cc51669527b3aeff134672602
7
- data.tar.gz: a997e6be44acc04f2ec241f9c98c6222930d79244d4a004a94018b8eaa35aef79592490d88c2b131edd63c9ab1ccd385b84f6f0734a8f77b48fc949f14d80734
6
+ metadata.gz: ccda655ad497e3ab4b4ef1fb944cdc30e3dc1ccd8ab7a145002280e2040b42633e4ad17266c9b28c49e4c029d9f5d058258aa8b20bf993382c62d65c11784d40
7
+ data.tar.gz: 70f5f05b33ea24147babfc561eabfc5e5d2e1ca05db3c4ef630ba4095be2318782fb8824c4ef81cbac6a76ce3fa7a417a1c6457f386d4339921dd431685f9934
data/README.md CHANGED
@@ -28,11 +28,11 @@ Startling.configure do |config|
28
28
  # WIP Limit
29
29
  # config.wip_limit = 4
30
30
 
31
- # Repos to check against for WIP limit
32
- # config.repos << 'substantial/startling-dev'
31
+ # Labels for WIP pull requests
32
+ # config.wip_labels = ["WIP", "REVIEW"]
33
33
 
34
- # Valid story estimations
35
- # config.valid_estimates = [1, 2, 4, 8, 16, 32, 64, 128]
34
+ # Repos to check against for WIP limit
35
+ # config.repos << "substantial/startling"
36
36
 
37
37
  # Commands to be run before a story is stared
38
38
  # config.hook_commands.before_story_start = [:check_wip]
data/bin/wip ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/startling'
4
+ require_relative '../lib/startling/work'
5
+ require_relative '../lib/startling/work_printer'
6
+
7
+ Startling::Configuration.load_configuration
8
+ wip = Startling::Work.in_progress
9
+ Startling::WorkPrinter.new.print wip
@@ -25,11 +25,11 @@ Startling.configure do |config|
25
25
  # WIP Limit
26
26
  # config.wip_limit = 4
27
27
 
28
- # Repos to check against for WIP limit
29
- # config.repos << 'substantial/startling-dev'
28
+ # Labels for WIP pull requests
29
+ # config.wip_labels = ["WIP", "REVIEW"]
30
30
 
31
- # Valid story estimations
32
- # config.valid_estimates = [1, 2, 4, 8, 16, 32, 64, 128]
31
+ # Repos to check against for WIP limit
32
+ # config.repos << "substantial/startling"
33
33
 
34
34
  # Commands to be run before a story is stared
35
35
  # config.hook_commands.before_story_start = [:check_wip]
@@ -23,45 +23,45 @@ module Startling
23
23
  end
24
24
 
25
25
  def execute
26
- Commands::CheckForLocalMods.run(git: git)
27
26
  command_args = cli_options.merge(git: git)
28
27
 
29
- # Before Start Story
30
- Startling.hook_commands.before_story_start.map do |command|
28
+ check_for_local_mods
29
+
30
+ run_hook_commands(hook: :before_story_start, command_args: command_args)
31
+ start_story(command_args)
32
+ run_hook_commands(hook: :after_story_start, command_args: command_args)
33
+
34
+ run_hook_commands(hook: :before_pull_request, command_args: command_args)
35
+ create_pull_request(command_args)
36
+ run_hook_commands(hook: :after_pull_request, command_args: command_args)
37
+ end
38
+
39
+ def git
40
+ @git ||= GitLocal.new
41
+ end
42
+
43
+ private
44
+
45
+ def check_for_local_mods
46
+ Commands::CheckForLocalMods.run(git: git)
47
+ end
48
+
49
+ def run_hook_commands(hook:, command_args:)
50
+ Startling.hook_commands.send(hook).map do |command|
31
51
  command_class(command).send(RUN, command_args)
32
52
  end
53
+ end
33
54
 
34
- # Start story
55
+ def start_story(command_args)
35
56
  story = command_class(Startling.story_handler)
36
57
  .send(RUN, command_args) if Startling.story_handler
37
58
  command_args.merge!(story: story)
59
+ end
38
60
 
39
- # After Story Start
40
- Startling.hook_commands.after_story_start.map do |command|
41
- command_class(command)
42
- .send(RUN, command_args)
43
- end
44
-
45
- #Before Pull Request Creation
46
- Startling.hook_commands.before_pull_request.map do |command|
47
- command_class(command)
48
- .send(RUN, command_args)
49
- end
50
-
51
- # Create pull request
61
+ def create_pull_request(command_args)
52
62
  pull_request = command_class(:create_pull_request)
53
63
  .send(RUN, command_args)
54
64
  command_args.merge!(pull_request: pull_request)
55
-
56
- # After Pull Request Creation
57
- Startling.hook_commands.after_pull_request.map do |command|
58
- command_class(command)
59
- .send(RUN, command_args)
60
- end
61
- end
62
-
63
- def git
64
- @git ||= GitLocal.new
65
65
  end
66
66
  end
67
67
  end
@@ -0,0 +1,30 @@
1
+ require 'highline/import'
2
+ require_relative 'base'
3
+ require_relative '../colorize_string'
4
+ require_relative '../work'
5
+ require_relative '../work_printer'
6
+
7
+ module Startling
8
+ module Commands
9
+ class CheckWip < Base
10
+ using ColorizeString
11
+
12
+ def execute
13
+ puts "Checking WIP..."
14
+ wip = Work.in_progress
15
+ if wip.count >= Startling.wip_limit
16
+ WorkPrinter.new.print wip
17
+ puts
18
+ question = [
19
+ "Would you like to start anyway (",
20
+ 'anything but "yes" will abort'.underline,
21
+ ")? "
22
+ ].map { |string| string.yellow }.join
23
+ confirm = ask(question)
24
+
25
+ exit unless confirm == "yes"
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,6 +1,6 @@
1
1
  require 'highline/import'
2
- require 'octokit'
3
2
  require_relative "base"
3
+ require_relative "../github"
4
4
 
5
5
  module Startling
6
6
  module Commands
@@ -1,6 +1,7 @@
1
1
  require 'startling/git_local'
2
2
  require 'startling/github'
3
3
  require 'startling/colorize_string'
4
+ require 'startling/commands/check_wip'
4
5
  require 'startling/commands/label_pull_request'
5
6
  require 'startling/handlers/default_pull_request_handler'
6
7
 
@@ -17,7 +18,7 @@ module Startling
17
18
  'Startlingfile.rb'
18
19
  ].freeze
19
20
 
20
- attr_accessor :cache_dir, :root_dir, :wip_limit, :repos, :story_handler,
21
+ attr_accessor :cache_dir, :root_dir, :wip_limit, :wip_labels, :repos, :story_handler,
21
22
  :validate_branch_name, :pull_request_body, :pull_request_handler,
22
23
  :pull_request_labels, :pull_request_commit_message, :cli_options
23
24
 
@@ -25,7 +26,8 @@ module Startling
25
26
  @cache_dir = Dir.pwd
26
27
  @root_dir = Dir.pwd
27
28
  @wip_limit = DEFAULT_WIP_LIMIT
28
- @repos = []
29
+ @wip_labels = []
30
+ @repos = [GitLocal.new.repo_name]
29
31
  @story_handler = nil
30
32
  @validate_branch_name = nil
31
33
  @pull_request_handler = nil
@@ -22,7 +22,9 @@ module Startling
22
22
  end
23
23
 
24
24
  def in_progress?
25
- label_names.any? { |label| label.match(/(WIP|REVIEW)/) }
25
+ return true if Startling.wip_labels.empty?
26
+
27
+ (label_names & Startling.wip_labels).size > 0
26
28
  end
27
29
 
28
30
  def label_names
@@ -46,6 +48,7 @@ module Startling
46
48
  end
47
49
 
48
50
  private
51
+
49
52
  def prefetch_data
50
53
  author
51
54
  end
@@ -0,0 +1,48 @@
1
+ require 'tzinfo'
2
+ require 'business_time'
3
+
4
+ module Startling
5
+ module TimeFormatHelpers
6
+ def business_time_ago(time)
7
+ days = pdt(time).to_date.business_days_until(pdt(Time.now).to_date)
8
+
9
+ case days
10
+ when 0
11
+ hours_ago(time)
12
+ else
13
+ "#{pluralize(days, "day")} ago"
14
+ end
15
+ end
16
+
17
+ def hours_ago(time)
18
+ total_seconds = Time.now - time
19
+ time_suffix = total_seconds >= 0 ? 'ago' : 'from now'
20
+ total_seconds = total_seconds.abs
21
+
22
+ hours = (total_seconds / (60 * 60)).floor
23
+
24
+ if hours < 1
25
+ pretty_time = "less than an hour"
26
+ else
27
+ pretty_time = pluralize(hours, 'hour')
28
+ end
29
+
30
+ "#{pretty_time} #{time_suffix}"
31
+ end
32
+
33
+ def pluralize(n, singular, plural=nil)
34
+ if n == 1
35
+ "1 #{singular}"
36
+ elsif plural
37
+ "#{n} #{plural}"
38
+ else
39
+ "#{n} #{singular}s"
40
+ end
41
+ end
42
+
43
+ def pdt(time)
44
+ tz = TZInfo::Timezone.get('America/Los_Angeles')
45
+ tz.utc_to_local(time)
46
+ end
47
+ end
48
+ end
@@ -1,3 +1,3 @@
1
1
  module Startling
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -0,0 +1,47 @@
1
+ require 'parallel'
2
+ require_relative 'github'
3
+
4
+ module Startling
5
+ class Work
6
+ using ColorizeString
7
+
8
+ attr_reader :pull_requests, :branch
9
+
10
+ def initialize(branch, pull_requests)
11
+ @branch = branch
12
+ @pull_requests = pull_requests
13
+ end
14
+
15
+ def in_progress?
16
+ pull_requests.any?(&:in_progress?)
17
+ end
18
+
19
+ def to_s
20
+ "#{authors.join(", ").blue} - #{branch.to_s.yellow}\n" +
21
+ pull_requests.map { |p| " #{p}"}.join("\n")
22
+ end
23
+
24
+ def authors
25
+ pull_requests.map(&:author).uniq.sort
26
+ end
27
+
28
+ def started_at
29
+ pull_requests.map(&:created_at).min
30
+ end
31
+
32
+ def self.all
33
+ repos = Startling.repos.map { |name| Github.repo(name) }
34
+ pull_requests = Parallel.map(repos, in_threads: repos.count, &:pull_requests).flatten
35
+ from_pull_requests(pull_requests)
36
+ end
37
+
38
+ def self.from_pull_requests(pull_requests)
39
+ work = pull_requests.group_by(&:branch)
40
+ work.map { |branch, pulls| new(branch, pulls) }
41
+ end
42
+
43
+ def self.in_progress
44
+ all.select(&:in_progress?)
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,53 @@
1
+ require 'paint'
2
+ require_relative 'colorize_string'
3
+ require_relative 'time_format_helpers'
4
+
5
+ module Startling
6
+ class WorkPrinter
7
+ using ColorizeString
8
+ include TimeFormatHelpers
9
+
10
+ def print(works)
11
+ puts works.sort_by(&:started_at).map { |work| format_work(work) }.join("\n\n")
12
+ puts "\nThere is currently #{count(works)} out of #{Startling.wip_limit.to_s.yellow} WIP."
13
+ end
14
+
15
+ def format_pull_request(pull_request)
16
+ "#{format_pull_request_labels(pull_request)}: #{pull_request.title}\n" +
17
+ " Started #{ago pull_request.created_at}, last updated #{ago pull_request.updated_at}\n" +
18
+ " #{pull_request.url.cyan.underline}"
19
+ end
20
+
21
+ def format_work(work)
22
+ "#{work.authors.join(", ").green} - #{work.branch.to_s.yellow}\n".yellow +
23
+ indent(work.pull_requests.sort_by(&:created_at).map { |p| format_pull_request(p) }.join("\n"))
24
+ end
25
+
26
+ def indent(string)
27
+ string.split("\n").map {|s| " #{s}"}.join("\n")
28
+ end
29
+
30
+ def ago(time)
31
+ business_time_ago(time).yellow
32
+ end
33
+
34
+ def count(works)
35
+ count = works.count
36
+
37
+ if count > Startling.wip_limit
38
+ count.to_s.red
39
+ elsif count == Startling.wip_limit
40
+ count.to_s.yellow
41
+ else
42
+ count.to_s.blue
43
+ end
44
+ end
45
+
46
+ private
47
+ def format_pull_request_labels(pull_request)
48
+ pull_request.labels.map do |label|
49
+ Paint[label[:name], :black, label[:color]]
50
+ end.join(", ")
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,85 @@
1
+ require 'spec_helper'
2
+
3
+ require 'startling/command'
4
+
5
+ describe Startling::Command do
6
+ let(:command) { Startling::Command.new }
7
+
8
+ describe '#execute' do
9
+ before do
10
+ allow(Startling::Commands::CheckForLocalMods).to receive(Startling::Command::RUN)
11
+
12
+ allow(Startling)
13
+ .to receive_message_chain(:hook_commands, :before_story_start) { [] }
14
+
15
+ allow(Startling)
16
+ .to receive_message_chain(:hook_commands, :after_story_start) { [] }
17
+
18
+ allow(Startling)
19
+ .to receive_message_chain(:hook_commands, :before_pull_request) { [] }
20
+
21
+ allow(Startling)
22
+ .to receive_message_chain(:hook_commands, :after_pull_request) { [] }
23
+
24
+ allow(Startling).to receive(:story_handler) { nil }
25
+
26
+ allow(Startling::Commands::CreatePullRequest).to receive(Startling::Command::RUN)
27
+ end
28
+
29
+ it 'should check for local modifications' do
30
+ expect(Startling::Commands::CheckForLocalMods).to receive(Startling::Command::RUN)
31
+
32
+ command.execute
33
+ end
34
+
35
+ it 'should run before story start commands' do
36
+ allow(Startling)
37
+ .to receive_message_chain(:hook_commands, :before_story_start) { [:create_branch] }
38
+
39
+ expect(Startling::Commands::CreateBranch).to receive(Startling::Command::RUN)
40
+
41
+ command.execute
42
+ end
43
+
44
+ it 'should start the story if a story handler is defined' do
45
+ allow(Startling).to receive(:story_handler) { Startling::Commands::CreateBranch }
46
+
47
+ expect(Startling::Commands::CreateBranch).to receive(Startling::Command::RUN)
48
+
49
+ command.execute
50
+ end
51
+
52
+ it 'should run after story start commands' do
53
+ allow(Startling)
54
+ .to receive_message_chain(:hook_commands, :after_story_start) { [:create_branch] }
55
+
56
+ expect(Startling::Commands::CreateBranch).to receive(Startling::Command::RUN)
57
+
58
+ command.execute
59
+ end
60
+
61
+ it 'should run before pull request commands' do
62
+ allow(Startling)
63
+ .to receive_message_chain(:hook_commands, :before_pull_request) { [:create_branch] }
64
+
65
+ expect(Startling::Commands::CreateBranch).to receive(Startling::Command::RUN)
66
+
67
+ command.execute
68
+ end
69
+
70
+ it 'should create the pull request' do
71
+ expect(Startling::Commands::CreatePullRequest).to receive(Startling::Command::RUN)
72
+
73
+ command.execute
74
+ end
75
+
76
+ it 'should run after pull request commands' do
77
+ allow(Startling)
78
+ .to receive_message_chain(:hook_commands, :after_pull_request) { [:create_branch] }
79
+
80
+ expect(Startling::Commands::CreateBranch).to receive(Startling::Command::RUN)
81
+
82
+ command.execute
83
+ end
84
+ end
85
+ end
@@ -61,13 +61,13 @@ describe Startling::Commands::CreateBranch do
61
61
  end
62
62
 
63
63
  it 'returns the branch entered through the prompt' do
64
- allow($terminal).to receive(:ask) { 'entered branch' }
64
+ allow_any_instance_of(Startling::Commands::CreateBranch).to receive(:ask) { 'entered branch' }
65
65
 
66
66
  expect(subject).to eq('entered-branch')
67
67
  end
68
68
 
69
69
  it 'returns the current branch when no branch is entered through the prompt' do
70
- allow($terminal).to receive(:ask) { '' }
70
+ allow_any_instance_of(Startling::Commands::CreateBranch).to receive(:ask) { '' }
71
71
  allow(git).to receive(:current_branch) { 'current-branch' }
72
72
 
73
73
  expect(subject).to eq('current-branch')
@@ -4,6 +4,11 @@ require 'startling'
4
4
  module Startling
5
5
  describe Configuration do
6
6
  let(:configuration) { Configuration.new }
7
+ let(:current_repo) { 'current' }
8
+
9
+ before do
10
+ allow_any_instance_of(GitLocal).to receive(:repo_name) { current_repo }
11
+ end
7
12
 
8
13
  describe "Default settings" do
9
14
  it "sets the default cache_dir to pwd" do
@@ -19,8 +24,29 @@ module Startling
19
24
  .to eql(Configuration::DEFAULT_WIP_LIMIT)
20
25
  end
21
26
 
22
- it "sets the default repos to empty" do
23
- expect(configuration.repos).to eql([])
27
+ it "sets the WIP labels to empty" do
28
+ expect(configuration.wip_labels).to eql([])
29
+ end
30
+
31
+ it "sets the default repos to the current repo" do
32
+ expect(configuration.repos).to eql([current_repo])
33
+ end
34
+
35
+ it "sets the default story handler to nil" do
36
+ expect(configuration.story_handler).to eql(nil)
37
+ end
38
+
39
+ it "sets the default branch name validator to nil" do
40
+ expect(configuration.validate_branch_name).to eql(nil)
41
+ end
42
+
43
+ it "sets the default pull request handler to nil" do
44
+ expect(configuration.pull_request_handler).to eql(nil)
45
+ end
46
+
47
+ it "sets the default pull request body" do
48
+ expect(configuration.pull_request_body)
49
+ .to eql(Configuration::DEFAULT_BODY)
24
50
  end
25
51
 
26
52
  it "sets the default pull request commit message" do
@@ -54,10 +80,46 @@ module Startling
54
80
  end
55
81
  end
56
82
 
83
+ describe "#wip_labels" do
84
+ it "can set the value" do
85
+ configuration.wip_labels = ['WIP']
86
+ expect(configuration.wip_labels).to eql(['WIP'])
87
+ end
88
+ end
89
+
57
90
  describe "#repos" do
58
91
  it "can set the value" do
59
92
  configuration.repos << "repo path"
60
- expect(configuration.repos).to eql(["repo path"])
93
+ expect(configuration.repos).to eql([current_repo, "repo path"])
94
+ end
95
+ end
96
+
97
+ describe "#story_handler" do
98
+ it "can set the value" do
99
+ configuration.story_handler = :pivotal_start
100
+ expect(configuration.story_handler).to eql(:pivotal_start)
101
+ end
102
+ end
103
+
104
+ describe "#validate_branch_name" do
105
+ it "can set the value" do
106
+ validate_branch_name = -> (branch_name) { /feature\/.*/ =~ branch_name }
107
+ configuration.validate_branch_name = validate_branch_name
108
+ expect(configuration.validate_branch_name).to eql(validate_branch_name)
109
+ end
110
+ end
111
+
112
+ describe "#pull_request_handler" do
113
+ it "can set the value" do
114
+ configuration.pull_request_handler = :custom
115
+ expect(configuration.pull_request_handler).to eql(:custom)
116
+ end
117
+ end
118
+
119
+ describe "#pull_request_body" do
120
+ it "can set the value" do
121
+ configuration.pull_request_body = "Startling Body"
122
+ expect(configuration.pull_request_body).to eql("Startling Body")
61
123
  end
62
124
  end
63
125
 
@@ -4,34 +4,46 @@ require 'startling/github/pull_request'
4
4
  module Startling
5
5
  module Github
6
6
  describe PullRequest, "#in_progress?" do
7
-
8
- it "should be true for WIP label" do
7
+ it "should be true if no WIP labels configured" do
9
8
  pull_request = PullRequest.new(double(:attributes))
10
- allow(pull_request).to receive(:label_names) { ["WIP"] }
9
+ allow(Startling).to receive(:wip_labels) { [] }
11
10
 
12
11
  expect(pull_request.in_progress?).to be_truthy
13
12
  end
14
13
 
15
- it "should be true for REVIEW label" do
16
- pull_request = PullRequest.new(double(:attributes))
17
- allow(pull_request).to receive(:label_names) { ["REVIEW"] }
14
+ context 'WIP labels configured' do
15
+ before do
16
+ allow(Startling).to receive(:wip_labels) { ['WIP', 'REVIEW'] }
17
+ end
18
18
 
19
- expect(pull_request.in_progress?).to be_truthy
20
- end
19
+ it "should be true for WIP label" do
20
+ pull_request = PullRequest.new(double(:attributes))
21
+ allow(pull_request).to receive(:label_names) { ["WIP"] }
21
22
 
22
- it "should be false if for other labels" do
23
- pull_request = PullRequest.new(double(:attributes))
24
- allow(pull_request).to receive(:label_names) { ["some other thing", "bug"] }
23
+ expect(pull_request.in_progress?).to be_truthy
24
+ end
25
25
 
26
- expect(pull_request.in_progress?).to be_falsey
27
- end
26
+ it "should be true for REVIEW label" do
27
+ pull_request = PullRequest.new(double(:attributes))
28
+ allow(pull_request).to receive(:label_names) { ["REVIEW"] }
28
29
 
29
- it "should be false if no labels" do
30
- pull_request = PullRequest.new(double(:attributes))
31
- allow(pull_request).to receive(:label_names) { [] }
30
+ expect(pull_request.in_progress?).to be_truthy
31
+ end
32
+
33
+ it "should be false if for other labels" do
34
+ pull_request = PullRequest.new(double(:attributes))
35
+ allow(pull_request).to receive(:label_names) { ["some other thing", "bug"] }
36
+
37
+ expect(pull_request.in_progress?).to be_falsey
38
+ end
32
39
 
33
- expect(pull_request.in_progress?).to be_falsey
34
- end
40
+ it "should be false if no labels" do
41
+ pull_request = PullRequest.new(double(:attributes))
42
+ allow(pull_request).to receive(:label_names) { [] }
43
+
44
+ expect(pull_request.in_progress?).to be_falsey
45
+ end
46
+ end
35
47
  end
36
48
  end
37
49
  end
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+ require 'startling/time_format_helpers'
3
+
4
+ module Startling
5
+ describe TimeFormatHelpers, "#business_time_ago" do
6
+ include TimeFormatHelpers
7
+
8
+ let(:minute) { 60 }
9
+ let(:hour) { 60 * minute }
10
+ let(:day) { 24 * hour }
11
+
12
+ before do
13
+ now = Time.parse("February 7th, 2014, 1:00 pm")
14
+ allow(Time).to receive(:now) { now }
15
+ end
16
+
17
+ it "says 1 day ago if it was yesterday" do
18
+ time = Time.now - 1 * day
19
+ expect(business_time_ago(time)).to eq("1 day ago")
20
+ end
21
+
22
+ it "says number of days if it was more than a day ago" do
23
+ time = Time.now - 3 * day
24
+ expect(business_time_ago(time)).to eq("3 days ago")
25
+ end
26
+
27
+ it "says number of hours if it is more than 1 hour" do
28
+ time = Time.now - 2 * hour - 20 * minute
29
+ expect(business_time_ago(time)).to eq("2 hours ago")
30
+ end
31
+
32
+ it "says number of hours if it is 1 hour" do
33
+ time = Time.now - 1 * hour - 20 * minute
34
+ expect(business_time_ago(time)).to eq("1 hour ago")
35
+ end
36
+
37
+ it "says less than an hour if it was" do
38
+ time = Time.now - 40 * minute
39
+ expect(business_time_ago(time)).to eq("less than an hour ago")
40
+ end
41
+ end
42
+ end
@@ -18,11 +18,11 @@ Startling.configure do |config|
18
18
  # WIP Limit
19
19
  # config.wip_limit = 4
20
20
 
21
- # Repos to check against for WIP limit
22
- # config.repos << 'substantial/startling-dev'
21
+ # Labels for WIP pull requests
22
+ # config.wip_labels = ["WIP", "REVIEW"]
23
23
 
24
- # Valid story estimations
25
- # config.valid_estimates = [1, 2, 4, 8, 16, 32, 64, 128]
24
+ # Repos to check against for WIP limit
25
+ # config.repos << "substantial/startling"
26
26
 
27
27
  # Commands to be run before a story is stared
28
28
  # config.hook_commands.before_story_start = [:check_wip]
data/spec/support/vcr.rb CHANGED
@@ -9,8 +9,5 @@ VCR.configure do |config|
9
9
  config.filter_sensitive_data '<GITHUB_ACCESS_TOKEN>' do
10
10
  ENV.fetch "TEST_GITHUB_ACCESS_TOKEN"
11
11
  end
12
- config.filter_sensitive_data '<PIVOTAL_API_TOKEN>' do
13
- ENV.fetch "TEST_PIVOTAL_TRACKER_API_TOKEN"
14
- end
15
12
  config.configure_rspec_metadata!
16
13
  end
data/startling.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency "excon"
28
28
  spec.add_development_dependency "dotenv"
29
29
 
30
- spec.add_dependency "octokit", "~> 3.7"
30
+ spec.add_dependency "octokit", "~> 4.2"
31
31
  spec.add_dependency "highline", "~> 1.6"
32
32
  spec.add_dependency "paint", "~> 0.9"
33
33
  spec.add_dependency "parallel", "~> 1.4"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: startling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Jensen
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-02-19 00:00:00.000000000 Z
13
+ date: 2016-02-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -130,14 +130,14 @@ dependencies:
130
130
  requirements:
131
131
  - - "~>"
132
132
  - !ruby/object:Gem::Version
133
- version: '3.7'
133
+ version: '4.2'
134
134
  type: :runtime
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
137
137
  requirements:
138
138
  - - "~>"
139
139
  - !ruby/object:Gem::Version
140
- version: '3.7'
140
+ version: '4.2'
141
141
  - !ruby/object:Gem::Dependency
142
142
  name: highline
143
143
  requirement: !ruby/object:Gem::Requirement
@@ -213,6 +213,7 @@ email:
213
213
  - tchdevs@substantial.com
214
214
  executables:
215
215
  - start
216
+ - wip
216
217
  extensions: []
217
218
  extra_rdoc_files: []
218
219
  files:
@@ -223,6 +224,7 @@ files:
223
224
  - README.md
224
225
  - Rakefile
225
226
  - bin/start
227
+ - bin/wip
226
228
  - lib/generators/startling/configuration_generator.rb
227
229
  - lib/startling.rb
228
230
  - lib/startling/cache.rb
@@ -231,6 +233,7 @@ files:
231
233
  - lib/startling/command.rb
232
234
  - lib/startling/commands/base.rb
233
235
  - lib/startling/commands/check_for_local_mods.rb
236
+ - lib/startling/commands/check_wip.rb
234
237
  - lib/startling/commands/create_branch.rb
235
238
  - lib/startling/commands/create_pull_request.rb
236
239
  - lib/startling/commands/label_pull_request.rb
@@ -244,14 +247,19 @@ files:
244
247
  - lib/startling/handlers/pull_request_handler_base.rb
245
248
  - lib/startling/markdown.rb
246
249
  - lib/startling/shell.rb
250
+ - lib/startling/time_format_helpers.rb
247
251
  - lib/startling/version.rb
252
+ - lib/startling/work.rb
253
+ - lib/startling/work_printer.rb
248
254
  - spec/spec_helper.rb
255
+ - spec/startling/command_spec.rb
249
256
  - spec/startling/commands/base_spec.rb
250
257
  - spec/startling/commands/create_branch_spec.rb
251
258
  - spec/startling/commands/create_pull_request_spec.rb
252
259
  - spec/startling/configuration_spec.rb
253
260
  - spec/startling/git_local_spec.rb
254
261
  - spec/startling/github/pull_request_spec.rb
262
+ - spec/startling/time_format_helpers_spec.rb
255
263
  - spec/startling_configuration_spec.rb
256
264
  - spec/startling_spec.rb
257
265
  - spec/support/dotenv.rb
@@ -286,12 +294,14 @@ specification_version: 4
286
294
  summary: script for startling a story
287
295
  test_files:
288
296
  - spec/spec_helper.rb
297
+ - spec/startling/command_spec.rb
289
298
  - spec/startling/commands/base_spec.rb
290
299
  - spec/startling/commands/create_branch_spec.rb
291
300
  - spec/startling/commands/create_pull_request_spec.rb
292
301
  - spec/startling/configuration_spec.rb
293
302
  - spec/startling/git_local_spec.rb
294
303
  - spec/startling/github/pull_request_spec.rb
304
+ - spec/startling/time_format_helpers_spec.rb
295
305
  - spec/startling_configuration_spec.rb
296
306
  - spec/startling_spec.rb
297
307
  - spec/support/dotenv.rb