bookmarkeron 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +3 -0
- data/bookmarkeron.gemspec +1 -0
- data/lib/bookmarkeron.rb +1 -1
- data/lib/bookmarkeron/cli.rb +13 -3
- data/lib/bookmarkeron/finder.rb +9 -0
- data/lib/bookmarkeron/version.rb +1 -1
- data/spec/cli_spec.rb +17 -1
- data/spec/finder_spec.rb +24 -0
- data/spec/spec_helper.rb +2 -0
- metadata +20 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9ee5571f36d79a3a7451289524def9f16ab3c60
|
4
|
+
data.tar.gz: abbdc83a873df2b78f21b9a95368c4948e3aae75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ebfe6594730fb0eeea3f29e9b6530bb56459cca73e94379456124c6fc47cf03ee6ecfaf8ed08407552e3dd61f85f8c34e4fc97e84a74c9eb501465a3d93fe4e
|
7
|
+
data.tar.gz: b95096a1973f1bdf160ed8e38cd3a08f74e216dfb0a96d9af8b63a790a77fee5978a8a245b796cad67a7e45dc145a1e25906debbab7a287b1ea152cffba73ffb
|
data/CHANGELOG
ADDED
data/bookmarkeron.gemspec
CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "fakefs"
|
23
24
|
spec.add_development_dependency "rspec"
|
24
25
|
spec.add_development_dependency "awesome_print"
|
25
26
|
end
|
data/lib/bookmarkeron.rb
CHANGED
data/lib/bookmarkeron/cli.rb
CHANGED
@@ -1,8 +1,18 @@
|
|
1
1
|
module Bookmarkeron
|
2
2
|
class CLI
|
3
|
-
def self.run(source,
|
4
|
-
|
5
|
-
|
3
|
+
def self.run(source, destination = nil)
|
4
|
+
if destination
|
5
|
+
dests = [destination]
|
6
|
+
else
|
7
|
+
dests = Finder.find
|
8
|
+
end
|
9
|
+
dests.each do |dest|
|
10
|
+
puts "merging bookmarks into #{dest}"
|
11
|
+
merger = Merger.new({source: source, target: dest})
|
12
|
+
File.write(dest, merger.result_json)
|
13
|
+
end
|
14
|
+
|
15
|
+
puts "#{dests.size} profiles updated"
|
6
16
|
end
|
7
17
|
end
|
8
18
|
end
|
data/lib/bookmarkeron/version.rb
CHANGED
data/spec/cli_spec.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
module Bookmarkeron
|
4
|
-
describe
|
4
|
+
describe CLI do
|
5
|
+
|
5
6
|
it "writes new stuff into the target file" do
|
6
7
|
FileUtils.cp fixtures("chrome"), fixtures("cli_test")
|
7
8
|
|
@@ -13,5 +14,20 @@ module Bookmarkeron
|
|
13
14
|
FileUtils.rm fixtures("cli_test")
|
14
15
|
File.exist?(fixtures("cli_test")).should be_false
|
15
16
|
end
|
17
|
+
|
18
|
+
describe "with no target" do
|
19
|
+
it "finds all Bookmark files in the chrome directory and runs on those" do
|
20
|
+
fake_merger = double(:merger, allow: true)
|
21
|
+
Finder.should_receive(:find).and_return(["a", "b"])
|
22
|
+
Merger.should_receive(:new).with(hash_including(target: "a")).and_return(fake_merger)
|
23
|
+
Merger.should_receive(:new).with(hash_including(target: "b")).and_return(fake_merger)
|
24
|
+
fake_merger.should_receive(:result_json).twice
|
25
|
+
File.should_receive(:write).twice
|
26
|
+
|
27
|
+
CLI.run(fixtures("example.yml"))
|
28
|
+
|
29
|
+
# use this:find ~/Library/Application\ Support/Google/Chrome -name Bookmarks
|
30
|
+
end
|
31
|
+
end
|
16
32
|
end
|
17
33
|
end
|
data/spec/finder_spec.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Bookmarkeron
|
4
|
+
describe Finder do
|
5
|
+
include FakeFS::SpecHelpers
|
6
|
+
|
7
|
+
xit "finds all the Bookmark files on the file system" do
|
8
|
+
root = File.join(ENV["HOME"], "Library", "Application Support", "Chrome")
|
9
|
+
profiles = ["A", "Bee", "see"]
|
10
|
+
bookmark_files = []
|
11
|
+
|
12
|
+
profiles.map do |p|
|
13
|
+
FileUtils.mkdir_p File.join(root, p)
|
14
|
+
bookmark_file = File.join(root, p, 'Bookmarks')
|
15
|
+
bookmark_files << bookmark_file
|
16
|
+
nonsense_file = File.join(root, p, 'Sandwich')
|
17
|
+
FileUtils.touch bookmark_file
|
18
|
+
FileUtils.touch nonsense_file
|
19
|
+
end
|
20
|
+
|
21
|
+
Finder.find.should == bookmark_files
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bookmarkeron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rukednous
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: fakefs
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rspec
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,6 +89,7 @@ extensions: []
|
|
75
89
|
extra_rdoc_files: []
|
76
90
|
files:
|
77
91
|
- .gitignore
|
92
|
+
- CHANGELOG
|
78
93
|
- Gemfile
|
79
94
|
- LICENSE.txt
|
80
95
|
- README.md
|
@@ -83,9 +98,11 @@ files:
|
|
83
98
|
- bookmarkeron.gemspec
|
84
99
|
- lib/bookmarkeron.rb
|
85
100
|
- lib/bookmarkeron/cli.rb
|
101
|
+
- lib/bookmarkeron/finder.rb
|
86
102
|
- lib/bookmarkeron/merger.rb
|
87
103
|
- lib/bookmarkeron/version.rb
|
88
104
|
- spec/cli_spec.rb
|
105
|
+
- spec/finder_spec.rb
|
89
106
|
- spec/fixtures/chrome
|
90
107
|
- spec/fixtures/example.yml
|
91
108
|
- spec/merger_spec.rb
|
@@ -116,6 +133,7 @@ specification_version: 4
|
|
116
133
|
summary: declare bookmarks in a yaml file, merge them into your Chrome bookmarks
|
117
134
|
test_files:
|
118
135
|
- spec/cli_spec.rb
|
136
|
+
- spec/finder_spec.rb
|
119
137
|
- spec/fixtures/chrome
|
120
138
|
- spec/fixtures/example.yml
|
121
139
|
- spec/merger_spec.rb
|