Class: Quandl::Sandbox::Repository::Script

Inherits:
Object
  • Object
show all
Defined in:
lib/quandl/sandbox/repository.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repo) ⇒ Script

Returns a new instance of Script.



32
33
34
# File 'lib/quandl/sandbox/repository.rb', line 32

def initialize(repo)
  self.repository = repo
end

Instance Attribute Details

#repositoryObject

Returns the value of attribute repository.



30
31
32
# File 'lib/quandl/sandbox/repository.rb', line 30

def repository
  @repository
end

Instance Method Details

#before_executeObject



36
37
38
# File 'lib/quandl/sandbox/repository.rb', line 36

def before_execute
  [ clone, checkout, pull, bundle ].join("\n")
end

#bundleObject



57
58
59
# File 'lib/quandl/sandbox/repository.rb', line 57

def bundle
  "cd #{r.full_path}; bundle update"
end

#checkoutObject



48
49
50
51
# File 'lib/quandl/sandbox/repository.rb', line 48

def checkout
  %Q{ cd #{r.full_path}
  git checkout -b "#{r.ref}"}
end

#cloneObject



44
45
46
# File 'lib/quandl/sandbox/repository.rb', line 44

def clone
  %Q{git clone "#{r.git}" "#{r.full_path}"}
end

#executeObject



40
41
42
# File 'lib/quandl/sandbox/repository.rb', line 40

def execute
  "cd #{r.full_path}; bundle exec ruby import.rb"
end

#pullObject



53
54
55
# File 'lib/quandl/sandbox/repository.rb', line 53

def pull
  %Q{ cd #{r.full_path}; git pull origin "#{r.ref}" }
end

#rObject



61
62
63
# File 'lib/quandl/sandbox/repository.rb', line 61

def r
  repository
end