Class: Nu::Project

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

Instance Method Summary collapse

Constructor Details

#initializeProject

Returns a new instance of Project.



6
7
8
9
# File 'lib/nu/project.rb', line 6

def initialize
  @config_file = ".nu/options.yaml"
  ensure_default_config
end

Instance Method Details

#add_file(name, content) ⇒ Object



47
48
49
50
# File 'lib/nu/project.rb', line 47

def add_file(name, content)
  FileUtils.mkdir_p(File.dirname(name))
  File.open(name, 'w'){|f| f.write(content)}
end

#locationObject

need to meta awesome this



12
13
14
15
# File 'lib/nu/project.rb', line 12

def location
  opts = get_options
  opts['lib']
end

#location=(name) ⇒ Object

need to meta awesome this



18
19
20
21
22
23
# File 'lib/nu/project.rb', line 18

def location=(name)
  opts = get_options
  opts['lib']=name
  save_file(opts)
  nil
end

#should_use_long_names?Boolean

need to meta awesome this

Returns:

  • (Boolean)


26
27
28
29
# File 'lib/nu/project.rb', line 26

def should_use_long_names?
  opts = get_options
  opts['uselongnames']
end

#use_long_namesObject

need to meta awesome this



32
33
34
35
36
37
# File 'lib/nu/project.rb', line 32

def use_long_names
  opts = get_options
  opts['uselongnames']=true
  save_file(opts)
  nil
end

#use_short_namesObject

need to meta awesome this



40
41
42
43
44
45
# File 'lib/nu/project.rb', line 40

def use_short_names
  opts = get_options
  opts['uselongnames']=false
  save_file(opts)
  nil
end