Class: Cejo::Projects::Builder
- Inherits:
-
Object
- Object
- Cejo::Projects::Builder
- Defined in:
- lib/cejo/projects/builder.rb
Overview
Build Projects
Constant Summary collapse
- BUILD_FOLDER =
Pathname.new File.join(Dir.home, 'Builds')
Instance Attribute Summary collapse
-
#cejo_config ⇒ Object
readonly
Returns the value of attribute cejo_config.
-
#local_folder ⇒ Object
readonly
Returns the value of attribute local_folder.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#utils ⇒ Object
readonly
Returns the value of attribute utils.
Instance Method Summary collapse
-
#apply_patches ⇒ Object
none, or exclusively these ones.
- #checkout_tag ⇒ Object
- #cleaning ⇒ Object
- #grab ⇒ Object
-
#initialize(local, utils, project) ⇒ Builder
constructor
A new instance of Builder.
- #install ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(local, utils, project) ⇒ Builder
Returns a new instance of Builder.
14 15 16 17 18 |
# File 'lib/cejo/projects/builder.rb', line 14 def initialize(local, utils, project) @local_folder = local @utils = utils @project = project end |
Instance Attribute Details
#cejo_config ⇒ Object (readonly)
Returns the value of attribute cejo_config.
12 13 14 |
# File 'lib/cejo/projects/builder.rb', line 12 def cejo_config @cejo_config end |
#local_folder ⇒ Object (readonly)
Returns the value of attribute local_folder.
12 13 14 |
# File 'lib/cejo/projects/builder.rb', line 12 def local_folder @local_folder end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
12 13 14 |
# File 'lib/cejo/projects/builder.rb', line 12 def project @project end |
#utils ⇒ Object (readonly)
Returns the value of attribute utils.
12 13 14 |
# File 'lib/cejo/projects/builder.rb', line 12 def utils @utils end |
Instance Method Details
#apply_patches ⇒ Object
none, or exclusively these ones.
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/cejo/projects/builder.rb', line 40 def apply_patches tasks = project.patch return if tasks == 'none' Dir.chdir(project.folder) do project.patches.children.each do |patch| next unless tasks.include? patch.basename.to_s puts "Patched: #{patch.to_path}" # all project.repository.apply patch.to_path end end end |
#checkout_tag ⇒ Object
24 25 26 27 28 |
# File 'lib/cejo/projects/builder.rb', line 24 def checkout_tag return if project.tag.empty? project.repository.checkout project.tag end |
#cleaning ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/cejo/projects/builder.rb', line 54 def cleaning project.repository.reset_hard project.repository.checkout project.main_branch Dir.chdir(project.folder) do project.purge.each { |command| system command } end end |
#grab ⇒ Object
20 21 22 |
# File 'lib/cejo/projects/builder.rb', line 20 def grab Floss::Grab.new(utils, project.folder, project.url, project.to_s).run end |
#install ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/cejo/projects/builder.rb', line 30 def install Dir.chdir(project.folder) do project.commands.each do |command| command.gsub!('{0}', local_folder.to_s) system command end end end |
#run ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/cejo/projects/builder.rb', line 63 def run grab checkout_tag apply_patches install # TODO: raise Git::GitExecuteError cleaning end |