ayadn 1.0.13 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/ayadn/status.rb CHANGED
@@ -16,6 +16,9 @@ module Ayadn
16
16
  def self.deleting_post(post_id)
17
17
  "\nDeleting post #{post_id}\n".inverse
18
18
  end
19
+ def self.deleting_message(message_id)
20
+ "\nDeleting message #{message_id}\n".inverse
21
+ end
19
22
  def self.unfollowing(username)
20
23
  "\nUnfollowing #{username}\n".inverse
21
24
  end
@@ -82,6 +85,9 @@ module Ayadn
82
85
  def self.deleted(post_id)
83
86
  "\nPost #{post_id} has been deleted.\n".color(:green)
84
87
  end
88
+ def self.deleted_m(message_id)
89
+ "\nMessage #{message_id} has been deleted.\n".color(:green)
90
+ end
85
91
  def self.starred(post_id)
86
92
  "\nPost #{post_id} has been starred.\n".color(:green)
87
93
  end
@@ -118,6 +124,9 @@ module Ayadn
118
124
  def self.error_missing_post_id
119
125
  "\nYou have to specify a post id.\n".color(:red)
120
126
  end
127
+ def self.error_missing_message_id
128
+ "\nYou have to specify a message id.\n".color(:red)
129
+ end
121
130
  def self.error_missing_channel_id
122
131
  "\nYou have to specify a channel id.\n".color(:red)
123
132
  end
@@ -136,12 +145,18 @@ module Ayadn
136
145
  def self.stopped
137
146
  "\n\nStopped.".color(:red)
138
147
  end
148
+ def self.writing
149
+ "\nPosting as ".color(:cyan) + "#{Settings.config[:identity][:handle]}".color(:green) + ".".color(:cyan)
150
+ end
139
151
  def self.yourpost
140
152
  "\nYour post:\n\n".color(:cyan)
141
153
  end
142
154
  def self.yourmessage
143
155
  "\nYour message:\n\n".color(:cyan)
144
156
  end
157
+ def self.message_from(username)
158
+ "\nMessage from ".color(:cyan) + "#{Settings.config[:identity][:handle]} ".color(:green) + "to ".color(:cyan) + "#{username[0]}".color(:yellow) + ".".color(:cyan)
159
+ end
145
160
  def self.replying_to(post_id)
146
161
  "\nReplying to post #{post_id}...\n".color(:green)
147
162
  end
@@ -152,13 +167,13 @@ module Ayadn
152
167
  # "\nType your text. ".color(:cyan) + "[ENTER] ".color(:green) + "to validate, ".color(:cyan) + "[CTRL+C] ".color(:red) + "to cancel.\n\n".color(:cyan)
153
168
  # end
154
169
  def self.reply
155
- "\n#{Settings.config[:post_max_length]} ".color(:yellow) + "characters maximum. If the original post has mentions, you text will be inserted after the first one. Markdown links are supported.\n"
170
+ "\n#{Settings.config[:post_max_length]} ".color(:yellow) + "characters maximum.\n"
156
171
  end
157
172
  def self.post
158
- "\n#{Settings.config[:post_max_length]} ".color(:yellow) + "characters maximum. Markdown links are supported.\n"
173
+ "\n#{Settings.config[:post_max_length]} ".color(:yellow) + "characters maximum.\n"
159
174
  end
160
175
  def self.message
161
- "\n#{Settings.config[:message_max_length]} ".color(:yellow) + "characters maximum. Markdown links are supported.\n"
176
+ "\n#{Settings.config[:message_max_length]} ".color(:yellow) + "characters maximum.\n"
162
177
  end
163
178
  # def self.method_missing(meth, args)
164
179
  # "\nThe command '#{meth} #{args}' doesn't exist.\n".color(:red)
data/lib/ayadn/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Ayadn
3
- VERSION = "1.0.13"
3
+ VERSION = "1.1.0"
4
4
  end
data/lib/ayadn/workers.rb CHANGED
@@ -95,11 +95,11 @@ module Ayadn
95
95
  posts = {}
