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
-
#set_authors!(authors) ⇒ Object
protected
Sets the authors of the project.
-
#set_date!(date) ⇒ Object
protected
Sets the release date of the project.
-
#set_default_executable!(name) ⇒ Object
protected
Sets the default executable of the project.
-
#set_dependencies!(dependencies) ⇒ Object
protected
Sets the dependencies of the project.
-
#set_development_dependencies!(dependencies) ⇒ Object
protected
Sets the development-dependencies of the project.
-
#set_executables!(paths) ⇒ Object
protected
Sets the executables of the project.
-
#set_extra_doc_files!(paths) ⇒ Object
protected
Sets the extra documentation files of the project.
-
#set_files!(paths) ⇒ Object
protected
Sets the files of the project.
-
#set_license!(license) ⇒ Object
protected
Sets the license(s) of the project.
-
#set_post_install_message!(message) ⇒ Object
protected
Sets the post-installation message.
-
#set_require_paths!(paths) ⇒ Object
protected
Sets the require-paths of the project.
-
#set_required_ruby_version!(version) ⇒ Object
protected
Sets the Ruby version required by the project.
-
#set_required_rubygems_version!(version) ⇒ Object
protected
Sets the RubyGems version required by the project.
-
#set_requirements!(requirements) ⇒ Object
protected
Sets the external requirements of the project.
-
#set_runtime_dependencies!(dependencies) ⇒ Object
protected
Sets the runtime-dependencies of the project.
-
#set_test_files!(paths) ⇒ Object
protected
Sets the test-files of the project.
-
#set_version!(version) ⇒ Object
protected
Sets the version of the project.
Instance Method Details
#set_authors!(authors) ⇒ Object (protected)
Sets the authors of the project.
58 59 60 61 62 63 64 |
# File 'lib/ore/settings.rb', line 58 def () if .kind_of?(Array) += else << end end |
#set_date!(date) ⇒ Object (protected)
Sets the release date of the project.
72 73 74 |
# File 'lib/ore/settings.rb', line 72 def set_date!(date) @date = Date.parse(date) end |
#set_default_executable!(name) ⇒ Object (protected)
Sets the default executable of the project.
111 112 113 114 115 116 117 |
# File 'lib/ore/settings.rb', line 111 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.
218 219 220 221 222 223 224 225 226 |
# File 'lib/ore/settings.rb', line 218 def set_dependencies!(dependencies) unless dependencies.kind_of?(Hash) raise(InvalidMetadata,"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.
258 259 260 261 262 263 264 265 266 |
# File 'lib/ore/settings.rb', line 258 def set_development_dependencies!(dependencies) unless dependencies.kind_of?(Hash) raise(InvalidMetadata,"development_dependencies must be a Hash") end dependencies.each do |name,versions| @development_dependencies << Dependency.parse_versions(name,versions) end end |
#set_executables!(paths) ⇒ Object (protected)
Sets the executables of the project.
97 98 99 100 101 102 103 |
# File 'lib/ore/settings.rb', line 97 def set_executables!(paths) if paths.kind_of?(Array) paths.each { |path| add_executable(path) } else glob(paths) { |path| add_executable(path) } end end |
#set_extra_doc_files!(paths) ⇒ Object (protected)
Sets the extra documentation files of the project.
125 126 127 128 129 130 131 |
# File 'lib/ore/settings.rb', line 125 def set_extra_doc_files!(paths) if paths.kind_of?(Array) paths.each { |path| add_extra_doc_file(path) } else glob(paths) { |path| add_extra_doc_file(path) } end end |
#set_files!(paths) ⇒ Object (protected)
Sets the files of the project.
139 140 141 142 143 144 145 |
# File 'lib/ore/settings.rb', line 139 def set_files!(paths) if paths.kind_of?(Array) paths.each { |path| add_file(path) } else glob(paths) { |path| add_file(path) } end end |
#set_license!(license) ⇒ Object (protected)
Sets the license(s) of the project.
44 45 46 47 48 49 50 |
# File 'lib/ore/settings.rb', line 44 def set_license!(license) if license.kind_of?(Array) @licenses += license else @licenses << license end end |
#set_post_install_message!(message) ⇒ Object (protected)
Sets the post-installation message.
169 170 171 |
# File 'lib/ore/settings.rb', line 169 def () = end |
#set_require_paths!(paths) ⇒ Object (protected)
Sets the require-paths of the project.
82 83 84 85 86 87 88 |
# File 'lib/ore/settings.rb', line 82 def set_require_paths!(paths) if paths.kind_of?(Array) paths.each { |path| add_require_path(path) } else glob(paths) { |path| add_require_path(path) } end end |
#set_required_ruby_version!(version) ⇒ Object (protected)
Sets the Ruby version required by the project.
195 196 197 |
# File 'lib/ore/settings.rb', line 195 def set_required_ruby_version!(version) @required_ruby_version = version.to_s end |
#set_required_rubygems_version!(version) ⇒ Object (protected)
Sets the RubyGems version required by the project.
205 206 207 |
# File 'lib/ore/settings.rb', line 205 def set_required_rubygems_version!(version) @required_rubygems_version = version.to_s end |
#set_requirements!(requirements) ⇒ Object (protected)
Sets the external requirements of the project.
181 182 183 184 185 186 187 |
# File 'lib/ore/settings.rb', line 181 def set_requirements!(requirements) if requirements.kind_of?(Array) @requirements += requirements else @requirements << requirements end end |
#set_runtime_dependencies!(dependencies) ⇒ Object (protected)
Sets the runtime-dependencies of the project.
238 239 240 241 242 243 244 245 246 |
# File 'lib/ore/settings.rb', line 238 def set_runtime_dependencies!(dependencies) unless dependencies.kind_of?(Hash) raise(InvalidMetadata,"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.
153 154 155 156 157 158 159 |
# File 'lib/ore/settings.rb', line 153 def set_test_files!(paths) if paths.kind_of?(Array) paths.each { |path| add_test_file(path) } else glob(paths) { |path| add_test_file(path) } end end |
#set_version!(version) ⇒ Object (protected)
Sets the version of the project.
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(InvalidMetadata,"version must be a Hash or a String") end end |