qiita_org 0.1.10 → 0.1.15
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 +19 -7
- data/lib/qiita_org/config.rb +1 -1
- data/lib/qiita_org/get_template.rb +55 -7
- data/lib/qiita_org/post.rb +1 -0
- data/lib/qiita_org/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88f0ea4de914134782eac18097c144c9a7d5393c0334bf03ef9f1cdd2374f60e
|
4
|
+
data.tar.gz: fdd51bf362e3ff8635dcb873fcb9801d10a3124b63921b4dcfae3c572cba4aa5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65fd2e9345bfbf148e6bbeab986059a3ee07716571e9533da1f491cbc5d12685b120752f7986d557b4bc97778ebf0f0ab904257d99cfc4a3636c83ff85acff0d
|
7
|
+
data.tar.gz: cb0723fc53febe667ecb933bd1e34a719979e2ff447b8893a10dafbfa7da052cadc8d79b7c768025d17f18fab7f11f44774557331231685efcf801565c9586ba
|
data/Gemfile.lock
CHANGED
data/lib/qiita_org.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
require "thor"
|
2
3
|
require "colorize"
|
3
4
|
require "qiita_org/version"
|
@@ -7,6 +8,7 @@ require "qiita_org/get"
|
|
7
8
|
require "qiita_org/list"
|
8
9
|
require "qiita_org/get_template"
|
9
10
|
require "qiita_org/check_pc_os"
|
11
|
+
require "qiita_org/version"
|
10
12
|
#require "qiita_org/qiita_org_thor"
|
11
13
|
|
12
14
|
module QiitaOrg
|
@@ -17,7 +19,6 @@ module QiitaOrg
|
|
17
19
|
#
|
18
20
|
def initialize(*argv)
|
19
21
|
super(*argv)
|
20
|
-
@checkos = CheckPcOs.new
|
21
22
|
end
|
22
23
|
|
23
24
|
desc "say_hello", "say_hello"
|
@@ -27,10 +28,12 @@ module QiitaOrg
|
|
27
28
|
puts "Hello #{name}."
|
28
29
|
end
|
29
30
|
|
30
|
-
desc "post", "post to qiita from org"
|
31
|
+
desc "post [FILE] [private/public/teams]", "post to qiita from org"
|
31
32
|
|
32
33
|
def post(*argv)
|
33
|
-
|
34
|
+
checkos = CheckPcOs.new
|
35
|
+
os = checkos.return_os()
|
36
|
+
|
34
37
|
p ["in qiita_org.rb", argv]
|
35
38
|
p file = argv[0] || "README.org"
|
36
39
|
p mode = argv[1] || "private"
|
@@ -44,7 +47,7 @@ module QiitaOrg
|
|
44
47
|
end
|
45
48
|
end
|
46
49
|
|
47
|
-
desc "config", "set config"
|
50
|
+
desc "config [global/local] [option] [input]", "set config"
|
48
51
|
|
49
52
|
def config(*argv)
|
50
53
|
status = argv[0] || "local"
|
@@ -54,7 +57,7 @@ module QiitaOrg
|
|
54
57
|
config.run
|
55
58
|
end
|
56
59
|
|
57
|
-
desc "get", "get qiita report"
|
60
|
+
desc "get [qiita/teams] [記事のID]", "get qiita report"
|
58
61
|
|
59
62
|
def get(*argv)
|
60
63
|
p mode = argv[0] || "qiita"
|
@@ -66,7 +69,10 @@ module QiitaOrg
|
|
66
69
|
desc "template", "make template.org"
|
67
70
|
|
68
71
|
def template(*argv)
|
69
|
-
|
72
|
+
checkos = CheckPcOs.new
|
73
|
+
os = checkos.return_os()
|
74
|
+
|
75
|
+
template = QiitaGetTemplate.new(os)
|
70
76
|
end
|
71
77
|
|
72
78
|
desc "all", "post all org file in the directory"
|
@@ -84,11 +90,17 @@ module QiitaOrg
|
|
84
90
|
end
|
85
91
|
end
|
86
92
|
|
87
|
-
desc "list", "view qiita report list"
|
93
|
+
desc "list [qiita/teams]", "view qiita report list"
|
88
94
|
|
89
95
|
def list(*argv)
|
90
96
|
p mode = argv[0] || "qiita"
|
91
97
|
QiitaList.new(mode)
|
92
98
|
end
|
99
|
+
|
100
|
+
desc "version", "show version"
|
101
|
+
|
102
|
+
def version
|
103
|
+
puts QiitaOrg::VERSION
|
104
|
+
end
|
93
105
|
end
|
94
106
|
end
|
data/lib/qiita_org/config.rb
CHANGED
@@ -9,7 +9,7 @@ class QiitaConfig
|
|
9
9
|
if status == "local"
|
10
10
|
search = SearchConfPath.new(Dir.pwd, Dir.home)
|
11
11
|
conf_dir = search.search_conf_path()
|
12
|
-
if
|
12
|
+
if @option == "set"
|
13
13
|
@setup = File.join(Dir.pwd, ".qiita.conf")
|
14
14
|
else
|
15
15
|
@setup = File.join(conf_dir, ".qiita.conf")
|
@@ -1,9 +1,11 @@
|
|
1
1
|
require "fileutils"
|
2
2
|
require "colorize"
|
3
|
+
require "kconv"
|
3
4
|
require "qiita_org/search_conf_path"
|
4
5
|
|
5
6
|
class QiitaGetTemplate
|
6
|
-
def initialize()
|
7
|
+
def initialize(os)
|
8
|
+
@os = os
|
7
9
|
cp_template()
|
8
10
|
search = SearchConfPath.new(Dir.pwd, Dir.home)
|
9
11
|
@conf_dir = search.search_conf_path()
|
@@ -23,6 +25,32 @@ class QiitaGetTemplate
|
|
23
25
|
File.write("template.org", conts) # + "# {m[1]}: # {m[2]}\n")
|
24
26
|
end
|
25
27
|
|
28
|
+
def get_windowsos_version()
|
29
|
+
system 'wmic.exe os get caption > hoge1.txt'
|
30
|
+
system 'wmic.exe os get osarchitecture > hoge2.txt'
|
31
|
+
version1 = Kconv.tosjis(File.read("hoge1.txt"))
|
32
|
+
version2 = Kconv.tosjis(File.read("hoge2.txt"))
|
33
|
+
m1, m2 = [], []
|
34
|
+
m1 = version1.match(/Caption\nMicrosoft (.+) (.+)/)
|
35
|
+
m2 = version2.match(/OSArchitecture\n(.+)-bit/)
|
36
|
+
system 'rm hoge1.txt'
|
37
|
+
system 'rm hoge2.txt'
|
38
|
+
conts = File.read("template.org")
|
39
|
+
conts << "![#{m1[1]}-#{m1[2]}](https://img.shields.io/badge/#{m1[1].gsub(" ", "")}#{m1[2]}-#{m2[1]}bit-brightgreen) "
|
40
|
+
File.write("template.org", conts) # + "# {m[1]}: # {m[2]}\n")
|
41
|
+
end
|
42
|
+
|
43
|
+
def get_ubuntu_version()
|
44
|
+
system 'cat /etc/issue > hoge.txt'
|
45
|
+
version = File.read("hoge.txt")
|
46
|
+
m = []
|
47
|
+
m = version.match(/(.+) (.+) LTS /)
|
48
|
+
system 'rm hoge.txt'
|
49
|
+
conts = File.read("template.org")
|
50
|
+
conts << "![#{m[1]}-#{m[2]}](https://img.shields.io/badge/#{m[1]}-#{m[2]}-brightgreen) "
|
51
|
+
File.write("template.org", conts)
|
52
|
+
end
|
53
|
+
|
26
54
|
def get_ruby_version()
|
27
55
|
system 'ruby --version > hoge.txt'
|
28
56
|
version = File.read("hoge.txt")
|
@@ -48,12 +76,32 @@ class QiitaGetTemplate
|
|
48
76
|
end
|
49
77
|
|
50
78
|
def check_write_contents()
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
79
|
+
if @os == "mac"
|
80
|
+
["MacOS", "ruby"].each do |src|
|
81
|
+
print "Write #{src} version?(y/n) "
|
82
|
+
ans = STDIN.gets.chomp
|
83
|
+
next if ans == "n"
|
84
|
+
if ans == "y"
|
85
|
+
send("get_#{src.downcase}_version")
|
86
|
+
end
|
87
|
+
end
|
88
|
+
elsif @os == "windows"
|
89
|
+
["Ubuntu", "ruby"].each do |src|
|
90
|
+
print "Write #{src} version?(y/n) "
|
91
|
+
ans = STDIN.gets.chomp
|
92
|
+
next if ans == "n"
|
93
|
+
if ans == "y"
|
94
|
+
send("get_#{src.downcase}_version")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
else
|
98
|
+
["ruby"].each do |src|
|
99
|
+
print "Write #{src} version?(y/n) "
|
100
|
+
ans = STDIN.gets.chomp
|
101
|
+
next if ans == "n"
|
102
|
+
if ans == "y"
|
103
|
+
send("get_#{src.downcase}_version")
|
104
|
+
end
|
57
105
|
end
|
58
106
|
end
|
59
107
|
end
|
data/lib/qiita_org/post.rb
CHANGED
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.15
|
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-10-
|
11
|
+
date: 2020-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|