souls 0.24.6 → 0.24.10
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 +4 -4
- data/README.md +1 -3
- data/exe/souls +34 -8
- data/lib/souls.rb +63 -13
- data/lib/souls/init.rb +7 -7
- data/lib/souls/version.rb +1 -1
- data/lib/souls/versions/.souls_api_version +1 -0
- data/lib/souls/versions/.souls_worker_version +1 -0
- metadata +17 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 94bced269c42744e87f03e45ad6b5ff2c184ede2b13d3f2102062eb9be38b4c4
         | 
| 4 | 
            +
              data.tar.gz: 14f7168e17187e4a890541b1b6688f68da17c7d8480fdea1a47e3af92873a372
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: b1c13bf43152ad05fc7d2112c1288634b1f7f0b179d8612b12ee7b1dde7b11ce8520bb759ecf16d6287e02f4bb6bd5052e73d21ba88eb01dad6b820a732f2c93
         | 
| 7 | 
            +
              data.tar.gz: c97c690506015c0902b6bff57bd4420e5de893bfdedab3424214f28da147136bf8c43fe5f05f96d478c764a375b98b5c1a0eeb221e98b88c58ca5e8da350556b
         | 
    
        data/README.md
    CHANGED
    
    | @@ -102,9 +102,7 @@ souls gem:update | |
| 102 102 | 
             
            Souls.configure do |config|
         | 
| 103 103 | 
             
              config.app = "souls-api"
         | 
| 104 104 | 
             
              config.project_id = "souls-api"
         | 
| 105 | 
            -
              config.strain = " | 
| 106 | 
            -
              config.api_repo = "elsoul/souls_api"
         | 
| 107 | 
            -
              config.worker_repo = "elsoul/souls_worker"
         | 
| 105 | 
            +
              config.strain = "api"
         | 
| 108 106 | 
             
              config.worker_endpoint = "https://worker.com"
         | 
| 109 107 | 
             
              config.fixed_gems = ["selenium-webdriver", "pg"]
         | 
| 110 108 | 
             
            end
         | 
    
        data/exe/souls
    CHANGED
    
    | @@ -32,8 +32,9 @@ begin | |
| 32 32 | 
             
                strain = $stdin.gets.chomp.to_i
         | 
| 33 33 | 
             
                case strain
         | 
| 34 34 | 
             
                when 1, 2
         | 
| 35 | 
            -
                   | 
| 36 | 
            -
                  Souls::Init. | 
| 35 | 
            +
                  service_name = (STRAINS[strain.to_i - 1]).to_s
         | 
| 36 | 
            +
                  Souls::Init.download_souls(app_name: app_name, service_name: service_name)
         | 
| 37 | 
            +
                  Souls::Init.initial_config_init(app_name: app_name, service_name: service_name)
         | 
| 37 38 | 
             
                else
         | 
| 38 39 | 
             
                  puts(Paint["Coming Soon...", :blue])
         | 
| 39 40 | 
             
                end
         | 
| @@ -94,17 +95,41 @@ begin | |
| 94 95 | 
             
                  Souls.update_gemfile
         | 
| 95 96 | 
             
                  Whirly.status = "Done!"
         | 
| 96 97 | 
             
                end
         | 
| 97 | 
            -
              when " | 
| 98 | 
            -
                 | 
| 99 | 
            -
                 | 
| 100 | 
            -
                 | 
| 98 | 
            +
              when "release"
         | 
| 99 | 
            +
                current_souls_ver = Souls::VERSION.strip.split(".").map(&:to_i)
         | 
| 100 | 
            +
                prompt = TTY::Prompt.new
         | 
| 101 | 
            +
                choices = [
         | 
| 102 | 
            +
                  "1. Patch(#{Souls.version_detector(current_ver: current_souls_ver, update_kind: 'patch')})",
         | 
| 103 | 
            +
                  "2. Minor(#{Souls.version_detector(current_ver: current_souls_ver, update_kind: 'minor')})",
         | 
| 104 | 
            +
                  "3. Major(#{Souls.version_detector(current_ver: current_souls_ver, update_kind: 'major')})"
         | 
| 105 | 
            +
                ]
         | 
| 106 | 
            +
                choice_num = prompt.select("Select Version: ", choices)[0].to_i
         | 
| 107 | 
            +
                update_kinds = %w[patch minor major]
         | 
| 108 | 
            +
                update_kind = update_kinds[choice_num - 1]
         | 
| 109 | 
            +
                souls_new_ver = Souls.version_detector(current_ver: current_souls_ver, update_kind: update_kind)
         | 
| 101 110 |  | 
| 102 111 | 
             
                status = Paint["Saving Repo...", :yellow]
         | 
| 103 112 | 
             
                Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
         | 
| 104 113 | 
             
                  Whirly.status = status
         | 
| 105 | 
            -
                   | 
| 106 | 
            -
             | 
| 114 | 
            +
                  %w[api worker].each do |s_name|
         | 
| 115 | 
            +
                    result = Paint[Souls.update_repo(service_name: s_name, update_kind: update_kind), :green]
         | 
| 116 | 
            +
                    Whirly.status = result
         | 
| 117 | 
            +
                  end
         | 
| 118 | 
            +
                  Souls.overwrite_version(new_version: souls_new_ver)
         | 
| 119 | 
            +
                  sleep(10)
         | 
| 120 | 
            +
                  puts("before add")
         | 
| 121 | 
            +
                  system("git add .")
         | 
| 122 | 
            +
                  sleep(2)
         | 
| 123 | 
            +
                  puts("before commit")
         | 
| 124 | 
            +
                  system("git commit -m 'souls update v#{souls_new_ver}'")
         | 
| 125 | 
            +
                  sleep(2)
         | 
| 126 | 
            +
                  puts("before build")
         | 
| 127 | 
            +
                  system("rake build")
         | 
| 128 | 
            +
                  system("rake release")
         | 
| 129 | 
            +
                  Whirly.status = Paint["soul-v#{souls_new_ver} successfully updated!"]
         | 
| 107 130 | 
             
                end
         | 
| 131 | 
            +
              when "update"
         | 
| 132 | 
            +
                puts(Paint["Coming soon..", :cyan])
         | 
| 108 133 | 
             
              when "add"
         | 
| 109 134 | 
             
                graphql_class = ARGV[1]
         | 
| 110 135 | 
             
                case graphql_class
         | 
| @@ -233,4 +258,5 @@ begin | |
| 233 258 | 
             
              end
         | 
| 234 259 | 
             
            rescue StandardError => e
         | 
| 235 260 | 
             
              puts(Paint[e, :red])
         | 
| 261 | 
            +
              puts(e.backtrace)
         | 
| 236 262 | 
             
            end
         | 
    
        data/lib/souls.rb
    CHANGED
    
    | @@ -10,6 +10,7 @@ require "net/http" | |
| 10 10 | 
             
            require "paint"
         | 
| 11 11 | 
             
            require "whirly"
         | 
| 12 12 | 
             
            require "google/cloud/firestore"
         | 
| 13 | 
            +
            require "tty-prompt"
         | 
| 13 14 |  | 
| 14 15 | 
             
            module Souls
         | 
