Skip to content

Commit

Permalink
Merge pull request #53 from elsoul/update/souls-bucket
Browse files Browse the repository at this point in the history
add version management to initial files
  • Loading branch information
POPPIN-FUMI authored Nov 15, 2021
2 parents 98451d6 + a051b30 commit 9fce32b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
7 changes: 4 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ RSpec::Core::RakeTask.new(:spec)
task :default => :spec

namespace :upload do
@gs_bucket_url = "gs://souls-bucket/boilerplates/#{Souls::VERSION}"
task :github do
file_name = "./github.tgz"
system("tar -czf #{file_name} github/")
system("gsutil cp #{file_name} gs://souls-bucket/boilerplates/github_actions/")
system("gsutil cp #{file_name} #{@gs_bucket_url}/github_actions/")
system("rm -rf #{file_name}")
end

task :sig do
file_name = "./sig.tgz"
system("tar -czf #{file_name} sig/")
system("gsutil cp #{file_name} gs://souls-bucket/boilerplates/sig/")
system("gsutil cp #{file_name} #{@gs_bucket_url}/sig/")
system("rm -rf #{file_name}")
end

Expand All @@ -29,7 +30,7 @@ namespace :upload do
Rake::Task["upload:sig"].invoke
files = Dir["init_files/*"]
files.each do |file|
system("gsutil cp #{file} gs://souls-bucket/boilerplates/")
system("gsutil cp #{file} #{@gs_bucket_url}/")
end
end
end
Expand Down
17 changes: 9 additions & 8 deletions lib/souls/cli/init/index.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Souls
class CLI < Thor
@bucket_url = "https://storage.googleapis.com/souls-bucket/boilerplates/#{Souls::VERSION}"
desc "new [APP_NAME]", "Create SOULs APP"
def new(app_name)
if app_name.nil?
Expand Down Expand Up @@ -84,7 +85,7 @@ def initial_config_init(app_name: "souls", service_name: "api")

def download_github_actions(app_name: "souls-app")
file_name = "github.tgz"
url = "https://storage.googleapis.com/souls-bucket/boilerplates/github_actions/github.tgz"
url = "#{@bucket_url}/github_actions/github.tgz"
system("curl -OL #{url}")
FileUtils.mkdir_p("#{app_name}/github")
system("tar -zxvf ./#{file_name} -C #{app_name}/")
Expand Down Expand Up @@ -146,23 +147,23 @@ def get_latest_gem(app_name)
def download_souls(app_name: "souls", service_name: "api")
version = Souls.get_latest_version_txt(service_name: service_name).join(".")
file_name = "#{service_name}-v#{version}.tgz"
url = "https://storage.googleapis.com/souls-bucket/boilerplates/#{service_name.pluralize}/#{file_name}"
url = "#{@bucket_url}/#{service_name.pluralize}/#{file_name}"
system("curl -OL #{url}")
system("mkdir -p #{app_name}/apps/#{service_name}")
system("tar -zxvf ./#{file_name} -C #{app_name}/apps/")
FileUtils.rm(file_name)

sig_name = "sig.tgz"
url = "https://storage.googleapis.com/souls-bucket/boilerplates/sig/#{sig_name}"
url = "#{@bucket_url}/sig/#{sig_name}"
system("curl -OL #{url}")
system("tar -zxvf ./#{sig_name} -C #{app_name}")

system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/.rubocop.yml")
system("cd #{app_name} && curl -OL #{@bucket_url}/.rubocop.yml")
get_latest_gem(app_name)
system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/Procfile.dev")
system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/Procfile")
system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/Steepfile")
system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/gitignore")
system("cd #{app_name} && curl -OL #{@bucket_url}/Procfile.dev")
system("cd #{app_name} && curl -OL #{@bucket_url}/Procfile")
system("cd #{app_name} && curl -OL #{@bucket_url}/Steepfile")
system("cd #{app_name} && curl -OL #{@bucket_url}/gitignore")
system("cd #{app_name} && mv gitignore .gitignore")
system("cd #{app_name} && bundle")
system("cd #{app_name}/apps/api && bundle")
Expand Down

0 comments on commit 9fce32b

Please sign in to comment.