Class: RedminePluginSupport::Base

Inherits:
Object
  • Object
show all
Extended by:
Rake::DSL
Includes:
Rake::DSL, Singleton
Defined in:
lib/redmine_plugin_support.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#default_taskObject

Returns the value of attribute default_task.



25
26
27
# File 'lib/redmine_plugin_support.rb', line 25

def default_task
  @default_task
end

#pluginObject

Returns the value of attribute plugin.



27
28
29
# File 'lib/redmine_plugin_support.rb', line 27

def plugin
  @plugin
end

#plugin_rootObject

Returns the value of attribute plugin_root.



23
24
25
# File 'lib/redmine_plugin_support.rb', line 23

def plugin_root
  @plugin_root
end

#project_nameObject

Returns the value of attribute project_name.



21
22
23
# File 'lib/redmine_plugin_support.rb', line 21

def project_name
  @project_name
end

#redmine_rootObject

Returns the value of attribute redmine_root.



24
25
26
# File 'lib/redmine_plugin_support.rb', line 24

def redmine_root
  @redmine_root
end

#tasksObject

Returns the value of attribute tasks.



22
23
24
# File 'lib/redmine_plugin_support.rb', line 22

def tasks
  @tasks
end

Class Method Details

.setup(options = { }, &block) ⇒ Object

:plugin_root => File.expand_path(File.dirname(__FILE__))



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
75
76
77
# File 'lib/redmine_plugin_support.rb', line 31

def self.setup(options = { }, &block)
  plugin = self.instance
  plugin.project_name = 'undefined'
  plugin.tasks = [:db, :doc, :spec, :cucumber, :release, :clean, :test, :stats]
  plugin.plugin_root = '.'
  plugin.redmine_root = ENV["REDMINE_ROOT"] || File.expand_path(File.dirname(__FILE__) + '/../../../')
  plugin.default_task = :doc

  plugin.instance_eval(&block)

  RedminePluginSupport::EnvironmentTask.new(:environment)

  plugin.tasks.each do |task|
    case task
    when :db
      require 'redmine_plugin_support/database_task'
      RedminePluginSupport::DatabaseTask.new(:db)
    when :doc
      require 'redmine_plugin_support/rdoc_task'
      RedminePluginSupport::RDocTask.new(:doc)
    when :spec
      require 'redmine_plugin_support/rspec_task'
      RedminePluginSupport::RspecTask.new(:spec)
    when :test
      require 'redmine_plugin_support/test_unit_task'
      RedminePluginSupport::TestUnitTask.new(:test)
    when :cucumber
      require 'redmine_plugin_support/cucumber_task'
      RedminePluginSupport::CucumberTask.new(:features)
    when :release
      require 'redmine_plugin_support/release_task'
      RedminePluginSupport::ReleaseTask.new(:release)
    when :stats
      require 'redmine_plugin_support/stats_task'
      RedminePluginSupport::StatsTask.new(:stats)
    when :metrics
      require 'redmine_plugin_support/metrics_task'
      RedminePluginSupport::MetricsTask.new(:metrics)
    when :clean
      require 'rake/clean'
      CLEAN.include('**/semantic.cache', "**/#{plugin.project_name}.zip", "**/#{plugin.project_name}.tar.gz")
    end
  end
  
  task :default => plugin.default_task

end