Class: Monoz::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/monoz/project.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root_path) ⇒ Project

Returns a new instance of Project.



7
8
9
10
11
12
13
14
# File 'lib/monoz/project.rb', line 7

def initialize(root_path)
  @root_path = root_path

  parse_project_files
  parse_dependencies

  setup_instance_variables
end

Instance Attribute Details

#dependantsObject (readonly)

Returns the value of attribute dependants.



5
6
7
# File 'lib/monoz/project.rb', line 5

def dependants
  @dependants
end

#dependenciesObject (readonly)

Returns the value of attribute dependencies.



5
6
7
# File 'lib/monoz/project.rb', line 5

def dependencies
  @dependencies
end

#frameworksObject (readonly)

Returns the value of attribute frameworks.



5
6
7
# File 'lib/monoz/project.rb', line 5

def frameworks
  @frameworks
end

#gem_nameObject (readonly)

Returns the value of attribute gem_name.



5
6
7
# File 'lib/monoz/project.rb', line 5

def gem_name
  @gem_name
end

#gemspecObject (readonly)

Returns the value of attribute gemspec.



5
6
7
# File 'lib/monoz/project.rb', line 5

def gemspec
  @gemspec
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/monoz/project.rb', line 5

def name
  @name
end

#root_pathObject (readonly)

Returns the value of attribute root_path.



5
6
7
# File 'lib/monoz/project.rb', line 5

def root_path
  @root_path
end

#typeObject (readonly)

Returns the value of attribute type.



5
6
7
# File 'lib/monoz/project.rb', line 5

def type
  @type
end

Instance Method Details

#is_gem?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/monoz/project.rb', line 16

def is_gem?
  !gemspec_path.nil?
end

#text_colorObject



24
25
26
# File 'lib/monoz/project.rb', line 24

def text_color
  is_gem? ? :green : :blue
end

#update_dependants(collection) ⇒ Object

Update dependants of this project based on other projects in the collection



110
111
112
113
114
115
116
# File 'lib/monoz/project.rb', line 110

def update_dependants(collection)
  collection.each do |project|
    if project.dependencies.key?(name)
      project.dependants << self
    end
  end
end

#valid?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/monoz/project.rb', line 20

def valid?
  @root_path != nil && gemfile_path != nil
end