journaltxt 0.0.1 → 1.0.0

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: c32f384a50536df5f9c7997e721912cfd90f60e6
4
- data.tar.gz: 0bf922b19677baf36a160a2e147a0c6e67895d89
3
+ metadata.gz: 0322499b7aa32d50778470dfeb81fd0318e1795a
4
+ data.tar.gz: cf684977e3e28615aef65bc4dbc886012472cd84
5
5
  SHA512:
6
- metadata.gz: 70ffa8e8fc8cafeabff2d18658812712bfe1bab4aadd57a033b53b414a905cb4f594d798e0becad0885baaa8027a6e06ceb3522bc3926edb354743383969adb8
7
- data.tar.gz: 9f558373699db8c8a55ae2412bb1912fb1ed73b36e854730c54159d80b22fcf991ea23fec665745598cf371236cb4588acb2f28c245cc7b8f599d181688e9d5f
6
+ metadata.gz: fef0ccacf2d852ef6ef78657178663d0e2ef4a46df52aea5cd49bb1520376ab5ce3cad0bd0285a013c0b1893ac86e02a6b5fae2c73d73710265cf703ed572a1d
7
+ data.tar.gz: 4e789f63161222b3ff526bd70a92339e07903011c8d5782aa4168329c3a8c1ea95f4c0c635467bf7e52f72d30f93b658292b5a7a22a0518d46da1422550cb6fe
data/Manifest.txt CHANGED
@@ -2,7 +2,14 @@ HISTORY.md
2
2
  Manifest.txt
3
3
  README.md
4
4
  Rakefile
5
+ bin/jo
6
+ bin/journaltxt
5
7
  lib/journaltxt.rb
8
+ lib/journaltxt/parser.rb
6
9
  lib/journaltxt/version.rb
10
+ test/data/journal.txt
11
+ test/data/vienna.txt
7
12
  test/helper.rb
13
+ test/test_build.rb
14
+ test/test_parser.rb
8
15
  test/test_version.rb
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # journaltxt - reads Journal.TXT and writes out a blog (w/ Jekyll posts etc.)
1
+ # journaltxt - reads Journal.TXT and writes out (auto-builds) a blog (w/ Jekyll posts etc.)
2
2
 
