Sha256: 18a9cb1f78d365d867491cd602b813d0dbe06cd62d74b90e1495a78d26e8ddea

Contents?: true

Size: 1.79 KB

Versions: 26

Compression:

Stored size: 1.79 KB

Contents

module Souls
  module Init
    class << self
      def get_version repository_name: "souls_api"
        data = JSON.parse `curl \
        -H "Accept: application/vnd.github.v3+json" \
        -s https://api.github.com/repos/elsoul/#{repository_name}/releases`
        data[0]["tag_name"]
      end

      def initial_config_init app_name: "souls", strain: "api"
        FileUtils.touch "./#{app_name}/config/souls.rb"
        file_path = "./#{app_name}/config/souls.rb"
        File.open(file_path, "w") do |f|
          f.write <<~EOS
            Souls.configure do |config|
              config.app = "#{app_name}"
              config.strain = "#{strain}"
            end
          EOS
        end
      rescue StandardError => error
        puts error
      end

      def download_souls app_name: "souls", repository_name: "souls_api "
        version = get_version repository_name: repository_name
        system "curl -OL https://github.com/elsoul/#{repository_name}/archive/#{version}.tar.gz"
        system "tar -zxvf ./#{version}.tar.gz"
        system "mkdir #{app_name}"
        folder = version.delete "v"
        system "cp -r #{repository_name}-#{folder}/. #{app_name}/"
        system "rm -rf #{version}.tar.gz && rm -rf #{repository_name}-#{folder}"
        txt = <<~TEXT
             _____ ____  __  ____#{'        '}
            / ___// __ \\/ / / / /   _____
            \\__ \\/ / / / / / / /   / ___/
           ___/ / /_/ / /_/ / /___(__  )#{' '}
          /____/\\____/\\____/_____/____/#{'  '}
        TEXT
        puts txt
        puts "=============================="
        puts "Welcome to SOULs!"
        puts "SOULs Version: #{Souls::VERSION}"
        puts "=============================="
        puts "$ cd #{app_name}"
        puts "------------------------------"
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
souls-0.22.6 lib/souls/init.rb
souls-0.22.5 lib/souls/init.rb
souls-0.22.4 lib/souls/init.rb
souls-0.22.3 lib/souls/init.rb
souls-0.22.2 lib/souls/init.rb
souls-0.22.1 lib/souls/init.rb
souls-0.22.0 lib/souls/init.rb
souls-0.21.9 lib/souls/init.rb
souls-0.21.8 lib/souls/init.rb
souls-0.21.7 lib/souls/init.rb
souls-0.21.6 lib/souls/init.rb
souls-0.21.5 lib/souls/init.rb
souls-0.21.4 lib/souls/init.rb
souls-0.21.3 lib/souls/init.rb
souls-0.21.2 lib/souls/init.rb
souls-0.21.1 lib/souls/init.rb
souls-0.21.0 lib/souls/init.rb
souls-0.20.9 lib/souls/init.rb
souls-0.20.8 lib/souls/init.rb
souls-0.20.7 lib/souls/init.rb