Method: TYCiCore::Git.git_create_empty_repos

Defined in:
lib/tuya/ci/core/git.rb

.git_create_empty_repos(name, url) ⇒ Object



183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/tuya/ci/core/git.rb', line 183

def self.git_create_empty_repos(name, url)

  user = ENV["HOME"]
  temp_path = "#{user}/.tuya_git_temp/"
  temp_path_p = "#{temp_path}#{name}"

  `mkdir -p #{temp_path_p}`

  FileUtils.cd temp_path_p

  `touch Readme.md`

  git_commands = [
    %W(init),
    %W(add -A),
    %W(commit -am init\ #{name}\ by\ tuya-odm),
    %W(remote add origin #{url}),
    %W(push --set-upstream origin master)
  ]
  TYCiCore::EXE.multi_exe('git', git_commands, true)

  FileUtils.cd temp_path
end