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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0dd6537ee44be13e6ee3cec336a5d6eaae6aee8422c80493a4b0255f4a19dcf6
4
- data.tar.gz: e029336e5fb678e8737db77bedfba19b1045f2c2d142159f8a6424e885744dd2
3
+ metadata.gz: 88f0ea4de914134782eac18097c144c9a7d5393c0334bf03ef9f1cdd2374f60e
4
+ data.tar.gz: fdd51bf362e3ff8635dcb873fcb9801d10a3124b63921b4dcfae3c572cba4aa5
5
5
  SHA512:
6
- metadata.gz: 6a3a7b0ad871ab96a269c37504bfd500710a1c114ee6c43b9a68deff5bf4849bcd2ac76bb7f2852f3f4829d4e5c70242ba0442997f82f6e8674f75c968748e11
7
- data.tar.gz: 3653eedd40df01ed28f68756a4c094cb2a71e5ba87ab11bd81e4a353dd11abc21b25c5273c6695561f14d0f9aa2948164fa80832259f76c248fd6815b1747d4c
6
+ metadata.gz: 65fd2e9345bfbf148e6bbeab986059a3ee07716571e9533da1f491cbc5d12685b120752f7986d557b4bc97778ebf0f0ab904257d99cfc4a3636c83ff85acff0d
7
+ data.tar.gz: cb0723fc53febe667ecb933bd1e34a719979e2ff447b8893a10dafbfa7da052cadc8d79b7c768025d17f18fab7f11f44774557331231685efcf801565c9586ba
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- qiita_org (0.1.9)
4
+ qiita_org (0.1.14)
5
5
  colorize
6
6
  command_line (> 2.0.0)
7
7
  fileutils
@@ -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
- os = @checkos.return_os()
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
- template = QiitaGetTemplate.new()
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
@@ -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 conf_dir == Dir.home || @option == "set"
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
- ["MacOS", "ruby"].each do |src|
52
- print "Write #{src} version?(y/n) "
53
- ans = STDIN.gets.chomp
54
- next if ans == "n"
55
- if ans == "y"
56
- send("get_#{src.downcase}_version")
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
@@ -146,6 +146,7 @@ class QiitaPost
146
146
  system "explorer.exe #{@res_body["url"]}"
147
147
  else
148
148
  system "open #{@res_body["url"]}"
149
+ system "xdg-open #{@res_body["url"]}"
149
150
  end
150
151
  end
151
152
 
@@ -1,3 +1,3 @@
1
1
  module QiitaOrg
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.15"
3
3
  end
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.10
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-13 00:00:00.000000000 Z
11
+ date: 2020-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler