twirly 0.0.2 → 0.0.3

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: d82c30a04c2080c8b7ced5834f7f895859934f7a
4
- data.tar.gz: 9a29b5303a0b9563ca481fab3ab2ed590203af0b
3
+ metadata.gz: 199532e2e26335cfee469774efc59f058717070b
4
+ data.tar.gz: b9fea7df62ba574265410349cb6e22113a88db42
5
5
  SHA512:
6
- metadata.gz: ab3e4904d62ec15748c6b5c7cfd02d563a6e98708b966cd96fc080db779766f7d7fcaf8e42b82dc65e0462bbd0009c9f11d6ab8f17aa7e804473d6c259e30f03
7
- data.tar.gz: 53ff040f72fbecdb9436764aa657a201c5b8fd3dea1f5e96ed79b56d51b5279b9e7e3d9615370bec465bf28fb3e84338f60392d8441aefceb848a00de98522f3
6
+ metadata.gz: 51d7fcddf17bcbbb81f416506fe716dd3afabd4d3d0740e6d9f449c4f8a7cabeb596b1f77cef1e6854ef25854bfdc9b553d2b0f0d86bdcacaded318f97eba437
7
+ data.tar.gz: cacc6503a9acd8f9f8614d6a49c0cd77f558098b44d577936eb96f0e2a402be17005858db503124e4d6825b37af07cf4641e6babc08f8a0cacb4bec780e98b7e
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ Gemfile.lock
1
2
  tags
2
3
  twirly.yml
3
4
  public
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  ## Twirly
2
2
 
