vnews 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown ADDED
@@ -0,0 +1,296 @@
1
+ # Vnews
2
+
3
+ Vnews is a fast, lightweight newsfeed reader built on top of Vim and
4
+ MySQL.
5
+
6
+ [screenshots]
7
+
8
+ There are lots of newsfeed readers out there, both desktop and
9
+ web-based. Here are some of Vnews's advantages:
10
+
11
+ * minimizes distractions; everything is rendered as plain text and pure content; images and ads are not displayed
12
+ * makes it easy to navigate your entire feed collection using efficient keystrokes
13
+ * makes it easy to copy, append, or pipe text from your feeds to whatever file or program you want
14
+
15
+ Vnews uses MySQL to store your feed data locally. It uses MySQL's MyISAM
16
+ tables to provide natural-language full-text search capability.
17
+
18
+
19
+ ## Prerequisites
20
+
21
+ * a recent version of Vim (Vnews is developed against Vim 7.2)
22
+ * a recent version of Ruby: Ruby 1.9.2 is recommended
23
+ * MySQL
24
+ * the Unix program `tidy`
25
+ * the Unix program `fmt`
26
+
27
+ Vnews assumes a Unix environment.
28
+
29
+ To install Ruby 1.9.2, I recommend using the [RVM Version Manager][rvm],
30
+ which makes it easy to install and manage different versions of Ruby.
31
+
32
+ [rvm]:http://rvm.beginrescueend.com
33
+
34
+ ## Installation
35
+
36
+ gem install vnews
37
+
38
+ Test your installation by typing `vnews -h`. You should see Vnews's help.
39
+
40
+ If you run into any PATH errors, try the following: Install the RVM
41
+ Version Manager, then install Ruby 1.9.2 through RVM, and then run `gem
42
+ install vnews`. This should solve any installation issues.
43
+
44
+ If you ever want to uninstall Vnews from your system, execute this command:
45
+
46
+ gem uninstall vnews
47
+
48
+ ... and all traces of Vnews will removed.
49
+
50
+ New and improved versions of Vnews will be released over time. To install the
51
+ latest version, just type `gem install vnews` again.
52
+
53
+
54
+ ## Setup
55
+
56
+ vnews
57
+
58
+ When you run Vnews for the first time, a `.vnewsrc` configuration file will be
59
+ generated in your home directory. The top of this file will look like
60
+ this:
61
+
62
+ host: localhost
63
+ database: vnews
64
+ username: root
65
+ password:
66
+
67
+ You must edit this file to match your MySQL settings, and then run
68
+
69
+ vnews --create-db
70
+
71
+ to generate the MySQL database that will store your feed data. Leave
72
+ `password:` blank if you don't use a MySQL password.
73
+
74
+ To use MacVim as your Vnews Vim engine, you can run vnews like this
75
+
76
+ VNEWS_VIM=mvim vnews
77
+
78
+ or you can `export VNEWS_VIM=mvim` in your `~/.bash_profile` and then
79
+ just run `vnews`.
80
+
81
+ ## Configuring your feeds
82
+
83
+ To configure your feeds, edit the bottom part of the `.vnewsrc` file.
84
+ The bottom part of the file looks like this:
85
+
86
+ General News
87
+ http://feedproxy.google.com/economist/full_print_edition
88
+ http://feeds.feedburner.com/TheAtlanticWire
89
+
90
+ Humor
91
+ http://feed.dilbert.com/dilbert/blog
92
+
93
+ Tech
94
+ http://rss.slashdot.org/Slashdot/slashdot
95
+ http://feeds2.feedburner.com/readwriteweb
96
+ http://feedproxy.google.com/programmableweb
97
+ http://news.ycombinator.com/rss
98
+ http://daringfireball.net/index.xml
99
+ http://dailyvim.blogspot.com/feeds/posts/default
100
+
101
+ The configuration syntax is very simple. Feeds are organized into
102
+ folders, e.g. "General News". Under each folder name, list the feeds you
103
+ want to go inside that folder. You may put a feed under more than one
104
+ folder. Feeds are listed by their URLs. These should point to live Atom
105
+ or RSS content.
106
+
107
+ Whenever you change the feed/folder configuration, run this command:
108
+
109
+ vnews -u
110
+
111
+ This will update the Vnews datastore to reflect the changes (including
112
+ removing feeds). Then Vnews will update all your feeds and start a Vnews
113
+ session. If you don't want to start a Vnews session (e.g. if you want
114
+ to run this as a cron job), use `vnews -U` instead.
115
+
116
+
117
+ ## Basic navigation
118
+
119
+ To start Vnews, use `vnews -u` to update all your feeds before starting
120
+ your Vnews session. To simply start the session without going through
121
+ the update process, use the simple `vnews` command.
122
+
123
+ At this point, you should see the feed items for all your feeds
124
+ in one consolidated list.
125
+
126
+ * `j` moves up the item list
127
+ * `k` moves down the item list
128
+ * `ENTER` from the list window displays the item under the cursor and focuses the item window
129
+ * `ENTER` from item window returns focus to the list window
130
+ * `C-l` displays the item under the cursor without focusing the item window
131
+ * `SPACE` toggles full-screen mode for the current window.
132
+ * `C-j` shows the next item without changing window focus
133
+ * `C-k` shows the previous item without changing window focus
134
+
135
+ You can also use the standard Vim window switching, rotating, and
136
+ positioning commands.
137
+
138
+
139
+ ## Navigating feeds and folders
140
+
141
+ * `,n` calls up the folder selection window
142
+ * `,m` calls up the feed selection window, sorted alphabetically
143
+ * `,M` calls up the feed selection window, sorted by the number of times you read an item from each feed
144
+
145
+ For all of the commands, you'll see an autocomplete window appear at the
146
+ top. The standard Vim autocomplete keystrokes apply:
147
+
148
+ * `C-p` and `C-n` move you up and down the match list
149
+ * `C-e` closes the match list and lets you continue typing
150
+ * `C-u`: when the match list is active, cycles forward through the match list and what you've typed so far; when the match list is inactive, erases what you've typed.
151
+ * `C-x C-u` finds matches for what you've typed so far (when the match list window is closed)
152
+ * `C-y` selects the highlighted match without triggering ENTER
153
+ * ENTER selects the highlighted match from the match list
154
+
155
+ TIP: start typing the first 1-3 characters of the mailbox name, then
156
+ press `C-n`, `C-u` or `C-p` until you highlight the right match, and
157
+ finally press ENTER to select.
158
+
159
+
160
+ ## Unread items
161
+
162
+ Unread items are marked with a `+` symbol.
163
+
164
+
165
+ ## Starring items
166
+
167
+ You can star interesting feed items by using `,*` or `,8` (both use the
168
+ same keys, the only difference being the SHIFT key). Starred items are
169
+ colored green and made available in a specially `Starred` folder.
170
+
171
+ Starred items don't get deleted when you remove the feed they came
172
+ from from your `.vnewsrc` configuration file.
173
+
174
+ To unstar an item, press `,*` or `,8` on a starred item.
175
+
176
+
177
+ ## Deleting items
178
+
179
+ To delete items, use `,#` or `,3`.
180
+
181
+ You can also delete a range of items, e.g. if you wanted to clear out a
182
+ backlog of items in a feed or folder. To delete a range of items, you
183
+ can either of these methods:
184
+
185
+ * make a selection of rows in visual mode and type `:VNDelete`
186
+ * specify a line number range with the command: `:[range]VNDelete`
187
+
188
+ See `:help 10.3` to learn how to specify command line ranges.
189
+
190
+ You can use `:VND` as an abbreviation for `:VNDelete`.
191
+
192
+
193
+ ## Opening webpages and hyperlinks
194
+
195
+ * `,o` opens the next web hyperlink on or after the cursor in your default external web browser
196
+ * `,h` opens the web page that the feed item is linked to
197
+
198
+ Web hyperlinks are the URLs that begin with http:// or https://.
199
+
200
+ Under the covers, Vnews uses the command `gnome-open` or `open` to
201
+ launch your external web browser. This should cover Linux Gnome desktop
202
+ and OS X users. You can change the command Vnews uses to open a
203
+ hyperlink by adding this to your `~/.vimrc`:
204
+
205
+ let g:Vnews#browser_command = "your browser command here"
206
+
207
+ If your Vim has `netrw` installed, you can open a hyperlink directly in
208
+ Vim by putting the cursor on a web hyperlink and typing `gf`, `CTRL-W f`
209
+ or `,O` (capital O). All these commands open the webpage inside your Vim
210
+ session using `elinks` or whatever browser you set as your
211
+ `g:netrw_http_cmd`. See `:help netrw` for more information.
212
+
213
+
214
+ ## Searching your feeds
215
+
216
+ * `:VNSearch [term]` searches your feeds for items matching `[term]`
217
+
218
+
219
+ You can use the abbreviation `:VNS`. If there are matches, you'll see
220
+ the matching words color-highlighted.
221
+
222
+
223
+ ## Concatenating feed items
224
+
225
+ * `:VNConcat` with a visual selection
226
+ * `:[range]VNConcat`
227
+
228
+ These commands let you concatenate feed items into a single, continuous
229
+ text document for printing or more leisurely reading.
230
+
231
+ See `:help 10.3` to learn how to specify command line ranges.
232
+
233
+
234
+ ## Updating your feeds
235
+
236
+ Starting vnews with
237
+
238
+ vnews -u
239
+
240
+ will update all your feeds before opening the Vnews session.
241
+
242
+ vnews -U
243
+
244
+ will update all your feeds without starting a session. You might want to
245
+ use this option if you want to update your feeds periodically in the
246
+ background using `cron`.
247
+
248
+ If you're already in a Vnews session, you can update the current feed of
249
+ folder by pressing `u`.
250
+
251
+ ## OPML import
252
+
253
+ If you want to import an OPML list of your feed subscriptions into
254
+ Vnews, use this command:
255
+
256
+ vnews --opml [file]
257
+
258
+ `[file]` is your OPML file.
259
+
260
+ You can easily import your Google Reader subscriptions this way.
261
+ Here's [a video][export-tutorial] that shows you how to export your Google Reader
262
+ subscriptions to an OPML file.
263
+
264
+ [export-tutorial]:http://www.clipotech.com/2007/06/opml-export-in-google-reader.html
265
+
266
+
267
+ ## Getting help
268
+
269
+ Typing `,?` will open the help webpage in a browser.
270
+
271
+
272
+ ## Bug reports and feature requests
273
+
274
+ Vnews is very new, so there are kinks and bugs to iron out and lot of
275
+ desirable features to add. If you have a bug to report or a good feature to
276
+ suggest, please file it on the [issue tracker][1]. That will help a lot.
277
+
278
+ [1]:https://github.com/danchoi/vnews/issues
279
+
280
+ You can also join the [Google Group][group] and comment there.
281
+
282
+ [group]:http://groups.google.com/group/vnews-users?msg=new&lnk=gcis
283
+
284
+ ## How to contact the developer
285
+
286
+ My name is Daniel Choi. I am based in Cambridge, Massachusetts, USA, and you
287
+ can email me at dhchoi {at} gmail.com.
288
+
289
+
290
+
291
+
292
+
293
+
294
+
295
+
296
+
data/Rakefile CHANGED
@@ -1,37 +1,50 @@
1
1
  $LOAD_PATH.unshift File.join(File.dirname(__FILE__), 'lib')
2
- require 'couchrest'
3
2
  require 'yaml'
4
3
  require 'json'
5
- require 'vnews'
6
4
  require 'rake'
7
5
  require 'rake/testtask'
8
6
  require 'bundler'
7
+ require 'vnews'
8
+ require 'vnews/version'
9
+
9
10
  Bundler::GemHelper.install_tasks
10
11
 
11
- desc "Save couchdb views in lib/couchviews.yml"
12
- task :create_views do
13
- db = CouchRest.database! "http://localhost:5984/vnews"
14
- views = YAML::load File.read("lib/couchviews.yml")
15
- begin
16
- rev = db.get(views['_id'])['_rev']
17
- puts db.save_doc(views.merge('_rev' => rev))
18
- rescue RestClient::ResourceNotFound
19
- puts db.save_doc(views)
20
- end
21
- end
12
+ desc "release and build and push new website"
13
+ task :push => [:release, :web]
22
14
 
23
- desc "List feeds with recent entry titles"
24
- task :list_feeds do
25
- vnews = Vnews::Aggregator.new
26
- puts vnews.list_feeds.inspect
15
+ desc "Bumps version number up one and git commits"
16
+ task :bump do
17
+ basefile = "lib/vnews/version.rb"
18
+ file = File.read(basefile)
19
+ oldver = file[/VERSION = '(\d.\d.\d)'/, 1]
20
+ newver_i = oldver.gsub(".", '').to_i + 1
21
+ newver = ("%.3d" % newver_i).split(//).join('.')
22
+ puts oldver
23
+ puts newver
24
+ puts "Bumping version: #{oldver} => #{newver}"
25
+ newfile = file.gsub("VERSION = '#{oldver}'", "VERSION = '#{newver}'")
26
+ File.open(basefile, 'w') {|f| f.write newfile}
27
+ `git commit -am 'Bump'`
27
28
  end
28
29
 
29
- desc "Run tests"
30
- task :test do
31
- $:.unshift File.expand_path("test")
32
- MiniTest::Unit.autorun
30
+ desc "build and push website"
31
+ task :web => :build_webpage do
32
+ puts "Building and pushing website"
33
+ Dir.chdir "../project-webpages" do
34
+ `scp out/vnews.html zoe2@instantwatcher.com:~/danielchoi.com/public/software/`
35
+ `rsync -avz out/images-vnews zoe2@instantwatcher.com:~/danielchoi.com/public/software/`
36
+ `rsync -avz out/stylesheets zoe2@instantwatcher.com:~/danielchoi.com/public/software/`
37
+ `rsync -avz out/lightbox2 zoe2@instantwatcher.com:~/danielchoi.com/public/software/`
38
+ end
39
+ `open http://danielchoi.com/software/vnews.html`
33
40
  end
34
41
 
35
- task :default => :test
36
-
42
+ desc "build webpage"
43
+ task :build_webpage do
44
+ `cp README.markdown ../project-webpages/src/vnews.README.markdown`
45
+ Dir.chdir "../project-webpages" do
46
+ puts `ruby gen.rb vnews #{Vnews::VERSION}`
47
+ `open out/vnews.html`
48
+ end
49
+ end
37
50
 
data/bin/vnews ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ require 'vnews'
4
+ rescue LoadError
5
+ require 'rubygems'
6
+ require 'vnews'
7
+ end
8
+
9
+ Vnews.start
data/lib/vnews.rb CHANGED
@@ -7,7 +7,13 @@ require 'drb'
7
7
  class Vnews
8
8
 
9
9
  def self.start
10
- puts "Starting vnews #{Vnews::VERSION}"
10
+
11
+ ["tidy", "fmt"].each do |x|
12
+ if `which #{x}` == ''
13
+ puts "Before you can run Vnews, you need to install #{x}."
14
+ exit
15
+ end
16
+ end
11
17
 
12
18
  if ! File.exists?(File.expand_path(Vnews::Config::CONFIGPATH))
13
19
  puts "Missing #{Vnews::Config::CONFIGPATH}"
@@ -18,6 +24,37 @@ class Vnews
18
24
  exit
19
25
  end
20
26
 
27
+ if ['--version', '-v', "--help", "-h"].include?(ARGV.first)
28
+ puts "vnews #{Vnews::VERSION}"
29
+ puts "by Daniel Choi dhchoi@gmail.com"
30
+ puts
31
+ puts <<-END
32
+ ---
33
+ Usage: vnews
34
+
35
+ When you run Vnews for the first time, a .vnewsrc configuration file will be
36
+ generated in your home directory. You must edit this file to match your MySQL
37
+ settings, and then run `vnews --create-db`.
38
+
39
+ After that you can run `vnews` to read your feeds.
40
+
41
+ Specific options:
42
+
43
+ -u, --update Update all feeds and folders before starting vnews
44
+ -U Update all feeds and folders without starting vnews session
45
+ --opml [opml file] Import feeds from an OPML file
46
+ --create-db Create MySQL database configured in .vnewrc
47
+ -v, --version Show version
48
+ -h, --help Show this message
49
+
50
+ Please visit http://danielchoi.com/software/vnews.html for more help.
51
+
52
+ ---
53
+ END
54
+ exit
55
+ end
56
+
57
+
21
58
  if ARGV.first == "--create-db"
22
59
  c = File.read(Vnews::Config::CONFIGPATH)
23
60
  top, bottom = c.split(/^\s*$/,2)
@@ -39,13 +76,17 @@ class Vnews
39
76
  puts "Done."
40
77
  end
41
78
 
42
- if ['--update', '-u'].include?(ARGV.first)
79
+ if ['--update', '-u', '-U'].include?(ARGV.first)
43
80
  Vnews::Config.update_folders
81
+ if ARGV.first == '-U'
82
+ exit
83
+ end
44
84
  end
45
85
 
86
+ puts "Starting vnews #{Vnews::VERSION}"
46
87
  Vnews.sql_client # loads the config
47
88
 
48
- vim = ENV['VMAIL_VIM'] || 'vim'
89
+ vim = ENV['VNEWS_VIM'] || 'vim'
49
90
  vimscript = File.join(File.dirname(__FILE__), "vnews.vim")
50
91
  vim_command = "#{vim} -S #{vimscript} "
51
92
  STDERR.puts vim_command
data/lib/vnews.vim CHANGED
@@ -49,6 +49,7 @@ function! s:common_mappings()
49
49
  nnoremap <buffer> <leader>3 :call <SID>delete_item()<CR>
50
50
  nnoremap <buffer> u :call <SID>update_feed()<CR>
51
51
  nnoremap <buffer> <leader>u :call <SID>update_feed()<CR>
52
+ nnoremap <silent> <leader>? :call <SID>show_help()<cr>
52
53
  command! -bar -nargs=0 VNUpdateFeed :call <SID>update_feed()
53
54
  endfunc
54
55
 
@@ -460,6 +461,13 @@ func! s:update_feed()
460
461
  endfunc
461
462
 
462
463
 
464
+ " --------------------------------------------------------------------------------
465
+ " HELP
466
+ func! s:show_help()
467
+ let command = g:Vnews#browser_command . ' ' . shellescape('http://danielchoi.com/software/vnews.html')
468
+ call system(command)
469
+ endfunc
470
+
463
471
  command! -bar -nargs=1 VNSearch :call s:search_items(<f-args>)
464
472
 
465
473
 
data/lib/vnews/display.rb CHANGED
@@ -63,7 +63,7 @@ class Vnews
63
63
  end
64
64
 
65
65
  def format_item_summary(i, width)
66
- varwidth = width.to_i - 31
66
+ varwidth = width.to_i - 32
67
67
  feed_title = col i['feed_title'], varwidth * 0.25
68
68
  title = col i['title'], varwidth * 0.75
69
69
  word_count = i['word_count'].to_s.rjust(6)
data/lib/vnews/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  class Vnews
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
4
4
 
data/vnews.gemspec CHANGED
@@ -19,9 +19,8 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
- s.add_dependency 'feed_yamlizer', '>=0.0.6'
23
22
  s.add_dependency 'nokogiri'
24
-
25
- # remember to say in readme that fmt and tidy are required
23
+ s.add_dependency 'mysql2'
24
+ s.add_dependency 'feed_yamlizer', '>=0.0.7'
26
25
 
27
26
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Choi
@@ -14,11 +14,11 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-02-21 00:00:00 -05:00
17
+ date: 2011-02-22 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- name: feed_yamlizer
21
+ name: nokogiri
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
24
  none: false
@@ -27,13 +27,11 @@ dependencies:
27
27
  - !ruby/object:Gem::Version
28
28
  segments:
29
29
  - 0
30
- - 0
31
- - 6
32
- version: 0.0.6
30
+ version: "0"
33
31
  type: :runtime
34
32
  version_requirements: *id001
35
33
  - !ruby/object:Gem::Dependency
36
- name: nokogiri
34
+ name: mysql2
37
35
  prerelease: false
38
36
  requirement: &id002 !ruby/object:Gem::Requirement
39
37
  none: false
@@ -45,10 +43,26 @@ dependencies:
45
43
  version: "0"
46
44
  type: :runtime
47
45
  version_requirements: *id002
46
+ - !ruby/object:Gem::Dependency
47
+ name: feed_yamlizer
48
+ prerelease: false
49
+ requirement: &id003 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ segments:
55
+ - 0
56
+ - 0
57
+ - 7
58
+ version: 0.0.7
59
+ type: :runtime
60
+ version_requirements: *id003
48
61
  description: Read your feeds in Vim
49
62
  email:
50
63
  - dhchoi@gmail.com
51
64
  executables:
65
+ - vnews
52
66
  - vnews-client
53
67
  extensions: []
54
68
 
@@ -59,7 +73,9 @@ files:
59
73
  - Gemfile
60
74
  - Gemfile.lock
61
75
  - MIT-LICENSE.txt
76
+ - README.markdown
62
77
  - Rakefile
78
+ - bin/vnews
63
79
  - bin/vnews-client
64
80
  - lib/create.sql
65
81
  - lib/vnews.rb