| 15 16 | 
             
              SOULS_METHODS = %w[
         | 
| @@ -167,37 +168,73 @@ module Souls | |
| 167 168 | 
             
                  end
         | 
| 168 169 | 
             
                end
         | 
| 169 170 |  | 
| 170 | 
            -
                def update_repo(service_name: "api")
         | 
| 171 | 
            +
                def update_repo(service_name: "api", update_kind: "patch")
         | 
| 171 172 | 
             
                  current_dir_name = FileUtils.pwd.to_s.match(%r{/([^/]+)/?$})[1]
         | 
| 172 | 
            -
                   | 
| 173 | 
            -
                  new_ver =  | 
| 173 | 
            +
                  current_ver = get_latest_version_txt(service_name: service_name)
         | 
| 174 | 
            +
                  new_ver = version_detector(current_ver: current_ver, update_kind: update_kind)
         | 
| 174 175 | 
             
                  bucket_url = "gs://souls-bucket/boilerplates"
         | 
| 175 176 | 
             
                  file_name = "#{service_name}-v#{new_ver}.tgz"
         | 
| 177 | 
            +
                  release_name = "#{service_name}-latest.tgz"
         | 
| 176 178 |  | 
| 177 179 | 
             
                  case current_dir_name
         | 
| 178 180 | 
             
                  when "souls"
         | 
| 179 | 
            -
                    system("echo 'v#{new_ver}' >  | 
| 181 | 
            +
                    system("echo 'v#{new_ver}' > lib/souls/versions/.souls_#{service_name}_version")
         | 
| 180 182 | 
             
                    system("cd apps/ && tar -czf ../#{service_name}.tgz #{service_name}/ && cd ..")
         | 
| 181 183 | 
             
                  when "api", "worker", "console", "admin", "media"
         | 
| 182 | 
            -
                    system("echo 'v#{new_ver}' >  | 
| 184 | 
            +
                    system("echo 'v#{new_ver}' > lib/souls/versions/.souls_#{service_name}_version")
         | 
| 183 185 | 
             
                    system("cd .. && tar -czf ../#{service_name}.tgz #{service_name}/ && cd #{service_name}")
         | 
| 184 186 | 
             
                  else
         | 
| 185 187 | 
             
                    raise(StandardError, "You are at wrong directory!")
         | 
| 186 188 | 
             
                  end
         | 
| 187 189 |  | 
| 188 190 | 
             
                  system("gsutil cp #{service_name}.tgz #{bucket_url}/#{service_name.pluralize}/#{file_name}")
         | 
| 189 | 
            -
                   | 
| 190 | 
            -
                  version_log(service_name: service_name, version_counter: new_ver, file_url: file_url)
         | 
| 191 | 
            +
                  system("gsutil cp #{service_name}.tgz #{bucket_url}/#{service_name.pluralize}/#{release_name}")
         | 
| 191 192 | 
             
                  FileUtils.rm("#{service_name}.tgz")
         | 
| 192 193 | 
             
                  "#{service_name}-v#{new_ver} Succefully Stored to GCS! "
         | 
| 193 194 | 
             
                end
         | 
| 194 195 |  | 
| 195 | 
            -
                def  | 
| 196 | 
            -
                   | 
| 197 | 
            -
                   | 
| 198 | 
            -
             | 
| 199 | 
            -
                   | 
| 200 | 
            -
             | 
| 196 | 
            +
                def version_detector(current_ver: [0, 0, 1], update_kind: "patch")
         | 
| 197 | 
            +
                  case update_kind
         | 
| 198 | 
            +
                  when "patch"
         | 
| 199 | 
            +
                    "#{current_ver[0]}.#{current_ver[1]}.#{current_ver[2] + 1}"
         | 
| 200 | 
            +
                  when "minor"
         | 
| 201 | 
            +
                    "#{current_ver[0]}.#{current_ver[1] + 1}.0"
         | 
| 202 | 
            +
                  when "major"
         | 
| 203 | 
            +
                    "#{current_ver[0] + 1}.0.0"
         | 
| 204 | 
            +
                  else
         | 
| 205 | 
            +
                    raise(StandardError, "Wrong version!")
         | 
| 206 | 
            +
                  end
         | 
| 207 | 
            +
                end
         | 
| 208 | 
            +
             | 
| 209 | 
            +
                def overwrite_version(new_version: "0.1.1")
         | 
| 210 | 
            +
                  FileUtils.rm("./lib/souls/version.rb")
         | 
| 211 | 
            +
                  file_path = "./lib/souls/version.rb"
         | 
| 212 | 
            +
                  File.open(file_path, "w") do |f|
         | 
| 213 | 
            +
                    f.write(<<~TEXT)
         | 
| 214 | 
            +
                      module Souls
         | 
| 215 | 
            +
                        VERSION = "#{new_version}".freeze
         | 
| 216 | 
            +
                        public_constant :VERSION
         | 
| 217 | 
            +
                      end
         | 
| 218 | 
            +
                    TEXT
         | 
| 219 | 
            +
                  end
         | 
| 220 | 
            +
                  true
         | 
| 221 | 
            +
                rescue StandardError, e
         | 
| 222 | 
            +
                  raise(StandardError, e)
         | 
| 223 | 
            +
                end
         | 
| 224 | 
            +
             | 
| 225 | 
            +
                def get_latest_version_txt(service_name: "api")
         | 
| 226 | 
            +
                  current_dir_name = FileUtils.pwd.to_s.match(%r{/([^/]+)/?$})[1]
         | 
| 227 | 
            +
                  case current_dir_name
         | 
| 228 | 
            +
                  when "souls"
         | 
| 229 | 
            +
                    return Souls::VERSION.split(".").map(&:to_i)
         | 
| 230 | 
            +
                  when "api", "worker", "console", "admin", "media"
         | 
| 231 | 
            +
                    file_path = ".../lib/souls/versions/.souls_#{service_name}_version"
         | 
| 232 | 
            +
                  else
         | 
| 233 | 
            +
                    raise(StandardError, "You are at wrong directory!")
         | 
| 234 | 
            +
                  end
         | 
| 235 | 
            +
                  File.open(file_path, "r") do |f|
         | 
| 236 | 
            +
                    f.readlines[0].strip.split(".").map(&:to_i)
         | 
| 237 | 
            +
                  end
         | 
| 201 238 | 
             
                end
         | 
| 202 239 |  | 
| 203 240 | 
             
                def get_latest_version(service_name: "api")
         | 
| @@ -219,6 +256,19 @@ module Souls | |
| 219 256 | 
             
                  end
         | 
| 220 257 | 
             
                end
         | 
| 221 258 |  | 
| 259 | 
            +
                def detect_change
         | 
| 260 | 
            +
                  git_status = `git status`
         | 
| 261 | 
            +
                  result =
         | 
| 262 | 
            +
                    %w[api worker].map do |service_name|
         | 
| 263 | 
            +
                      if git_status.include?("apps/#{service_name}/")
         | 
| 264 | 
            +
                        service_name
         | 
| 265 | 
            +
                      else
         | 
| 266 | 
            +
                        next
         | 
| 267 | 
            +
                      end
         | 
| 268 | 
            +
                    end
         | 
| 269 | 
            +
                  result.compact
         | 
| 270 | 
            +
                end
         | 
| 271 | 
            +
             | 
| 222 272 | 
             
                def configure
         | 
| 223 273 | 
             
                  self.configuration ||= Configuration.new
         | 
| 224 274 | 
             
                  yield(configuration)
         | 
    
        data/lib/souls/init.rb
    CHANGED
    
    | @@ -9,15 +9,15 @@ module Souls | |
| 9 9 | 
             
                  data[0]["tag_name"]
         | 
| 10 10 | 
             
                end
         | 
| 11 11 |  | 
| 12 | 
            -
                def self.initial_config_init(app_name: "souls",  | 
| 13 | 
            -
                  FileUtils.touch("./#{app_name}/config/souls.rb")
         | 
| 14 | 
            -
                  file_path = "./#{app_name}/config/souls.rb"
         | 
| 12 | 
            +
                def self.initial_config_init(app_name: "souls", service_name: "api")
         | 
| 13 | 
            +
                  FileUtils.touch("./#{app_name}/#{service_name}/config/souls.rb")
         | 
| 14 | 
            +
                  file_path = "./#{app_name}/#{service_name}/config/souls.rb"
         | 
| 15 15 | 
             
                  File.open(file_path, "w") do |f|
         | 
| 16 16 | 
             
                    f.write(<<~TEXT)
         | 
| 17 17 | 
             
                      Souls.configure do |config|
         | 
| 18 18 | 
             
                        config.app = "#{app_name}"
         | 
| 19 19 | 
             
                        config.project_id = "souls-api"
         | 
| 20 | 
            -
                        config.strain = "#{ | 
| 20 | 
            +
                        config.strain = "#{service_name}"
         | 
| 21 21 | 
             
                        config.worker_endpoint = "https://worker.com"
         | 
| 22 22 | 
             
                        config.fixed_gems = ["excluded_gem"]
         | 
| 23 23 | 
             
                      end
         | 
| @@ -28,9 +28,9 @@ module Souls | |
| 28 28 | 
             
                end
         | 
| 29 29 |  | 
| 30 30 | 
             
                def self.download_souls(app_name: "souls", service_name: "api")
         | 
| 31 | 
            -
                   | 
| 32 | 
            -
                   | 
| 33 | 
            -
                  system("curl -OL #{ | 
| 31 | 
            +
                  file_name = "#{service_name}-latest.tgz"
         | 
| 32 | 
            +
                  url = "https://storage.googleapis.com/souls-bucket/boilerplates/#{service_name.pluralize}/#{file_name}"
         | 
| 33 | 
            +
                  system("curl -OL #{url}")
         | 
| 34 34 | 
             
                  system("mkdir -p #{app_name}/#{service_name}")
         | 
| 35 35 | 
             
                  system("tar -zxvf ./#{file_name} -C #{app_name}/")
         | 
| 36 36 | 
             
                  FileUtils.rm(file_name)
         | 
    
        data/lib/souls/version.rb
    CHANGED
    
    
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            v0.24.10
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            v0.24.10
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: souls
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.24. | 
| 4 | 
            +
              version: 0.24.10
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - POPPIN-FUMI
         | 
| @@ -40,6 +40,20 @@ dependencies: | |
| 40 40 | 
             
                - - '='
         | 
| 41 41 | 
             
                  - !ruby/object:Gem::Version
         | 
| 42 42 | 
             
                    version: 2.2.1
         | 
| 43 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 44 | 
            +
              name: tty-prompt
         | 
| 45 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 46 | 
            +
                requirements:
         | 
| 47 | 
            +
                - - '='
         | 
| 48 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 49 | 
            +
                    version: 0.23.1
         | 
| 50 | 
            +
              type: :runtime
         | 
| 51 | 
            +
              prerelease: false
         | 
| 52 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 53 | 
            +
                requirements:
         | 
| 54 | 
            +
                - - '='
         | 
| 55 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 56 | 
            +
                    version: 0.23.1
         | 
| 43 57 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 44 58 | 
             
              name: whirly
         | 
| 45 59 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -94,6 +108,8 @@ files: | |
| 94 108 | 
             
            - lib/souls/generate/type.rb
         | 
| 95 109 | 
             
            - lib/souls/init.rb
         | 
| 96 110 | 
             
            - lib/souls/version.rb
         | 
| 111 | 
            +
            - lib/souls/versions/.souls_api_version
         | 
| 112 | 
            +
            - lib/souls/versions/.souls_worker_version
         | 
| 97 113 | 
             
            homepage: https://souls.elsoul.nl
         | 
| 98 114 | 
             
            licenses:
         | 
| 99 115 | 
             
            - Apache-2.0
         |