3
3
  [![Gem version](https://badge.fury.io/rb/twirly.png)](http://badge.fury.io/rb/twirly)
4
+ [![code climate](https://d3s6mut3hikguw.cloudfront.net/github/Zorbash/twirly/badges/gpa.svg)](https://codeclimate.com/github/Zorbash/twirly)
4
5
 
5
6
  Twirly is a cli tool which converts [Trello](http://trello.com) cards to
6
7
  articles for use with ruby static site generators like
data/lib/twirly/post.rb CHANGED
@@ -41,12 +41,16 @@ module Twirly
41
41
  @body ||= Liquid::Template.parse(card.desc.sub(/---.*---/mi, '').strip).render
42
42
  end
43
43
 
44
+ def published_at
45
+ due || updated_at
46
+ end
47
+
44
48
  def short_published_at
45
49
  published_at.strftime('%Y-%m-%d')
46
50
  end
47
51
 
48
52
  def published?
49
- published_at && card.labels.any? { |label| label.name == 'published' }
53
+ card.labels.any? { |label| label.name == 'published' }
50
54
  end
51
55
 
52
56
  def slug
@@ -1,3 +1,3 @@
1
1
  module Twirly
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -26,8 +26,6 @@ FactoryGirl.define do
26
26
  association :attachments, factory: :trello_attachment
27
27
 
28
28
  trait :published do
29
- due { (DateTime.now - 1).to_time }
30
-
31
29
  card_labels do
32
30
  [ { name: 'published' } ]
33
31
  end
@@ -38,7 +36,8 @@ FactoryGirl.define do
38
36
  end
39
37
 
40
38
  trait :unpublished do
41
- due nil
39
+ card_labels { [] }
40
+ labels { [] }
42
41
  end
43
42
 
44
43
  trait :with_attachments do
data/spec/post_spec.rb CHANGED
@@ -48,8 +48,18 @@ describe Twirly::Post do
48
48
  end
49
49
 
50
50
  describe '#published_at' do
51
- it "is delegated to the card's due" do
52
- expect(subject.published_at).to eq(subject.card.due)
51
+ context 'when the cards due is not nil' do
52
+ it "is set to the value of #due" do
53
+ expect(subject.published_at).to eq(subject.card.due)
54
+ end
55
+ end
56
+
57
+ context 'when the cards due is nil' do
58
+ before { post.due = nil }
59
+
60
+ it 'is set to the value of #updated_at' do
61
+ expect(subject.published_at).to eq(subject.updated_at)
62
+ end
53
63
  end
54
64
  end
55
65
 
@@ -92,7 +102,7 @@ describe Twirly::Post do
92
102
  end
93
103
 
94
104
  describe '#published?' do
95
- context 'card is published (has published_at and the "published" label' do
105
+ context 'card is published (has the "published" label)' do
96
106
  let(:subject) do
97
107
  post = Twirly::Post.new(create(:trello_card, :published))
98
108
  post.card.stub(:labels).and_return([double(name: 'published')])
@@ -104,8 +114,12 @@ describe Twirly::Post do
104
114
  end
105
115
  end
106
116
 
107
- context 'card is not published (has published_at and the "published" label' do
108
- let(:subject) { Twirly::Post.new(create(:trello_card, :unpublished)) }
117
+ context 'card is not published (does not have a "published" label)' do
118
+ let(:subject) do
119
+ post = Twirly::Post.new(create(:trello_card, :unpublished))
120
+ post.card.stub(:labels).and_return([])
121
+ post
122
+ end
109
123
 
110
124
  it 'returns false' do
111
125
  expect(subject).to_not be_published
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twirly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitris Zorbas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-07 00:00:00.000000000 Z
11
+ date: 2014-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -203,7 +203,6 @@ extra_rdoc_files: []
203
203
  files:
204
204
  - ".gitignore"
205
205
  - Gemfile
206
- - Gemfile.lock
207
206
  - LICENSE
208
207
  - README.md
209
208
  - bin/twirly
data/Gemfile.lock DELETED
@@ -1,120 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- twirly (0.0.1)
5
- json (>= 1.8.1)
6
- liquid (~> 3.0)
7
- ruby-trello (~> 1.1)
8
- thor (~> 0.19)
9
-
10
- GEM
11
- remote: https://rubygems.org/
12
- specs:
13
- activemodel (4.1.8)
14
- activesupport (= 4.1.8)
15
- builder (~> 3.1)
16
- activesupport (4.1.8)
17
- i18n (~> 0.6, >= 0.6.9)
18
- json (~> 1.7, >= 1.7.7)
19
- minitest (~> 5.1)
20
- thread_safe (~> 0.1)
21
- tzinfo (~> 1.1)
22
- addressable (2.3.6)
23
- ast (2.0.0)
24
- astrolabe (1.3.0)
25
- parser (>= 2.2.0.pre.3, < 3.0)
26
- builder (3.2.2)
27
- celluloid (0.16.0)
28
- timers (~> 4.0.0)
29
- coderay (1.1.0)
30
- diff-lcs (1.2.5)
31
- factory_girl (4.5.0)
32
- activesupport (>= 3.0.0)
33
- faker (1.4.3)
34
- i18n (~> 0.5)
35
- ffi (1.9.6)
36
- formatador (0.2.5)
37
- guard (2.10.1)
38
- formatador (>= 0.2.4)
39
- listen (~> 2.7)
40
- lumberjack (~> 1.0)
41
- pry (>= 0.9.12)
42
- thor (>= 0.18.1)
43
- guard-rspec (4.3.1)
44
- guard (~> 2.1)
45
- rspec (>= 2.14, < 4.0)
46
- hitimes (1.2.2)
47
- i18n (0.6.11)
48
- json (1.8.1)
49
- liquid (3.0.0)
50
- listen (2.8.3)
51
- celluloid (>= 0.15.2)
52
- rb-fsevent (>= 0.9.3)
53
- rb-inotify (>= 0.9)
54
- lumberjack (1.0.9)
55
- method_source (0.8.2)
56
- mime-types (2.4.3)
57
- minitest (5.4.3)
58
- netrc (0.9.0)
59
- oauth (0.4.7)
60
- parser (2.2.0.pre.8)
61
- ast (>= 1.1, < 3.0)
62
- slop (~> 3.4, >= 3.4.5)
63
- powerpack (0.0.9)
64
- pry (0.10.1)
65
- coderay (~> 1.1.0)
66
- method_source (~> 0.8.1)
67
- slop (~> 3.4)
68
- pry-nav (0.2.4)
69
- pry (>= 0.9.10, < 0.11.0)
70
- rainbow (2.0.0)
71
- rake (10.4.2)
72
- rb-fsevent (0.9.4)
73
- rb-inotify (0.9.5)
74
- ffi (>= 0.5.0)
75
- rest-client (1.7.2)
76
- mime-types (>= 1.16, < 3.0)
77
- netrc (~> 0.7)
78
- rspec (2.14.1)
79
- rspec-core (~> 2.14.0)
80
- rspec-expectations (~> 2.14.0)
81
- rspec-mocks (~> 2.14.0)
82
- rspec-core (2.14.8)
83
- rspec-expectations (2.14.5)
84
- diff-lcs (>= 1.1.3, < 2.0)
85
- rspec-mocks (2.14.6)
86
- rubocop (0.27.1)
87
- astrolabe (~> 1.3)
88
- parser (>= 2.2.0.pre.7, < 3.0)
89
- powerpack (~> 0.0.6)
90
- rainbow (>= 1.99.1, < 3.0)
91
- ruby-progressbar (~> 1.4)
92
- ruby-progressbar (1.7.0)
93
- ruby-trello (1.1.2)
94
- activemodel (>= 3.2.0)
95
- addressable (~> 2.3)
96
- json
97
- oauth (~> 0.4.5)
98
- rest-client (~> 1.7.2)
99
- slop (3.6.0)
100
- thor (0.19.1)
101
- thread_safe (0.3.4)
102
- timers (4.0.1)
103
- hitimes
104
- tzinfo (1.2.2)
105
- thread_safe (~> 0.1)
106
-
107
- PLATFORMS
108
- ruby
109
-
110
- DEPENDENCIES
111
- bundler (~> 1.7)
112
- factory_girl
113
- faker
114
- guard-rspec
115
- pry
116
- pry-nav
117
- rake
118
- rspec (~> 2.14.1)
119
- rubocop
120
- twirly!