combination.rb revision 22607ad2617ae07db8df3478c1e3c5bede481c91
a99b64f7d63812806ee40c2e8a347343fa3b84a7Timo Sirainen validate :nodes_is_collection, :nodes_is_not_empty
22627da0fb77c1d0d9a8e8bc485ef5540b6f2e69Timo Sirainen def initialize(user, target_repository, combination_hash)
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen @target_repository = Repository.find(target_repository)
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen from_combination_hash(combination_hash.with_indifferent_access)
1d132fe27d010b73aacc605b4c6257b0079f9e97Timo Sirainen @commit_message ||= commit_message_erb.result(binding)
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen @combination_name ||= DEFAULT_COMBINATION_NAME
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen target_directory = nil if target_directory == '.'
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen repository_file: {repository_id: target_repository.path},
5fbf8719b9ef072295c16bc4492f9f0ece92117dTimo Sirainen file.write(dol_representation_erb.result(binding))
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen template_file = Rails.root.join('lib/combinations/dol.erb')
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen template_file = Rails.root.join('lib/combinations/commit_message.erb')
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen errors.add(:nodes, 'is not an array/collection')
e8db44d3d542a8d29500ddfc0e7b51004345af36Timo Sirainen errors.add(:nodes, 'should be set and contain URIs')