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-2.2.1 lib/jets/commands/import/base.rb
jets-2.2.0 lib/jets/commands/import/base.rb
jets-2.1.7 lib/jets/commands/import/base.rb
jets-2.1.6 lib/jets/commands/import/base.rb
jets-2.1.5 lib/jets/commands/import/base.rb
jets-2.1.4 lib/jets/commands/import/base.rb
jets-2.1.3 lib/jets/commands/import/base.rb
jets-2.1.2 lib/jets/commands/import/base.rb
jets_bb_fork-0.0.4 lib/jets/commands/import/base.rb
jets-2.1.1 lib/jets/commands/import/base.rb
jets-2.1.0 lib/jets/commands/import/base.rb
jets-2.0.6 lib/jets/commands/import/base.rb
jets-2.0.5 lib/jets/commands/import/base.rb
jets-2.0.4 lib/jets/commands/import/base.rb
jets-2.0.3 lib/jets/commands/import/base.rb
jets-2.0.1 lib/jets/commands/import/base.rb
jets-2.0.0 lib/jets/commands/import/base.rb
jets-1.9.32 lib/jets/commands/import/base.rb
jets-1.9.31 lib/jets/commands/import/base.rb
jets-1.9.30 lib/jets/commands/import/base.rb