trello_flow 3.7.1 → 3.8.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: 5fe9047aa6ce66f555bd2fe9fbbddaeafbfc749c
4
- data.tar.gz: 067ba97e25dd2fa79b9dbbd6b3606c2cd575293a
3
+ metadata.gz: a0616f6846753dffe0c73a6e08926f5b7ab7a1a8
4
+ data.tar.gz: 985fcdf1d7bad05ea11cd2858c4a6a58eaef3afe
5
5
  SHA512:
6
- metadata.gz: ccfabd20b63e46d91b15503f5cd6851f0991f76d99405732b6a11f0cf2ac358f3b991f433a79940789ca2355f977cede249fc69f24de3cf2e86529948fd21191
7
- data.tar.gz: 8d92a4760ca7cb4399a7d0933dee421cb6516423ff03d029b2ec37de1756cb75207360cfef3bfb5f1e665f9a80091d8e4652dc5400ffa6a4177de979aa642953
6
+ metadata.gz: 95c22b4aeb7f688cafc149fb20c630c2bab5795eb753a172db6a1f013bccb40f089b0bc822ba1037cd3bee2c1cb3882ae513e589ccf81ca0c8229a08c4c2d513
7
+ data.tar.gz: fe2901bcb364f8ba8773c28642b8457c8d7b10256a1ebf752da9b50fcc3848dccb9db20c5600e1dc1664831e01c9a0100417972e01719becb6bb049c22161025
@@ -45,10 +45,6 @@ module TrelloFlow
45
45
  attributes[:shortUrl]
46
46
  end
47
47
 
48
- def to_param
49
- name.parameterize[0..50]
50
- end
51
-
52
48
  private
53
49
 
54
50
  def move_to(list)
@@ -1,5 +1,6 @@
1
1
  require "active_support/core_ext/string/inflections"
2
2
  require "trello_flow/pull_request"
3
+ require "trello_flow/branch_name"
3
4
 
4
5
  module TrelloFlow
5
6
  class Branch
@@ -12,7 +13,7 @@ module TrelloFlow
12
13
  end
13
14
 
14
15
  def self.from_card(user:, card:)
15
- new("#{user.initials.downcase}.#{card.to_param}.#{current.target}.#{card.short_link}")
16
+ new BranchName.new(user: user, target: current.target, card: card).to_s
16
17
  end
17
18
 
18
19
  def checkout
@@ -24,10 +25,11 @@ module TrelloFlow
24
25
  end
25
26
 
26
27
  def open_pull_request(options = {})
27
- PullRequest.new(current_card, options.merge(from: name, target: target)).open
28
+ pr = PullRequest.new options.merge(card: current_card, from: name, target: target)
29
+ pr.open
28
30
  end
29
31
 
30
- def open_trello(user:, config:)
32
+ def open_trello(config)
31
33
  if current_card
32
34
  Cli.open_url current_card.url
33
35
  else
@@ -36,11 +38,7 @@ module TrelloFlow
36
38
  end
37
39
 
38
40
  def target
39
- if legacy_naming?
40
- name_parts.first
41
- else
42
- name_parts[-2] || name
43
- end
41
+ name_parts[2] || name
44
42
  end
45
43
 
46
44
  private
@@ -52,11 +50,7 @@ module TrelloFlow
52
50
  end
53
51
 
54
52
  def card_short_link
55
- name[/\.(\w+)$/, 1]
56
- end
57
-
58
- def legacy_naming?
59
- name_parts.size == 3
53
+ name_parts[3]
60
54
  end
61
55
 
62
56
  def name_parts
@@ -0,0 +1,30 @@
1
+ module TrelloFlow
2
+ class BranchName
3
+ def initialize(user:, target:, card:)
4
+ @user = user
5
+ @target = target
6
+ @card = card
7
+ end
8
+
9
+ def to_s
10
+ parts.join(".")
11
+ end
12
+
13
+ private
14
+
15
+ attr_reader :user, :target, :card
16
+
17
+ def parts
18
+ parts = []
19
+ parts << user.initials.downcase
20
+ parts << title
21
+ parts << target
22
+ parts << card.short_link
23
+ parts
24
+ end
25
+
26
+ def title
27
+ card.name.parameterize[0..50]
28
+ end
29
+ end
30
+ end
@@ -1,5 +1,5 @@
1
1
  require "colored"
2
- require "forwardable"
2
+ require "active_support/core_ext/module/delegation"
3
3
  require "highline"
4
4
  require "hirb-colors"
5
5
  require "hirb"
@@ -7,12 +7,11 @@ require "hirb"
7
7
  module TrelloFlow
8
8
  class Cli
9
9
  class << self
10
- extend Forwardable
11
- def_delegators :client, :table, :open_url, :say, :success, :ask, :title, :error, :run, :read
10
+ delegate :table, :open_url, :say, :success, :ask, :title, :error, :run, :read, to: :client
12
11
  attr_accessor :client
13
12
  end
14
13
 
15
- self.client = Cli.new
14
+ self.client = new
16
15
 
17
16
  def table(items)
18
17
  puts Hirb::Helpers::AutoTable.render(items, unicode: true)
@@ -20,7 +20,7 @@ module TrelloFlow
20
20
  end
21
21
 
22
22
  def open
23
- Branch.current.open_trello(user: current_user, config: local_config)
23
+ Branch.current.open_trello(local_config)
24
24
  end
25
25
 
26
26
  def finish(options = {})
@@ -2,7 +2,7 @@ require "trello_flow/repo"
2
2
 
3
3
  module TrelloFlow
4
4
  class PullRequest
5
- def initialize(card, from:, target:, **options)
5
+ def initialize(from:, target:, card: nil, **options)
6
6
  @card = card
7
7
  @from = from
8
8
  @target = target
@@ -22,6 +22,7 @@ module TrelloFlow
22
22
  end
23
23
 
24
24
  def title
25
+ return unless card
25
26
  card_name + " [Delivers ##{card.short_link}]"
26
27
  end
27
28
 
@@ -30,6 +31,7 @@ module TrelloFlow
30
31
  end
31
32
 
32
33
  def body
34
+ return unless card
33
35
  body = "Trello: #{card.short_url}"
34
36
  body << release_note unless release_branch?
35
37
  body
@@ -55,7 +57,7 @@ module TrelloFlow
55
57
  end
56
58
 
57
59
  def escape(text)
58
- URI.escape text.strip
60
+ URI.escape text.to_s.strip
59
61
  end
60
62
 
61
63
  def repo
@@ -1,5 +1,5 @@
1
1
  module TrelloFlow
2
- VERSION = "3.7.1"
2
+ VERSION = "3.8.0"
3
3
 
4
4
  class Version
5
5
  def self.latest?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trello_flow
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.1
4
+ version: 3.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Balvig
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-05 00:00:00.000000000 Z
11
+ date: 2017-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -281,6 +281,7 @@ files:
281
281
  - lib/trello_flow/api/list.rb
282
282
  - lib/trello_flow/api/member.rb
283
283
  - lib/trello_flow/branch.rb
284
+ - lib/trello_flow/branch_name.rb
284
285
  - lib/trello_flow/cleanup.rb
285
286
  - lib/trello_flow/cli.rb
286
287
  - lib/trello_flow/config_store.rb