qiita_org 0.1.4 → 0.1.5
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/qiita_org.rb +4 -3
- data/lib/qiita_org/config.rb +13 -3
- data/lib/qiita_org/post.rb +8 -3
- data/lib/qiita_org/search_conf_path.rb +18 -0
- data/lib/qiita_org/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72dc27665b3c0c77fe171a3440a39e610d0cf2bb5649259ec0d0e3d13b51d0d2
|
4
|
+
data.tar.gz: 29cdbf92e0e8b1001085796a60ff7537fec377ef49577252c9783e12c0982888
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 270d6285dac1e3d4e03feccaa075ef87ff259d07ac7ad862860b57307d132bd3b09311db5f215d96d32add017a013e3dbb6b7faa14c342e01f20a2ad489f55c4
|
7
|
+
data.tar.gz: 676b4534810880410bc134aa96bf174e72e447a412a7b4211d27e77481e52e88bf6b377d88dae22191ee11f1693afa693cb09525a58559e136efbf08db4594bf
|
data/Gemfile.lock
CHANGED
data/lib/qiita_org.rb
CHANGED
@@ -40,9 +40,10 @@ module QiitaOrg
|
|
40
40
|
desc "config", "set config"
|
41
41
|
|
42
42
|
def config(*argv)
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
status = argv[0] || "local"
|
44
|
+
option = argv[1] || nil
|
45
|
+
input = [argv[2], argv[3], argv[4]]
|
46
|
+
config = QiitaConfig.new(status, option, input)
|
46
47
|
config.run
|
47
48
|
end
|
48
49
|
|
data/lib/qiita_org/config.rb
CHANGED
@@ -3,10 +3,20 @@ require "fileutils"
|
|
3
3
|
require "json"
|
4
4
|
|
5
5
|
class QiitaConfig
|
6
|
-
def initialize(option, input)
|
6
|
+
def initialize(status, option, input)
|
7
7
|
@option = option
|
8
8
|
@input = input
|
9
|
-
|
9
|
+
if status == "local"
|
10
|
+
search = SearchConfPath.new(Dir.pwd, Dir.home)
|
11
|
+
conf_dir = search.search_conf_path()
|
12
|
+
if conf_dir == Dir.home
|
13
|
+
@setup = File.join(Dir.pwd, ".qiita.conf")
|
14
|
+
else
|
15
|
+
@setup = File.join(conf_dir, ".qiita.conf")
|
16
|
+
end
|
17
|
+
else
|
18
|
+
@setup = File.join(Dir.home, ".qiita.conf")
|
19
|
+
end
|
10
20
|
end
|
11
21
|
|
12
22
|
# check qiita.conf or copy qiita.conf
|
@@ -14,7 +24,7 @@ class QiitaConfig
|
|
14
24
|
lib = File.expand_path("../../../lib", __FILE__)
|
15
25
|
cp_file = File.join(lib, "qiita_org", ".qiita.conf")
|
16
26
|
|
17
|
-
if File.exists?("#{ENV["HOME"]}/.qiita.conf")
|
27
|
+
if File.exists?(@setup) # "# {ENV["HOME"]}/.qiita.conf")
|
18
28
|
puts @setup.green
|
19
29
|
print_config("now", "black")
|
20
30
|
else
|
data/lib/qiita_org/post.rb
CHANGED
@@ -4,11 +4,15 @@ require "net/https"
|
|
4
4
|
require "json"
|
5
5
|
require "command_line/global"
|
6
6
|
require "colorize"
|
7
|
+
require "qiita_org/search_conf_path.rb"
|
7
8
|
|
8
9
|
class QiitaPost
|
9
10
|
def initialize(file, option)
|
10
11
|
@src = file
|
11
12
|
@option = (option == "qiita" || option == "open")? "public" : option
|
13
|
+
search = SearchConfPath.new(Dir.pwd, Dir.home)
|
14
|
+
@conf_dir = search.search_conf_path()
|
15
|
+
p @conf_dir
|
12
16
|
end
|
13
17
|
|
14
18
|
public
|
@@ -31,7 +35,7 @@ class QiitaPost
|
|
31
35
|
end
|
32
36
|
|
33
37
|
def set_config()
|
34
|
-
conf_path = File.join(
|
38
|
+
conf_path = File.join(@conf_dir, ".qiita.conf")
|
35
39
|
@conf = JSON.load(File.read(conf_path))
|
36
40
|
@access_token = @conf["access_token"]
|
37
41
|
@teams_url = @conf["teams_url"]
|
@@ -65,8 +69,9 @@ class QiitaPost
|
|
65
69
|
end
|
66
70
|
|
67
71
|
def select_option(option)
|
68
|
-
qiita = (option == "teams")? "https://
|
69
|
-
|
72
|
+
qiita = (option == "teams")? @teams_url : "https://qiita.com/"
|
73
|
+
#qiita = (option == "teams")? "https://nishitani.qiita.com/" :
|
74
|
+
# "https://qiita.com/"
|
70
75
|
case option
|
71
76
|
when "teams", "qiita", "public", "open"
|
72
77
|
private = false
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class SearchConfPath
|
2
|
+
def initialize(dir, home)
|
3
|
+
@dir = dir
|
4
|
+
@home = home
|
5
|
+
search_conf_path()
|
6
|
+
end
|
7
|
+
|
8
|
+
def search_conf_path()
|
9
|
+
while @dir != @home
|
10
|
+
if File.exists?(File.join(@dir, ".qiita.conf"))
|
11
|
+
return @dir
|
12
|
+
else
|
13
|
+
@dir = @dir.match(/(.+)\//)[1]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
return @dir
|
17
|
+
end
|
18
|
+
end
|
data/lib/qiita_org/version.rb
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.5
|
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-09-
|
11
|
+
date: 2020-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -960,6 +960,7 @@ files:
|
|
960
960
|
- lib/qiita_org/hoge.txt
|
961
961
|
- lib/qiita_org/list.rb
|
962
962
|
- lib/qiita_org/post.rb
|
963
|
+
- lib/qiita_org/search_conf_path.rb
|
963
964
|
- lib/qiita_org/template.org
|
964
965
|
- lib/qiita_org/version.rb
|
965
966
|
- qiita_org.gemspec
|