joplin 0.3.0 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +17 -17
- data/Makefile +3 -0
- data/README.md +3 -3
- data/bin/joplin +2 -3
- data/joplin.gemspec +4 -4
- data/lib/joplin/version.rb +1 -1
- data/lib/joplin.rb +11 -1
- metadata +8 -9
- data/lib/joplin/token.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25c5fb1c89e4e91404ff3551eab854d7d60d1233dae32089419fadca850c0fc6
|
4
|
+
data.tar.gz: 1b682ba27da2ef362b92f2d0810e3fedff7e18480f03d82810201bf4e787777e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 349baaaacee32d7adb003a921b33a002a3e400980eca1778353777ffa6d2a7c5bb42d05d76b0b5dd9d41a38bab66cc16044cebf64da158784814aa7324c0b3e1
|
7
|
+
data.tar.gz: 95c59bca854fd21545bab1d3473afe1cb253c2a7d9a7e55463d3091ddc2514dec316e08fb3b9c8c9535652585e85f0eaa99b525614c14e5520783b3d7b146833
|
data/Gemfile.lock
CHANGED
@@ -1,38 +1,38 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
joplin (0.
|
4
|
+
joplin (0.5.2)
|
5
5
|
faraday (~> 1.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
diff-lcs (1.
|
10
|
+
diff-lcs (1.5.0)
|
11
11
|
faraday (1.0.1)
|
12
12
|
multipart-post (>= 1.2, < 3)
|
13
13
|
multipart-post (2.1.1)
|
14
|
-
rake (13.0.
|
15
|
-
rspec (3.
|
16
|
-
rspec-core (~> 3.
|
17
|
-
rspec-expectations (~> 3.
|
18
|
-
rspec-mocks (~> 3.
|
19
|
-
rspec-core (3.
|
20
|
-
rspec-support (~> 3.
|
21
|
-
rspec-expectations (3.
|
14
|
+
rake (13.0.6)
|
15
|
+
rspec (3.11.0)
|
16
|
+
rspec-core (~> 3.11.0)
|
17
|
+
rspec-expectations (~> 3.11.0)
|
18
|
+
rspec-mocks (~> 3.11.0)
|
19
|
+
rspec-core (3.11.0)
|
20
|
+
rspec-support (~> 3.11.0)
|
21
|
+
rspec-expectations (3.11.0)
|
22
22
|
diff-lcs (>= 1.2.0, < 2.0)
|
23
|
-
rspec-support (~> 3.
|
24
|
-
rspec-mocks (3.
|
23
|
+
rspec-support (~> 3.11.0)
|
24
|
+
rspec-mocks (3.11.0)
|
25
25
|
diff-lcs (>= 1.2.0, < 2.0)
|
26
|
-
rspec-support (~> 3.
|
27
|
-
rspec-support (3.
|
26
|
+
rspec-support (~> 3.11.0)
|
27
|
+
rspec-support (3.11.0)
|
28
28
|
sqlite3 (1.4.2)
|
29
|
-
thor (1.
|
29
|
+
thor (1.2.1)
|
30
30
|
|
31
31
|
PLATFORMS
|
32
32
|
ruby
|
33
33
|
|
34
34
|
DEPENDENCIES
|
35
|
-
bundler (~>
|
35
|
+
bundler (~> 2.0)
|
36
36
|
faraday (~> 1.0)
|
37
37
|
joplin!
|
38
38
|
rake (~> 13.0)
|
@@ -41,4 +41,4 @@ DEPENDENCIES
|
|
41
41
|
thor (~> 1.0)
|
42
42
|
|
43
43
|
BUNDLED WITH
|
44
|
-
|
44
|
+
2.0.1
|
data/Makefile
CHANGED
data/README.md
CHANGED
@@ -8,7 +8,7 @@ Creating a note
|
|
8
8
|
Joplin::token = "your joplintoken here copied from the webclippper settings"
|
9
9
|
|
10
10
|
begin
|
11
|
-
note = Joplin::
|
11
|
+
note = Joplin::Note.new
|
12
12
|
note.title = "a new note"
|
13
13
|
note.body = "markdown content"
|
14
14
|
note.save!
|
@@ -19,7 +19,7 @@ end
|
|
19
19
|
|
20
20
|
updating a note
|
21
21
|
```ruby
|
22
|
-
note = Joplin::
|
22
|
+
note = Joplin::Note.new "6e3811c7a73148a" # note id can be found in the information of any note
|
23
23
|
note.title = "a new note title"
|
24
24
|
note.save!
|
25
25
|
```
|
@@ -42,4 +42,4 @@ to get the token programatically. It reads from the sqlite database located in `
|
|
42
42
|
|
43
43
|
Will take a notebook and concatenate all notes into one for easy export to PDF
|
44
44
|
|
45
|
-
The token argument is optional and if you have it installed locally it will find the token
|
45
|
+
The token argument is optional and if you have it installed locally it will find the token
|
data/bin/joplin
CHANGED
@@ -4,7 +4,6 @@ $:.unshift File.expand_path("../../lib", __FILE__)
|
|
4
4
|
|
5
5
|
require "joplin"
|
6
6
|
require 'thor'
|
7
|
-
require "joplin/token"
|
8
7
|
|
9
8
|
DIVIDER = %Q(
|
10
9
|
|
@@ -28,7 +27,7 @@ class MyCLI < Thor
|
|
28
27
|
option :'dry-run', desc: "dry-run", aliases: '-n'
|
29
28
|
desc :clean, "clean unused resources"
|
30
29
|
def clean
|
31
|
-
Joplin::token = options[:token]
|
30
|
+
Joplin::token = Joplinl.get_token || options[:token]
|
32
31
|
puts "Please wait, this can take while."
|
33
32
|
Joplin::Resource.orphaned.map { |r|
|
34
33
|
r.delete if not options['dry-run']
|
@@ -90,7 +89,7 @@ class MyCLI < Thor
|
|
90
89
|
|
91
90
|
private
|
92
91
|
def token()
|
93
|
-
Joplin::token = options[:token]
|
92
|
+
Joplin::token = Joplin.get_token || options[:token]
|
94
93
|
raise "Couldn't find token in local database and it wasn't passed as an option. You better check yourself!" if not Joplin::token
|
95
94
|
end
|
96
95
|
end
|
data/joplin.gemspec
CHANGED
@@ -11,15 +11,15 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = %q{joplin API}
|
13
13
|
spec.description = %q{joplin API}
|
14
|
-
spec.homepage = "http://github.com/danielb2/joplin"
|
14
|
+
spec.homepage = "http://github.com/danielb2/joplin-ruby"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
18
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
19
|
if spec.respond_to?(:metadata)
|
20
20
|
spec.metadata["homepage_uri"] = spec.homepage
|
21
|
-
spec.metadata["source_code_uri"] = "http://github.com/danielb2/joplin"
|
22
|
-
spec.metadata["changelog_uri"] = "http://github.com/danielb2/joplin"
|
21
|
+
spec.metadata["source_code_uri"] = "http://github.com/danielb2/joplin-ruby"
|
22
|
+
spec.metadata["changelog_uri"] = "http://github.com/danielb2/joplin-ruby"
|
23
23
|
else
|
24
24
|
raise "RubyGems 2.0 or newer is required to protect against " \
|
25
25
|
"public gem pushes."
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.require_paths = ["lib"]
|
36
36
|
|
37
37
|
spec.add_dependency "faraday", "~> 1.0"
|
38
|
-
spec.add_development_dependency "bundler", "~>
|
38
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
39
39
|
spec.add_development_dependency "rake", "~> 13.0"
|
40
40
|
spec.add_development_dependency "rspec", "~> 3.0"
|
41
41
|
spec.add_development_dependency "thor", "~> 1.0.1"
|
data/lib/joplin/version.rb
CHANGED
data/lib/joplin.rb
CHANGED
@@ -5,6 +5,7 @@ require "json"
|
|
5
5
|
module Joplin
|
6
6
|
class Error < StandardError; end
|
7
7
|
attr_accessor :token
|
8
|
+
@@token = nil
|
8
9
|
|
9
10
|
def self.token= token
|
10
11
|
@@token = token
|
@@ -17,8 +18,17 @@ module Joplin
|
|
17
18
|
return parsed
|
18
19
|
end
|
19
20
|
|
21
|
+
def self.get_token
|
22
|
+
begin
|
23
|
+
settings = JSON.parse File.read("#{ENV['HOME']}/.config/joplin-desktop/settings.json")
|
24
|
+
return settings['api.token']
|
25
|
+
rescue
|
26
|
+
return nil
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
20
30
|
def self.token
|
21
|
-
@@token
|
31
|
+
@@token || get_token
|
22
32
|
end
|
23
33
|
|
24
34
|
def self.uri= uri
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: joplin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Bretoi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.0'
|
34
34
|
type: :development
|
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: '
|
40
|
+
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,15 +102,14 @@ files:
|
|
102
102
|
- bin/setup
|
103
103
|
- joplin.gemspec
|
104
104
|
- lib/joplin.rb
|
105
|
-
- lib/joplin/token.rb
|
106
105
|
- lib/joplin/version.rb
|
107
|
-
homepage: http://github.com/danielb2/joplin
|
106
|
+
homepage: http://github.com/danielb2/joplin-ruby
|
108
107
|
licenses:
|
109
108
|
- MIT
|
110
109
|
metadata:
|
111
|
-
homepage_uri: http://github.com/danielb2/joplin
|
112
|
-
source_code_uri: http://github.com/danielb2/joplin
|
113
|
-
changelog_uri: http://github.com/danielb2/joplin
|
110
|
+
homepage_uri: http://github.com/danielb2/joplin-ruby
|
111
|
+
source_code_uri: http://github.com/danielb2/joplin-ruby
|
112
|
+
changelog_uri: http://github.com/danielb2/joplin-ruby
|
114
113
|
post_install_message:
|
115
114
|
rdoc_options: []
|
116
115
|
require_paths:
|
data/lib/joplin/token.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require "sqlite3"
|
2
|
-
module Joplin
|
3
|
-
module Token
|
4
|
-
def self.get
|
5
|
-
begin
|
6
|
-
db = SQLite3::Database.new "#{ENV['HOME']}/.config/joplin-desktop/database.sqlite"
|
7
|
-
rows = db.execute("select value from settings where key='api.token';")
|
8
|
-
return rows.flatten.first
|
9
|
-
rescue
|
10
|
-
return nil
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|