Module: HirotoCreate

Defined in:
lib/hiroto_create.rb,
lib/hiroto_create/version.rb

Defined Under Namespace

Classes: Error

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.hiroto_createObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/hiroto_create.rb', line 7

def self.hiroto_create
  # リポジトリ名の入力
  print 'Enter the repository name: '
  repo_name = gets.chomp.strip

  # GitHubユーザー名の入力
  print 'Enter your GitHub username: '
  username = gets.chomp.strip

  # publicかprivateかを聞く
  print 'Enter public or private: '
  flag = gets.chomp.strip

  # リモートリポジトリのSSH
  remote_repo_url = "[email protected]:#{username}/#{repo_name}.git"

  # リモートリポジトリの作成
  system("gh repo create #{username}/#{repo_name} --#{flag}")

  # GitHubにログイン
  system('gh auth login')

  # リモートリポジトリへの接続
  system("git remote add origin #{remote_repo_url}")
end