ayadn 1.7.4 → 1.7.5

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: c26bb80eb4bb55ac2d2cfe880d8d0c0de1a11095
4
- data.tar.gz: 9ba0314b825df65ce3c9aad1d2e7409bb602bde1
3
+ metadata.gz: b101f2949d37db133dd7f1955d95aec8fac1424c
4
+ data.tar.gz: 32222443d4c962edaf8fbbb2658bb9716284c55c
5
5
  SHA512:
6
- metadata.gz: 0bc03fa598ae9666acdaaf1f871c89ded15e61e9cbad4e5d0b1309cf51eb6fc74fde836bf826780492ea8bfc020c0436c45ea3035aa32f29478ba55f5d597cc2
7
- data.tar.gz: 176e6a11ca6871ebff6c6eee4bebe0dc446d8d0a69b66dbec04a2d7b679edbcecf076878c68142dd9b1d4a05e7ee084e964df4f7a079998364c5fa9e351200b4
6
+ metadata.gz: 26014e72af700bcecee4792546ca015ca9efdb8083042b3bf2498cc940ef11501917d946f7d30f149b3b19ce2a88f027d7270b8741b298e8660a5be85cd6c62c
7
+ data.tar.gz: 74d280a4461e5f78ec746e4506b23cd433f3338a118a960324b7849b6d92c12b1e6e3d28523ff1ec2fc372273813c39c706b099897e1af563ef8440862aca838
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 1.7.5 (2014-10-20) - 'Cirrus'
2
+
3
+ - New: option to display a compact view for the timeline
4
+ - Fix: character count in reply with Markdown links
5
+
1
6
  # 1.7.4 (2014-09-21) - 'Elton'
2
7
 
3
8
  - Fix: nowplaying (show artwork)
data/doc/05-streams.md CHANGED
@@ -115,6 +115,16 @@ Differences will occur due to ADN policy:
115
115
 
116
116
  - Other streams, search, tags: temporarily disables the Blacklist databases
117
117
 
118
+ ### COMPACT
119
+
120
+ Removes the line-breaks when possible, and forces the view to be "compact".
121
+
122
+ Set it with:
123
+
124
+ `ayadn set timeline compact true`
125
+
126
+ You may want to change colors to create visual marks between posts if you choose the compact view, i.e. putting the all header in the same color (post id, username, name, etc).
127
+
118
128
 
119
129
  # GLOBAL
120
130
 
data/lib/ayadn/action.rb CHANGED
@@ -379,7 +379,11 @@ module Ayadn
379
379
  Errors.repost(post_id, resp['repost_of']['id'])
380
380
  @view.show_simple_post([resp['repost_of']], options)
381
381
  end
382
- puts "AUTHOR:\n".inverse
382
+ if Settings.options[:timeline][:compact] == true
383
+ puts "\nAUTHOR:\n".inverse
384
+ else
385
+ puts "AUTHOR:\n".inverse
386
+ end
383
387
  if response['data']['username'] == Settings.config[:identity][:username]
384
388
  @view.show_userinfos(stream, @api.get_token_info['data'], true)
385
389
  else
data/lib/ayadn/errors.rb CHANGED
@@ -3,7 +3,7 @@ module Ayadn
3
3
  class Errors
4
4
 
5
5
  def self.global_error(args)
6
- abort(Status.wtf) if Logs.nil?
6
+ abort(Status.wtf) if Logs.nil? || Logs.rec.nil?
7
7
  Logs.rec.error "--BEGIN--"
8
8
  Logs.rec.error "CAUSE: #{args[:error]}"
9
9
  Logs.rec.debug "DATA: #{args[:data]}"
data/lib/ayadn/post.rb CHANGED
@@ -106,6 +106,10 @@ module Ayadn
106
106
  end
107
107
 
108
108
  def post_size(post) # works on a string
109
+ words = post.split(" ")
110
+ result = []
111
+ words.each { |word| result << get_markdown_text(word) }
112
+ post = result.join(" ")
109
113
  size, max_size = post.length, Settings.config[:post_max_length]
110
114
  if size < 1
