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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0dd6537ee44be13e6ee3cec336a5d6eaae6aee8422c80493a4b0255f4a19dcf6
4
- data.tar.gz: e029336e5fb678e8737db77bedfba19b1045f2c2d142159f8a6424e885744dd2
3
+ metadata.gz: 742401dcbd4870451b8a3d3fa2db0a2cf973043aaa75da2d9732b2f8b6ac9d67
4
+ data.tar.gz: 1764449a6d54c06e1543ed1153514933e19ef03d10cc5889d23f8f4adba447cd
5
5
  SHA512:
6
- metadata.gz: 6a3a7b0ad871ab96a269c37504bfd500710a1c114ee6c43b9a68deff5bf4849bcd2ac76bb7f2852f3f4829d4e5c70242ba0442997f82f6e8674f75c968748e11
7
- data.tar.gz: 3653eedd40df01ed28f68756a4c094cb2a71e5ba87ab11bd81e4a353dd11abc21b25c5273c6695561f14d0f9aa2948164fa80832259f76c248fd6815b1747d4c
6
+ metadata.gz: '09571c9ee55def24345f54203d86ede06a75a258c92775c47a7b5cf0e3df5662dca99e11039d76a37493b5b5655da67ca5460bcff13fcddf9297c79597b2ca41'
7
+ data.tar.gz: 0d3fe77479cabff025a276650567ee4311f5cde91363692973728c959bf25e996f787e74867fc47197ad4e44f89824cb07b1f7759cdeaf2cbf7a38f74adcd9a9
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- qiita_org (0.1.9)
4
+ qiita_org (0.1.10)
5
5
  colorize
6
6
  command_line (> 2.0.0)
7
7
  fileutils
@@ -17,7 +17,8 @@ module QiitaOrg
17
17
  #
18
18
  def initialize(*argv)
19
19
  super(*argv)
20
- @checkos = CheckPcOs.new
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
- ["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")
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
@@ -1,3 +1,3 @@
1
1
  module QiitaOrg
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.11"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
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.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenta Yamamoto