Class: WaxTasks::TravisBranch

Inherits:
Branch
  • Object
show all
Defined in:
lib/wax_tasks/branch.rb

Overview

Branch object for ‘$ wax:push` task when run on Travis-CI VM using encrypted Travis environment vars

Instance Attribute Summary collapse

Attributes inherited from Branch

#success, #target

Instance Method Summary collapse

Methods inherited from Branch

inherited, #push, #rebuild

Constructor Details

#initialize(site, target) ⇒ TravisBranch

Returns a new instance of TravisBranch.



79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/wax_tasks/branch.rb', line 79

def initialize(site, target)
  super(site, target)

  @repo_slug    = ENV['TRAVIS_REPO_SLUG']
  @user         = @repo_slug.split('/').first
  @token        = ENV['ACCESS_TOKEN']

  @commit_msg   = "Updated via #{ENV['TRAVIS_COMMIT']} @#{Time.now.utc}"
  @origin       = "https://#{@user}:#{@token}@github.com/#{@repo_slug}.git"
  @baseurl      = @repo_slug.split('/').last
  @success_msg  = "Deploying to #{@target} branch from Travis as #{@user}."
end

Instance Attribute Details

#baseurlString

the site baseurl to build with (if on gh-pages)

Returns:

  • (String)

    the current value of baseurl



78
79
80
# File 'lib/wax_tasks/branch.rb', line 78

def baseurl
  @baseurl
end

#commit_msgString

the commit message to use on push

Returns:

  • (String)

    the current value of commit_msg



78
79
80
# File 'lib/wax_tasks/branch.rb', line 78

def commit_msg
  @commit_msg
end

#originString

the current repository remote

Returns:

  • (String)

    the current value of origin



78
79
80
# File 'lib/wax_tasks/branch.rb', line 78

def origin
  @origin
end

#repo_slugString

the ‘user/repo_name’

Returns:

  • (String)

    the current value of repo_slug



78
79
80
# File 'lib/wax_tasks/branch.rb', line 78

def repo_slug
  @repo_slug
end

#success_msgString

informative message to be output to console

Returns:

  • (String)

    the current value of success_msg



78
79
80
# File 'lib/wax_tasks/branch.rb', line 78

def success_msg
  @success_msg
end

#tokenString

secret git access token

Returns:

  • (String)

    the current value of token



78
79
80
# File 'lib/wax_tasks/branch.rb', line 78

def token
  @token
end

#userString

the GitHub user making the commit/push

Returns:

  • (String)

    the current value of user



78
79
80
# File 'lib/wax_tasks/branch.rb', line 78

def user
  @user
end