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 +4 -4
- data/README.md +5 -1
- data/bin/noter +7 -3
- data/lib/noter/version.rb +1 -1
- data/lib/noter/viewer.rb +6 -2
- data/spec/lib/noter/viewer_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8f6fe54a4f2f67331927a21e0ea69f8dffb6f04
|
4
|
+
data.tar.gz: e45c54aef26210f5b3a05c1c73467527717cc557
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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", "
|
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
|
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("-
|
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
|
data/lib/noter/version.rb
CHANGED
data/lib/noter/viewer.rb
CHANGED
@@ -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
|
-
|
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
|
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-
|
11
|
+
date: 2014-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|