hiroto_create 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5035f69a2cb716eba8031d04bc8fabf931e223082535ff305bfcb0d762e767cd
4
- data.tar.gz: 27edb3c4c052b6af58a2e4b81876e5bbda8097c68826a25187ded75252ac5455
3
+ metadata.gz: bba20beabf0009316a798791e77f0da754b81184c0fff1b7669f5a795b104b5c
4
+ data.tar.gz: 66b0cf21a98473799c69261f5e787a6a2c2d43754910d78ee249277b6b5d271d
5
5
  SHA512:
6
- metadata.gz: 8bad87f707a02201d274ed803f5f3daf0c351ca3bff1a6fc0592492a0a0900899e384de08df6ac1e68828088751398c459e0c947496c8ccfe2b9e1d4462f2334
7
- data.tar.gz: 79c07946ad4e47aa38cc5411dcb5b0dbf4dac636759414ffc3eb6764fc416eeb241456c50ed46124bf9d8a2d3edc986ce7459fc1f6f401c523fae8d55b9c1d49
6
+ metadata.gz: b1638c50a6300546f6a94b24de167385e471826aa995f77ff8c1f3ae69e28b25c6f80ed82897ae21b1eff93c454ed57ae9deab0f283539dcbd4d491cabab90a4
7
+ data.tar.gz: 2af4b7f30e631e1500ec878d6515ae15acfafffe0eda7dc573c667a6fe80dd1a5479c599f7321ad985eb6aeef1baf757bc5e211a1b2a72013bfd55dcce6f6b12
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HirotoCreate
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  end
data/lib/hiroto_create.rb CHANGED
@@ -2,31 +2,47 @@
2
2
 
3
3
  require_relative "hiroto_create/version"
4
4
 
5
- module HirotoCreate
6
- class Error < StandardError; end
7
- def self.hiroto_create
8
- # リポジトリ名の入力
9
- print 'Enter the repository name: '
10
- repo_name = gets.chomp.strip
11
-
12
- # GitHubユーザー名の入力
13
- print 'Enter your GitHub username: '
14
- username = gets.chomp.strip
15
-
16
- # publicかprivateかを聞く
17
- print 'Enter public or private: '
18
- flag = gets.chomp.strip
19
-
20
- # リモートリポジトリのSSH
21
- remote_repo_url = "git@github.com:#{username}/#{repo_name}.git"
22
-
23
- # リモートリポジトリの作成
24
- system("gh repo create #{username}/#{repo_name} --#{flag}")
25
-
26
- # GitHubにログイン
27
- system('gh auth login')
28
-
29
- # リモートリポジトリへの接続
30
- system("git remote add origin #{remote_repo_url}")
5
+ # ghコマンドがインストールされているか確認
6
+ gh_installed = system('which gh > /dev/null')
7
+
8
+ unless gh_installed
9
+ puts "ghコマンドが見つかりません。"
10
+
11
+ # インストール確認
12
+ print "ghコマンドをインストールしますか? (yes/no): "
13
+ user_input = gets.chomp.strip.downcase
14
+
15
+ case user_input
16
+ when 'yes'
17
+ # macOSの場合
18
+ if RUBY_PLATFORM.include?('darwin')
19
+ puts "GitHub CLI (gh)のインストール中..."
20
+ system('brew install gh')
21
+ # インストールの完了を待機する
22
+ end
23
+
24
+ # Linuxの場合 (ここではUbuntu)
25
+ if RUBY_PLATFORM.include?('linux')
26
+ puts "GitHub CLI (gh)のインストール中..."
27
+ system('sudo apt install gh')
28
+ # インストールの完了を待機する
29
+ end
30
+
31
+ # インストールが成功したか再度確認
32
+ gh_installed_after_install = system('which gh > /dev/null')
33
+ if gh_installed_after_install
34
+ puts "GitHub CLI (gh)のインストールが完了しました。"
35
+ else
36
+ puts "GitHub CLI (gh)のインストールに失敗しました。手動でインストールしてください。"
37
+ exit(1)
38
+ end
39
+
40
+ when 'いいえ', 'no'
41
+ puts "インストールを中止しました。hiroto_createを使用するには手動でghコマンドをインストールしてください。"
42
+ exit(1)
43
+
44
+ else
45
+ puts "無効な入力です。yesかnoで答えてください。"
46
+ exit(1)
31
47
  end
32
48
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiroto_create
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - SuzukiHiroto08
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-23 00:00:00.000000000 Z
11
+ date: 2024-01-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: gem to create and connect remote repository to github on local PC
14
14
  email: