Sha256: 6996f53a24c829be0e13a8e65cce6a3452650e7987d5826117dd92c27985b255

Contents?: true

Size: 1.34 KB

Versions: 156

Compression:

Stored size: 1.34 KB

Contents

class Jets::Commands::Import
  class Base < Sequence
    # Ugly, but when the class_option is only defined in the Thor::Group class
    # it doesnt show up with jets new help :(
    # If anyone knows how to fix this let me know.
    def self.cli_options
      [
        [:submodule, type: :boolean, default: false, desc: "Imports the project as a submodule"],
      ]
    end
    cli_options.each { |args| class_option(*args) }

    # Since setup is public it will automatically run in the subclasses
    def setup
      start_message
      create_rack_folder
      configure_ruby
      create_rackup_wrappers
    end

  private
    def start_message
      puts "Importing app into the rack folder..."
    end

    def create_rack_folder
      repo? ? clone_project : copy_project
    end

    def configure_ruby
      gsub_file 'rack/Gemfile', /^ruby(.*)/, '# ruby\1' # comment out ruby declaration
      create_file "rack/.ruby-version", RUBY_VERSION, force: true
    end

    def create_rackup_wrappers
      path = File.expand_path("../../builders/rackup_wrappers", File.dirname(__FILE__))
      Dir.glob("#{path}/*").each do |p|
        FileUtils.cp(p, "#{rack_folder}/bin/")
      end
      chmod "#{rack_folder}/bin/rackup", 0755
    end

    def bundle_install
      Bundler.with_clean_env do
        run "cd rack && bundle install"
      end
    end
  end
end

Version data entries

156 entries across 156 versions & 3 rubygems

Version Path
jets-1.9.29 lib/jets/commands/import/base.rb
jets-1.9.28 lib/jets/commands/import/base.rb
jets-1.9.27 lib/jets/commands/import/base.rb
jets-1.9.26 lib/jets/commands/import/base.rb
jets-1.9.25 lib/jets/commands/import/base.rb
jets-1.9.24 lib/jets/commands/import/base.rb
jets-1.9.23 lib/jets/commands/import/base.rb
jets-1.9.22 lib/jets/commands/import/base.rb
jets-1.9.21 lib/jets/commands/import/base.rb
jets-1.9.20 lib/jets/commands/import/base.rb
jets-1.9.19 lib/jets/commands/import/base.rb
jets-1.9.18 lib/jets/commands/import/base.rb
jets-1.9.17 lib/jets/commands/import/base.rb
jets-1.9.16 lib/jets/commands/import/base.rb
jets-1.9.15 lib/jets/commands/import/base.rb
jets-1.9.14 lib/jets/commands/import/base.rb
jets-1.9.13 lib/jets/commands/import/base.rb
jets-1.9.12 lib/jets/commands/import/base.rb
jets-1.9.11 lib/jets/commands/import/base.rb
jets-1.9.10 lib/jets/commands/import/base.rb