liveblog 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 15a732f45a27c55eea7352f47c9212bba818eacf
4
+ data.tar.gz: 7aebeb3deb806d32974cef6ffe544f76b2188eb2
5
+ SHA512:
6
+ metadata.gz: 0b1c61fec881d4c3443f71834bf6bf5df97a2e937d8a81466c99750680a1440b37a1aa4e9c2846c78ea4449873e7ad7f69172da61ae596ef3cea421f906c449f
7
+ data.tar.gz: 356dd829e518e00d5dd596a1926eebb38b8661bb565256974c75d1692df0782cfd00a19affdf1f119b06e6ab87a56956e4b67958ccc4417f33b31ecb79d796f8
Binary file
Binary file
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: liveblog.rb
4
+
5
+ require 'time'
6
+ require 'dynarex'
7
+ require 'fileutils'
8
+
9
+ class LiveBlog
10
+
11
+ def initialize(liveblogfilepath='.')
12
+
13
+ Dir.chdir liveblogfilepath
14
+ @t = Time.now
15
+ dxfile = File.join(path(), 'index.xml')
16
+ @dx = Dynarex.new dxfile if File.exists? dxfile
17
+
18
+ end
19
+
20
+ def new_file
21
+
22
+ s =<<EOF
23
+ <?dynarex schema="sections[title]/section(x)"?>
24
+ title: LiveBlog #{ordinalize(@t.day) + @t.strftime(" %B %Y")}
25
+ --#
26
+
27
+ EOF
28
+
29
+ FileUtils.mkdir_p path()
30
+
31
+ @dx = Dynarex.new
32
+ @dx.import s
33
+ @dx.default_key = 'uid'
34
+ save()
35
+
36
+ end
37
+
38
+ def add_entry(hashtag, entry)
39
+
40
+ a = @dx.all
41
+ rec = a.find {|section| section.x.lstrip.lines.first =~ /#\s*#{hashtag}/}
42
+
43
+ if rec then
44
+ rec.x += "\n" + entry
45
+ save()
46
+ 'section entry added'
47
+ else
48
+ 'rec not found'
49
+ end
50
+ end
51
+
52
+ def add_section(entry)
53
+
54
+ @dx.create({x: entry})
55
+ save()
56
+ end
57
+
58
+ def save()
59
+
60
+ @dx.save File.join(path(), 'index.xml')
61
+ File.write File.join(path(), 'index.txt'), @dx.to_s
62
+ end
63
+
64
+ private
65
+
66
+ def path
67
+
68
+ File.join [@t.year.to_s, Date::MONTHNAMES[@t.month].downcase[0..2], \
69
+ @t.day.to_s]
70
+ end
71
+
72
+ def ordinalize(n)
73
+ n.to_s + ( (10...20).include?(n) ? 'th' :
74
+ %w{ th st nd rd th th th th th th }[n % 10] )
75
+ end
76
+
77
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: liveblog
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTE1MDMxMjIzNDEzOVoXDTE2MDMxMTIzNDEzOVowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBAK3liU6rFtXLhC9XtFBW1E9cE2i7mDK6TnYbUaKRzKJHCM9Meoxu0c12dKDj
19
+ iQ5j+i6+muTF58c9f2YElqipWlM69d30cIQu6n7K/yJFKzHmqOmV6sdOh3ilPpOP
20
+ 2QGxkMthA5n/PeH1MlEEAA0FrfKGpDEn0YX+hkZF7b5mZc/dtSQsjb4BaxQDFhm+
21
+ kgWG6urVVTpwVaLQ+cbaFHIjPy+LIoUCYt/+4wEiL4CWNCYEph3NvKVDjs0/VYfM
22
+ TswU2OHgPVrNcQxy2bUHQ7JFK1sH1TJA5wh2bKHdVN6vsVOd7AgT2eRYvVD3/KHf
23
+ l/ElgdZdNpYZKYHQ0ndNIgqJCKMCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUALj67aBbm6G2OzoII0CLfVAyB/MwJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAGyUMy4Ph
27
+ yHp82KEvvD+PJIz7GExtX6rGFslNH7nvGiY+OWwasGAIc3+5ApYrV95e99fYQUGH
28
+ aVaaHly+MOqjjyt90uNXJiVBNyEFzGjnjQqlB13tv4NSfzFKJcUuMbrK2KYWnBpr
29
+ /07ftvHeNU6zVJ62jOoNl70k9kU0NIGhkuicdHlaRHHSLb7phjLH/mnmBAKzcCxH
30
+ /QdbNf7AXe3vo8vzK4W7cK92lJHFcrWc57mZHQBb3DvjpWVCVfo4gbqr5RhhpiAy
31
+ WoOSxvsTN7qoA8F0W4mkDpf+HhHxBOLTPykcHMIlx2gILLnNraaZ1rJlZAqWABGj
32
+ v8lGgeeqqjd5QA==
33
+ -----END CERTIFICATE-----
34
+ date: 2015-03-12 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: dynarex
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '1.5'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 1.5.2
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '1.5'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 1.5.2
56
+ description:
57
+ email: james@r0bertson.co.uk
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/liveblog.rb
63
+ homepage: https://github.com/jrobertson/liveblog
64
+ licenses:
65
+ - MIT
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 2.2.2
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: Uses the Dynarex gem to create a daily live blog. Convenient for grouping
87
+ together microblog posts
88
+ test_files: []
@@ -0,0 +1,4 @@
1
+ fm���ZӢ%Q��!�n�,2�-���
2
+ m�N�u��y��D�e�%�K8��������t���nk$fO��@>�66_°[����S@w������B`��" x�s����OIS�vZ�B;�Dav}
3
+ ���:�.�`b�a��({���ZT�4���);����>y�q_�x&�c|���#I��(��r[\I
4
+ #n.v�8.��N7޾6"O��oFtL�X��-岯>�Rml��D�i�:��as�+�/,��