noter 0.0.2 → 0.1.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: 002b30af6cad3c7f3496bd767f125b3cc745bfee
4
- data.tar.gz: 78c5c58b1963a6af5b9f28e10c9292e77f6bd2b5
3
+ metadata.gz: e8f6fe54a4f2f67331927a21e0ea69f8dffb6f04
4
+ data.tar.gz: e45c54aef26210f5b3a05c1c73467527717cc557
5
5
  SHA512:
6
- metadata.gz: a5f7007bb761ecaae4a5f0b95bca50fc7e22a00e2e8d273193d0e4dc0561a0a400c39b5fce2cc981f3904e2e6b4e90c2859d1df23dfa0dec3a4415474dff9438
7
- data.tar.gz: 7b3c39cc077ad2d82264d00b3c11158a7d20ab3ea42e5f907f25fef3ae6208948e6528b0e5402b69f8166a211223acb4270eb9a08ddd543d692d4a807baf7287
6
+ metadata.gz: 452aff5b4e6a9ee30d831ab11b640dbdb9fedea44fecf12043a3bcd3a7a0d84d845546a679034ee93027149e678df3f092cd750798aaca17421b17d22cca674e
7
+ data.tar.gz: 21ce2e5cf5db5677077f8e66157a3621a30ffcd35b5660a22c59eb3c80a254ee4ac29a522b0687640ff271c120546ab91ebe3d80eb9f85f2296cdaf980783c97
data/README.md CHANGED
@@ -20,7 +20,11 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- TODO: Write usage instructions here
23
+ Usage: noter [options]
24
+ -f, --file FILE Create a note using the given file
25
+ -l, --one-line Show first line of each note file
26
+ -n, --name Show first line of each note file, with filename
27
+ -m, --message MESSAGE Create a note using the given string
24
28
 
25
29
  ## Contributing
26
30
 
data/bin/noter CHANGED
@@ -6,15 +6,19 @@ require "optparse"
6
6
  class NoteRunner
7
7
  def run(args)
8
8
  parser = OptionParser.new do |opts|
9
- opts.on("-f", "--file FILE", "Use the specified file as the note") do |filename|
9
+ opts.on("-f", "--file FILE", "Create a note using the given file") do |filename|
10
10
  Noter::FileMaker.new.make_from_file(filename)
11
11
  end
12
12
 
13
- opts.on("-l", "--one-line", "Show first lines of each note file") do
13
+ opts.on("-l", "--one-line", "Show first line of each note file") do
14
14
  Noter::Viewer.new.show_first_lines
15
15
  end
16
16
 
17
- opts.on("-m", "--message MESSAGE", "Use the given message as the note") do |message|
17
+ opts.on("-n", "--name", "Show first line of each note file, with filename") do
18
+ Noter::Viewer.new.show_first_lines(with_filename: true)
19
+ end
20
+
21
+ opts.on("-m", "--message MESSAGE", "Create a note using the given string") do |message|
18
22
  Noter::FileMaker.new(message).save_file
19
23
  end
20
24
  end
@@ -1,3 +1,3 @@
1
1
  module Noter
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -6,10 +6,14 @@ module Noter
6
6
  Dir.glob("#{NoteFile.dir}/*")
7
7
  end
8
8
 
9
- def show_first_lines
9
+ def show_first_lines(options = {})
10
10
  existing_files.each do |filename|
11
11
  file = NoteFile.new(filename)
12
- puts "#{file.formatted_time}: #{file.first_line}"
12
+ filename_string = ""
13
+ if options[:with_filename]
14
+ filename_string = "#{filename}: "
15
+ end
16
+ puts "#{file.formatted_time}: #{filename_string}#{file.first_line}"
13
17
  end
14
18
  end
15
19
  end
@@ -24,6 +24,12 @@ module Noter
24
24
  expect(viewer).to receive(:puts).with("09-21 19:20: file 2")
25
25
  viewer.show_first_lines
26
26
  end
27
+
28
+ it "includes the filenames" do
29
+ expect(viewer).to receive(:puts).with("09-21 18:20: #{NoteFile.dir}/2014_09_21_18_20_22.txt: file 1")
30
+ expect(viewer).to receive(:puts).with("09-21 19:20: #{NoteFile.dir}/2014_09_21_19_20_22.txt: file 2")
31
+ viewer.show_first_lines(with_filename: true)
32
+ end
27
33
  end
28
34
  end
29
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Roush
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-22 00:00:00.000000000 Z
11
+ date: 2014-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler