Class: Ore::Tasks
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Ore::Tasks
- Defined in:
- lib/ore/tasks.rb
Instance Method Summary collapse
- #define ⇒ Object
- #define_core_tasks ⇒ Object
- #define_git_tasks ⇒ Object
-
#initialize(root = Dir.pwd) ⇒ Tasks
constructor
A new instance of Tasks.
- #run(program, *arguments) ⇒ Object
Constructor Details
Instance Method Details
#define ⇒ Object
88 89 90 91 92 93 94 95 |
# File 'lib/ore/tasks.rb', line 88 def define define_core_tasks case @project.scm when :git define_git_tasks end end |
#define_core_tasks ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 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 |
# File 'lib/ore/tasks.rb', line 14 def define_core_tasks desc "Only builds a Gem" task :build do @project.build! end desc "Alias to the 'build' task" task :gem => :build desc "Builds and installs a Gem" task :install => :build do pkg = @project.pkg_file if File.file?(pkg) run "gem install #{pkg}" else abort "Could not find #{pkg}!" end end desc "Builds and pushes a Gem" task :push => :build do pkg = @project.pkg_file if File.file?(pkg) run "gem push #{pkg}" else abort "Could not find #{pkg}!" end end desc "Builds and Pushes a new Gem" task :release => [:build, :push] desc "Start IRB with all runtime dependencies loaded" task :console, [:script] do |t,args| original_load_path = $LOAD_PATH if @project.bundler? require 'bundler' Bundler.setup(:default) end # add the project code directories $LOAD_PATH.unshift(*@project.require_paths) # clear ARGV so IRB is not confused ARGV.clear require 'irb' # set the optional script to run IRB.conf[:SCRIPT] = args.script IRB.start # return the $LOAD_PATH to it's original state $LOAD_PATH.reject! do |path| !(original_load_path.include?(path)) end end end |
#define_git_tasks ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/ore/tasks.rb', line 76 def define_git_tasks desc 'Tags a release and pushes the tag' task :tag => :build do run "git push" run "git tag v#{@project.version}" run "git push --tags" end desc "Build, Tags and Pushes a new Gem" task :release => [:build, :tag, :push] end |
#run(program, *arguments) ⇒ Object
97 98 99 100 101 102 103 104 105 |
# File 'lib/ore/tasks.rb', line 97 def run(program,*arguments) show_command = ([program] + arguments).join(' ') unless rake_system(program,*arguments) abort "Command failed: #{show_command}" end return true end |