Class: Develry::Site

Inherits:
Object
  • Object
show all
Defined in:
lib/develry/site.rb,
lib/develry/site/initializer.rb

Overview

Encapsulates a specific Project develry is used for

Defined Under Namespace

Classes: Initializer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ Site

Returns a new instance of Site.



12
13
14
15
# File 'lib/develry/site.rb', line 12

def initialize(project)
  @project = project
  @root    = project.root
end

Instance Attribute Details

#projectObject (readonly)

Returns the value of attribute project.



10
11
12
# File 'lib/develry/site.rb', line 10

def project
  @project
end

#rootObject (readonly)

Returns the value of attribute root.



8
9
10
# File 'lib/develry/site.rb', line 8

def root
  @root
end

Instance Method Details

#initundefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize develry using default config

Returns:

  • (undefined)


34
35
36
37
38
# File 'lib/develry/site.rb', line 34

def init
  Initializer.call(self)
  puts 'Run bundle install to complete the develry installation'
  self
end

#init_spec_helperself

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize project and load shared specs

Expects to be called from $application_root/spec/spec_helper.rb

Returns:

  • (self)


24
25
26
27
# File 'lib/develry/site.rb', line 24

def init_spec_helper
  Project::Initializer::Rspec.call(project)
  self
end

#syncundefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Sync gemfiles

Returns:

  • (undefined)


45
46
47
48
49
50
# File 'lib/develry/site.rb', line 45

def sync
  target = root.join(GEMFILE_NAME)
  FileUtils.cp(SHARED_GEMFILE_PATH, target)
  puts "Successfully synced #{target}"
  self
end

#updateundefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Sync gemfiles and run bundle update

Returns:

  • (undefined)


57
58
59
60
61
# File 'lib/develry/site.rb', line 57

def update
  sync
  system(BUNDLE_UPDATE)
  self
end