qiita_org 0.1.9 → 0.1.10

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: 9e7a075ad1c16002e53fff794d556f9ce5bb2c6e7d5e37768a37a8deb59f28e9
4
- data.tar.gz: aad3df025127c3e87d3ccb71a262f28083904d63b12e7371cea4c80cf68ecdf1
3
+ metadata.gz: 0dd6537ee44be13e6ee3cec336a5d6eaae6aee8422c80493a4b0255f4a19dcf6
4
+ data.tar.gz: e029336e5fb678e8737db77bedfba19b1045f2c2d142159f8a6424e885744dd2
5
5
  SHA512:
6
- metadata.gz: c4e4645899b5b8ef3cf84b4203b911d3cdc3da1cf3f58d67cc1ca8d64b06f95ada184fe7491102c69fd9d75da91346db01f734ad384fcbac492a9169d81238cf
7
- data.tar.gz: 72dcab368ce64937c26ed77e89d25face880d71cff3ac9ff5e2797dcdb78023d4d5e6be1a747813426a3851ad6f2a9b9edd7d3bffa9bd4156e8962763b039a48
6
+ metadata.gz: 6a3a7b0ad871ab96a269c37504bfd500710a1c114ee6c43b9a68deff5bf4849bcd2ac76bb7f2852f3f4829d4e5c70242ba0442997f82f6e8674f75c968748e11
7
+ data.tar.gz: 3653eedd40df01ed28f68756a4c094cb2a71e5ba87ab11bd81e4a353dd11abc21b25c5273c6695561f14d0f9aa2948164fa80832259f76c248fd6815b1747d4c
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- qiita_org (0.1.8)
4
+ qiita_org (0.1.9)
5
5
  colorize
6
6
  command_line (> 2.0.0)
7
7
  fileutils
@@ -6,6 +6,7 @@ require "qiita_org/config"
6
6
  require "qiita_org/get"
7
7
  require "qiita_org/list"
8
8
  require "qiita_org/get_template"
9
+ require "qiita_org/check_pc_os"
9
10
  #require "qiita_org/qiita_org_thor"
10
11
 
11
12
  module QiitaOrg
@@ -14,6 +15,11 @@ module QiitaOrg
14
15
  # super(*argv)
15
16
  # end
16
17
  #
18
+ def initialize(*argv)
19
+ super(*argv)
20
+ @checkos = CheckPcOs.new
21
+ end
22
+
17
23
  desc "say_hello", "say_hello"
18
24
 
19
25
  def say_hello(*name)
@@ -24,10 +30,11 @@ module QiitaOrg
24
30
  desc "post", "post to qiita from org"
25
31
 
26
32
  def post(*argv)
33
+ os = @checkos.return_os()
27
34
  p ["in qiita_org.rb", argv]
28
35
  p file = argv[0] || "README.org"
29
36
  p mode = argv[1] || "private"
30
- qiita = QiitaPost.new(file, mode)
37
+ qiita = QiitaPost.new(file, mode, os)
31
38
  begin
32
39
  qiita.select_option(mode)
33
40
  rescue RuntimeError => e
@@ -0,0 +1,19 @@
1
+ class CheckPcOs
2
+ def initialize()
3
+ @macos = system "sw_vers"
4
+ @winos = system "wmic.exe os get caption"
5
+ end
6
+
7
+ def return_os()
8
+ if @macos
9
+ return os = "mac"
10
+ elsif @winos
11
+ return os = "windows"
12
+ else
13
+ return nil
14
+ end
15
+ end
16
+ end
17
+
18
+ #p os = CheckPcOs.new.return_os()
19
+
@@ -7,9 +7,10 @@ require "colorize"
7
7
  require "qiita_org/search_conf_path.rb"
8
8
 
9
9
  class QiitaPost
10
- def initialize(file, option)
10
+ def initialize(file, option, os)
11
11
  @src = file
12
12
  @option = (option == "qiita" || option == "open")? "public" : option
13
+ @os = os
13
14
  search = SearchConfPath.new(Dir.pwd, Dir.home)
14
15
  @conf_dir = search.search_conf_path()
15
16
  p @conf_dir
@@ -137,6 +138,17 @@ class QiitaPost
137
138
  end
138
139
  end
139
140
 
141
+ # open qiita
142
+ def open_qiita()
143
+ if @os == "mac"
144
+ system "open #{@res_body["url"]}"
145
+ elsif @os == "windows"
146
+ system "explorer.exe #{@res_body["url"]}"
147
+ else
148
+ system "open #{@res_body["url"]}"
149
+ end
150
+ end
151
+
140
152
  def run()
141
153
  get_title_tags()
142
154
  set_config()
@@ -147,8 +159,7 @@ class QiitaPost
147
159
  qiita_post()
148
160
  get_and_print_qiita_return()
149
161
 
150
- # open qiitta
151
- system "open #{@res_body["url"]}"
162
+ open_qiita()
152
163
 
153
164
  add_qiita_id_on_org()
154
165
  end
@@ -1,3 +1,3 @@
1
1
  module QiitaOrg
2
- VERSION = "0.1.9"
2
+ VERSION = "0.1.10"
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.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenta Yamamoto
@@ -953,6 +953,7 @@ files:
953
953
  - hoge.rb
954
954
  - lib/qiita_org.rb
955
955
  - lib/qiita_org/.qiita.conf
956
+ - lib/qiita_org/check_pc_os.rb
956
957
  - lib/qiita_org/config.json
957
958
  - lib/qiita_org/config.rb
958
959
  - lib/qiita_org/get.rb