fundler 0.2.4 → 0.2.5
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.
- checksums.yaml +4 -4
- data/README.md +30 -12
- data/bin/fundler +15 -0
- data/fundler.gemspec +3 -0
- data/lib/fundler/bookmarks_reader.rb +43 -21
- data/lib/fundler/version.rb +1 -1
- data/lib/fundler.rb +3 -0
- data/spec/fundler_bookmarks_spec.rb +34 -0
- metadata +32 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d126ab4a0ce34305604459b4607513f1d00aa1b
|
4
|
+
data.tar.gz: ce7f216f98126c8965f12ffd6ec9c288bb8a8915
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0650721de13bce3bb8dca720a75a3f5d163a615e4743f9b9732cd7269b1ab1a39da17ddf5d9b594a2d3b5adb5f6ad45843c8fb1ed544b7502fb45c6c48b83908
|
7
|
+
data.tar.gz: e7d6e9708b44704e3b6d2908008962d8094470efa3a4eea02c90a9e287a1ead46b03b7a39da5b4e1c48a2718884437051f5e86c007f673d089429d631c7ba2ff
|
data/README.md
CHANGED
@@ -1,33 +1,51 @@
|
|
1
|
-
#
|
1
|
+
# Fundler
|
2
2
|
|
3
|
-
|
3
|
+
[](http://travis-ci.org/zeroed/fundler)
|
4
|
+
|
5
|
+
Simple gem... It's a gem that wanna be useful but it's too simple for this claim.
|
6
|
+
Maybe Fundler it's more a script than a gem... but it's growning, slowly but it's growning.
|
7
|
+
|
8
|
+
## What Fundler can do for me?
|
9
|
+
|
10
|
+
Target: Unix user, Firefox user, terminal user...
|
11
|
+
|
12
|
+
Fundler (now) has 2 functionalities:
|
13
|
+
- clean and rename file
|
14
|
+
- read and dump bookmarks
|
4
15
|
|
5
16
|
## Installation
|
6
17
|
|
7
18
|
Add this line to your application's Gemfile:
|
8
19
|
|
9
|
-
|
20
|
+
```ruby
|
21
|
+
gem 'fundler'
|
22
|
+
```
|
10
23
|
|
11
24
|
And then execute:
|
12
25
|
|
13
|
-
|
26
|
+
`$ bundle`
|
14
27
|
|
15
28
|
Or install it yourself as:
|
16
29
|
|
17
|
-
|
30
|
+
`$ gem install fundler`
|
18
31
|
|
19
32
|
## Usage
|
20
33
|
|
21
|
-
|
22
|
-
|
23
|
-
```
|
34
|
+
In the current (`pwd`) directory:
|
24
35
|
|
25
|
-
|
26
|
-
|
27
|
-
|
36
|
+
- `$ fundler -h` : show the usage
|
37
|
+
- `$ fundler -l` : list the files in the `pwd`
|
38
|
+
- `$ fundler -c` : clean the filenames
|
39
|
+
- `$ fundler -b` : print (stdout) your Firefox bookmarks
|
28
40
|
|
41
|
+
## Work in progress
|
29
42
|
|
30
|
-
|
43
|
+
- dump bookmarks in different format (txt, html, markdown...)
|
44
|
+
- copy the `places.sqlite` (db_backup)
|
45
|
+
- advanced sqlite query
|
46
|
+
- rename file preview
|
47
|
+
- filter for file renaming
|
48
|
+
- ...
|
31
49
|
|
32
50
|
## Contributing
|
33
51
|
|
data/bin/fundler
CHANGED
@@ -101,3 +101,18 @@ end
|
|
101
101
|
#end
|
102
102
|
|
103
103
|
# EOF
|
104
|
+
|
105
|
+
#=begin
|
106
|
+
# commands = %[add list -l help -h rm backup -b]
|
107
|
+
# if ARGV[0]
|
108
|
+
# if commands.include?(ARGV[0])
|
109
|
+
# Fundler::CLI.start(ARGV)
|
110
|
+
# else
|
111
|
+
# cli = Fundler::CLI.new
|
112
|
+
# cli.open(ARGV[0])
|
113
|
+
# end
|
114
|
+
# else
|
115
|
+
# cli = Fundler::CLI.new
|
116
|
+
# cli.help
|
117
|
+
# end
|
118
|
+
#=end
|
data/fundler.gemspec
CHANGED
@@ -17,7 +17,10 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "sqlite3"
|
20
22
|
|
21
23
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
24
|
spec.add_development_dependency "rake"
|
25
|
+
spec.add_development_dependency "rspec"
|
23
26
|
end
|
@@ -15,9 +15,20 @@ https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsINavBookmar
|
|
15
15
|
http://davidkoepi.wordpress.com/2010/11/27/firefoxforensics/
|
16
16
|
|
17
17
|
== Queries
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
|
19
|
+
select moz_places.url, moz_bookmarks.title
|
20
|
+
from moz_places,moz_bookmarks
|
21
|
+
where moz_places.id = moz_bookmarks.fk and moz_bookmarks.title != '';
|
22
|
+
|
23
|
+
select keyword,url
|
24
|
+
from moz_keywords
|
25
|
+
left join moz_bookmarks on (moz_keywords.id = keyword_id)
|
26
|
+
left join moz_places on (fk = moz_places.id);
|
27
|
+
|
28
|
+
select moz_places.url, datetime((moz_historyvisits.visit_date/1000000), ‘unixepoch’, ‘localtime’), moz_historyvisits.visit_type
|
29
|
+
from moz_places, moz_historyvisits
|
30
|
+
where moz_historyvisits.place_id = moz_places.id
|
31
|
+
order by moz_historyvisits.visit_date desc;
|
21
32
|
=end
|
22
33
|
|
23
34
|
MOZILLA_FIREFOX_CONF_DIR = File.expand_path('~') + '/.mozilla/firefox/'
|
@@ -35,12 +46,13 @@ FROM
|
|
35
46
|
moz_anno_attributes
|
36
47
|
|
37
48
|
WHERE
|
38
|
-
moz_anno_attributes.name = 'bookmarkProperties/description'
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
SELECT DISTINCT fk
|
49
|
+
moz_anno_attributes.name = 'bookmarkProperties/description' AND
|
50
|
+
moz_items_annos.anno_attribute_id = moz_anno_attributes.id AND
|
51
|
+
moz_items_annos.item_id = moz_bookmarks.id AND
|
52
|
+
moz_places.id = moz_bookmarks.fk AND
|
53
|
+
moz_places.id IN (
|
54
|
+
SELECT DISTINCT fk
|
55
|
+
FROM moz_bookmarks
|
44
56
|
WHERE parent IN (
|
45
57
|
SELECT moz_bookmarks.id
|
46
58
|
FROM moz_bookmarks, moz_bookmarks_roots
|
@@ -57,18 +69,27 @@ ORDER BY UPPER(moz_bookmarks.title) ASC
|
|
57
69
|
# retrieve all the bookmarks stored.
|
58
70
|
def drop_bookmarks(format = :plain)
|
59
71
|
require 'sqlite3'
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
72
|
+
output = []
|
73
|
+
if locate_places
|
74
|
+
db = SQLite3::Database.new(locate_places)
|
75
|
+
rows = db.execute(BOOKMARKS_QUERY)
|
76
|
+
rows.each_with_index do |row, index|
|
77
|
+
case format
|
78
|
+
when :plain
|
79
|
+
output << "#{index}: #{row.join(' | ')}"
|
80
|
+
output << '---'
|
81
|
+
when :html
|
82
|
+
puts "TODO"
|
83
|
+
when :markdown
|
84
|
+
puts "TODO"
|
85
|
+
when :json
|
86
|
+
puts "TODO"
|
87
|
+
end
|
70
88
|
end
|
71
|
-
end
|
89
|
+
end
|
90
|
+
File.open('./bookmarks_dump.txt', 'w') do |file|
|
91
|
+
file.puts output
|
92
|
+
end
|
72
93
|
end
|
73
94
|
|
74
95
|
def locate_places
|
@@ -78,7 +99,8 @@ ORDER BY UPPER(moz_bookmarks.title) ASC
|
|
78
99
|
db_file = MOZILLA_FIREFOX_CONF_DIR + profile_dir.join + '/places.sqlite'
|
79
100
|
rescue Errno::ENOENT
|
80
101
|
puts "no db_bookmarks found"
|
81
|
-
exit 1
|
102
|
+
# exit 1
|
103
|
+
nil
|
82
104
|
end
|
83
105
|
end
|
84
106
|
|
data/lib/fundler/version.rb
CHANGED
data/lib/fundler.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'fundler'
|
2
|
+
require 'fundler/fundler_utils'
|
3
|
+
|
4
|
+
RSpec.configure do |config|
|
5
|
+
config.filter_run_excluding ruby: ->(v) { !RUBY_VERSION.start_with?(v.to_s) }
|
6
|
+
config.color_enabled = true
|
7
|
+
config.formatter = 'documentation'
|
8
|
+
# https://github.com/rspec/rspec-expectations
|
9
|
+
config.expect_with :rspec do |c|
|
10
|
+
c.syntax = :expect # disables `should`
|
11
|
+
end
|
12
|
+
|
13
|
+
config.include(ExitCodeMatchers)
|
14
|
+
end
|
15
|
+
|
16
|
+
class TestBookmarksFundler
|
17
|
+
describe Fundler do
|
18
|
+
let(:fundler) { Fundler.new }
|
19
|
+
before(:each) do
|
20
|
+
FileUtils::mkdir 'test'
|
21
|
+
end
|
22
|
+
|
23
|
+
after(:each) do
|
24
|
+
FileUtils::rm_rf 'test'
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'finds bookmarks file' do
|
28
|
+
FileUtils::cd './test' do
|
29
|
+
fundler.drop_bookmarks_file(:plain)
|
30
|
+
expect(fundler.all_files).to include('bookmarks_dump.txt')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end #describe
|
34
|
+
end # TestBookmarksFundler
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fundler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zeroed
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sqlite3
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +52,20 @@ dependencies:
|
|
38
52
|
- - '>='
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
41
69
|
description: just an humble find/rename utility
|
42
70
|
email:
|
43
71
|
- edd.rossi@gmail.com
|
@@ -58,6 +86,7 @@ files:
|
|
58
86
|
- lib/fundler/find_and_clean.rb
|
59
87
|
- lib/fundler/fundler_utils.rb
|
60
88
|
- lib/fundler/version.rb
|
89
|
+
- spec/fundler_bookmarks_spec.rb
|
61
90
|
- spec/fundler_spec.rb
|
62
91
|
homepage: https://github.com/zeroed/fundler
|
63
92
|
licenses:
|
@@ -84,5 +113,6 @@ signing_key:
|
|
84
113
|
specification_version: 4
|
85
114
|
summary: find rename utility
|
86
115
|
test_files:
|
116
|
+
- spec/fundler_bookmarks_spec.rb
|
87
117
|
- spec/fundler_spec.rb
|
88
118
|
has_rdoc:
|