Sha256: 20af050aa86f113bb30439a3088893914ecd3c7df52de41a90a976160a340755

Contents?: true

Size: 1.34 KB

Versions: 51

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_unbundled_env do
        run "cd rack && bundle install"
      end
    end
  end
end

Version data entries

51 entries across 51 versions & 2 rubygems

Version Path
jets-4.0.12 lib/jets/commands/import/base.rb
jets-4.0.11 lib/jets/commands/import/base.rb
jets-4.0.10 lib/jets/commands/import/base.rb
jets-4.0.9 lib/jets/commands/import/base.rb
jets-4.0.8 lib/jets/commands/import/base.rb
jets-4.0.7 lib/jets/commands/import/base.rb
jets-4.0.6 lib/jets/commands/import/base.rb
jets-4.0.5 lib/jets/commands/import/base.rb
jets-4.0.4 lib/jets/commands/import/base.rb
jets-4.0.3 lib/jets/commands/import/base.rb
jets-4.0.2 lib/jets/commands/import/base.rb
jets-4.0.1 lib/jets/commands/import/base.rb
jets-4.0.0 lib/jets/commands/import/base.rb
jets-3.2.2 lib/jets/commands/import/base.rb
jets-3.2.1 lib/jets/commands/import/base.rb
jets.benforeva-3.0.17.pre.mount.pre.fix lib/jets/commands/import/base.rb
jets-3.2.0 lib/jets/commands/import/base.rb
jets-3.1.5 lib/jets/commands/import/base.rb
jets-3.1.4 lib/jets/commands/import/base.rb
jets-3.1.3 lib/jets/commands/import/base.rb