unofficial-quiver-export 0.0.1
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 +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/README.md +19 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/exe/quiver-export +6 -0
- data/lib/unofficial/quiver/export/cli.rb +42 -0
- data/lib/unofficial/quiver/export/note_writer.rb +39 -0
- data/lib/unofficial/quiver/export/version.rb +7 -0
- data/lib/unofficial/quiver/export.rb +3 -0
- data/unofficial-quiver-export.gemspec +28 -0
- metadata +115 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d04e71be017ca4c28d7e90a9839cdb6aaae7c7be
|
4
|
+
data.tar.gz: bc95c8d7ca8c59ff4729c3f71209b451832980a3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5e2158152b95ff29a6df37a766e9d8cc6116c8cbd08f09e4160c943b65b1be77679f36b4bb0b9e6c30d5488fafd3f724e456afc5afa096a452b7746ff92a5be4
|
7
|
+
data.tar.gz: 471f63861338999ce41217c0c2317d007543b8bf73c6c278ae4385dd9aa6f63a5d9de6c82c4b1bbd89ec43e76fbb242bd12fa231230cdc9fc0c028309ff597a9
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Unofficial Quiver Export
|
2
|
+
|
3
|
+
This is the un-official gem for [Quiver](http://happenapps.com/#quiver). It exports plain text files within Quiver notebooks.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'unofficial-quiver-export'
|
9
|
+
```
|
10
|
+
|
11
|
+
## Warnings
|
12
|
+
|
13
|
+
This gem removes the selected --out option directory. Please back up the directory before execute it.
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
```bash
|
18
|
+
quiver-export --in ~/Dropbox/App/Quiver/Quiver.qvlibrary --out ~/Dropbox/App/Quiver/Quiver.export --ext .txt
|
19
|
+
```
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "unofficial/quiver/export"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/exe/quiver-export
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Unofficial
|
5
|
+
module Quiver
|
6
|
+
module Export
|
7
|
+
class CLI < Thor
|
8
|
+
|
9
|
+
desc "exec", "export Quiver notes to .md files."
|
10
|
+
option :in, required: true
|
11
|
+
option :out, required: true
|
12
|
+
option :ext, required: false, default: '.txt'
|
13
|
+
default_task :exec
|
14
|
+
|
15
|
+
def exec
|
16
|
+
puts "options: in = #{options[:in]}, out = #{options[:out]}"
|
17
|
+
|
18
|
+
clean
|
19
|
+
scan_content do |content_file|
|
20
|
+
writer = NoteWriter.new(content_file, options)
|
21
|
+
writer.write
|
22
|
+
end
|
23
|
+
|
24
|
+
puts 'Export complete!!'
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def clean
|
30
|
+
puts 'Clean the --out option directory.'
|
31
|
+
FileUtils.rm_r(options[:out])
|
32
|
+
end
|
33
|
+
|
34
|
+
def scan_content
|
35
|
+
Dir.glob(File.join(options[:in], '**/*.qvnote/content.json')).each do |content_file|
|
36
|
+
yield(content_file)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Unofficial
|
2
|
+
module Quiver
|
3
|
+
module Export
|
4
|
+
class NoteWriter
|
5
|
+
def initialize(content_file, options)
|
6
|
+
@content_file = content_file
|
7
|
+
@content = JSON.parse(open(content_file).read)
|
8
|
+
@options = options
|
9
|
+
end
|
10
|
+
|
11
|
+
def write
|
12
|
+
open(output_note_file, 'w') do |f|
|
13
|
+
puts f.path
|
14
|
+
@content['cells'].each do |cell|
|
15
|
+
f.puts cell['data']
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def meta_file
|
23
|
+
@meta_file ||= File.join(File.dirname(@content_file), '../meta.json')
|
24
|
+
end
|
25
|
+
|
26
|
+
def nootbook
|
27
|
+
nootbook_meta = JSON.parse(open(meta_file).read)
|
28
|
+
nootbook_meta['name']
|
29
|
+
end
|
30
|
+
|
31
|
+
def output_note_file
|
32
|
+
f = File.join(@options[:out], nootbook, @content['title'].gsub('/', '') + @options[:ext])
|
33
|
+
FileUtils.mkdir_p(File.dirname(f))
|
34
|
+
f
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'unofficial/quiver/export/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.required_ruby_version = '~> 2.0'
|
8
|
+
|
9
|
+
spec.name = "unofficial-quiver-export"
|
10
|
+
spec.version = Unofficial::Quiver::Export::VERSION
|
11
|
+
spec.authors = ["Norimitsu YAMASHITA"]
|
12
|
+
spec.email = ["tugend.licht@gmail.com"]
|
13
|
+
|
14
|
+
spec.summary = %q{This gem exports plain text files within Quiver notebooks.}
|
15
|
+
spec.description = %q{This is the un-official gem for Quiver. It exports plain text files within Quiver notebooks.}
|
16
|
+
spec.homepage = "https://github.com/nori3tsu/unofficial-quiver-export"
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = %w(quiver-export)
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_runtime_dependency "thor"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "rspec"
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: unofficial-quiver-export
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Norimitsu YAMASHITA
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
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'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.9'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.9'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.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'
|
69
|
+
description: This is the un-official gem for Quiver. It exports plain text files within
|
70
|
+
Quiver notebooks.
|
71
|
+
email:
|
72
|
+
- tugend.licht@gmail.com
|
73
|
+
executables:
|
74
|
+
- quiver-export
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- .gitignore
|
79
|
+
- .rspec
|
80
|
+
- .travis.yml
|
81
|
+
- Gemfile
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- bin/console
|
85
|
+
- bin/setup
|
86
|
+
- exe/quiver-export
|
87
|
+
- lib/unofficial/quiver/export.rb
|
88
|
+
- lib/unofficial/quiver/export/cli.rb
|
89
|
+
- lib/unofficial/quiver/export/note_writer.rb
|
90
|
+
- lib/unofficial/quiver/export/version.rb
|
91
|
+
- unofficial-quiver-export.gemspec
|
92
|
+
homepage: https://github.com/nori3tsu/unofficial-quiver-export
|
93
|
+
licenses: []
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '2.0'
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 2.0.14
|
112
|
+
signing_key:
|
113
|
+
specification_version: 4
|
114
|
+
summary: This gem exports plain text files within Quiver notebooks.
|
115
|
+
test_files: []
|