3
3
  * home :: [github.com/journaltxt/journaltxt](https://github.com/journaltxt/journaltxt)
4
- * bugs :: [github.com/feedtxt/journaltxt/issues](https://github.com/journaltxt/journaltxt/issues)
4
+ * bugs :: [github.com/journaltxt/journaltxt/issues](https://github.com/journaltxt/journaltxt/issues)
5
5
  * gem :: [rubygems.org/gems/journaltxt](https://rubygems.org/gems/journaltxt)
6
6
  * rdoc :: [rubydoc.info/gems/journaltxt](http://rubydoc.info/gems/journaltxt)
7
7
  * forum :: [groups.google.com/group/wwwmake](http://groups.google.com/group/wwwmake)
@@ -9,7 +9,99 @@
9
9
 
10
10
  ## Usage
11
11
 
12
- To be done
12
+ Use the single-file [Journal.TXT format](https://journaltxt.github.io)
13
+ to write your blog posts / journal entries.
14
+ Example:
15
+
16
+ ```
17
+ ---
18
+ year: 2017
19
+ month: July
20
+ day: Mon 17
21
+ ---
22
+
23
+ Jumping on tram #1 in front of the Staatsoper (state opera house).
24
+ Circling the Ringstrasse (grand boulevard vienna ring road)
25
+ for a great tour with a public transport ticket.
26
+ Passing the Hofburg (imperial palace), Parlament,
27
+ Burggarten (imperial court's garden),
28
+ Rathaus (city council), Burgtheater (imperial court's theatre),
29
+ Vienna University, and more. [...]
30
+
31
+ ---
32
+ day: Tue 18
33
+ ---
34
+
35
+ Visiting the imperial palace Schönbrunn - the former summer residence
36
+ of the Habsburg family.
37
+ Taking an inside tour of the 1 441-room baroque palace.
38
+ Enjoying the Neptune Fountain and sculptures in the public garden. [...]
39
+
40
+ ---
41
+ day: Wed 19
42
+ ---
43
+
44
+ Visiting the Sigmund Freud Museum in Bergstrasse 9. Too much culture -
45
+ need a beer therapy soon.
46
+ Passing through the Palais Lichtenstein to the
47
+ Beaver Brewing Co. (Liechtensteinstraße 69). [...]
48
+ ```
49
+
50
+ (Source: [samples/Vienna.txt](https://github.com/journaltxt/journaltxt.github.io/blob/master/samples/Vienna.txt))
51
+
52
+
53
+ Try the `journaltxt` or `jo` (shortened alternate) command line tool e.g.:
54
+
55
+ ```
56
+ $ journaltxt --help
57
+
58
+ Usage: journaltxt [OPTS] [JOURNAL.TXT FILES...]
59
+ -v, --[no-]verbose Show debug messages
60
+ -o, --output=PATH Output path (default: .)
61
+ -n, --name=NAME Journal name (default: Journal)
62
+ --[no-]date Add date to page title (default: true)
63
+ -h, --help Prints this help
64
+ ```
65
+
66
+ For example, to auto-build all posts for a static Jekyll website / blog
67
+ in the `YYYY-MM-DD-title.md` format from a single-file in the Journal.TXT format
68
+ e.g. [Vienna.txt](https://github.com/journaltxt/journaltxt.github.io/blob/master/samples/Vienna.txt) use:
69
+
70
+ ```
71
+ $ journaltxt --output=_posts Vienna.txt
72
+ -or-
73
+ $ journaltxt -o _posts Vienna.txt
74
+ -or-
75
+ $ jo -o _posts Vienna.txt
76
+ ```
77
+
78
+ resulting in:
79
+
80
+ ```
81
+ Writing entry 1/3 >Vienna - Day 1< to ./_posts/2017-07-17-vienna.md...
82
+ Writing entry 2/3 >Vienna - Day 2< to ./_posts/2017-07-18-vienna.md...
83
+ Writing entry 3/3 >Vienna - Day 3< to ./_posts/2017-07-19-vienna.md...
84
+ ```
85
+
86
+ That's it.
87
+ **See the live auto-built [Vienna.TXT Blog »](https://journaltxt.github.io/blog)**
88
+
89
+
90
+ ## Bonus: Add Your Perfect Day!
91
+
92
+ Berlin.TXT, Munich.TXT, Salzburg.TXT, Paris.TXT, London.TXT, Rome.TXT, New York.TXT, Austin.TXT, Tornoto.TXT, Calgary.TXT,
93
+ Melbourne.TXT, Sydney.TXT, ... - Anyone?
94
+ Write your perfect day(s) in a single-text file with Journal.TXT.
95
+
96
+
97
+
98
+ ## Install
99
+
100
+ Just install the gem:
101
+
102
+ ```
103
+ $ gem install journaltxt
104
+ ```
13
105
 
14
106
 
15
107
  ## License
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ Hoe.spec 'journaltxt' do
5
5
 
6
6
  self.version = Journaltxt::VERSION
7
7
 
8
- self.summary = "journaltxt - reads Journal.TXT and writes out a blog (w/ Jekyll posts etc.)"
8
+ self.summary = "journaltxt - reads Journal.TXT and writes out (auto-builds) a blog (w/ Jekyll posts etc.)"
9
9
  self.description = summary
10
10
 
11
11
  self.urls = ['https://github.com/journaltxt/journaltxt']
data/bin/jo ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'journaltxt'
4
+
5
+ Journaltxt.main
data/bin/journaltxt ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'journaltxt'
4
+
5
+ Journaltxt.main
@@ -0,0 +1,121 @@
1
+ # encoding: utf-8
2
+
3
+ module Journaltxt
4
+
5
+ class Parser
6
+
7
+ def self.parse( text ) ## convenience helper
8
+ self.new( text ).parse
9
+ end
10
+
11
+ def initialize( text )
12
+ @text = text
13
+ end
14
+
15
+ def parse
16
+
17
+ puts ":: Text :::::::::::::::::::::"
18
+ puts @text
19
+
20
+ ## allow trailing spaces for now
21
+ ## - allow leadin spaces too - why? why not?
22
+
23
+ ## remove leading 1st separator --- first
24
+ text = @text.sub( /^---[ ]*$\n?/, '' )
25
+ b = text.split( /^---[ ]*$\n?/ )
26
+
27
+ items = b.each_slice(2).to_a
28
+
29
+
30
+ ## process meta data blocks convert to hash via yaml
31
+
32
+ ##
33
+ ## todo: check for required entries
34
+ ##
35
+ ## first entry needs/requires:
36
+ ## year/month/day
37
+ ## all others requireÖ
38
+ ## day
39
+
40
+ last_page_date = nil
41
+
42
+ items = items.each_with_index.map do |item,i|
43
+ page_meta = YAML.load( item[0] ) ## convert to hash (from yaml text)
44
+ pp page_meta
45
+ page_content = item[1]
46
+
47
+ ## remove all (short-cut) date entries
48
+ year = page_meta.delete( 'year' )
49
+ month = page_meta.delete( 'month' )
50
+ day = page_meta.delete( 'day' )
51
+
52
+ puts " year: >#{year}< : #{year.class.name}, month: >#{month}< : #{month.class.name}, day: >#{day}< : #{day.class.name}"
53
+
54
+ ## convert all date entries to ints
55
+ ## lets us handle day => Sun 23 etc.
56
+
57
+ ## note: assume year is always a number
58
+ if year.nil?
59
+ if last_page_date
60
+ year = last_page_date.year
61
+ else
62
+ ### fix/todo: throw format/parse exception!!
63
+ puts "** year entry required / expected for first entry / meta data block"
64
+ exit 1
65
+ end
66
+ end
67
+
68
+
69
+ if day && day.is_a?(String)
70
+ puts " trying to convert day to int..."
71
+ nums_day = day.scan( /[0-9]+/ ) ## returns array e.g. ['12']
72
+ day = nums_day[0].to_i
73
+ puts " day: >#{day}< : #{day.class.name}"
74
+ end
75
+
76
+ if day.nil? ### fix/add - check if day >0 and< 31 why? why not??
77
+ ### fix/todo: throw format/parse exception!!
78
+ puts "** day entry required in meta data block"
79
+ exit 1
80
+ end
81
+
82
+
83
+ if month && month.is_a?(String)
84
+ puts " trying to convert month to int..."
85
+ ## for now let stdlib handle conversion
86
+ ## supports abbreviated names (e.g. Jan) and full names (e.g. January)
87
+
88
+ ## todo/fix: check what happens if montn is invalid/unknow
89
+ ## returns nil? throws exception?
90
+ date_month = Date.parse( "#{year}/#{month}/#{day}" )
91
+ month = date_month.month
92
+ puts " month: >#{month}< : #{month.class.name}"
93
+ end
94
+
95
+ if month.nil?
96
+ if last_page_date
97
+ month = last_page_date.month
98
+ else
99
+ ### fix/todo: throw format/parse exception!!
100
+ puts "** month entry required for first entry / meta data block"
101
+ exit 1
102
+ end
103
+ end
104
+
105
+
106
+ page_date = Date.new( year, month, day )
107
+ last_page_date = page_date
108
+
109
+ ## todo:check if date exists? possible?
110
+ ## issue warning or something - will get replaced - why? why not?
111
+ page_meta['date'] = page_date
112
+
113
+ ## pp YAML.dump( h )
114
+
115
+ [page_meta, page_content]
116
+ end
117
+ items
118
+ end # method parse
119
+
120
+ end # class Parser
121
+ end # module Journaltxt
@@ -2,9 +2,9 @@
2
2
 
3
3
  module Journaltxt
4
4
 
5
- MAJOR = 0
5
+ MAJOR = 1
6
6
  MINOR = 0
7
- PATCH = 1
7
+ PATCH = 0
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
10
10
  def self.version
data/lib/journaltxt.rb CHANGED
@@ -3,23 +3,167 @@
3
3
 
4
4
  # core and stdlibs
5
5
 
6
- require 'strscan' ## StringScanner
7
- require 'json'
8
6
  require 'yaml'
9
7
  require 'date'
10
8
  require 'time'
11
9
  require 'pp'
10
+ require 'optparse'
12
11
 
13
12
 
13
+ # our own code
14
+ require 'journaltxt/version' # let it always go first
15
+ require 'journaltxt/parser'
14
16
 
15
- # 3rd party gems/libs
16
- require 'logutils'
17
- require 'props' ## used for IniFile.parse
18
17
 
18
+ module Journaltxt
19
19
 
20
- # our own code
21
- require 'journaltxt/version' # let it always go first
20
+ def self.main
21
+ process( ARGV )
22
+ end
23
+
24
+
25
+ DEFAULTS = { outpath: '.',
26
+ date: true, # include date in (auto-)title
27
+ verbose: false,
28
+ name: 'Journal'
29
+ }
30
+
31
+ def self.process( args )
32
+
33
+ config = {} ## note: keep use supplied and defaults separated!!! entry nil - if not set!!
34
+
35
+ parser = OptionParser.new do |opts|
36
+ opts.banner = "Usage: journaltxt [OPTS]"
37
+
38
+ opts.on("-v", "--[no-]verbose", "Show debug messages") do |verbose|
39
+ config[:verbose] = verbose
40
+ end
41
+
42
+ ## use --outdir or outputdir or something or output
43
+ opts.on("-o", "--output=PATH", "Output path (default: #{DEFAULTS[:outpath]})") do |outpath|
44
+ config[:outpath] = outpath
45
+ end
46
+
47
+ opts.on("-n", "--name=NAME", "Journal name (default: #{DEFAULTS[:name]})") do |name|
48
+ config[:name] = name
49
+ end
50
+
51
+ opts.on("--[no-]date", "Add date to page title (default: #{DEFAULTS[:date]})") do |date|
52
+ config[:date] = date
53
+ end
54
+
55
+ opts.on("-h", "--help", "Prints this help") do
56
+ puts opts
57
+ exit
58
+ end
59
+ end
60
+
61
+ parser.parse!(args)
62
+
63
+ puts ":: Config :::"
64
+ pp config
65
+ puts ":: Args :::"
66
+ pp args
67
+
68
+ if args.size == 0 ## default to journal.txt if no filename passed along
69
+ args << 'journal.txt'
70
+ end
71
+
72
+ args.each do |arg|
73
+ build_file( arg, config )
74
+ end
75
+ end
76
+
77
+
78
+ def self.build_file( path, opts={} )
79
+ text = File.open( path, 'r:bom|utf-8' ).read
80
+
81
+ ## note: remove .txt extension if present for basename
82
+ basename = File.basename( path, '.txt' )
83
+ puts "basename:"
84
+ pp basename
85
+
86
+ ## note: only overwrite if NOT user-supplied
87
+ opts[:name] ||= basename
88
+
89
+ build( text, opts )
90
+ end
91
+
92
+
93
+ def self.build( text, opts={} )
94
+ puts ":: Opts :::"
95
+ pp opts
96
+
97
+ outpath = opts[:outpath] || DEFAULTS[:outpath]
98
+ name = opts[:name] || DEFAULTS[:name]
99
+ add_date = opts.fetch( :date, DEFAULTS[:date] ) ## special case boolean flag migth be false
100
+
101
+
102
+ items = Parser.parse( text )
103
+
104
+ items.each_with_index do |item,i|
105
+ ## add page_title
106
+ ## todo/fix: check if title exists? do NOT overwrite - why? why not?
107
+
108
+ page_meta = item[0]
109
+ page_date = page_meta['date']
110
+
111
+ page_title = ''
112
+ if name.downcase == 'journal' ## note: special case (do NOT auto-add journal to title)
113
+ ## dont't add "default/generic" journal to title
114
+ else
115
+ page_title << "#{name} - "
116
+ end
117
+ page_title << "Day #{i+1}"
118
+ page_title << " - #{page_date.strftime('%a, %-d %b')}" if add_date
119
+
120
+ page_meta['title'] = page_title
121
+ end
122
+
123
+
124
+ items.each_with_index do |item,i|
125
+ page_meta = item[0]
126
+ page_content = item[1]
127
+
128
+ page_date = page_meta['date']
129
+ page_title = page_meta['title']
130
+
131
+ path = ''
132
+ path << "#{outpath}/#{page_date}"
133
+ path << "-#{name.downcase}.md" ## note: journal gets auto-added to the name too
134
+
135
+ ##
136
+ ## check if path exits?
137
+ page_root = File.dirname( File.expand_path( path ) )
138
+ unless File.directory?( page_root )
139
+ puts " make (missing) output dirs >#{page_root}...<"
140
+ FileUtils.makedirs( page_root )
141
+ end
142
+
143
+
144
+ puts "Writing entry #{i+1}/#{items.size} >#{page_title}< to #{path}..."
145
+
146
+ ### todo:
147
+ ## add a comment in the yaml meta data block e.g.
148
+ ## # Journal.TXT entry 1/4 - auto-built on xxxx by journaltxt v1.2.3
149
+ ## or something
150
+
151
+ comment = "Journal.TXT entry #{i+1}/#{items.size} - auto-built on #{Time.now} by journaltxt/#{Journaltxt.version}"
152
+
153
+ yaml_text = YAML.dump( page_meta )
154
+ ## todo: check better way to add an upfront comment?
155
+ ## for now just replace leading --- with leading --- with comment
156
+ yaml_text = yaml_text.sub( /^---[ ]*$\n?/, "---\n# #{comment}\n" )
157
+
158
+ File.open( path, 'w:utf-8' ) do |f|
159
+ f.write yaml_text
160
+ f.write "---\n\n"
161
+ f.write page_content
162
+ end
163
+ end
164
+ end
22
165
 
166
+ end # module Journaltxt
23
167
 
24
168
 
25
169
  # say hello
@@ -0,0 +1,24 @@
1
+ ---
2
+ year: 2017
3
+ month: July
4
+ day: Wed 19
5
+ ---
6
+ Let's reinvent push-button publishing on the internets!
7
+ Use a single-file for your journal / diary / blog. That's it.
8
+ ---
9
+ day: Thu 20
10
+ ---
11
+ Crazy idea? Let's put up a website and a example blog auto-generated from journal.txt.
12
+ ---
13
+ day: Fri 21
14
+ ---
15
+ Did you know? The single-file format works great for advent calendars
16
+ or beer-of-the-day calendars.
17
+ ---
18
+ day: Sat 22
19
+ ---
20
+ Let's add another example. A diary about the Oktoberfest 2016. Prost. Cheers.
21
+ ---
22
+ day: Sun 23
23
+ ---
24
+ Let's rest.
@@ -0,0 +1,83 @@
1
+ ---
2
+ year: 2017
3
+ month: July
4
+ day: Mon 17
5
+ ---
6
+
7
+ Jumping on tram #1 in front of the Staatsoper (state opera house).
8
+ Circling the Ringstrasse (grand boulevard vienna ring road)
9
+ for a great tour with a public transport ticket.
10
+ Passing the Hofburg (imperial palace), Parlament,
11
+ Burggarten (imperial court's garden),
12
+ Rathaus (city council), Burgtheater (imperial court's theatre),
13
+ Vienna University, and more.
14
+
15
+ Getting off at the Vienna University stop.
16
+ Wandering to the heart of the city to the glourious
17
+ gothic Stepansdom (Stephan's cathedral).
18
+
19
+ Making my way to the Hofburg passing the Pestsäule (plague column) in the Graben
20
+ and the Michaeler Tor (St. Michael's gate). Passing the National Library and
21
+ the Imperial Sisi Apartments and Crown Jewels.
22
+
23
+ Crossing the Ringstrasse to the Kunsthistorisches Museum (national art gallery) - home
24
+ to a breath-taking art collection. Must see!
25
+ The (Great) Babel Tower by Pieter Bruegel the Elder (c.1525-1530 - 1569)
26
+ and the Geographer by Johannes Vermeer (1668 – 1669).
27
+
28
+ Recharging at 7 Stern Bräu in Neubau with a Gulash[^1] and beers brewed-on-location
29
+ with Vienna's fine tap water (from the Austrian Mountains).
30
+ Trying 7 Stern Märzen (5.1%, 13.5°),
31
+ 7 Stern Weizen Classic (5.2%, 12.7°),
32
+ 7 Stern Prager Dunkles (4.5%, 12.1°) and
33
+ today's special 7 Stern Smoked Porter (5.3%, 13.8°). Cheers. Prost.
34
+
35
+ [^1]: Goulash (Hungarian: gulyás [ˈɡujaːʃ]) is a soup or stew of meat and vegetables, seasoned with paprika and other spices.
36
+
37
+ ---
38
+ day: Tue 18
39
+ ---
40
+
41
+ Visiting the imperial palace Schönbrunn - the former summer residence
42
+ of the Habsburg family.
43
+ Taking an inside tour of the 1 441-room baroque palace.
44
+ Enjoying the Neptune Fountain and sculptures in the public garden.
45
+
46
+ Heading back to the city to explore Schloss Belvedere - another
47
+ unequalled baroque palace. Entering the art collection.
48
+ Must see! The Kiss by Gustav Klimt (1862-1918) -
49
+ a symbol of Vienna Jugendstil (Viennese Art Nouveau).
50
+
51
+ Recharging at Salm Bräu (Rennweg 8)
52
+ with Schinkenfleckerl (Austrian noodles with ham)
53
+ and beers brewed-on-location.
54
+ Trying Salm 1842 Pils (5.0%, 12.5°),
55
+ Salm Wiener Märzen (5.0%, 12.5°),
56
+ Salm Böhmisch Dunkles (5.0%, 12.5°)
57
+ and today's special Salm Burning Hell (4.9%, 12.2°). Cheers. Prost.
58
+
59
+
60
+ ---
61
+ day: Wed 19
62
+ ---
63
+
64
+ Visiting the Sigmund Freud Museum in Bergstrasse 9. Too much culture -
65
+ need a beer therapy soon.
66
+ Passing through the Palais Lichtenstein to the
67
+ Beaver Brewing Co. (Liechtensteinstraße 69).
68
+ Trying a 6-sample beer flight:
69
+ Beaver Blue Ribbon, Wry Pale Ale,
70
+ Late Summer IPA,
71
+ Witty Bastard Witbier,
72
+ Charlie Brown Ale,
73
+ Brave Lion Golden Strong Ale.
74
+
75
+ Heading to the Highlander (Sobieskiplatz 4) -
76
+ brewing Vienna's first and oldest porter - the
77
+ Highlander Stout. Let's try an unfiltered lager too - the Highlander Märzen Zwickl.
78
+
79
+ Last therapy stop - recharging in the Biergarten at Lichtenthaler Bräu
80
+ (Lichtensteinstraße 108). Sampling a Lichtenthaler Helles,
81
+ Lichtenthaler West Coast P.A.,
82
+ Lichtenthaler Dark U.S. Lager and
83
+ Lichtenthaler Dinkel Leicht.
data/test/helper.rb CHANGED
@@ -10,7 +10,7 @@ require 'textutils'
10
10
 
11
11
 
12
12
  ## our own code
13
- require 'feedtxt'
13
+ require 'journaltxt'
14
14
 
15
15
 
16
16
 
@@ -18,6 +18,6 @@ LogUtils::Logger.root.level = :debug
18
18
 
19
19
 
20
20
  def read_text( name )
21
- text = File.read( "#{Feedtxt.root}/test/feeds/#{name}.txt" )
21
+ text = File.open( "#{Journaltxt.root}/test/data/#{name}.txt", 'r:bom|utf-8' ).read
22
22
  text
23
23
  end
@@ -0,0 +1,35 @@
1
+ ###
2
+ # to run use
3
+ # ruby -I ./lib -I ./test test/test_build.rb
4
+ # or better
5
+ # rake test
6
+
7
+ require 'helper'
8
+
9
+
10
+ class TestParser < MiniTest::Test
11
+
12
+ def xxx_test_journal
13
+ text = read_text( 'journal' )
14
+
15
+ Journaltxt.build( text, name: 'journal', outpath: './tmp' )
16
+
17
+ assert true
18
+ end
19
+
20
+ def test_journal_ii
21
+ Journaltxt.build_file( "#{Journaltxt.root}/test/data/journal.txt", outpath: './tmp' )
22
+
23
+ assert true
24
+ end
25
+
26
+ def test_vienna
27
+ text = read_text( 'vienna' )
28
+
29
+ Journaltxt.build( text, name: 'Vienna', outpath: './tmp', date: false )
30
+
31
+ assert true
32
+ end
33
+
34
+
35
+ end # class TestParser
@@ -0,0 +1,35 @@
1
+ ###
2
+ # to run use
3
+ # ruby -I ./lib -I ./test test/test_parser.rb
4
+ # or better
5
+ # rake test
6
+
7
+ require 'helper'
8
+
9
+
10
+ class TestParser < MiniTest::Test
11
+
12
+ def test_journal
13
+ text = read_text( 'journal' )
14
+
15
+ items = Journaltxt::Parser.parse( text )
16
+
17
+ puts ":: Blocks ::::::::::::::::::::::"
18
+ pp items
19
+
20
+ assert true
21
+ end
22
+
23
+ def test_vienna
24
+ text = read_text( 'vienna' )
25
+
26
+ items = Journaltxt::Parser.parse( text )
27
+
28
+ puts ":: Blocks ::::::::::::::::::::::"
29
+ pp items
30
+
31
+ assert true
32
+ end
33
+
34
+
35
+ end # class TestParser
data/test/test_version.rb CHANGED
@@ -10,8 +10,12 @@ require 'helper'
10
10
  class TestVersion < MiniTest::Test
11
11
 
12
12
  def test_version
13
- puts Journaltxt::Version
13
+ puts Journaltxt.version
14
+ puts Journaltxt::VERSION
15
+
14
16
  assert true
17
+
18
+ ## Journaltxt.process( ['--help'] )
15
19
  end
16
20
 
17
21
  end # class TestVersion
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: journaltxt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-20 00:00:00.000000000 Z
11
+ date: 2017-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc
@@ -30,18 +30,20 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.15'
33
+ version: '3.16'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.15'
41
- description: journaltxt - reads Journal.TXT and writes out a blog (w/ Jekyll posts
42
- etc.)
40
+ version: '3.16'
41
+ description: journaltxt - reads Journal.TXT and writes out (auto-builds) a blog (w/
42
+ Jekyll posts etc.)
43
43
  email: wwwmake@googlegroups.com
44
- executables: []
44
+ executables:
45
+ - jo
46
+ - journaltxt
45
47
  extensions: []
46
48
  extra_rdoc_files:
47
49
  - HISTORY.md
@@ -52,9 +54,16 @@ files:
52
54
  - Manifest.txt
53
55
  - README.md
54
56
  - Rakefile
57
+ - bin/jo
58
+ - bin/journaltxt
55
59
  - lib/journaltxt.rb
60
+ - lib/journaltxt/parser.rb
56
61
  - lib/journaltxt/version.rb
62
+ - test/data/journal.txt
63
+ - test/data/vienna.txt
57
64
  - test/helper.rb
65
+ - test/test_build.rb
66
+ - test/test_parser.rb
58
67
  - test/test_version.rb
59
68
  homepage: https://github.com/journaltxt/journaltxt
60
69
  licenses:
@@ -81,5 +90,6 @@ rubyforge_project:
81
90
  rubygems_version: 2.6.7
82
91
  signing_key:
83
92
  specification_version: 4
84
- summary: journaltxt - reads Journal.TXT and writes out a blog (w/ Jekyll posts etc.)
93
+ summary: journaltxt - reads Journal.TXT and writes out (auto-builds) a blog (w/ Jekyll
94
+ posts etc.)
85
95
  test_files: []