Sha256: 8a3df9c40d8c3761da1e5a89644e7660e60e5261bc83d19bdf4a542f36ced035

Contents?: true

Size: 1.08 KB

Versions: 148

Compression:

Stored size: 1.08 KB

Contents

class Jets::Commands::Import
  class Cheatsheet
    def self.create(rack_repo_url)
      new(rack_repo_url).create
    end

    def initialize(rack_repo_url)
      @rack_repo_url = rack_repo_url
    end

    def create
      path = File.expand_path("./templates/", File.dirname(__FILE__)) + "/submodules-cheatsheet.md"
      basename = File.basename(path)
      dest = "#{Jets.root}/#{basename}"
      cheatsheet = Jets::Erb.result(path, cheatsheet_vars)
      FileUtils.mkdir_p(File.dirname(dest))
      IO.write(dest, cheatsheet)
      puts "Created #{basename} to help with using submodules."
    end

    def cheatsheet_vars
      import_command = ARGV[0]
      {
        import_command: import_command,
        rack_repo_url: @rack_repo_url,
        jets_project_repo_url: jets_project_repo_url,
      }
    end

    def jets_project_repo_url
      # Thanks: https://stackoverflow.com/questions/4089430/how-can-i-determine-the-url-that-a-local-git-repository-was-originally-cloned-fr/4089452
      `git config --get remote.origin.url`.strip rescue 'https://github.com/user/repo'
    end
  end
end

Version data entries

148 entries across 148 versions & 4 rubygems

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