marquetapage 0.0.1 → 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: 83186079a129d656cf05238db63b8d3b39fb9ce7
4
- data.tar.gz: ecfb6c7775de3408543d1d95074490a8ad2fdb9c
3
+ metadata.gz: c5fe7f2769b658ae8c8d0910bfd8577d0bb26064
4
+ data.tar.gz: 0997d1f4f1b8b1a1985a63848234e863c787228d
5
5
  SHA512:
6
- metadata.gz: 5635907059b633c5b0cadb964c1be2d378ffd735f971884882dab4f421dcf06e024657914e75596b46e3605b45b0622240e3c8e12533bf508d68a3a4b0fed8c4
7
- data.tar.gz: 23e1b4f7400e5631173c589111ab1ed5d087c1777bebb6704ec84bf1f42a97f3e5016a0b16600e8ca11209ab4dc26fab9473ec290f16464d2fea854cad2022a3
6
+ metadata.gz: 47f8e7e31902e3fdf18b55c2e5f8ee33343d0bb36ba815fde08d24c8a71561200391429d68676150f7db8f6a3e162e503eea55214cc4243d5eda1cc3a0e865d9
7
+ data.tar.gz: 817fe635d31d60a8ae8d2cd3feb89dad00f704f5dedbcab3011392257b8fd97cd945b24c5fda0d295bb445693b4890d866afe9cc6997da87569b9b6b4c8abfa5
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2015-2016 Laurent Arnoud <laurent@spkdev.net>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  Extract from `places.sqlite` firefox bookmarks with specific tag to JSON format.
4
4
 
5
+ Note: supporting now firefox >= 48, due to [moz_bookmarks_roots
6
+ removal](https://bugzilla.mozilla.org/show_bug.cgi?id=1143712)
7
+
5
8
  ## Usage
6
9
 
7
10
  ~~~
@@ -31,3 +34,17 @@ bundle exec rake
31
34
  * https://github.com/websafe/ffbx
32
35
  * https://wiki.mozilla.org/images/d/d5/Places.sqlite.schema3.pdf
33
36
  * https://developer.mozilla.org/en-US/docs/Mozilla/Tech/Places/Database
37
+
38
+ ## License
39
+
40
+ The MIT License
41
+
42
+ Copyright © 2015-2016 Laurent Arnoud <laurent@spkdev.net>
43
+
44
+ ---
45
+ [![Build](https://img.shields.io/travis-ci/spk/marquetapage.svg)](https://travis-ci.org/spk/marquetapage)
46
+ [![Version](https://img.shields.io/gem/v/marquetapage.svg)](https://rubygems.org/gems/marquetapage)
47
+ [![Documentation](https://img.shields.io/badge/doc-rubydoc-blue.svg)](http://www.rubydoc.info/gems/marquetapage)
48
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT "MIT")
49
+ [![Code Climate](http://img.shields.io/codeclimate/github/spk/marquetapage.svg)](https://codeclimate.com/github/spk/marquetapage)
50
+ [![Inline docs](http://inch-ci.org/github/spk/marquetapage.svg?branch=master)](http://inch-ci.org/github/spk/marquetapage)
@@ -3,7 +3,7 @@ require 'sequel'
3
3
  # Marquetapage module handle env, db, and db connection
4
4
  module Marquetapage
5
5
  # Get current environment from MARQUETAPAGE_ENV
6
- # Default: development
6
+ # Default: production
7
7
  # @return String
8
8
  def self.env
9
9
  ENV['MARQUETAPAGE_ENV'] || 'production'
@@ -25,10 +25,6 @@ class Place < Sequel::Model(:moz_places)
25
25
  end
26
26
  end
27
27
 
28
- # moz_bookmarks_roots Sequel class
29
- class BookmarkRoot < Sequel::Model(:moz_bookmarks_roots)
30
- end
31
-
32
28
  # moz_bookmarks Sequel class
33
29
  class Bookmark < Sequel::Model(:moz_bookmarks)
34
30
  end
@@ -17,7 +17,7 @@ module Marquetapage
17
17
  # @param [ARGV] args must include a tag
18
18
  # @return [Integer] Exit status
19
19
  def run(args)
20
- fail ArgumentError unless args
20
+ raise ArgumentError unless args
21
21
  usage if args.empty?
22
22
  trap_interrupt
23
23
  @tag_name = args.first
@@ -28,7 +28,7 @@ module Marquetapage
28
28
 
29
29
  # Print usage
30
30
  def usage
31
- puts 'Usage: firefox-bookmarks-extract TAG'
31
+ puts 'Usage: marquetapage TAG'
32
32
  exit!(1)
33
33
  end
34
34
 
@@ -71,16 +71,11 @@ module Marquetapage
71
71
  end
72
72
 
73
73
  def bookmark_place_ids
74
- Bookmark.distinct.select(:fk).where(parent: tag)
74
+ Bookmark.distinct.select(:fk).where(parent: tag_id)
75
75
  end
76
76
 
77
- def tag
78
- Bookmark.join(
79
- :moz_bookmarks_roots,
80
- root_name: 'tags',
81
- moz_bookmarks__parent: :moz_bookmarks_roots__folder_id,
82
- moz_bookmarks__title: @tag_name
83
- ).select(:id)
77
+ def tag_id
78
+ Bookmark.where(moz_bookmarks__title: @tag_name).select(:id)
84
79
  end
85
80
  end
86
81
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Version file
2
4
  module Marquetapage
3
5
  # Version constant
4
- VERSION = '0.0.1'
6
+ VERSION = '0.1.0'.freeze
5
7
  end
@@ -1,6 +1,5 @@
1
1
 
2
2
  CREATE TABLE moz_bookmarks (id INTEGER PRIMARY KEY,type INTEGER, fk INTEGER DEFAULT NULL, parent INTEGER, position INTEGER, title LONGVARCHAR, keyword_id INTEGER, folder_type TEXT, dateAdded INTEGER, lastModified INTEGER, guid TEXT);
3
- CREATE TABLE moz_bookmarks_roots (root_name VARCHAR(16) UNIQUE, folder_id INTEGER);
4
3
  CREATE TABLE moz_keywords (id INTEGER PRIMARY KEY AUTOINCREMENT, keyword TEXT UNIQUE, place_id INTEGER, post_data TEXT);
5
4
  CREATE TABLE moz_favicons (id INTEGER PRIMARY KEY, url LONGVARCHAR UNIQUE, data BLOB, mime_type VARCHAR(32), expiration LONG, guid TEXT);
6
5
  CREATE TABLE moz_annos (id INTEGER PRIMARY KEY,place_id INTEGER NOT NULL,anno_attribute_id INTEGER,mime_type VARCHAR(32) DEFAULT NULL,content LONGVARCHAR, flags INTEGER DEFAULT 0,expiration INTEGER DEFAULT 0,type INTEGER DEFAULT 0,dateAdded INTEGER DEFAULT 0,lastModified INTEGER DEFAULT 0);
@@ -16,8 +16,6 @@ describe Marquetapage::Runner do
16
16
  @url = 'https://www.mozilla.org/en-US/firefox/central/'
17
17
  place_id = Place.insert url: @url
18
18
  bookmark_root_folder_id = 4
19
- BookmarkRoot.insert root_name: 'tags',
20
- folder_id: bookmark_root_folder_id
21
19
  tag_id = Bookmark.insert type: 2, fk: nil,
22
20
  parent: bookmark_root_folder_id,
23
21
  title: @tag_name,
@@ -34,12 +32,11 @@ describe Marquetapage::Runner do
34
32
  end
35
33
 
36
34
  it 'with good arg' do
37
- out, err = capture_io do
35
+ out, = capture_io do
38
36
  Marquetapage::Runner.run([@tag_name])
39
37
  end
40
38
  out.chomp.must_match @url
41
39
  out.chomp.must_match @content
42
- err.chomp.must_equal ''
43
40
  end
44
41
  end
45
42
  end
@@ -1,11 +1,13 @@
1
- ENV['MARQUETAPAGE_ENV'] = 'test'
1
+ # frozen_string_literal: true
2
+
3
+ ENV['MARQUETAPAGE_ENV'] = 'test'.freeze
2
4
  require 'minitest/autorun'
3
5
  require 'marquetapage'
4
6
  require 'marquetapage/runner'
5
7
 
6
8
  DB = Marquetapage.sequel_connect
7
- %i(places anno_attributes items_annos bookmarks bookmarks_roots
8
- keywords favicons annos historyvisits inputhistory hosts).each do |t|
9
+ %i(places anno_attributes items_annos bookmarks keywords favicons annos
10
+ historyvisits inputhistory hosts).each do |t|
9
11
  DB.drop_table(:"moz_#{t}") if DB.table_exists?(:"moz_#{t}")
10
12
  end
11
13
  DB.run(File.read(File.expand_path('../moz_places.schema', __FILE__)))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marquetapage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laurent Arnoud
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-01 00:00:00.000000000 Z
11
+ date: 2016-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.8'
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.8'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sequel
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '4.27'
33
+ version: '4'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '4.27'
40
+ version: '4'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sqlite3
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,75 +53,47 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.3'
55
55
  - !ruby/object:Gem::Dependency
56
- name: minitest
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '5.6'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '5.6'
69
- - !ruby/object:Gem::Dependency
70
- name: minitest-line
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '0.6'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '0.6'
83
- - !ruby/object:Gem::Dependency
84
- name: inch
56
+ name: rake
85
57
  requirement: !ruby/object:Gem::Requirement
86
58
  requirements:
87
59
  - - "~>"
88
60
  - !ruby/object:Gem::Version
89
- version: '0.7'
61
+ version: '11'
90
62
  type: :development
91
63
  prerelease: false
92
64
  version_requirements: !ruby/object:Gem::Requirement
93
65
  requirements:
94
66
  - - "~>"
95
67
  - !ruby/object:Gem::Version
96
- version: '0.7'
68
+ version: '11'
97
69
  - !ruby/object:Gem::Dependency
98
- name: rake
70
+ name: minitest
99
71
  requirement: !ruby/object:Gem::Requirement
100
72
  requirements:
101
73
  - - "~>"
102
74
  - !ruby/object:Gem::Version
103
- version: '10'
75
+ version: '5'
104
76
  type: :development
105
77
  prerelease: false
106
78
  version_requirements: !ruby/object:Gem::Requirement
107
79
  requirements:
108
80
  - - "~>"
109
81
  - !ruby/object:Gem::Version
110
- version: '10'
82
+ version: '5'
111
83
  - !ruby/object:Gem::Dependency
112
84
  name: rubocop
113
85
  requirement: !ruby/object:Gem::Requirement
114
86
  requirements:
115
87
  - - "~>"
116
88
  - !ruby/object:Gem::Version
117
- version: '0.34'
89
+ version: 0.42.0
118
90
  type: :development
119
91
  prerelease: false
120
92
  version_requirements: !ruby/object:Gem::Requirement
121
93
  requirements:
122
94
  - - "~>"
123
95
  - !ruby/object:Gem::Version
124
- version: '0.34'
96
+ version: 0.42.0
125
97
  description: marquetapage
126
98
  email: laurent@spkdev.net
127
99
  executables:
@@ -131,6 +103,7 @@ extra_rdoc_files:
131
103
  - README.md
132
104
  files:
133
105
  - Gemfile
106
+ - LICENSE
134
107
  - README.md
135
108
  - bin/marquetapage
136
109
  - lib/marquetapage.rb
@@ -152,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
152
125
  requirements:
153
126
  - - ">="
154
127
  - !ruby/object:Gem::Version
155
- version: 1.9.3
128
+ version: 2.0.0
156
129
  required_rubygems_version: !ruby/object:Gem::Requirement
157
130
  requirements:
158
131
  - - ">="
@@ -160,10 +133,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
133
  version: '0'
161
134
  requirements: []
162
135
  rubyforge_project:
163
- rubygems_version: 2.4.5
136
+ rubygems_version: 2.5.1
164
137
  signing_key:
165
138
  specification_version: 4
166
139
  summary: Extract to JSON bookmarks from `places.sqlite` with specific tag
167
140
  test_files:
168
141
  - test/runner_test.rb
169
- has_rdoc: