Class: Gembuild::Project
- Inherits:
-
Object
- Object
- Gembuild::Project
- Defined in:
- lib/gembuild/project.rb
Overview
This class is mostly responsible for creating new AUR packages: checking out, adding files and committing to git.
Constant Summary collapse
- GITIGNORE =
A standard gitignore for new projects that only allows the following whitelisted files: itself, the PKGBUILD and the .SRCINFO.
"*\n!.gitignore\n!PKGBUILD\n!.SRCINFO\n"
Instance Attribute Summary collapse
-
#config ⇒ Hash
readonly
The response from Gembuild.configure.
-
#full_path ⇒ String
readonly
The full local path to the project.
-
#gemname ⇒ String
readonly
The name of the gem.
-
#pkgdir ⇒ String
readonly
Where repositories are checked out.
-
#pkgname ⇒ String
readonly
The AUR package.
Instance Method Summary collapse
-
#clone_and_commit! ⇒ void
Make sure that the working directory is created and up to date, and that git is configured for the project.
-
#clone_and_update! ⇒ void
Git clone the project if it hasn’t already been checked out.
-
#commit_changes!(message) ⇒ void
Commit the currently staged changeset.
-
#commit_message(version) ⇒ String
Determine the commit message depending upon whether it’s the initial commit or we’re bumping the release.
-
#configure_git!(name, email) ⇒ void
Ensure that the git user and email address are correct for the repository.
-
#ensure_pkgdir! ⇒ void
Get the gembuild configuration and ensure that the pkgdir exists creating it if necessary.
-
#initialize(gemname) ⇒ Gembuild::Project
constructor
Return a new project instance.
-
#load_existing_pkgbuild ⇒ String
Read into memory the PKGBUILD in the project’s directory or an empty string if none exists.
-
#prepare_working_directory! ⇒ void
Ensure that the project directory has been created and is up-to-date.
-
#stage_changes! ⇒ void
Update the package metadata with mksrcinfo and then stage all changes with git.
-
#write_gitignore! ⇒ void
Write a standard gitignore file if none exists.
Constructor Details
#initialize(gemname) ⇒ Gembuild::Project
Return a new project instance.
46 47 48 49 50 51 52 53 |
# File 'lib/gembuild/project.rb', line 46 def initialize(gemname) @pkgname = "ruby-#{gemname}" @gemname = gemname @config = Gembuild.configure @pkgdir = @config[:pkgdir] @full_path = File.join(@pkgdir, @pkgname) end |
Instance Attribute Details
#config ⇒ Hash (readonly)
Returns the response from Gembuild.configure.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/gembuild/project.rb', line 35 class Project attr_reader :config, :full_path, :gemname, :pkgdir, :pkgname # A standard gitignore for new projects that only allows the following # whitelisted files: itself, the PKGBUILD and the .SRCINFO. GITIGNORE = "*\n!.gitignore\n!PKGBUILD\n!.SRCINFO\n" # Return a new project instance. # # @param gemname [String] The ruby gem for which to create a project. # @return [Gembuild::Project] the new project instance def initialize(gemname) @pkgname = "ruby-#{gemname}" @gemname = gemname @config = Gembuild.configure @pkgdir = @config[:pkgdir] @full_path = File.join(@pkgdir, @pkgname) end # Git clone the project if it hasn't already been checked out. If it has # then pull master to ensure the most recent update. # # @return [void] def clone_and_update! if File.directory?(full_path) `cd #{full_path} && git checkout master && git pull origin master` else `git clone ssh://[email protected]/#{pkgname}.git #{full_path}` end end # Write a standard gitignore file if none exists. # # @return [void] def write_gitignore! ignore_path = File.join(full_path, '.gitignore') File.write(ignore_path, GITIGNORE) unless File.exist?(ignore_path) end # Ensure that the git user and email address are correct for the # repository. # # @param name [String] The user name to send to git. # @param email [String] The user email to send to git. # @return [void] def configure_git!(name, email) `cd #{full_path} && git config user.name "#{name}"` `cd #{full_path} && git config user.email "#{email}"` end # Read into memory the PKGBUILD in the project's directory or an empty # string if none exists. # # @return [String] the existing pkgbuild or an empty string def load_existing_pkgbuild pkgbuild_path = File.join(full_path, 'PKGBUILD') if File.file?(pkgbuild_path) File.read(pkgbuild_path) else '' end end # Update the package metadata with mksrcinfo and then stage all changes # with git. # # @return [void] def stage_changes! `cd #{full_path} && mksrcinfo && git add .` end # Determine the commit message depending upon whether it's the initial # commit or we're bumping the release. # # @param version [String] The version of the package to include in the # commit message. # @return [String] the appropriate commit message def (version) `cd #{full_path} && git rev-parse HEAD &> /dev/null` if !$CHILD_STATUS.success? 'Initial commit' else "Bump version to #{version}" end end # Commit the currently staged changeset. # # @param message [String] The requested commit message. # @return [void] def commit_changes!() `cd #{full_path} && git commit -m "#{}"` end # Get the gembuild configuration and ensure that the pkgdir exists # creating it if necessary. # # @return [void] def ensure_pkgdir! FileUtils.mkdir_p(pkgdir) unless File.directory?(pkgdir) end # Ensure that the project directory has been created and is up-to-date. # # @return [void] def prepare_working_directory! ensure_pkgdir! clone_and_update! write_gitignore! configure_git!(config[:name], config[:email]) end # Make sure that the working directory is created and up to date, and that # git is configured for the project. Then create an updated PKGBUILD based # on the most recent version of the gem and write it out. Generate the # updated metadata using `mksrcinfo` and then commit all changes to git. # # @return [void] def clone_and_commit! prepare_working_directory! pkgbuild = Gembuild::Pkgbuild.create(gemname, load_existing_pkgbuild) pkgbuild.write(full_path) stage_changes! commit_changes!((pkgbuild.pkgver)) end end |
#full_path ⇒ String (readonly)
Returns the full local path to the project.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/gembuild/project.rb', line 35 class Project attr_reader :config, :full_path, :gemname, :pkgdir, :pkgname # A standard gitignore for new projects that only allows the following # whitelisted files: itself, the PKGBUILD and the .SRCINFO. GITIGNORE = "*\n!.gitignore\n!PKGBUILD\n!.SRCINFO\n" # Return a new project instance. # # @param gemname [String] The ruby gem for which to create a project. # @return [Gembuild::Project] the new project instance def initialize(gemname) @pkgname = "ruby-#{gemname}" @gemname = gemname @config = Gembuild.configure @pkgdir = @config[:pkgdir] @full_path = File.join(@pkgdir, @pkgname) end # Git clone the project if it hasn't already been checked out. If it has # then pull master to ensure the most recent update. # # @return [void] def clone_and_update! if File.directory?(full_path) `cd #{full_path} && git checkout master && git pull origin master` else `git clone ssh://[email protected]/#{pkgname}.git #{full_path}` end end # Write a standard gitignore file if none exists. # # @return [void] def write_gitignore! ignore_path = File.join(full_path, '.gitignore') File.write(ignore_path, GITIGNORE) unless File.exist?(ignore_path) end # Ensure that the git user and email address are correct for the # repository. # # @param name [String] The user name to send to git. # @param email [String] The user email to send to git. # @return [void] def configure_git!(name, email) `cd #{full_path} && git config user.name "#{name}"` `cd #{full_path} && git config user.email "#{email}"` end # Read into memory the PKGBUILD in the project's directory or an empty # string if none exists. # # @return [String] the existing pkgbuild or an empty string def load_existing_pkgbuild pkgbuild_path = File.join(full_path, 'PKGBUILD') if File.file?(pkgbuild_path) File.read(pkgbuild_path) else '' end end # Update the package metadata with mksrcinfo and then stage all changes # with git. # # @return [void] def stage_changes! `cd #{full_path} && mksrcinfo && git add .` end # Determine the commit message depending upon whether it's the initial # commit or we're bumping the release. # # @param version [String] The version of the package to include in the # commit message. # @return [String] the appropriate commit message def (version) `cd #{full_path} && git rev-parse HEAD &> /dev/null` if !$CHILD_STATUS.success? 'Initial commit' else "Bump version to #{version}" end end # Commit the currently staged changeset. # # @param message [String] The requested commit message. # @return [void] def commit_changes!() `cd #{full_path} && git commit -m "#{}"` end # Get the gembuild configuration and ensure that the pkgdir exists # creating it if necessary. # # @return [void] def ensure_pkgdir! FileUtils.mkdir_p(pkgdir) unless File.directory?(pkgdir) end # Ensure that the project directory has been created and is up-to-date. # # @return [void] def prepare_working_directory! ensure_pkgdir! clone_and_update! write_gitignore! configure_git!(config[:name], config[:email]) end # Make sure that the working directory is created and up to date, and that # git is configured for the project. Then create an updated PKGBUILD based # on the most recent version of the gem and write it out. Generate the # updated metadata using `mksrcinfo` and then commit all changes to git. # # @return [void] def clone_and_commit! prepare_working_directory! pkgbuild = Gembuild::Pkgbuild.create(gemname, load_existing_pkgbuild) pkgbuild.write(full_path) stage_changes! commit_changes!((pkgbuild.pkgver)) end end |
#gemname ⇒ String (readonly)
Returns the name of the gem.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/gembuild/project.rb', line 35 class Project attr_reader :config, :full_path, :gemname, :pkgdir, :pkgname # A standard gitignore for new projects that only allows the following # whitelisted files: itself, the PKGBUILD and the .SRCINFO. GITIGNORE = "*\n!.gitignore\n!PKGBUILD\n!.SRCINFO\n" # Return a new project instance. # # @param gemname [String] The ruby gem for which to create a project. # @return [Gembuild::Project] the new project instance def initialize(gemname) @pkgname = "ruby-#{gemname}" @gemname = gemname @config = Gembuild.configure @pkgdir = @config[:pkgdir] @full_path = File.join(@pkgdir, @pkgname) end # Git clone the project if it hasn't already been checked out. If it has # then pull master to ensure the most recent update. # # @return [void] def clone_and_update! if File.directory?(full_path) `cd #{full_path} && git checkout master && git pull origin master` else `git clone ssh://[email protected]/#{pkgname}.git #{full_path}` end end # Write a standard gitignore file if none exists. # # @return [void] def write_gitignore! ignore_path = File.join(full_path, '.gitignore') File.write(ignore_path, GITIGNORE) unless File.exist?(ignore_path) end # Ensure that the git user and email address are correct for the # repository. # # @param name [String] The user name to send to git. # @param email [String] The user email to send to git. # @return [void] def configure_git!(name, email) `cd #{full_path} && git config user.name "#{name}"` `cd #{full_path} && git config user.email "#{email}"` end # Read into memory the PKGBUILD in the project's directory or an empty # string if none exists. # # @return [String] the existing pkgbuild or an empty string def load_existing_pkgbuild pkgbuild_path = File.join(full_path, 'PKGBUILD') if File.file?(pkgbuild_path) File.read(pkgbuild_path) else '' end end # Update the package metadata with mksrcinfo and then stage all changes # with git. # # @return [void] def stage_changes! `cd #{full_path} && mksrcinfo && git add .` end # Determine the commit message depending upon whether it's the initial # commit or we're bumping the release. # # @param version [String] The version of the package to include in the # commit message. # @return [String] the appropriate commit message def (version) `cd #{full_path} && git rev-parse HEAD &> /dev/null` if !$CHILD_STATUS.success? 'Initial commit' else "Bump version to #{version}" end end # Commit the currently staged changeset. # # @param message [String] The requested commit message. # @return [void] def commit_changes!() `cd #{full_path} && git commit -m "#{}"` end # Get the gembuild configuration and ensure that the pkgdir exists # creating it if necessary. # # @return [void] def ensure_pkgdir! FileUtils.mkdir_p(pkgdir) unless File.directory?(pkgdir) end # Ensure that the project directory has been created and is up-to-date. # # @return [void] def prepare_working_directory! ensure_pkgdir! clone_and_update! write_gitignore! configure_git!(config[:name], config[:email]) end # Make sure that the working directory is created and up to date, and that # git is configured for the project. Then create an updated PKGBUILD based # on the most recent version of the gem and write it out. Generate the # updated metadata using `mksrcinfo` and then commit all changes to git. # # @return [void] def clone_and_commit! prepare_working_directory! pkgbuild = Gembuild::Pkgbuild.create(gemname, load_existing_pkgbuild) pkgbuild.write(full_path) stage_changes! commit_changes!((pkgbuild.pkgver)) end end |
#pkgdir ⇒ String (readonly)
Returns where repositories are checked out.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/gembuild/project.rb', line 35 class Project attr_reader :config, :full_path, :gemname, :pkgdir, :pkgname # A standard gitignore for new projects that only allows the following # whitelisted files: itself, the PKGBUILD and the .SRCINFO. GITIGNORE = "*\n!.gitignore\n!PKGBUILD\n!.SRCINFO\n" # Return a new project instance. # # @param gemname [String] The ruby gem for which to create a project. # @return [Gembuild::Project] the new project instance def initialize(gemname) @pkgname = "ruby-#{gemname}" @gemname = gemname @config = Gembuild.configure @pkgdir = @config[:pkgdir] @full_path = File.join(@pkgdir, @pkgname) end # Git clone the project if it hasn't already been checked out. If it has # then pull master to ensure the most recent update. # # @return [void] def clone_and_update! if File.directory?(full_path) `cd #{full_path} && git checkout master && git pull origin master` else `git clone ssh://[email protected]/#{pkgname}.git #{full_path}` end end # Write a standard gitignore file if none exists. # # @return [void] def write_gitignore! ignore_path = File.join(full_path, '.gitignore') File.write(ignore_path, GITIGNORE) unless File.exist?(ignore_path) end # Ensure that the git user and email address are correct for the # repository. # # @param name [String] The user name to send to git. # @param email [String] The user email to send to git. # @return [void] def configure_git!(name, email) `cd #{full_path} && git config user.name "#{name}"` `cd #{full_path} && git config user.email "#{email}"` end # Read into memory the PKGBUILD in the project's directory or an empty # string if none exists. # # @return [String] the existing pkgbuild or an empty string def load_existing_pkgbuild pkgbuild_path = File.join(full_path, 'PKGBUILD') if File.file?(pkgbuild_path) File.read(pkgbuild_path) else '' end end # Update the package metadata with mksrcinfo and then stage all changes # with git. # # @return [void] def stage_changes! `cd #{full_path} && mksrcinfo && git add .` end # Determine the commit message depending upon whether it's the initial # commit or we're bumping the release. # # @param version [String] The version of the package to include in the # commit message. # @return [String] the appropriate commit message def (version) `cd #{full_path} && git rev-parse HEAD &> /dev/null` if !$CHILD_STATUS.success? 'Initial commit' else "Bump version to #{version}" end end # Commit the currently staged changeset. # # @param message [String] The requested commit message. # @return [void] def commit_changes!() `cd #{full_path} && git commit -m "#{}"` end # Get the gembuild configuration and ensure that the pkgdir exists # creating it if necessary. # # @return [void] def ensure_pkgdir! FileUtils.mkdir_p(pkgdir) unless File.directory?(pkgdir) end # Ensure that the project directory has been created and is up-to-date. # # @return [void] def prepare_working_directory! ensure_pkgdir! clone_and_update! write_gitignore! configure_git!(config[:name], config[:email]) end # Make sure that the working directory is created and up to date, and that # git is configured for the project. Then create an updated PKGBUILD based # on the most recent version of the gem and write it out. Generate the # updated metadata using `mksrcinfo` and then commit all changes to git. # # @return [void] def clone_and_commit! prepare_working_directory! pkgbuild = Gembuild::Pkgbuild.create(gemname, load_existing_pkgbuild) pkgbuild.write(full_path) stage_changes! commit_changes!((pkgbuild.pkgver)) end end |
#pkgname ⇒ String (readonly)
Returns the AUR package.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/gembuild/project.rb', line 35 class Project attr_reader :config, :full_path, :gemname, :pkgdir, :pkgname # A standard gitignore for new projects that only allows the following # whitelisted files: itself, the PKGBUILD and the .SRCINFO. GITIGNORE = "*\n!.gitignore\n!PKGBUILD\n!.SRCINFO\n" # Return a new project instance. # # @param gemname [String] The ruby gem for which to create a project. # @return [Gembuild::Project] the new project instance def initialize(gemname) @pkgname = "ruby-#{gemname}" @gemname = gemname @config = Gembuild.configure @pkgdir = @config[:pkgdir] @full_path = File.join(@pkgdir, @pkgname) end # Git clone the project if it hasn't already been checked out. If it has # then pull master to ensure the most recent update. # # @return [void] def clone_and_update! if File.directory?(full_path) `cd #{full_path} && git checkout master && git pull origin master` else `git clone ssh://[email protected]/#{pkgname}.git #{full_path}` end end # Write a standard gitignore file if none exists. # # @return [void] def write_gitignore! ignore_path = File.join(full_path, '.gitignore') File.write(ignore_path, GITIGNORE) unless File.exist?(ignore_path) end # Ensure that the git user and email address are correct for the # repository. # # @param name [String] The user name to send to git. # @param email [String] The user email to send to git. # @return [void] def configure_git!(name, email) `cd #{full_path} && git config user.name "#{name}"` `cd #{full_path} && git config user.email "#{email}"` end # Read into memory the PKGBUILD in the project's directory or an empty # string if none exists. # # @return [String] the existing pkgbuild or an empty string def load_existing_pkgbuild pkgbuild_path = File.join(full_path, 'PKGBUILD') if File.file?(pkgbuild_path) File.read(pkgbuild_path) else '' end end # Update the package metadata with mksrcinfo and then stage all changes # with git. # # @return [void] def stage_changes! `cd #{full_path} && mksrcinfo && git add .` end # Determine the commit message depending upon whether it's the initial # commit or we're bumping the release. # # @param version [String] The version of the package to include in the # commit message. # @return [String] the appropriate commit message def (version) `cd #{full_path} && git rev-parse HEAD &> /dev/null` if !$CHILD_STATUS.success? 'Initial commit' else "Bump version to #{version}" end end # Commit the currently staged changeset. # # @param message [String] The requested commit message. # @return [void] def commit_changes!() `cd #{full_path} && git commit -m "#{}"` end # Get the gembuild configuration and ensure that the pkgdir exists # creating it if necessary. # # @return [void] def ensure_pkgdir! FileUtils.mkdir_p(pkgdir) unless File.directory?(pkgdir) end # Ensure that the project directory has been created and is up-to-date. # # @return [void] def prepare_working_directory! ensure_pkgdir! clone_and_update! write_gitignore! configure_git!(config[:name], config[:email]) end # Make sure that the working directory is created and up to date, and that # git is configured for the project. Then create an updated PKGBUILD based # on the most recent version of the gem and write it out. Generate the # updated metadata using `mksrcinfo` and then commit all changes to git. # # @return [void] def clone_and_commit! prepare_working_directory! pkgbuild = Gembuild::Pkgbuild.create(gemname, load_existing_pkgbuild) pkgbuild.write(full_path) stage_changes! commit_changes!((pkgbuild.pkgver)) end end |
Instance Method Details
#clone_and_commit! ⇒ void
This method returns an undefined value.
Make sure that the working directory is created and up to date, and that git is configured for the project. Then create an updated PKGBUILD based on the most recent version of the gem and write it out. Generate the updated metadata using ‘mksrcinfo` and then commit all changes to git.
157 158 159 160 161 162 163 164 165 |
# File 'lib/gembuild/project.rb', line 157 def clone_and_commit! prepare_working_directory! pkgbuild = Gembuild::Pkgbuild.create(gemname, load_existing_pkgbuild) pkgbuild.write(full_path) stage_changes! commit_changes!((pkgbuild.pkgver)) end |
#clone_and_update! ⇒ void
This method returns an undefined value.
Git clone the project if it hasn’t already been checked out. If it has then pull master to ensure the most recent update.
59 60 61 62 63 64 65 |
# File 'lib/gembuild/project.rb', line 59 def clone_and_update! if File.directory?(full_path) `cd #{full_path} && git checkout master && git pull origin master` else `git clone ssh://[email protected]/#{pkgname}.git #{full_path}` end end |
#commit_changes!(message) ⇒ void
This method returns an undefined value.
Commit the currently staged changeset.
129 130 131 |
# File 'lib/gembuild/project.rb', line 129 def commit_changes!() `cd #{full_path} && git commit -m "#{}"` end |
#commit_message(version) ⇒ String
Determine the commit message depending upon whether it’s the initial commit or we’re bumping the release.
115 116 117 118 119 120 121 122 123 |
# File 'lib/gembuild/project.rb', line 115 def (version) `cd #{full_path} && git rev-parse HEAD &> /dev/null` if !$CHILD_STATUS.success? 'Initial commit' else "Bump version to #{version}" end end |
#configure_git!(name, email) ⇒ void
This method returns an undefined value.
Ensure that the git user and email address are correct for the repository.
82 83 84 85 |
# File 'lib/gembuild/project.rb', line 82 def configure_git!(name, email) `cd #{full_path} && git config user.name "#{name}"` `cd #{full_path} && git config user.email "#{email}"` end |
#ensure_pkgdir! ⇒ void
This method returns an undefined value.
Get the gembuild configuration and ensure that the pkgdir exists creating it if necessary.
137 138 139 |
# File 'lib/gembuild/project.rb', line 137 def ensure_pkgdir! FileUtils.mkdir_p(pkgdir) unless File.directory?(pkgdir) end |
#load_existing_pkgbuild ⇒ String
Read into memory the PKGBUILD in the project’s directory or an empty string if none exists.
91 92 93 94 95 96 97 98 99 |
# File 'lib/gembuild/project.rb', line 91 def load_existing_pkgbuild pkgbuild_path = File.join(full_path, 'PKGBUILD') if File.file?(pkgbuild_path) File.read(pkgbuild_path) else '' end end |
#prepare_working_directory! ⇒ void
This method returns an undefined value.
Ensure that the project directory has been created and is up-to-date.
144 145 146 147 148 149 |
# File 'lib/gembuild/project.rb', line 144 def prepare_working_directory! ensure_pkgdir! clone_and_update! write_gitignore! configure_git!(config[:name], config[:email]) end |
#stage_changes! ⇒ void
This method returns an undefined value.
Update the package metadata with mksrcinfo and then stage all changes with git.
105 106 107 |
# File 'lib/gembuild/project.rb', line 105 def stage_changes! `cd #{full_path} && mksrcinfo && git add .` end |
#write_gitignore! ⇒ void
This method returns an undefined value.
Write a standard gitignore file if none exists.
70 71 72 73 74 |
# File 'lib/gembuild/project.rb', line 70 def write_gitignore! ignore_path = File.join(full_path, '.gitignore') File.write(ignore_path, GITIGNORE) unless File.exist?(ignore_path) end |