111
115
  abort(error_text_empty)
data/lib/ayadn/set.rb CHANGED
@@ -431,7 +431,7 @@ module Ayadn
431
431
  @input = meth.to_s
432
432
  @output = validate(options)
433
433
  case @input
434
- when 'directed', 'html', 'show_source', 'show_symbols', 'show_real_name', 'show_date', 'show_spinner', 'show_debug'
434
+ when 'directed', 'html', 'show_source', 'show_symbols', 'show_real_name', 'show_date', 'show_spinner', 'show_debug', 'compact'
435
435
  Settings.options[:timeline][meth.to_sym] = @output
436
436
  when 'deleted', 'annotations'
437
437
  abort(Status.not_mutable)
@@ -99,6 +99,7 @@ module Ayadn
99
99
  conf[:movie] = {hashtag: 'nowwatching'} if conf[:movie].nil?
100
100
  conf[:tvshow] = {hashtag: 'nowwatching'} if conf[:tvshow].nil?
101
101
  conf[:formats][:list] = {reverse: true} if conf[:formats][:list].nil?
102
+ conf[:timeline][:compact] = false if conf[:timeline][:compact].nil?
102
103
 
103
104
  @options = conf
104
105
  self.write_config_file(config_file, @options)
@@ -174,7 +175,8 @@ module Ayadn
174
175
  show_real_name: true,
175
176
  show_date: true,
176
177
  show_spinner: true,
177
- show_debug: false
178
+ show_debug: false,
179
+ compact: false
178
180
  },