96
96
 
97
97
  data.each.with_index(1) do |post, index|
98
- next if Databases.blacklist[post['source']['name']]
98
+ next if Databases.blacklist[post['source']['name'].downcase]
99
99
  hashtags = extract_hashtags(post)
100
100
  @skip = false
101
101
  hashtags.each do |h|
102
- if Databases.blacklist[h]
102
+ if Databases.blacklist[h.downcase]
103
103
  @skip = true
104
104
  break
105
105
  end
@@ -108,7 +108,7 @@ module Ayadn
108
108
  mentions= []
109
109
  post['entities']['mentions'].each { |m| mentions << m['name'] }
110
110
  mentions.each do |m|
111
- if Databases.blacklist["@" + m]
111
+ if Databases.blacklist["@" + m.downcase]
112
112
  @skip = true
113
113
  break
114
114
  end
@@ -292,13 +292,7 @@ module Ayadn
292
292
  if word =~ /#\w+/
293
293
  words << word.gsub(/#{reg_tag}/, '#\1'.color(hashtag_color))
294
294
  elsif word =~ /@\w+/
295
- splitted = word.split(/#{reg_split}/) if word =~ /#{reg_split}/
296
- if splitted
297
- splitted.each {|d| @str = d if d =~ /@\w+/}
298
- @str = word if @str.nil?
299
- else
300
- @str = word
301
- end
295
+ @str = def_str(word, reg_split)
302
296
  if handles.include?(@str.downcase)
303
297
  words << word.gsub(/#{reg_mention}/, '@\1'.color(mention_color))
304
298
  else
@@ -316,6 +310,17 @@ module Ayadn
316
310
 
317
311
  private
318
312
 
313
+ def def_str(word, reg_split)
314
+ splitted = word.split(/#{reg_split}/) if word =~ /#{reg_split}/
315
+ if splitted
316
+ splitted.each {|d| @str = d if d =~ /@\w+/}
317
+ return word if @str.nil?
318
+ @str
319
+ else
320
+ word
321
+ end
322
+ end
323
+
319
324
  def init_table
320
325
  Terminal::Table.new do |t|
321
326
  t.style = { :width => Settings.options[:formats][:table][:width] }
@@ -53,20 +53,20 @@ describe Ayadn::BlacklistWorkers do
53
53
  it "adds a client to the blacklist" do
54
54
  k = Ayadn::BlacklistWorkers.new
55
55
  k.add(['client', 'IFTTT'])
56
- expect(Ayadn::Databases.blacklist['IFTTT']).to eq :client
56
+ expect(Ayadn::Databases.blacklist['ifttt']).to eq :client
57
57
  expect(File.read('spec/mock/ayadn.log')).to include "(wee) INFO -- Added 'IFTTT' to blacklist of clients."
58
58
  end
59
59
  it "adds a client to the blacklist" do
60
60
  k = Ayadn::BlacklistWorkers.new
61
61
  k.add(['source', 'Zapier'])
62
- expect(Ayadn::Databases.blacklist['Zapier']).to eq :client
62
+ expect(Ayadn::Databases.blacklist['zapier']).to eq :client
63
63
  expect(File.read('spec/mock/ayadn.log')).to include "(wee) INFO -- Added 'Zapier' to blacklist of clients."
64
64
  end
65
65
  it "adds a hashtag to the blacklist" do
66
66
  k = Ayadn::BlacklistWorkers.new
67
- k.add(['hashtag', 'sports'])
67
+ k.add(['hashtag', 'Sports'])
68
68
  expect(Ayadn::Databases.blacklist['sports']).to eq :hashtag
69
- expect(File.read('spec/mock/ayadn.log')).to include "(wee) INFO -- Added 'sports' to blacklist of hashtags."
69
+ expect(File.read('spec/mock/ayadn.log')).to include "(wee) INFO -- Added 'Sports' to blacklist of hashtags."
70
70
  end
71
71
  it "adds a hashtag to the blacklist" do
72
72
  k = Ayadn::BlacklistWorkers.new
@@ -76,9 +76,9 @@ describe Ayadn::BlacklistWorkers do
76
76
  end
77
77
  it "adds a mention to the blacklist" do
78
78
  k = Ayadn::BlacklistWorkers.new
79
- k.add(['mention', 'mrtest'])
79
+ k.add(['mention', 'mrTest'])
80
80
  expect(Ayadn::Databases.blacklist['@mrtest']).to eq :mention
81
- expect(File.read('spec/mock/ayadn.log')).to include "(wee) INFO -- Added '@mrtest' to blacklist of mentions."
81
+ expect(File.read('spec/mock/ayadn.log')).to include "(wee) INFO -- Added '@mrTest' to blacklist of mentions."
82
82
  end
83
83
  it "adds a mention to the blacklist" do
84
84
  k = Ayadn::BlacklistWorkers.new
@@ -92,11 +92,11 @@ describe Ayadn::BlacklistWorkers do
92
92
  it "removes a client from the blacklist" do
93
93
  k = Ayadn::BlacklistWorkers.new
94
94
  k.add(['client', 'IFTTT'])
95
- expect(Ayadn::Databases.blacklist['IFTTT']).to eq :client
95
+ expect(Ayadn::Databases.blacklist['ifttt']).to eq :client
96
96
  expect(File.read('spec/mock/ayadn.log')).to include "(wee) INFO -- Added 'IFTTT' to blacklist of clients."
97
97
  k = Ayadn::BlacklistWorkers.new
98
98
  k.remove(['client', 'IFTTT'])
99
- expect(Ayadn::Databases.blacklist['IFTTT']).to eq nil
99
+ expect(Ayadn::Databases.blacklist['ifttt']).to eq nil
100
100
  expect(File.read('spec/mock/ayadn.log')).to include "(wee) INFO -- Removed 'client:IFTTT' from blacklist."
101
101
  end
102
102
  end
metadata CHANGED
@@ -1,181 +1,181 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ayadn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.13
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Dejonckheere
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-25 00:00:00.000000000 Z
11
+ date: 2014-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.18'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.18'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rest-client
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.6'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.6'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rainbow
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '2.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: terminal-table
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.4'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.4'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: daybreak
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0.3'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.3'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: pinboard
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: bundler
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '1.5'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '1.5'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rake
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '10.1'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '10.1'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rspec
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '2.14'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '2.14'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rb-fsevent
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - '>='
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0.9'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - '>='
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0.9'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: guard-rspec
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - '>='
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
159
  version: '4.2'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - '>='
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '4.2'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: coveralls
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - '>='
171
+ - - ">="
172
172
  - !ruby/object:Gem::Version
173
173
  version: '0'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - '>='
178
+ - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
181
  description: 'App.net command-line client: toolbox to access and manage your ADN data,
@@ -187,10 +187,10 @@ executables:
187
187
  extensions: []
188
188
  extra_rdoc_files: []
189
189
  files:
190
- - .coveralls.yml
191
- - .gitignore
192
- - .rspec
193
- - .travis.yml
190
+ - ".coveralls.yml"
191
+ - ".gitignore"
192
+ - ".rspec"
193
+ - ".travis.yml"
194
194
  - CHANGELOG.md
195
195
  - Gemfile
196
196
  - Guardfile
@@ -259,17 +259,17 @@ require_paths:
259
259
  - lib
260
260
  required_ruby_version: !ruby/object:Gem::Requirement
261
261
  requirements:
262
- - - '>='
262
+ - - ">="
263
263
  - !ruby/object:Gem::Version
264
264
  version: 1.9.3
265
265
  required_rubygems_version: !ruby/object:Gem::Requirement
266
266
  requirements:
267
- - - '>='
267
+ - - ">="
268
268
  - !ruby/object:Gem::Version
269
269
  version: '0'
270
270
  requirements: []
271
271
  rubyforge_project:
272
- rubygems_version: 2.0.3
272
+ rubygems_version: 2.2.2
273
273
  signing_key:
274
274
  specification_version: 4
275
275
  summary: App.net command-line client.