evernote_link_extractor 0.1.9 → 0.2.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: 9f14760f2d1594be451c566e79a70754a4a83f70
4
- data.tar.gz: be89a2209773903840ab97a7ef4e147a9f85f711
3
+ metadata.gz: 8443df37c9bd999ae53e4fdfb44316b432868164
4
+ data.tar.gz: 8ebd9e5884e9d5e59994481c5679331a94d64618
5
5
  SHA512:
6
- metadata.gz: 9a9443d6708d16dd4c53bb7a0d80a96c5fbc20a2b89ae489822d10bac3a03964943b877558e13809ce91cfb08a433c64acc4a8049802292e3266b326e59c9298
7
- data.tar.gz: a097a3393bde40bd60a64a762c2c446e397e94a773ee03e3c1e50019dbbe78cf00cd45a9d877085d00f68e95a1402f3701bb610fe737cd0e47e058a1fd63cbe6
6
+ metadata.gz: 83c4845462f73fb29a553b603c81205d941d29110f79f938e644fa61057d87481a485ee0c84b395b372ad1e9022b9e3af128ffff540594a0f90aea78703685ac
7
+ data.tar.gz: 9f7c4baa2d31524fd496ecdb498ea9a96de7caccf746596a447c8f7821ac8e44e3857d12ca09c164b0ccd07b6c846dbac7ef75adb6e5e453079f475451422507
data/.gitignore CHANGED
@@ -8,3 +8,4 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  /.tags
11
+ /.csv
data/README.md CHANGED
@@ -61,6 +61,11 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
61
61
 
62
62
  Bug reports and pull requests are welcome on GitHub at https://github.com/andywenk/evernote_link_extractor. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
63
63
 