179
181
  counts: {
180
182
  default: 50,
data/lib/ayadn/stream.rb CHANGED
@@ -14,11 +14,16 @@ module Ayadn
14
14
  options = settings.dup
15
15
  options[:filter] = nicerank_true()
16
16
  @view.downloading(options)
17
- stream = @api.get_global(options)
18
- Settings.options[:force] == true ? niceranks = {} : niceranks = NiceRank.new.get_ranks(stream)
19
- Check.no_new_posts(stream, options, 'global')
20
- Databases.save_max_id(stream, 'global') unless stream['meta']['max_id'].nil?
21
- @view.render(stream, options, niceranks)
17
+ unless options[:scroll]
18
+ stream = @api.get_global(options)
19
+ Settings.options[:force] == true ? niceranks = {} : niceranks = NiceRank.new.get_ranks(stream)
20
+ Check.no_new_posts(stream, options, 'global')
21
+ Databases.save_max_id(stream, 'global') unless stream['meta']['max_id'].nil?
22
+ @view.render(stream, options, niceranks)
23
+ end
24
+ if Settings.options[:timeline][:compact] == true && options[:scroll] == true
25
+ @view.clear_screen()
26
+ end
22
27
  Scroll.new(@api, @view).global(options) if options[:scroll]
23
28
  end
24
29
 
@@ -39,10 +44,15 @@ module Ayadn
39
44
  def stream meth, options, target
40
45
  Settings.options[:force] = true if options[:force]
41
46
  @view.downloading(options)
42
- stream = @api.send("get_#{meth}".to_sym, options)
43
- Check.no_new_posts(stream, options, target)
44
- Databases.save_max_id(stream)
45
- @view.render(stream, options)
47
+ unless options[:scroll]
48
+ stream = @api.send("get_#{meth}".to_sym, options)
49
+ Check.no_new_posts(stream, options, target)
50
+ Databases.save_max_id(stream)
51
+ @view.render(stream, options)
52
+ end
53
+ if Settings.options[:timeline][:compact] == true && options[:scroll] == true
54
+ @view.clear_screen()
55
+ end
46
56
  Scroll.new(@api, @view).send(meth, options) if options[:scroll]
47
57
  end
48
58
 
@@ -52,13 +62,18 @@ module Ayadn
52
62
  Check.no_username(username)
53
63
  username = @workers.add_arobase(username)
54
64
  @view.downloading(options)
55
- stream = @api.get_mentions(username, options)
56
- Check.no_user(stream, username)
57
- Databases.save_max_id(stream)
58
- Check.no_data(stream, 'mentions')
59
- options = options.dup
60
- options[:in_mentions] = true
61
- @view.render(stream, options)
65
+ unless options[:scroll]
66
+ stream = @api.get_mentions(username, options)
67
+ Check.no_user(stream, username)
68
+ Databases.save_max_id(stream)
69
+ Check.no_data(stream, 'mentions')
70
+ options = options.dup
71
+ options[:in_mentions] = true
72
+ @view.render(stream, options)
73
+ end
74
+ if Settings.options[:timeline][:compact] == true && options[:scroll] == true
75
+ @view.clear_screen()
76
+ end
62
77
  Scroll.new(@api, @view).mentions(username, options) if options[:scroll]
63
78
  end
64
79
 
data/lib/ayadn/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Ayadn
3
- VERSION = "1.7.4"
3
+ VERSION = "1.7.5"
4
4
  end
data/lib/ayadn/view.rb CHANGED
@@ -551,12 +551,12 @@ module Ayadn
551
551
  def build_content(content)
552
552
  view = ""
553
553
  view << build_header(content)
554
- view << "\n"
554
+ view << "\n" unless Settings.options[:timeline][:compact] == true
555
555
  view << content[:text]
556
- view << "\n"
556
+ view << "\n" unless Settings.options[:timeline][:compact] == true
557
557
  if content[:has_checkins]
558
558
  view << build_checkins(content)
559
- view << "\n"
559
+ view << "\n" unless Settings.options[:timeline][:compact] == true
560
560
  end
561
561
  unless content[:links].empty?
562
562
  view << "\n"
@@ -565,7 +565,15 @@ module Ayadn
565
565
  view << "\n"
566
566
  end
567
567
  end
568
- view << "\n\n"
568
+ if Settings.options[:timeline][:compact] == true
569
+ if content[:links].empty?
570
+ view << "\n"
571
+ else
572
+ view
573
+ end
574
+ else
575
+ view << "\n\n"
576
+ end
569
577
  end
570
578
 
571
579
  def build_header(content)
@@ -598,8 +606,12 @@ module Ayadn
598
606
  else
599
607
  num_dots = 10
600
608
  end
601
- hd = (".".color(Settings.options[:colors][:dots])) * num_dots
602
- hd << "\n"
609
+ if Settings.options[:timeline][:compact] == true
610
+ hd = "\n"
611
+ else
612
+ hd = (".".color(Settings.options[:colors][:dots])) * num_dots
613
+ hd << "\n"
614
+ end
603
615
  formatted = { header: hd }
604
616
  content[:checkins].each do |key, val|
605
617
  formatted[key] = val
data/lib/ayadn/workers.rb CHANGED
@@ -113,7 +113,9 @@ module Ayadn
113
113
  else
114
114
  table << [ "@#{username} ".color(Settings.options[:colors][:username]), "", posts_day ]
115
115
  end
116
- table << :separator unless index + 1 == list.length
116
+ if index + 1 != list.length && Settings.options[:timeline][:compact] == false
117
+ table << :separator
118
+ end
117
119
  end
118
120
  table
119
121
  end
@@ -472,7 +474,12 @@ module Ayadn
472
474
  sentences << words.join(' ')
473
475
  words = Array.new
474
476
  end
475
- sentences.join("\n")
477
+ if Settings.options[:timeline][:compact] == true
478
+ without_linebreaks = sentences.keep_if { |s| s != "" }
479
+ without_linebreaks.join("\n")
480
+ else
481
+ sentences.join("\n")
482
+ end
476
483
  end
477
484
 
478
485
  def links_from_posts(stream)
@@ -11,6 +11,7 @@ describe Ayadn::Workers do
11
11
  mentions: :red,
12
12
  username: :green
13
13
  },
14
+ timeline: {compact: false},
14
15
  formats: {table: {width: 75}, list: {reverse: true}}
15
16
  })
16
17
  Ayadn::Logs.stub(:rec).and_return("logged")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ayadn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.4
4
+ version: 1.7.5
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-09-21 00:00:00.000000000 Z
11
+ date: 2014-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor