tinynews 1.0.1 → 1.0.2

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.
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 1.9.3
data/README.md CHANGED
@@ -3,26 +3,20 @@ A simple gem built to see the titles of various news feeds very easily. Mostly a
3
3
 
4
4
  ## Installation
5
5
 
6
- Add this line to your application's Gemfile:
7
-
8
- gem 'tinynews'
9
-
10
- And then execute:
11
-
12
- $ bundle
13
-
14
- Or install it yourself as:
15
-
16
6
  $ gem install tinynews
17
7
 
18
8
  ## Usage
19
9
 
20
10
  ### CLI (nothing else for now)
21
11
 
22
- Standard use:
12
+ Usage:
23
13
 
24
14
  $ tinynews --NEWS_SOURCE # example: tinynews --bbc
25
15
 
16
+ List all news sources:
17
+
18
+ $ tinynews list
19
+
26
20
  Further info: (Nothing pretty much ;))
27
21
 
28
22
  $ tinynews --help for help.
@@ -30,6 +24,8 @@ Further info: (Nothing pretty much ;))
30
24
  ## Todo:
31
25
 
32
26
  1. Providing a configuration file in the home directory to configure news sources.
27
+ 2. Provide better help
28
+ 3. Format list command to include the options better.
33
29
 
34
30
  ## Contributing
35
31
 
data/bin/tinynews CHANGED
@@ -4,13 +4,11 @@ require 'thor'
4
4
  require 'yaml'
5
5
  require 'tinynews'
6
6
 
7
-
8
7
  module TinyNews
9
8
 
10
- f = File.open( "../sources.yml", "r" ).read
11
- SOURCES = YAML::load( f )
9
+ SOURCES = TinyNews.sources_from_home
12
10
 
13
- class TinyNewsCLI < Thor
11
+ class CLI < Thor
14
12
 
15
13
  default_task :news_from_source
16
14
 
@@ -31,4 +29,4 @@ module TinyNews
31
29
 
32
30
  end
33
31
 
34
- TinyNews::TinyNewsCLI.start( ARGV )
32
+ TinyNews::CLI.start( ARGV )
data/lib/tinynews.rb CHANGED
@@ -17,4 +17,19 @@ module TinyNews
17
17
  CLIPrinter.print( get_feed(feed_symbol) )
18
18
  end
19
19
 
20
+ def self.say_hello
21
+ puts "Hello"
22
+ end
23
+
24
+ def self.sources_from_home
25
+ source_file = File.expand_path('~/.tinynews.yml')
26
+ unless File.file?( source_file )
27
+ File.open( source_file, "w") do |f|
28
+ f.write( File.open("./sources.yml", "r").read )
29
+ end
30
+ end
31
+ f = open(source_file, "r").read
32
+ YAML::load( f )
33
+ end
34
+
20
35
  end
@@ -8,7 +8,7 @@ module TinyNews
8
8
  feeds.each do |feed_object|
9
9
  puts "\n#{feed_object.title.color(:blue)}:"
10
10
  feed_object.stories.each do |story|
11
- puts "-".color(:yellow) + " #{story}"
11
+ puts "-".color(:yellow) << " #{story}"
12
12
  end
13
13
  end
14
14
  end
@@ -1,3 +1,4 @@
1
+ require 'tinynews'
1
2
  require 'tinynews/feed'
2
3
  require 'yaml'
3
4
 
@@ -6,8 +7,7 @@ module TinyNews
6
7
  class Feeds
7
8
 
8
9
  def initialize
9
- sources_file = File.open('sources.yml', 'r').read
10
- @sources = YAML::load( sources_file )
10
+ @sources = TinyNews.sources_from_home
11
11
  end
12
12
 
13
13
  def generate source_symbol
@@ -7,10 +7,9 @@ module TinyNews
7
7
 
8
8
  def self.export feeds
9
9
  feeds.map do |feed_object|
10
- hash = { :title => feed_object.title,
11
- :news => feed_object.stories
12
- }
13
- JSON.generate( hash )
10
+ { title: feed_object.title,
11
+ news: feed_object.stories
12
+ }.to_json
14
13
  end
15
14
  end
16
15
 
@@ -0,0 +1,8 @@
1
+ module TinyNews
2
+
3
+ def sources_from_home
4
+ f = open(File.expand_path('~/.tinynews.yml')).read
5
+ YAML::load( f )
6
+ end
7
+
8
+ end
@@ -1,3 +1,3 @@
1
1
  module TinyNews
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tinynews
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-31 00:00:00.000000000 Z
12
+ date: 2014-04-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -117,6 +117,7 @@ extensions: []
117
117
  extra_rdoc_files: []
118
118
  files:
119
119
  - .gitignore
120
+ - .travis.yml
120
121
  - Gemfile
121
122
  - LICENSE.txt
122
123
  - README.md
@@ -127,6 +128,7 @@ files:
127
128
  - lib/tinynews/feed.rb
128
129
  - lib/tinynews/feeds.rb
129
130
  - lib/tinynews/json_exporter.rb
131
+ - lib/tinynews/sources.rb
130
132
  - lib/tinynews/version.rb
131
133
  - sources.yml
132
134
  - spec/spec_helper.rb
@@ -147,7 +149,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
149
  version: '0'
148
150
  segments:
149
151
  - 0
150
- hash: -502651882714700712
152
+ hash: 787080775389177161
151
153
  required_rubygems_version: !ruby/object:Gem::Requirement
152
154
  none: false
153
155
  requirements:
@@ -156,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
158
  version: '0'
157
159
  segments:
158
160
  - 0
159
- hash: -502651882714700712
161
+ hash: 787080775389177161
160
162
  requirements: []
161
163
  rubyforge_project:
162
164
  rubygems_version: 1.8.23