qiita_org 0.1.23 → 0.1.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/qiita_org.rb +25 -12
- data/lib/qiita_org/error_message.rb +8 -4
- data/lib/qiita_org/get.rb +5 -5
- data/lib/qiita_org/get_multiple_files.rb +38 -0
- data/lib/qiita_org/list.rb +1 -1
- data/lib/qiita_org/post.rb +1 -1
- data/lib/qiita_org/select_path.rb +2 -2
- data/lib/qiita_org/version.rb +1 -1
- data/tests/test.org +1 -0
- data/tests/test2.org +1 -2
- data/tests/test3.org +1 -1
- data/tests/test4.org +1 -1
- metadata +3 -3
- data/tests/test2.md +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff5afe51529883ef3f843cc85608ea5eb112c97d9bee65ad71eee130e93ee3d1
|
4
|
+
data.tar.gz: b5945826738b2719a6dc861d60c920edc012db5d49e5c55d8cd464e608c9aab5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c7513a96480af4381e23b729a4308265d91721f3d75984cc7d3f28a756f8a386d5aa3d49fffbd00a8f946e2fbc6c77759bb8f61df9544d415315709c1d6dfb3
|
7
|
+
data.tar.gz: 96eb5ad3f7334dd0a14fa481fd33864f03fafc6739d2f6b3ae73b60a6c98d0a07c1a7614684cd7747e0216988052a567c96b6268a387d3085fd31e568a9d8417
|
data/Gemfile.lock
CHANGED
data/lib/qiita_org.rb
CHANGED
@@ -13,6 +13,7 @@ require "qiita_org/upload"
|
|
13
13
|
require "qiita_org/get_file_path"
|
14
14
|
require "qiita_org/show_file_and_url"
|
15
15
|
require "qiita_org/decide_option"
|
16
|
+
require "qiita_org/get_multiple_files"
|
16
17
|
#require "qiita_org/qiita_org_thor"
|
17
18
|
|
18
19
|
module QiitaOrg
|
@@ -38,16 +39,22 @@ module QiitaOrg
|
|
38
39
|
checkos = CheckPcOs.new
|
39
40
|
os = checkos.return_os()
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
begin
|
46
|
-
qiita.select_option(mode)
|
47
|
-
rescue RuntimeError => e
|
48
|
-
puts $!
|
42
|
+
if argv.size > 2
|
43
|
+
GetMultipleFiles.new(argv, os, "post").run()
|
44
|
+
elsif argv[-1].match(/(.+).org/) && argv.size != 1
|
45
|
+
GetMultipleFiles.new(argv, os, "post").run()
|
49
46
|
else
|
50
|
-
|
47
|
+
p ["in qiita_org.rb", argv]
|
48
|
+
p file = argv[0] || "README.org"
|
49
|
+
p mode = argv[1] || DecideOption.new(file).decide_option()
|
50
|
+
qiita = QiitaPost.new(file, mode, os)
|
51
|
+
begin
|
52
|
+
qiita.select_option(mode)
|
53
|
+
rescue RuntimeError => e
|
54
|
+
puts $!
|
55
|
+
else
|
56
|
+
qiita.run
|
57
|
+
end
|
51
58
|
end
|
52
59
|
end
|
53
60
|
|
@@ -57,10 +64,16 @@ module QiitaOrg
|
|
57
64
|
checkos = CheckPcOs.new
|
58
65
|
os = checkos.return_os()
|
59
66
|
|
60
|
-
|
61
|
-
|
67
|
+
if argv.size > 2
|
68
|
+
GetMultipleFiles.new(argv, os, "upload").run()
|
69
|
+
elsif argv[-1].match(/(.+).org/) && argv.size != 1
|
70
|
+
GetMultipleFiles.new(argv, os, "upload").run()
|
71
|
+
else
|
72
|
+
p file = argv[0] || "README.org"
|
73
|
+
p mode = argv[1] || DecideOption.new(file).decide_option()
|
62
74
|
|
63
|
-
|
75
|
+
qiita = UpLoad.new(file, mode, os).upload()
|
76
|
+
end
|
64
77
|
=begin
|
65
78
|
getpath = GetFilePath.new(file)
|
66
79
|
paths = getpath.get_file_path()
|
@@ -24,29 +24,33 @@ class ErrorMessage
|
|
24
24
|
exit
|
25
25
|
end
|
26
26
|
|
27
|
-
def qiita_post_error(response)
|
27
|
+
def qiita_post_error(response, file)
|
28
28
|
message = response.message
|
29
29
|
if message != "Created"
|
30
30
|
if message != "OK"
|
31
31
|
if message == "Unauthorized"
|
32
32
|
puts "#{message}".red
|
33
33
|
puts "Please check your access_token.".red
|
34
|
+
system "rm #{file}"
|
34
35
|
exit
|
35
|
-
|
36
|
+
elsif message == "Forbidden"
|
36
37
|
puts "#{message}".red
|
37
38
|
puts "You are not authorized to access this page. please check qiita_id.".red
|
39
|
+
system "rm #{file}"
|
38
40
|
exit
|
39
41
|
elsif message == "Not Found"
|
40
|
-
|
42
|
+
puts "#{message}".red
|
43
|
+
system "rm #{file}"
|
41
44
|
exit
|
42
45
|
else
|
43
46
|
puts "#{message}".red
|
47
|
+
system "rm #{file}"
|
44
48
|
exit
|
45
49
|
end
|
46
50
|
end
|
47
51
|
end
|
48
52
|
end
|
49
|
-
|
53
|
+
|
50
54
|
def config_set_error(conf_dir)
|
51
55
|
conf_path = File.join(conf_dir, ".qiita.conf")
|
52
56
|
conf = JSON.load(File.read(conf_path))
|
data/lib/qiita_org/get.rb
CHANGED
@@ -77,7 +77,7 @@ class QiitaGet
|
|
77
77
|
File.write(filename, item["body"])
|
78
78
|
convert_md_to_org()
|
79
79
|
write_header_on_org()
|
80
|
-
puts_massage_and_delete_md()
|
80
|
+
puts_massage_and_delete_md(item)
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
@@ -125,9 +125,9 @@ EOS
|
|
125
125
|
end
|
126
126
|
|
127
127
|
# see massage and delete id.md
|
128
|
-
def puts_massage_and_delete_md()
|
128
|
+
def puts_massage_and_delete_md(item)
|
129
129
|
puts "created #{@id}.org".green
|
130
|
-
puts "URL: #{
|
130
|
+
puts "URL: #{item["url"]}"
|
131
131
|
system "rm -f #{@id}.md"
|
132
132
|
end
|
133
133
|
|
@@ -155,7 +155,7 @@ EOS
|
|
155
155
|
File.write(filename, @items["body"])
|
156
156
|
convert_md_to_org()
|
157
157
|
write_header_on_org()
|
158
|
-
puts_massage_and_delete_md()
|
158
|
+
puts_massage_and_delete_md(@items)
|
159
159
|
end
|
160
160
|
|
161
161
|
def run()
|
@@ -165,7 +165,7 @@ EOS
|
|
165
165
|
end
|
166
166
|
|
167
167
|
if @get_id == nil
|
168
|
-
@qiita, @path = @selectpath.select_path(@mode)
|
168
|
+
@qiita, @path = @selectpath.select_path(@mode, @teams_url)
|
169
169
|
@items = AccessQiita.new(@access_token, @qiita, @path).access_qiita()
|
170
170
|
select_report()
|
171
171
|
else
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "colorize"
|
2
|
+
#require "../qiita_org/qiita_org.rb"
|
3
|
+
require "qiita_org/post.rb"
|
4
|
+
require "qiita_org/upload.rb"
|
5
|
+
require "qiita_org/decide_option.rb"
|
6
|
+
|
7
|
+
class GetMultipleFiles
|
8
|
+
def initialize(files, os, type)
|
9
|
+
@files = files
|
10
|
+
@option = nil
|
11
|
+
@os = os
|
12
|
+
@type = type
|
13
|
+
unless @files[-1].match(/(.+).org/)
|
14
|
+
@option = @files[-1]
|
15
|
+
@files = @files[0..-2]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def run()
|
20
|
+
puts "post files: #{@files}".green
|
21
|
+
@files.each do |file|
|
22
|
+
mode = @option || DecideOption.new(file).decide_option()
|
23
|
+
puts "qiita #{@type} #{file} #{mode}".green
|
24
|
+
if @type == "post"
|
25
|
+
qiita = QiitaPost.new(file, mode, @os)
|
26
|
+
begin
|
27
|
+
qiita.select_option(mode)
|
28
|
+
rescue RuntimeError => e
|
29
|
+
puts $!
|
30
|
+
else
|
31
|
+
qiita.run
|
32
|
+
end
|
33
|
+
elsif @type == "upload"
|
34
|
+
UpLoad.new(file, mode, @os).upload()
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/qiita_org/list.rb
CHANGED
@@ -15,7 +15,7 @@ class QiitaList
|
|
15
15
|
ErrorMessage.new().teams_url_error(@teams_url)
|
16
16
|
end
|
17
17
|
|
18
|
-
@qiita, @path = SelectPath.new().select_path(@mode)
|
18
|
+
@qiita, @path = SelectPath.new().select_path(@mode, @teams_url)
|
19
19
|
@items = AccessQiita.new(@access_token, @qiita, @path).access_qiita()
|
20
20
|
view_list()
|
21
21
|
end
|
data/lib/qiita_org/post.rb
CHANGED
data/lib/qiita_org/version.rb
CHANGED
data/tests/test.org
CHANGED
data/tests/test2.org
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#+qiita_private: ca3a6b6e1f5e8c0ba743
|
2
1
|
#+OPTIONS: ^:{}
|
3
2
|
#+STARTUP: indent nolineimages
|
4
3
|
#+TITLE: test
|
@@ -18,6 +17,6 @@ fogefoge
|
|
18
17
|
#+ATTR_LATEX: :width 8cm
|
19
18
|
[[https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/ebf505d2-6960-6bb9-20f0-e16dab142f4a.png][file:../figs/fig1.png]]
|
20
19
|
|
21
|
-
[[file:../figs/fig1.png]]
|
20
|
+
[[https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/ebf505d2-6960-6bb9-20f0-e16dab142f4a.png][file:../figs/fig1.png]]
|
22
21
|
|
23
22
|
|
data/tests/test3.org
CHANGED
data/tests/test4.org
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qiita_org
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenta Yamamoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -967,6 +967,7 @@ files:
|
|
967
967
|
- lib/qiita_org/get.rb
|
968
968
|
- lib/qiita_org/get_file_path.rb
|
969
969
|
- lib/qiita_org/get_file_url.rb
|
970
|
+
- lib/qiita_org/get_multiple_files.rb
|
970
971
|
- lib/qiita_org/get_template.rb
|
971
972
|
- lib/qiita_org/hoge.txt
|
972
973
|
- lib/qiita_org/list.rb
|
@@ -984,7 +985,6 @@ files:
|
|
984
985
|
- tests/hoge.rb
|
985
986
|
- tests/test.html
|
986
987
|
- tests/test.org
|
987
|
-
- tests/test2.md
|
988
988
|
- tests/test2.org
|
989
989
|
- tests/test3.org
|
990
990
|
- tests/test4.org
|
data/tests/test2.md
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
\![Mac OS X-10.13.3](<https://img.shields.io/badge/MacOSX-10.13.3-brightgreen>) \![ruby-2.7.0p0](<https://img.shields.io/badge/ruby-2.7.0p0-brightgreen>)
|
2
|
-
|
3
|
-
fogefoge
|
4
|
-
|
5
|
-
[![img](../figs/fig1.png)](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/ebf505d2-6960-6bb9-20f0-e16dab142f4a.png)
|
6
|
-
|