64
+ ### Used gems
65
+
66
+ * [Nokogiri - for HTML parsing](https://github.com/sparklemotion/nokogiri)
67
+ * [Pastel - for fancy command line colors](https://github.com/peter-murach/pastel)
68
+
64
69
  ## License (Apache2)
65
70
 
66
71
  Copyright (c) 2015 Andreas Wenk
@@ -68,5 +73,5 @@ Copyright (c) 2015 Andreas Wenk
68
73
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
69
74
 
70
75
  http://www.apache.org/licenses/LICENSE-2.0
71
-
76
+
72
77
  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
@@ -4,12 +4,12 @@ require 'evernote_link_extractor'
4
4
 
5
5
  info = <<INFO
6
6
 
7
- +++ Export Evernote links +++
7
+ This script is going to create a CSV file from all the URL's with title from
8
+ your exported HTML files creted with Evernote. Please note that this is tested
9
+ with Evernote Version 6.1 on Mac OS X.
8
10
 
9
- This script is going to create a CSV file from all the URL's with title from your exported HTML files creted
10
- with Evernote. Please note that this is tested with Evernote Version 6.1 on Mac OS X.
11
-
12
- You need to export your Evernote notes first to HTML. To do so, follow these steps:
11
+ You need to export your Evernote notes first to HTML. To do so, follow these
12
+ steps:
13
13
 
14
14
  * Open the Evernote programm
15
15
  * click Notes in the navigation (on the left)
@@ -18,10 +18,13 @@ You need to export your Evernote notes first to HTML. To do so, follow these ste
18
18
  * choose HTML as Format:
19
19
  * choose a directory on a hard drive and click save
20
20
 
21
- A folder with the extension .enex is being created. All your Notes are stored there as HTML files.
21
+ A folder with the extension .enex is being created. All your Notes are stored
22
+ there as HTML files.
22
23
 
23
24
  INFO
24
25
 
25
- print info
26
+ pastel = Pastel.new
27
+ puts pastel.white.on_cyan.bold(" +++ Export Evernote links +++ ")
28
+ print pastel.cyan.italic(info)
26
29
 
27
30
  EvernoteLinkExtractor.run
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ["lib"]
21
21
 
22
22
  spec.add_dependency "nokogiri"
23
+ spec.add_dependency "pastel"
23
24
 
24
25
  spec.add_development_dependency "bundler", "~> 1.10"
25
26
  spec.add_development_dependency "rake", "~> 10.0"
@@ -2,6 +2,8 @@ module EvernoteLinkExtractor
2
2
  class CsvBuilder
3
3
 
4
4
  def self.create(link_list)
5
+ Helper.message("Starting to create the CSV file ...\n")
6
+
5
7
  CSV.open("evernote_link_export_#{Time.now.to_i}.csv", 'w', :write_headers=> true, :headers => csv_headers) do |csv|
6
8
  csv << rows(link_list)
7
9
  end
@@ -19,20 +19,20 @@ module EvernoteLinkExtractor
19
19
 
20
20
  # ask which directory has to be scanned
21
21
  def directory_to_scan
22
- print 'What is the path to your .enex directory? (e.g.: ~/Documents/my_evernote.enex): '
22
+ Helper.question( 'What is the path to your .enex directory? (e.g.: ~/Documents/my_evernote.enex): ')
23
23
  @directory = full_path_to_directory(gets.chomp)
24
24
 
25
25
  if does_directory_exist?
26
26
  @directory = Pathname.new([@directory, '**/*'].join('/'))
27
27
  else
28
- puts 'The directory does not exist ...'
28
+ Helper.warning("The directory does not exist ...\n")
29
29
  Helper.exit?
30
30
  directory_to_scan
31
31
  end
32
32
  end
33
33
 
34
34
  def scan_directory
35
- puts "scanning #{directory} ...\n"
35
+ Helper.message("\nscanning #{directory} ...\n")
36
36
 
37
37
  Dir.glob(directory).each do |filename|
38
38
  next if File.directory?(filename)
@@ -43,7 +43,7 @@ module EvernoteLinkExtractor
43
43
 
44
44
  def check_if_files_exist
45
45
  return unless file_list.empty?
46
- puts "There are no files in the directory ..."
46
+ Helper.warning("There are no files in the directory ...\n")
47
47
  Helper.exit?
48
48
  directory_to_scan
49
49
  end
@@ -5,15 +5,35 @@ module EvernoteLinkExtractor
5
5
 
6
6
  # exit the whole program?
7
7
  def exit?
8
- print 'Exit? (yes|no): '
8
+ print question('Exit? (yes|no): ')
9
9
  close if gets.chomp == 'yes'
10
10
  end
11
11
 
12
12
  # close the program
13
13
  def close
14
- puts 'Closing. Have a nice day.'
14
+ message("\nClosing. Have a nice day!\n")
15
15
  exit(0)
16
16
  end
17
+
18
+ def question(q)
19
+ print pastel.yellow.bold(q)
20
+ end
21
+
22
+ def warning(w)
23
+ question(w)
24
+ end
25
+
26
+ def message(m)
27
+ print pastel.green(m)
28
+ end
29
+
30
+ def headline(h)
31
+ print pastel.white.on_cyan.bold(h)
32
+ end
33
+
34
+ def pastel
35
+ Pastel.new
36
+ end
17
37
  end
18
38
  end
19
39
  end
@@ -18,17 +18,16 @@ module EvernoteLinkExtractor
18
18
 
19
19
  # this is the only public method to be called
20
20
  def run
21
- print 'Do you want to create a CSV file now (yes|no)?: '
21
+ Helper.question('Do you want to create a CSV file now (yes|no)?: ')
22
22
  action = gets.chomp
23
23
 
24
24
  case action
25
25
  when 'no'
26
26
  Helper.close
27
27
  when 'yes'
28
- puts 'Starting to create the CSV file ...'
29
28
  execute
30
29
  else
31
- print 'please type yes or no: '
30
+ Helper.warning('please type yes or no: ')
32
31
  run
33
32
  end
34
33
  end
@@ -44,10 +43,16 @@ module EvernoteLinkExtractor
44
43
  end
45
44
 
46
45
  def show_summary
47
- puts " +++ Summary +++"
48
- puts "files found in directory: #{file_list.length}"
49
- puts "extracted links: #{link_list.length}"
50
- puts "failures: #{@ll.failures}"
46
+
47
+ summary = <<SUMMARY
48
+ \nfiles found in directory: #{file_list.length}
49
+ extracted links: #{link_list.length}
50
+ failures: #{@ll.failures}
51
+
52
+ SUMMARY
53
+ puts
54
+ Helper.headline(" +++ Summary +++ ")
55
+ Helper.message(summary)
51
56
  end
52
57
  end
53
58
  end
@@ -1,3 +1,3 @@
1
1
  module EvernoteLinkExtractor
2
- VERSION = "0.1.9"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -1,9 +1,10 @@
1
- require "evernote_link_extractor/version"
1
+ require 'pastel'
2
+ require 'evernote_link_extractor/version'
2
3
  require 'evernote_link_extractor/helper'
3
4
  require 'evernote_link_extractor/file_list'
4
5
  require 'evernote_link_extractor/link_list'
5
6
  require 'evernote_link_extractor/csv_builder'
6
- require "evernote_link_extractor/runner"
7
+ require 'evernote_link_extractor/runner'
7
8
 
8
9
 
9
10
  # Main Module
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evernote_link_extractor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Wenk
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pastel
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -135,4 +149,3 @@ signing_key:
135
149
  specification_version: 4
136
150
  summary: Extract links from your exported Evernote notes
137
151
  test_files: []
138
- has_rdoc: