Sha256: 764661d956f446eb54711c8e1477ef77a5c97264f12607bfa6d7bbff8d4b7be0

Contents?: true

Size: 588 Bytes

Versions: 18

Compression:

Stored size: 588 Bytes

Contents

require 'git'

module LearnTest
  class RepoParser
    def self.get_repo
      begin
        repo = Git.open(FileUtils.pwd)
      rescue
        puts "You don't appear to be in a Learn lesson's directory. Please cd to an appropriate directory and try again."
        die
      end

      if url = repo.remote.url
        url.match(/(?:https:\/\/|git@).*\/(.+?)(?:\.git)?$/)[1]
      else
        puts "You don't appear to be in a Learn lesson's directory. Please cd to an appropriate directory and try again."
        die
      end
    end

    def self.die
      exit
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
learn-test-2.4.0 lib/learn_test/repo_parser.rb
learn-test-2.3.3 lib/learn_test/repo_parser.rb
learn-test-2.3.2 lib/learn_test/repo_parser.rb
learn-test-2.3.1 lib/learn_test/repo_parser.rb
learn-test-2.3.0 lib/learn_test/repo_parser.rb
learn-test-2.2.2 lib/learn_test/repo_parser.rb
learn-test-2.2.1 lib/learn_test/repo_parser.rb
learn-test-2.2.0 lib/learn_test/repo_parser.rb
learn-test-2.1.2 lib/learn_test/repo_parser.rb
learn-test-2.1.0 lib/learn_test/repo_parser.rb
learn-test-2.1.1 lib/learn_test/repo_parser.rb
learn-test-2.0.0 lib/learn_test/repo_parser.rb
learn-test-2.0.0.rc2 lib/learn_test/repo_parser.rb
learn-test-2.0.0.rc1 lib/learn_test/repo_parser.rb
learn-test-2.0.0.pre lib/learn_test/repo_parser.rb
learn-test-1.2.26 lib/learn_test/repo_parser.rb
learn-test-1.2.25 lib/learn_test/repo_parser.rb
learn-test-1.2.24 lib/learn_test/repo_parser.rb