liveblog 1.0.0 → 1.0.1

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: 669ca13e2b010df1a25cd13f1f73f3d2bf8e6e11
4
- data.tar.gz: f982be782bd5d907f999fd1f3c7d57ce313fc11c
3
+ metadata.gz: b6234e5003f2f5baef97a08d4c4e714fd2f27143
4
+ data.tar.gz: 1569ef567376d26263dec90350eec69bb8da6b03
5
5
  SHA512:
6
- metadata.gz: e3a46da80daa9240f12ac2de859533fb51a8dc63b3694035827deb33f4c575dadb623e4670d5b69f1ac49d3113801ab4f6884fb64b84c67cccaeb4c7edd20226
7
- data.tar.gz: ee3903ecfbbbbf0e807169f97f0ee7fed514709c60c802fc2f0690811af723dbe947c82748c9d3bfa6eff877a23c9184cbcb279908e4a2d41fcb2c5409ae651b
6
+ metadata.gz: 982a9b7e99102c71ddb06b156e5ca9aea393dfa201ecc5dfc8e2998764acef7d63d14f03bbe1561c6735d56a0aa5bdc83d5b21212b0e93c2b56fdd4484bd3d39
7
+ data.tar.gz: 3ec9f3da634e75811bb924f573451a90eb9e208e3c0846388e1a77b9198080441b12519b0dd41847295985858d7f438eefbc474e4cdcf0fbb9872acac6d35856
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/liveblog.rb CHANGED
@@ -31,18 +31,20 @@ class LiveBlog
31
31
 
32
32
  h = SimpleConfig.new(config).to_h
33
33
 
34
- dir, @urlbase, @edit_url, @css_url, @xsl_path, \
35
- @xsl_url, @bannertext, @title, @rss_title, @rss_lang = \
34
+ @dir, @urlbase, @edit_url, @css_url, @xsl_path, \
35
+ @xsl_url, @bannertext, @title, @rss_title, @rss_lang, plugins = \
36
36
  (%i(dir urlbase edit_url css_url xsl_path xsl_url bannertext)\
37
- + %i(title rss_title rss_lang)).map{|x| h[x]}
37
+ + %i(title rss_title rss_lang plugins)).map{|x| h[x]}
38
38
 
39
39
  @title ||= 'LiveBlog'
40
40
  @rss_lang ||= 'en-gb'
41
41
 
42
- Dir.chdir dir
42
+ Dir.chdir @dir
43
43
 
44
44
  @d = date
45
45
  dxfile = File.join(path(), 'index.xml')
46
+
47
+ initialize_plugins(plugins)
46
48
 
47
49
  if File.exists? dxfile then
48
50
 
@@ -54,21 +56,22 @@ class LiveBlog
54
56
  new_file()
55
57
  link_today()
56
58
 
57
- end
58
-
59
- # intialize plugins
59
+ @plugins.each do |x|
60
60
 
61
- @plugins = plugins.inject([]) do |r, plugin|
62
-
63
- name, settings = plugin
64
- return r if settings[:active] == false and !settings[:active]
65
-
66
- klass_name = 'LiveBlogPlugin' + name.to_s.split(/[-_]/).map{|x| x.capitalize}.join
67
-
68
- r << Kernel.const_get(klass_name).new(settings: settings, variables: @variables)
61
+ if x.respond_to? :on_new_day then
62
+
63
+ yesterdays_index_file = File.join(path(@d-1), 'index.xml')
69
64
 
70
- end
65
+ return unless File.exists? yesterdays_index_file
66
+ x.on_new_day(yesterdays_index_file, @urlbase + urlpath(@d-1))
67
+
68
+ end
69
+
70
+ end
71
71
 
72
+ end
73
+
74
+
72
75
  end
73
76
 
74
77
  def add_entry(raw_entry)
@@ -110,6 +113,22 @@ class LiveBlog
110
113
  @dx.find hashtag[/\w+$/]
111
114
  end
112
115
 
116
+ def initialize_plugins(plugins)
117
+ #
118
+ @plugins = plugins.inject([]) do |r, plugin|
119
+
120
+ name, settings = plugin
121
+ return r if settings[:active] == false and !settings[:active]
122
+
123
+ klass_name = 'LiveBlogPlugin' + name.to_s
124
+
125
+ r << Kernel.const_get(klass_name)\
126
+ .new(settings: settings, variables: {filepath: @dir})
127
+
128
+ end
129
+ end
130
+
131
+
113
132
  # Use with yesterday's liveblog;
114
133
  #
115
134
  def link_today()
@@ -534,4 +553,4 @@ EOF
534
553
  nil
535
554
  end
536
555
  end
537
- end
556
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liveblog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  WoOSxvsTN7qoA8F0W4mkDpf+HhHxBOLTPykcHMIlx2gILLnNraaZ1rJlZAqWABGj
32
32
  v8lGgeeqqjd5QA==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-06-11 00:00:00.000000000 Z
34
+ date: 2015-06-13 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: dynarex
metadata.gz.sig CHANGED
Binary file