outliner 0.2.0 → 1.0.2

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
  SHA256:
3
- metadata.gz: 965c6e37c5f452ee902a235cf5eaaa73375894dbf1244cca2065f338ab12badd
4
- data.tar.gz: 84533e4c6617795ee3a50181c6e78b178709caa356730cdcc93d26c89a99d5cc
3
+ metadata.gz: f9c33ead5965c7d3343b0cb626eb725655e4e618938451363c314496648a41e6
4
+ data.tar.gz: 910e51e24b3e976454f302ca3f348bcfe2405758f34fcbc16c6e5aba08b13f6e
5
5
  SHA512:
6
- metadata.gz: 29c1e5c613d50fae1337ba041c1203d4d2e5ce82987997e59a83e21875a925c5ed3c0b730513de6a5efa9254997c04c79c4ea8ba26e9925db1019987c888da16
7
- data.tar.gz: 0c08dec404bffea65a5b00647770fb761725db0a2d5445830d401a22a26abbd77768a9336635913dca195486faf1b39e9becaef2ef7865cceca6d6064079b9a9
6
+ metadata.gz: a223dfcc0f99b2071559b842ceba71db4992c99af1601a9c7e7e8b40758614e69eed123f045ae48ab69e0c8e73542daaf63e05bade507986bc05d9631c4d047a
7
+ data.tar.gz: 459b25c411aec74177ee55eca5290f1a89a3614747f6ff48b89ebab83fa6a8f72b6b392b76e5eadf74170656c7f78e621bcaa27ea4d4b1eb1eb1353dc2ed0b59
data/CHANGELOG.md CHANGED
@@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## 1.0.1 - 2020-04-26
11
+
12
+ ### Changed
13
+
14
+ - Dependency Updates
15
+
16
+ ## 1.0.0 - 2020-04-26
17
+
18
+ ### Changed
19
+
20
+ - Changes `push` to `sync`.
21
+
22
+ ### Added
23
+
24
+ - `sync` now actually syncs the git repository, and maintains history.
25
+
26
+
27
+ ## 0.2.2 - 2019-08-14
28
+
29
+ - Adds a `push` command (See #2)
30
+
10
31
  ## 0.2.0 - 2019-08-12
11
32
 
12
33
  - Adds export command (See [#1013](https://github.com/outline/outline/pull/1013) for corresponding Outline PR)
data/Dockerfile CHANGED
@@ -1,9 +1,18 @@
1
- FROM ruby:2.6-alpine
1
+ FROM ruby:3.3-alpine3.19
2
+
3
+ RUN apk add --no-cache git openssh-client rsync && \
4
+ echo -e "StrictHostKeyChecking no" >> /etc/ssh/ssh_config && \
5
+ mkdir /root/.ssh
2
6
 
3
7
  WORKDIR /outliner
4
8
  COPY . /outliner/
5
9
 
6
- RUN gem install bundler && \
7
- bundle install
10
+ RUN echo "gem: --no-ri --no-rdoc" > ~/.gemrc && \
11
+ apk add --no-cache alpine-sdk && \
12
+ gem update --system && \
13
+ gem install bundler && \
14
+ bundle install && \
15
+ apk del --no-cache alpine-sdk && \
16
+ rm ~/.gemrc
8
17
 
9
18
  ENTRYPOINT ["/outliner/entrypoint.sh"]
data/Gemfile.lock CHANGED
@@ -1,42 +1,45 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- outliner (0.1.1)
4
+ outliner (1.0.2)
5
5
  httparty (~> 0.17)
6
+ rake (>= 12.3)
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
9
10
  specs:
10
- addressable (2.6.0)
11
- public_suffix (>= 2.0.2, < 4.0)
12
- crack (0.4.3)
13
- safe_yaml (~> 1.0.0)
14
- hashdiff (1.0.0)
15
- httparty (0.17.0)
16
- mime-types (~> 3.0)
11
+ addressable (2.8.6)
12
+ public_suffix (>= 2.0.2, < 6.0)
13
+ bigdecimal (3.1.6)
14
+ crack (1.0.0)
15
+ bigdecimal
16
+ rexml
17
+ hashdiff (1.1.0)
18
+ httparty (0.21.0)
19
+ mini_mime (>= 1.0.0)
17
20
  multi_xml (>= 0.5.2)
18
- mime-types (3.2.2)
19
- mime-types-data (~> 3.2015)
20
- mime-types-data (3.2019.0331)
21
- minitest (5.8.5)
21
+ json (2.7.1)
22
+ mini_mime (1.1.5)
23
+ minitest (5.22.2)
22
24
  multi_xml (0.6.0)
23
- public_suffix (3.1.1)
24
- rake (10.5.0)
25
- safe_yaml (1.0.5)
26
- webmock (3.6.0)
27
- addressable (>= 2.3.6)
25
+ public_suffix (5.0.4)
26
+ rake (13.1.0)
27
+ rexml (3.2.6)
28
+ webmock (3.23.0)
29
+ addressable (>= 2.8.0)
28
30
  crack (>= 0.3.2)
29
31
  hashdiff (>= 0.4.0, < 2.0.0)
30
32
 
31
33
  PLATFORMS
32
34
  ruby
35
+ x86_64-linux
33
36
 
34
37
  DEPENDENCIES
35
38
  bundler (~> 2.0)
36
- minitest (~> 5.8.4)
39
+ json (~> 2.7)
40
+ minitest (~> 5.8)
37
41
  outliner!
38
- rake (~> 10.0)
39
- webmock (~> 3.6.0)
42
+ webmock (~> 3.6)
40
43
 
41
44
  BUNDLED WITH
42
- 2.0.2
45
+ 2.5.4
data/LICENSE CHANGED
@@ -1,7 +1,7 @@
1
- Copyright 2019 Abhay Rana
1
+ Copyright 2020 Abhay Rana
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
5
5
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
6
 
7
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Outliner [![Gem Version](https://badge.fury.io/rb/outliner.svg)](https://badge.fury.io/rb/outliner) [![](https://images.microbadger.com/badges/version/captn3m0/outliner:v0.2.0.svg)](https://microbadger.com/images/captn3m0/outliner:v0.2.0 'Get your own version badge on microbadger.com') [![](https://images.microbadger.com/badges/version/captn3m0/outliner:latest.svg)](https://microbadger.com/images/captn3m0/outliner:latest 'Get your own version badge on microbadger.com')
1
+ # Outliner [![Gem Version](https://badge.fury.io/rb/outliner.svg)](https://badge.fury.io/rb/outliner) [![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/captn3m0/outliner)](https://hub.docker.com/r/captn3m0/outliner) [![Docker Image Version (latest semver)](https://img.shields.io/docker/v/captn3m0/outliner)](https://hub.docker.com/r/captn3m0/outliner) [![Docker Image Size (latest semver)](https://img.shields.io/docker/image-size/captn3m0/outliner)](https://hub.docker.com/r/captn3m0/outliner)
2
2
 
3
3
  A simple HTTParty based wrapper for the [Outline API](https://www.getoutline.com/developers). It also offers a one-line import option to let you migrate an existing set of Markdown files to Outline. For quickly running export/import commands, you can use the Docker Image as well.
4
4
 
@@ -28,6 +28,13 @@ require 'outliner'
28
28
  client = Outliner.new('https://knowledge.example.com')
29
29
  pp client.auth_info
30
30
  pp client.collections_list(offset: 0, limit: 10)
31
+ # This works around a 302 redirect bug in httparty
32
+ begin
33
+ r = @client.fileOperations__redirect({id: FILE_OPERATION_ID}, format: nil, no_follow: true)
34
+ rescue HTTParty::RedirectionTooDeep => e
35
+ # Download this using response = HTTParty.get e.response.header['location'] if needed
36
+ pp e.response.header['location']
37
+ end
31
38
  ```
32
39
 
33
40
  ### Import
@@ -60,11 +67,16 @@ outliner-export "$DESTINATION_DIRECTORY"
60
67
 
61
68
  You can use the pre-built docker image to run the above commands as well. See the following commands for examples:
62
69
 
70
+ ### Setup
71
+
72
+ Copy the `env.sample` file to `.env` and update the values there.
73
+
63
74
  ### Export
64
75
 
76
+ Downloads all collections from Outline, and exports them as nested markdown files inside the given directory (`/data` inside the container, mount it accordingly.)
77
+
65
78
  ```bash
66
- docker run --env OUTLINE_BASE_URI="https://kb.example.com" \
67
- --env OUTLINE_TOKEN="PUT YOUR TOKEN HERE" \
79
+ docker run --env-file .env
68
80
  --volume /tmp:/data \
69
81
  captn3m0/outliner \
70
82
  export \
@@ -73,18 +85,33 @@ docker run --env OUTLINE_BASE_URI="https://kb.example.com" \
73
85
 
74
86
  ### Import
75
87
 
88
+ Imports all markdown documents in a directory to a named Collection on outline. Creates the collection if it doesn't exist.
89
+
76
90
  ```bash
77
- docker run --env OUTLINE_BASE_URI="https://kb.example.com" \
78
- --env OUTLINE_TOKEN="PUT YOUR TOKEN HERE" \
91
+ docker run --env-file .env
79
92
  --volume /path/to/wiki:/data \
80
93
  captn3m0/outliner \
81
- import "/data" "Archive"
94
+ import /data "Archive"
95
+ ```
96
+
97
+ ### Sync
98
+
99
+ Does a export from Outline, and pushes the corresponding result to the Git repository. Currenly does a force-push to the repository. Use with care.
100
+
101
+ Note: Sync is currently only available as a Docker Command
102
+
103
+ ```bash
104
+ docker run --env-file .env
105
+ --volume /etc/ssh/private.key:/root/.ssh/id_rsa
106
+ captn3m0/outliner \
107
+ sync
82
108
  ```
83
109
 
84
110
  #### Limitations
85
111
 
86
- - Images are currently not imported. Host them externally for this to work.
87
- - Only `.md` files are currently supported
112
+ - [import] Images are currently not imported. Host them externally for this to work.
113
+ - [import] Only `.md` files are currently supported
114
+ - [docker] `StrictHostKeyChecking` is currently disabled for `push`, please only run this in trusted networks.
88
115
 
89
116
  ## Development
90
117
 
data/entrypoint.sh CHANGED
@@ -1,19 +1,77 @@
1
1
  #!/bin/sh
2
-
2
+ set -eu
3
3
  if [ $# -eq 0 ]; then
4
- echo "Please run with outliner [export|import] arguments"
4
+ echo "Please run with outliner [export|import|sync] arguments"
5
5
  exit
6
6
  fi
7
7
 
8
+ setup_git() {
9
+ if [ -f "$HOME/.ssh/id_rsa" ]; then
10
+ # This is required because Kubernetes secret mounts can't
11
+ # have file permissions set
12
+ chmod 0400 "$HOME/.ssh/id_rsa"
13
+
14
+ if [ ! -d "$HOME/.ssh/id_rsa.pub" ]; then
15
+ ssh-keygen -y -f "$HOME/.ssh/id_rsa" > "$HOME/.ssh/id_rsa.pub"
16
+ fi
17
+ echo "[+] Using SSH key for git pushes"
18
+ else
19
+ echo "[E] Git credentials not available, quitting"
20
+ exit 1
21
+ fi
22
+
23
+ eval $(ssh-agent)
24
+ ssh-add "$HOME/.ssh/id_rsa"
25
+ }
26
+
27
+ update_git_config() {
28
+ EMAIL=${GIT_EMAIL:-outliner@example.invalid}
29
+ git config --global user.email "$EMAIL"
30
+ git config --global user.name "Outliner Backup"
31
+ git remote add origin "$GIT_REMOTE_URL"
32
+ }
33
+
8
34
  case $1 in
9
35
  export)
10
36
  shift
11
- bundle exec outliner-export $@
37
+ bundle exec outliner-export "$@"
12
38
  ;;
13
39
  import)
14
40
  shift
15
- bundle exec outliner-import $@
16
- break
41
+ bundle exec outliner-import "$@"
42
+ ;;
43
+ sync)
44
+ BRANCH=${GIT_BRANCH:-master}
45
+ old_git_dir=$(mktemp -d)
46
+ fresh_export_dir=$(mktemp -d)
47
+ if [ -z "$GIT_REMOTE_URL" ]; then
48
+ echo "[E] GIT_REMOTE_URL not set"
49
+ exit 1
50
+ else
51
+ git clone --branch "$BRANCH" "$GIT_REMOTE_URL" "$old_git_dir"
52
+ setup_git
53
+ update_git_config
54
+ echo "[+] Exporting data from Outline"
55
+ bundle exec outliner-export "$fresh_export_dir"
56
+ echo "[+] Resetting git repository"
57
+ cd "$old_git_dir"
58
+ # We update so that git forgets all files
59
+ git ls-files -z |xargs -n1 -0 git rm
60
+ # Then we copy across the files from the new export
61
+ cd "$fresh_export_dir"
62
+ echo "[+] Updating git repository"
63
+ rsync -av . "$old_git_dir"
64
+ cd "$old_git_dir"
65
+ echo "[+] Committing to git"
66
+ git add .
67
+ git commit --message "Backup: $(date)" > /dev/null
68
+ git status
69
+ echo "[+] Pushing to git remote"
70
+ git push origin "HEAD:$BRANCH"
71
+ echo "[+] Cleaning up"
72
+ rm -rf "$old_git_dir"
73
+ rm -rf "$fresh_export_dir"
74
+ fi
17
75
  ;;
18
76
  *)
19
77
  echo "Invalid command, please check README"
data/env.sample ADDED
@@ -0,0 +1,4 @@
1
+ OUTLINE_BASE_URI=https://outline.example.com
2
+ GIT_BRANCH=master
3
+ GIT_REMOTE_URL=git@example.com:org/outline.backup.git
4
+ OUTLINE_TOKEN=
data/exe/outliner-export CHANGED
@@ -1,16 +1,15 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "outliner"
4
+ require 'bundler/setup'
5
+ require 'outliner'
5
6
  require 'tempfile'
6
7
 
7
8
  def validate
8
- unless (ARGV.size == 1) and Dir.exists?(ARGV[0]) and ENV.key?('OUTLINE_BASE_URI') and ENV.key?('OUTLINE_TOKEN')
9
- puts "[E] Please call as `outliner-export directory`"
10
- puts "[E] Please export OUTLINE_BASE_URI and OUTLINE_TOKEN environment variables"
11
- puts "[E] OUTLINE_BASE_URI should not include /api"
12
- exit 1
13
- end
9
+ raise 'Missing arguments' if ARGV.size != 1
10
+ raise 'Invalid directory' unless Dir.exist?(ARGV[0])
11
+ raise 'OUTLINE_BASE_URI not set' unless ENV.key?('OUTLINE_BASE_URI')
12
+ raise 'OUTLINE_TOKEN not set' unless ENV.key?('OUTLINE_TOKEN')
14
13
  end
15
14
 
16
15
  # Run validations
@@ -21,13 +20,30 @@ local_directory = ARGV[0]
21
20
  CLIENT = Outliner::Client.new ENV['OUTLINE_BASE_URI']
22
21
 
23
22
  # Download the complete zip
24
- response = CLIENT.collections_exportAll(download: true)
23
+ response = CLIENT.collections__export_all(format: "outline-markdown")
24
+
25
+ raise 'Failed to trigger export_all action' if not response['success']
26
+
27
+ file_operation_id = response['data']['fileOperation']['id']
28
+ fop_info_response = nil
29
+ i = 0
30
+ loop do
31
+ i += 1
32
+ raise 'Timed out waiting for the file export operation to complete' if i > 20
33
+ sleep(2*i)
34
+ fop_info_response = CLIENT.fileOperations__info(id: file_operation_id)
35
+ raise 'Failed to query export file operation info' if not fop_info_response['ok']
36
+ break if fop_info_response['data']['state'] == 'complete'
37
+ end
25
38
 
26
- # Extract it to a tempfle
27
- file = Tempfile.new('download.zip')
28
- File.open(file.path, 'w') { |file| file.write(response.body) }
39
+ begin
40
+ fop_redirect_response = CLIENT.fileOperations__redirect({id: file_operation_id}, {no_follow: true})
41
+ rescue HTTParty::RedirectionTooDeep => e
42
+ response = HTTParty.get e.response.header['location']
43
+ file = Tempfile.new('download.zip')
44
+ File.open(file.path, 'w') { |f| f.write(response.body) }
45
+ `unzip -o "#{file.path}" -d "#{local_directory}"`
46
+ file.unlink
47
+ end
29
48
 
30
- `unzip -o "#{file.path}" -d "#{local_directory}"`
31
49
 
32
- # Delete tempfile
33
- file.unlink
data/exe/outliner-import CHANGED
@@ -1,45 +1,48 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "outliner"
4
+ require 'bundler/setup'
5
+ require 'outliner'
5
6
 
6
7
  def validate
7
- unless (ARGV.size == 2) and Dir.exists?(ARGV[0]) and ARGV[1].match(/\w+/) and ENV.key?('OUTLINE_BASE_URI') and ENV.key?('OUTLINE_TOKEN')
8
- puts "[E] Please call as `outliner-import local_directory remote_collection_name`"
9
- puts "[E] Please export OUTLINE_BASE_URI and OUTLINE_TOKEN environment variables"
10
- puts "[E] OUTLINE_BASE_URI should not include /api"
11
- exit 1
12
- end
8
+ raise 'Missing arguments' if ARGV.size != 2
9
+ raise 'Invalid directory' unless Dir.exist?(ARGV[0])
10
+ raise 'Invalid collection' unless ARGV[1].match(/\w+/)
11
+ raise 'OUTLINE_BASE_URI not set' unless ENV.key?('OUTLINE_BASE_URI')
12
+ raise 'OUTLINE_TOKEN not set' unless ENV.key?('OUTLINE_TOKEN')
13
13
  end
14
14
 
15
- def create_documents_recursively(directory, collection_id, parent_document_id=nil)
15
+ def create_documents_recursively(directory, collection_id, parent_document_id = nil)
16
16
  cwd = Dir.pwd
17
17
  Dir.chdir directory
18
18
  # Create all documents for this directory
19
- Dir["*.md"].each do |file|
19
+ Dir['*.md'].each do |file|
20
20
  params = {
21
21
  title: file[0...-3],
22
- text: file[0...-3] + "\n" + File.read(file) + "\n\n---\nImported at #{Time.now}",
22
+ text: file[0...-3] +
23
+ "\n" +
24
+ File.read(file) +
25
+ "\n\n---\nImported at #{Time.now}",
23
26
  collectionId: collection_id,
24
27
  publish: true
25
28
  }
26
29
 
27
30
  params[:parentDocumentId] = parent_document_id if parent_document_id
28
- CLIENT.documents_create(params)
31
+ CLIENT.documents__create(params)
29
32
  puts "[-] #{file}"
30
33
  end
31
34
 
32
35
  # Create child documents for each sub-directory
33
- Dir.glob('*').select {|f| File.directory? f}.each do |dir|
36
+ Dir.glob('*').select { |f| File.directory? f }.each do |dir|
34
37
  puts "[-] #{dir}"
35
38
  params = {
36
39
  title: dir,
37
- text: dir +"\nImported at #{Time.now}",
40
+ text: dir + "\nImported at #{Time.now}",
38
41
  collectionId: collection_id,
39
42
  publish: true,
40
43
  parentDocumentId: parent_document_id
41
44
  }
42
- response = CLIENT.documents_create(params)
45
+ response = CLIENT.documents__create(params)
43
46
  create_documents_recursively(dir, collection_id, response['data']['id'])
44
47
  end
45
48
  Dir.chdir cwd
@@ -54,16 +57,15 @@ remote_collection_name = ARGV[1]
54
57
 
55
58
  # Create a root collection
56
59
  CLIENT = Outliner::Client.new ENV['OUTLINE_BASE_URI']
57
- root_collection_id = find_or_create_collection(CLIENT, remote_collection_name)
60
+ root_collection_id = CLIENT.find_or_create_collection(remote_collection_name)
58
61
 
59
62
  begin
60
63
  create_documents_recursively(local_directory, root_collection_id)
61
- puts "[S] Import successful"
62
- rescue Exception => e
64
+ puts '[S] Import successful'
65
+ rescue StandardError? => e
63
66
  # If we fail, print an error, and delete the collection
64
67
  puts "[E] Import failed with error: #{e.message}"
65
- CLIENT.collections_delete(id: root_collection_id)
66
- puts "[E] Deleted collection, please report the issue or retry"
68
+ CLIENT.collections__delete(id: root_collection_id)
69
+ puts '[E] Deleted collection, please report the issue or retry'
67
70
  exit 1
68
71
  end
69
-
@@ -10,18 +10,29 @@ module Outliner
10
10
  @token = ENV['OUTLINE_TOKEN']
11
11
  end
12
12
 
13
- def method_missing(method_name, params = {})
14
- method_name = '/' + method_name.to_s.sub('_', '.')
15
- body = {token: @token}.merge(params).to_json
16
- options = {
17
- body: body,
13
+ def find_or_create_collection(name)
14
+ collections = self.collections__list(limit: 100)['data']
15
+ collections.filter!{|c|c['name'] == name}
16
+ if collections.size >= 1
17
+ collections[0]['id']
18
+ else
19
+ self.collections__create(name: name, description: 'Imported Collection')['data']['id']
20
+ end
21
+ end
22
+
23
+ def method_missing(method_name, params = {}, options = {})
24
+ method_name = "/#{method_name.to_s.sub('__', '.')}"
25
+
26
+ options = {
27
+ body: params.to_json,
18
28
  headers: {
19
- 'Accept'=>'application/json',
20
- 'Content-Type': 'application/json',
21
- 'User-Agent': "Outliner/#{Outliner::VERSION}"
29
+ 'Accept' => 'application/json',
30
+ 'Content-Type' => 'application/json',
31
+ 'User-Agent' => "Outliner/#{Outliner::VERSION}",
32
+ 'Authorization' => "Bearer #{@token}"
22
33
  },
23
- format: :json
24
- }
34
+ format: :json,
35
+ }.merge!(options)
25
36
 
26
37
  self.class.post(method_name, options)
27
38
  end
@@ -1,3 +1,3 @@
1
1
  module Outliner
2
- VERSION = "0.2.0"
2
+ VERSION = "1.0.2"
3
3
  end
data/outliner.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.name = "outliner"
8
8
  spec.version = Outliner::VERSION
9
9
  spec.authors = ["Nemo"]
10
- spec.email = ["rubygem.outliner@captnemo.in"]
10
+ spec.email = ["outliner@captnemo.in"]
11
11
  spec.licenses = ["MIT"]
12
12
 
13
13
  spec.summary = "A simple HTTParty based client for outline knowledge base."
@@ -23,10 +23,11 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ["lib"]
25
25
 
26
- spec.add_dependency "httparty", "~> 0.17"
26
+ spec.add_dependency "httparty", "~> 0.21"
27
+ spec.add_dependency "json", "~> 2.7"
27
28
 
28
- spec.add_development_dependency "bundler", "~> 2.0"
29
- spec.add_development_dependency "rake", "~> 10.0"
30
- spec.add_development_dependency "webmock", "~> 3.6.0"
31
- spec.add_development_dependency "minitest", "~> 5.8.4"
29
+ spec.add_development_dependency "bundler", "~> 2.1"
30
+ spec.add_dependency "rake", ">= 13.1"
31
+ spec.add_development_dependency "webmock", "~> 3.23"
32
+ spec.add_development_dependency "minitest", "~> 5.22"
32
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: outliner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nemo
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-12 00:00:00.000000000 Z
11
+ date: 2024-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -16,73 +16,87 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.17'
19
+ version: '0.21'
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: '0.17'
26
+ version: '0.21'
27
27
  - !ruby/object:Gem::Dependency
28
- name: bundler
28
+ name: json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
34
- type: :development
33
+ version: '2.7'
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: '2.0'
40
+ version: '2.7'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rake
42
+ name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '2.1'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '2.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '13.1'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '13.1'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: webmock
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: 3.6.0
75
+ version: '3.23'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: 3.6.0
82
+ version: '3.23'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: minitest
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: 5.8.4
89
+ version: '5.22'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: 5.8.4
83
- description:
96
+ version: '5.22'
97
+ description:
84
98
  email:
85
- - rubygem.outliner@captnemo.in
99
+ - outliner@captnemo.in
86
100
  executables:
87
101
  - outliner-export
88
102
  - outliner-import
@@ -100,11 +114,11 @@ files:
100
114
  - bin/console
101
115
  - bin/setup
102
116
  - entrypoint.sh
117
+ - env.sample
103
118
  - exe/outliner-export
104
119
  - exe/outliner-import
105
120
  - lib/outliner.rb
106
121
  - lib/outliner/client.rb
107
- - lib/outliner/helper.rb
108
122
  - lib/outliner/version.rb
109
123
  - outliner.gemspec
110
124
  homepage: https://github.com/captn3m0/outliner
@@ -114,7 +128,7 @@ metadata:
114
128
  homepage_uri: https://github.com/captn3m0/outliner
115
129
  source_code_uri: https://github.com/captn3m0/outliner
116
130
  changelog_uri: https://github.com/captn3m0/outliner/blob/master/CHANGELOG.md
117
- post_install_message:
131
+ post_install_message:
118
132
  rdoc_options: []
119
133
  require_paths:
120
134
  - lib
@@ -129,8 +143,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
143
  - !ruby/object:Gem::Version
130
144
  version: '0'
131
145
  requirements: []
132
- rubygems_version: 3.0.4
133
- signing_key:
146
+ rubygems_version: 3.3.25
147
+ signing_key:
134
148
  specification_version: 4
135
149
  summary: A simple HTTParty based client for outline knowledge base.
136
150
  test_files: []
@@ -1,13 +0,0 @@
1
- module Outliner
2
- class Helper
3
- def find_or_create_collection(client, name)
4
- collections = client.collections_list(limit: 100)['data']
5
- collections.filter!{|c|c['name'] == name}
6
- if collections.size >= 1
7
- collections[0]['id']
8
- else
9
- client.collections_create(name: name, description: 'Imported Collection')['data']['id']
10
- end
11
- end
12
- end
13
- end