qiita_org 0.1.10 → 0.1.11
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 +4 -4
- data/lib/qiita_org/get_template.rb +54 -7
- data/lib/qiita_org/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 742401dcbd4870451b8a3d3fa2db0a2cf973043aaa75da2d9732b2f8b6ac9d67
|
4
|
+
data.tar.gz: 1764449a6d54c06e1543ed1153514933e19ef03d10cc5889d23f8f4adba447cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09571c9ee55def24345f54203d86ede06a75a258c92775c47a7b5cf0e3df5662dca99e11039d76a37493b5b5655da67ca5460bcff13fcddf9297c79597b2ca41'
|
7
|
+
data.tar.gz: 0d3fe77479cabff025a276650567ee4311f5cde91363692973728c959bf25e996f787e74867fc47197ad4e44f89824cb07b1f7759cdeaf2cbf7a38f74adcd9a9
|
data/Gemfile.lock
CHANGED
data/lib/qiita_org.rb
CHANGED
@@ -17,7 +17,8 @@ module QiitaOrg
|
|
17
17
|
#
|
18
18
|
def initialize(*argv)
|
19
19
|
super(*argv)
|
20
|
-
|
20
|
+
checkos = CheckPcOs.new
|
21
|
+
@os = checkos.return_os()
|
21
22
|
end
|
22
23
|
|
23
24
|
desc "say_hello", "say_hello"
|
@@ -30,11 +31,10 @@ module QiitaOrg
|
|
30
31
|
desc "post", "post to qiita from org"
|
31
32
|
|
32
33
|
def post(*argv)
|
33
|
-
os = @checkos.return_os()
|
34
34
|
p ["in qiita_org.rb", argv]
|
35
35
|
p file = argv[0] || "README.org"
|
36
36
|
p mode = argv[1] || "private"
|
37
|
-
qiita = QiitaPost.new(file, mode, os)
|
37
|
+
qiita = QiitaPost.new(file, mode, @os)
|
38
38
|
begin
|
39
39
|
qiita.select_option(mode)
|
40
40
|
rescue RuntimeError => e
|
@@ -66,7 +66,7 @@ module QiitaOrg
|
|
66
66
|
desc "template", "make template.org"
|
67
67
|
|
68
68
|
def template(*argv)
|
69
|
-
template = QiitaGetTemplate.new()
|
69
|
+
template = QiitaGetTemplate.new(@os)
|
70
70
|
end
|
71
71
|
|
72
72
|
desc "all", "post all org file in the directory"
|
@@ -3,7 +3,8 @@ require "colorize"
|
|
3
3
|
require "qiita_org/search_conf_path"
|
4
4
|
|
5
5
|
class QiitaGetTemplate
|
6
|
-
def initialize()
|
6
|
+
def initialize(os)
|
7
|
+
@os = os
|
7
8
|
cp_template()
|
8
9
|
search = SearchConfPath.new(Dir.pwd, Dir.home)
|
9
10
|
@conf_dir = search.search_conf_path()
|
@@ -23,6 +24,32 @@ class QiitaGetTemplate
|
|
23
24
|
File.write("template.org", conts) # + "# {m[1]}: # {m[2]}\n")
|
24
25
|
end
|
25
26
|
|
27
|
+
def get_windowsos_version()
|
28
|
+
system 'wmic.exe os get caption > hoge1.txt'
|
29
|
+
system 'wmic.exe os get osarchitecture > hoge2.txt'
|
30
|
+
version1 = File.read("hoge1.txt")
|
31
|
+
version2 = File.read("hoge2.txt")
|
32
|
+
m1, m2 = [], []
|
33
|
+
m1 = version1.match(/Caption\nMicrosoft (.+) (.+)/)
|
34
|
+
m2 = version2.match(/OSArchitecture\n(.+)-bit/)
|
35
|
+
system 'rm hoge1.txt'
|
36
|
+
system 'rm hoge2.txt'
|
37
|
+
conts = File.read("template.org")
|
38
|
+
conts << "![#{m1[1]}-#{m1[2]}](https://img.shields.io/badge/#{m1[1].gsub(" ", "")}#{m1[2]}-#{m2[1]}bit-brightgreen) "
|
39
|
+
File.write("template.org", conts) # + "# {m[1]}: # {m[2]}\n")
|
40
|
+
end
|
41
|
+
|
42
|
+
def get_ubuntu_version()
|
43
|
+
system 'cat /etc/issue > hoge.txt'
|
44
|
+
version = File.read("hoge.txt")
|
45
|
+
m = []
|
46
|
+
m = version.match(/(.+) (.+) LTS /)
|
47
|
+
system 'rm hoge.txt'
|
48
|
+
conts = File.read("template.org")
|
49
|
+
conts << "![#{m[1]}-#{m[2]}](https://img.shields.io/badge/#{m[1]}-#{m[2]}-brightgreen) "
|
50
|
+
File.write("template.org", conts)
|
51
|
+
end
|
52
|
+
|
26
53
|
def get_ruby_version()
|
27
54
|
system 'ruby --version > hoge.txt'
|
28
55
|
version = File.read("hoge.txt")
|
@@ -48,12 +75,32 @@ class QiitaGetTemplate
|
|
48
75
|
end
|
49
76
|
|
50
77
|
def check_write_contents()
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
78
|
+
if @os == "mac"
|
79
|
+
["MacOS", "ruby"].each do |src|
|
80
|
+
print "Write #{src} version?(y/n) "
|
81
|
+
ans = STDIN.gets.chomp
|
82
|
+
next if ans == "n"
|
83
|
+
if ans == "y"
|
84
|
+
send("get_#{src.downcase}_version")
|
85
|
+
end
|
86
|
+
end
|
87
|
+
elsif @os == "windows"
|
88
|
+
["WindowsOS", "Ubuntu", "ruby"].each do |src|
|
89
|
+
print "Write #{src} version?(y/n) "
|
90
|
+
ans = STDIN.gets.chomp
|
91
|
+
next if ans == "n"
|
92
|
+
if ans == "y"
|
93
|
+
send("get_#{src.downcase}_version")
|
94
|
+
end
|
95
|
+
end
|
96
|
+
else
|
97
|
+
["ruby"].each do |src|
|
98
|
+
print "Write #{src} version?(y/n) "
|
99
|
+
ans = STDIN.gets.chomp
|
100
|
+
next if ans == "n"
|
101
|
+
if ans == "y"
|
102
|
+
send("get_#{src.downcase}_version")
|
103
|
+
end
|
57
104
|
end
|
58
105
|
end
|
59
106
|
end
|
data/lib/qiita_org/version.rb
CHANGED