Module: Ore::SCM::Tasks::Git
- Defined in:
- lib/ore/scm/tasks/git.rb
Class Method Summary collapse
-
.extended(tasks) ⇒ Object
Registers the
sync
andtag
release tasks when extended.
Instance Method Summary collapse
-
#define_scm_tasks ⇒ Object
Defines the Git specific tasks.
-
#dirty_files ⇒ Hash{String => String}
Lists the modified files within the project.
Class Method Details
.extended(tasks) ⇒ Object
Registers the sync
and tag
release tasks when extended.
8 9 10 11 |
# File 'lib/ore/scm/tasks/git.rb', line 8 def self.extended(tasks) tasks.release_tasks.unshift('sync') tasks.release_tasks.push('tag') end |
Instance Method Details
#define_scm_tasks ⇒ Object
Defines the Git specific tasks.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ore/scm/tasks/git.rb', line 16 def define_scm_tasks @has_remote = !(`git remote`.empty?) desc 'Updates the remote repository' task :sync do run 'git', 'push' if @has_remote end desc 'Tags a release and pushes the tag' task :tag do run 'git', 'tag', "v#{@project.version}" run 'git', 'push', '--tags' if @has_remote end end |
#dirty_files ⇒ Hash{String => String}
Lists the modified files within the project.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/ore/scm/tasks/git.rb', line 39 def dirty_files files = {} `git status --porcelain`.each_line do |line| status, name = line.chomp.split # ignore untracked files unless status == '??' files[name] = status end end return files end |