Sha256: c896c5b96084410d7189f9112422860c41c66b57c337f1ca1ba55d9cb495c734

Contents?: true

Size: 1.56 KB

Versions: 7

Compression:

Stored size: 1.56 KB

Contents

module Roro

  class CLI < Thor

    include Thor::Actions

    desc "ruby_gem", "Generate files for containerized gem testing, CircleCI, and releasing to RubyGems."
    method_option :rubies, type: :array, banner: "2.5.3 2.4.2"

    def ruby_gem
      rubies = options["rubies"] || ["2.5.3", "2.6.0"]
      copy_file 'ruby_gem/docker-compose.yml', 'docker-compose.yml'
      copy_file 'ruby_gem/config.yml', '.circleci/config.yml'
      copy_file 'ruby_gem/setup-gem-credentials.sh', '.circleci/setup-gem-credentials.sh'
      directory 'ruby_gem/docker', 'docker', { ruby_version: "2.5"}

      rubies.each do |ruby|
        rubydash = ruby.gsub('.', '-')
        rubyunderscore = ruby.gsub('.', '_')
        doc_loc = "docker/containers/#{rubyunderscore}/Dockerfile"
        content = <<-EOM

  app-#{rubydash}:
    build:
      context: .
      dockerfile: #{doc_loc}
    command: rake test
        EOM
        append_to_file 'docker-compose.yml', content
        template 'ruby_gem/docker/containers/app/Dockerfile.tt', doc_loc, {ruby_version: ruby}
        # append_to_file 'docker-compose.yml', "\n  app-#{ruby}:\n    build:\n\s\s\s\s\s\scontext:"
      end

      # end
#       <<EOF
#    This is the first way of creating
#    here document ie. multiple line string.
# EOF
      # %w[app web].each do |container|
      #   options = {
      #     email: @env_hash['DOCKERHUB_EMAIL'],
      #     app_name: @env_hash['APP_NAME'] }
      #
      #   template("docker/containers/#{container}/Dockerfile.tt", "docker/containers/#{container}/Dockerfile", options)
      # end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
roro-0.3.2 lib/roro/cli/ruby_gem.rb
roro-0.3.1 lib/roro/cli/ruby_gem.rb
roro-0.3.0 lib/roro/cli/ruby_gem.rb
roro-0.2.5 lib/roro/cli/ruby_gem.rb
roro-0.2.4 lib/roro/cli/ruby_gem.rb
roro-0.2.2 lib/roro/cli/ruby_gem.rb
roro-0.2.1 lib/roro/cli/ruby_gem.rb