trellist 0.2.0 → 0.3.0

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
2
  SHA1:
3
- metadata.gz: 5ce390fc278514eb01b77708061f0bcd8c3d7a54
4
- data.tar.gz: 9ede766ac3b981ad1a995a97c94cf83db6a866c2
3
+ metadata.gz: 152ce5d52c26e6b08438f8025309621a6b010133
4
+ data.tar.gz: 1cbeaca4934c9677f7222f69bffad3acf3acf26a
5
5
  SHA512:
6
- metadata.gz: d4b30392393ce9f5c3bfeea9300001767d6ca7dc1182fef4707b6f1c1afda2f98d871494782521e4022ed39ccdbea2c335207714547255acccee7f799f7522c7
7
- data.tar.gz: bce39075ed5a2bf639566b014cd51bb67e299e13822c19e3fd105583e6db780f52882b622e2e6f9bfc313f3e11de9455f6ebc6cd6575d1e5c2513223d97e00d3
6
+ metadata.gz: ff61e726ce343f56abbdf9cbfbc65c0bf3106633950661faf290c827ccbc037537eb20e5bb2e04ea1ef65cd12a4ba6e11bce9e3b1bb148a3083d2f643140cb01
7
+ data.tar.gz: 7ec64cff59f36b7bc1dafeab1f5750e6f71d56abcca400ccc2dff8788c1ade29f538ac25e5ae144b55e4129628eb78711a780ef2340955d368ff54d132692bcf
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trellist (0.2.0)
4
+ trellist (0.3.0)
5
5
  gli (= 2.14.0)
6
6
  highline (= 1.7.8)
7
7
  paint (= 2.0.0)
data/bin/trellist CHANGED
@@ -34,11 +34,12 @@ default_value '' # empty we'll raise if empty
34
34
  arg_name 'TRELLO_MEMBER_TOKEN'
35
35
  flag [:t,:token], required: true
36
36
 
37
- desc 'Get cards from list'
37
+ desc 'Get cards from a list on your board'
38
38
  command :cards do |c|
39
39
  c.desc 'Gets cards from a selection of lists from the provided Trello board'
40
- c.default_value 'markdown'
41
- c.flag [:f, :format], :must_match => ["markdown", "plain", "html", "markdown-with-images"]
40
+ c.flag [:f, :format], must_match: ["markdown", "plain", "html", "markdown-with-logo"], default_value: 'markdown'
41
+ c.flag [:p, :prefix]
42
+ c.flag [:s, :suffix]
42
43
  c.action do |global_options,options,args|
43
44
  puts Paint["fetching lists...", :blue]
44
45
  @client = Client.new(key: global_options[:key],
@@ -56,7 +57,7 @@ command :cards do |c|
56
57
  @client.lists.each_with_index do |list, index|
57
58
  puts "#{index}. #{list.name}"
58
59
  end
59
- # ask for which list or to quit
60
+ # ask for which list or to quitf
60
61
  @answer = ''
61
62
  until @answer == 'q'
62
63
  prompt = "Select from 0..#{@client.lists.size - 1} or (q)uit ---> "
@@ -73,7 +74,11 @@ command :cards do |c|
73
74
  puts Paint["OK. Here are the cards for #{list.name}:", :blue]
74
75
  puts Paint["---", :blue]
75
76
  @client.list_cards(list.id)
76
- @client.generate_links(format: options[:format])
77
+ if options[:format] == 'markdown-with-logo'
78
+ options[:format] = 'markdown'
79
+ options[:prefix] += '![](https://github.trello.services/images/mini-trello-icon.png) '
80
+ end
81
+ @client.generate_links(format: options[:format], prefix: options[:prefix], suffix: options[:suffix])
77
82
  puts Paint["---", :blue]
78
83
  break
79
84
  else
@@ -4,17 +4,17 @@ require 'trello'
4
4
  # 2. invoke client with board id
5
5
  # 3. present list of lists to choose from
6
6
  # 4. receive choice
7
- # 5. output list as markdown
7
+ # 5. output list as markdown (or other format)
8
8
 
9
- # could put this module in /ext and require relative
9
+ # could put this module in trellist/ext and require relative
10
10
  module TrelloCardRefinements
11
11
  refine Trello::Card do
12
12
  def as_markdown(prefix: '', suffix: '')
13
13
  "#{prefix}[#{name}](#{short_url})#{suffix}"
14
14
  end
15
15
 
16
- def as_html
17
- "<a href=\"#{short_url}\">#{name}</a>"
16
+ def as_html(prefix: '', suffix: '')
17
+ "#{prefix}<a href=\"#{short_url}\">#{name}</a>#{suffix}"
18
18
  end
19
19
  end
20
20
  end
@@ -42,20 +42,15 @@ class Client
42
42
  @cards = Trello::List.find(list_id).cards
43
43
  end
44
44
 
45
- # TODO(chaserx): add option for image_link or some shit
46
- # as in ![](https://github.trello.services/images/mini-trello-icon.png) [name](short_url)
47
- #
48
- def generate_links(format: 'markdown')
45
+ def generate_links(format: 'markdown', prefix: '', suffix: '')
49
46
  @cards.each do |card|
50
47
  case format
51
48
  when 'markdown'
52
- puts card.as_markdown
49
+ puts card.as_markdown(prefix: prefix, suffix: suffix)
53
50
  when 'plain'
54
51
  puts card.short_url
55
52
  when 'html'
56
- puts card.as_html
57
- when 'markdown-with-images'
58
- puts card.as_markdown(prefix: '![](https://github.trello.services/images/mini-trello-icon.png) ')
53
+ puts card.as_html(prefix: prefix, suffix: suffix)
59
54
  else
60
55
  puts card.inspect
61
56
  end
@@ -1,3 +1,3 @@
1
1
  module Trellist
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.3.0'.freeze
3
3
  end
@@ -87,9 +87,9 @@ RSpec.describe 'Client' do
87
87
  end
88
88
  end
89
89
 
90
- context 'format: markdown-with-images' do
90
+ context 'format: markdown, prefix: small trello icon' do
91
91
  it 'prints link like markdown' do
92
- expect{@client.generate_links(format: 'markdown-with-images')}.
92
+ expect{@client.generate_links(prefix: '![](https://github.trello.services/images/mini-trello-icon.png) ')}.
93
93
  to output("![](https://github.trello.services/images/mini-trello-icon.png) [mock card title](http://example.com/foobar)\n").to_stdout
94
94
  end
95
95
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trellist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chase Southard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-27 00:00:00.000000000 Z
11
+ date: 2017-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake