Module: Ore::Settings

Included in:
Project
Defined in:
lib/ore/settings.rb

Overview

A mixin for Project which provides methods for normalizing and setting project attributes.

Instance Method Summary collapse

Instance Method Details

#set_authors!(authors) ⇒ Object (protected)

Sets the authors of the project.


59
60
61
62
63
64
65
66
# File 'lib/ore/settings.rb', line 59

def set_authors!(authors)
  case authors
  when Array
    @authors += authors
  else
    @authors << authors
  end
end

#set_date!(date) ⇒ Object (protected)

Sets the release date of the project.


91
92
93
# File 'lib/ore/settings.rb', line 91

def set_date!(date)
  @date = Date.parse(date)
end

#set_default_executable!(name) ⇒ Object (protected)

Sets the default executable of the project.


122
123
124
125
126
127
128
# File 'lib/ore/settings.rb', line 122

def set_default_executable!(name)
  if @executables.include?(name)
    @default_executable = name
  else
    warn "#{name} is not in the executables list"
  end
end

#set_dependencies!(dependencies) ⇒ Object (protected)

Sets the dependencies of the project.

Raises:


186
187
188
189
190
191
192
193
194
# File 'lib/ore/settings.rb', line 186

def set_dependencies!(dependencies)
  unless dependencies.kind_of?(Hash)
    raise(,"dependencies must be a Hash")
  end

  dependencies.each do |name,versions|
    @dependencies << Dependency.parse_versions(name,versions)
  end
end

#set_development_dependencies!(dependencies) ⇒ Object (protected)

Sets the development-dependencies of the project.

Raises:


226
227
228
229
230
231
232
233
234
# File 'lib/ore/settings.rb', line 226

def set_development_dependencies!(dependencies)
  unless dependencies.kind_of?(Hash)
    raise(,"development_dependencies must be a Hash")
  end

  dependencies.each do |name,versions|
    @development_dependencies << Dependency.parse_versions(name,versions)
  end
end

#set_emails!(emails) ⇒ Object (protected)

Sets the email contacts of the project.

Since:

  • 0.1.3


76
77
78
79
80
81
82
83
# File 'lib/ore/settings.rb', line 76

def set_emails!(emails)
  case emails
  when Array
    @emails += emails
  else
    @emails << emails
  end
end

#set_executables!(paths) ⇒ Object (protected)

Sets the executables of the project.


112
113
114
# File 'lib/ore/settings.rb', line 112

def set_executables!(paths)
  each_path(paths) { |path| add_executable(path) }
end

#set_extra_doc_files!(paths) ⇒ Object (protected)

Sets the extra documentation files of the project.


136
137
138
# File 'lib/ore/settings.rb', line 136

def set_extra_doc_files!(paths)
  each_path(paths) { |path| add_extra_doc_file(path) }
end

#set_files!(paths) ⇒ Object (protected)

Sets the files of the project.


146
147
148
# File 'lib/ore/settings.rb', line 146

def set_files!(paths)
  each_path(paths) { |path| add_file(path) }
end

#set_license!(license) ⇒ Object (protected)

Sets the license(s) of the project.


44
45
46
47
48
49
50
51
# File 'lib/ore/settings.rb', line 44

def set_license!(license)
  case license
  when Array
    @licenses += license
  else
    @licenses << license
  end
end

#set_require_paths!(paths) ⇒ Object (protected)

Sets the require-paths of the project.


101
102
103
# File 'lib/ore/settings.rb', line 101

def set_require_paths!(paths)
  each_path(paths) { |path| add_require_path(path) }
end

#set_requirements!(requirements) ⇒ Object (protected)

Sets the external requirements of the project.

Since:

  • 0.2.0


168
169
170
171
172
173
174
175
# File 'lib/ore/settings.rb', line 168

def set_requirements!(requirements)
  case requirements
  when Array
    @requirements += requirements
  else
    @requirements << requirements
  end
end

#set_runtime_dependencies!(dependencies) ⇒ Object (protected)

Sets the runtime-dependencies of the project.

Raises:


206
207
208
209
210
211
212
213
214
# File 'lib/ore/settings.rb', line 206

def set_runtime_dependencies!(dependencies)
  unless dependencies.kind_of?(Hash)
    raise(,"runtime_dependencies must be a Hash")
  end

  dependencies.each do |name,versions|
    @runtime_dependencies << Dependency.parse_versions(name,versions)
  end
end

#set_test_files!(paths) ⇒ Object (protected)

Sets the test-files of the project.


156
157
158
# File 'lib/ore/settings.rb', line 156

def set_test_files!(paths)
  each_path(paths) { |path| add_test_file(path) }
end

#set_version!(version) ⇒ Object (protected)

Sets the version of the project.

Raises:

  • (InvalidVersion)

    The version must either be a String or a Hash.


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/ore/settings.rb', line 22

def set_version!(version)
  case version
  when Hash
    major = version['major']
    minor = version['minor']
    patch = version['patch']
    build = version['build']

    @version = Versions::Version.new(major,minor,patch,build)
  when String
    @version = Versions::Version.parse(version.to_s)
  else
    raise(,"version must be a Hash or a String")
  end
end