redmine_plugin_support 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES.rdoc +22 -0
- data/README.rdoc +31 -7
- data/Rakefile +8 -0
- data/VERSION +1 -1
- data/lib/redmine_plugin_support/database_task.rb +187 -0
- data/lib/redmine_plugin_support/metrics_task.rb +14 -0
- data/lib/redmine_plugin_support/stats_task.rb +55 -0
- data/lib/redmine_plugin_support/test_unit_task.rb +5 -5
- data/lib/redmine_plugin_support.rb +11 -2
- metadata +6 -8
- data/.gitignore +0 -5
- data/redmine_plugin_support.gemspec +0 -69
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/tasks/rspec.rake +0 -21
data/CHANGES.rdoc
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
== NEXT
|
2
|
+
|
3
|
+
* Added: support for code statistics tasks
|
4
|
+
|
5
|
+
== 0.0.3
|
6
|
+
|
7
|
+
* Feature: MIT License
|
8
|
+
* Feature: use jeweler to package instead of newgem
|
9
|
+
|
10
|
+
== 0.0.2
|
11
|
+
|
12
|
+
* Feature: support for Test::Unit
|
13
|
+
* Bug: both zip and tar files can be generated together
|
14
|
+
|
15
|
+
== 0.0.1
|
16
|
+
|
17
|
+
* First public release
|
18
|
+
* Feature: support for rdoc tasks
|
19
|
+
* Feature: support for RSpec tasks
|
20
|
+
* Feature: support for Cucumber tasks
|
21
|
+
* Feature: support for packaging (zip and tar) tasks
|
22
|
+
* Feature: ENV['REDMINE_ROOT'] support for running tasks outside of vendor/plugins
|
data/README.rdoc
CHANGED
@@ -1,16 +1,40 @@
|
|
1
|
-
=
|
1
|
+
= Redmine Plugin Support
|
2
2
|
|
3
|
-
|
3
|
+
This library is a collection of rake tasks and other scripts that will make Redmine plugin development easier. To use it, just configure it in your plugin's Rakefile:
|
4
|
+
|
5
|
+
require 'redmine_plugin_support'
|
6
|
+
|
7
|
+
RedminePluginSupport::Base.setup do |plugin|
|
8
|
+
plugin.project_name = 'my_plugin_name'
|
9
|
+
plugin.default_task = [:spec]
|
10
|
+
plugin.tasks = [:doc, :release, :clean, :spec]
|
11
|
+
end
|
12
|
+
|
13
|
+
== Configuration options
|
14
|
+
|
15
|
+
* project_name - name of your Redmine plugin. Make sure it matches your name in the init.rb
|
16
|
+
* tasks - list of Rake tasks to use. Valid options are:
|
17
|
+
* :doc - rdoc tasks
|
18
|
+
* :spec
|
19
|
+
* :cucumber
|
20
|
+
* :release - packaging tasks
|
21
|
+
* :clean
|
22
|
+
* :test - Test::Unit tasks
|
23
|
+
* plugin_root - the location of your plugin. Default: '.' which will work fine if you're requiring this gem from a Rakefile.
|
24
|
+
* redmine_root - the location of your Redmine root. Default: the system's REDMINE_ROOT environment or three directories down from your plugin
|
25
|
+
* default_task
|
26
|
+
|
27
|
+
== Bugs and Feature requests
|
28
|
+
|
29
|
+
Bug reports and feature requests are welcome at https://projects.littlestreamsoftware.com/projects/plugin-support-gem.
|
4
30
|
|
5
31
|
== Note on Patches/Pull Requests
|
6
|
-
|
32
|
+
|
7
33
|
* Fork the project.
|
8
34
|
* Make your feature addition or bug fix.
|
9
|
-
* Add tests for it. This is important so I don't break it in a
|
10
|
-
future version unintentionally.
|
35
|
+
* Add tests for it. This is important so I don't break it in a future version unintentionally.
|
11
36
|
* Commit, do not mess with rakefile, version, or history.
|
12
|
-
(if you want to have your own version, that is fine but
|
13
|
-
bump version in a commit by itself I can ignore when I pull)
|
37
|
+
* (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
14
38
|
* Send me a pull request. Bonus points for topic branches.
|
15
39
|
|
16
40
|
== Copyright
|
data/Rakefile
CHANGED
@@ -12,6 +12,14 @@ begin
|
|
12
12
|
gem.authors = ["Eric Davis"]
|
13
13
|
gem.add_development_dependency "thoughtbot-shoulda"
|
14
14
|
gem.rubyforge_project = "redmine_plugin_support" # TODO
|
15
|
+
gem.files = FileList[
|
16
|
+
"[A-Z]*",
|
17
|
+
"init.rb",
|
18
|
+
"rails/init.rb",
|
19
|
+
"{bin,generators,lib,test,app,assets,config,lang}/**/*",
|
20
|
+
'lib/jeweler/templates/.gitignore'
|
21
|
+
]
|
22
|
+
|
15
23
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
24
|
end
|
17
25
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
@@ -0,0 +1,187 @@
|
|
1
|
+
module RedminePluginSupport
|
2
|
+
class DatabaseTask < GeneralTask
|
3
|
+
def define
|
4
|
+
# Adding Rails's database rake tasks, we need the db:test:reset one in
|
5
|
+
# order to clear the test database.
|
6
|
+
namespace :db do
|
7
|
+
desc "Raises an error if there are pending migrations"
|
8
|
+
task :abort_if_pending_migrations => :environment do
|
9
|
+
if defined? ActiveRecord
|
10
|
+
pending_migrations = ActiveRecord::Migrator.new(:up, 'db/migrate').pending_migrations
|
11
|
+
|
12
|
+
if pending_migrations.any?
|
13
|
+
puts "You have #{pending_migrations.size} pending migrations:"
|
14
|
+
pending_migrations.each do |pending_migration|
|
15
|
+
puts ' %4d %s' % [pending_migration.version, pending_migration.name]
|
16
|
+
end
|
17
|
+
abort %{Run "rake db:migrate" to update your database then try again.}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
namespace :schema do
|
23
|
+
desc "Create a db/schema.rb file that can be portably used against any DB supported by AR"
|
24
|
+
task :dump => :environment do
|
25
|
+
require 'active_record/schema_dumper'
|
26
|
+
File.open(ENV['SCHEMA'] || "#{RAILS_ROOT}/db/schema.rb", "w") do |file|
|
27
|
+
ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)
|
28
|
+
end
|
29
|
+
Rake::Task["db:schema:dump"].reenable
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "Load a schema.rb file into the database"
|
33
|
+
task :load => :environment do
|
34
|
+
file = ENV['SCHEMA'] || "#{RAILS_ROOT}/db/schema.rb"
|
35
|
+
if File.exists?(file)
|
36
|
+
load(file)
|
37
|
+
else
|
38
|
+
abort %{#{file} doesn't exist yet. Run "rake db:migrate" to create it then try again. If you do not intend to use a database, you should instead alter #{RAILS_ROOT}/config/environment.rb to prevent active_record from loading: config.frameworks -= [ :active_record ]}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
namespace :structure do
|
44
|
+
desc "Dump the database structure to a SQL file"
|
45
|
+
task :dump => :environment do
|
46
|
+
abcs = ActiveRecord::Base.configurations
|
47
|
+
case abcs[RAILS_ENV]["adapter"]
|
48
|
+
when "mysql", "oci", "oracle"
|
49
|
+
ActiveRecord::Base.establish_connection(abcs[RAILS_ENV])
|
50
|
+
File.open("#{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql", "w+") { |f| f << ActiveRecord::Base.connection.structure_dump }
|
51
|
+
when "postgresql"
|
52
|
+
ENV['PGHOST'] = abcs[RAILS_ENV]["host"] if abcs[RAILS_ENV]["host"]
|
53
|
+
ENV['PGPORT'] = abcs[RAILS_ENV]["port"].to_s if abcs[RAILS_ENV]["port"]
|
54
|
+
ENV['PGPASSWORD'] = abcs[RAILS_ENV]["password"].to_s if abcs[RAILS_ENV]["password"]
|
55
|
+
search_path = abcs[RAILS_ENV]["schema_search_path"]
|
56
|
+
search_path = "--schema=#{search_path}" if search_path
|
57
|
+
`pg_dump -i -U "#{abcs[RAILS_ENV]["username"]}" -s -x -O -f db/#{RAILS_ENV}_structure.sql #{search_path} #{abcs[RAILS_ENV]["database"]}`
|
58
|
+
raise "Error dumping database" if $?.exitstatus == 1
|
59
|
+
when "sqlite", "sqlite3"
|
60
|
+
dbfile = abcs[RAILS_ENV]["database"] || abcs[RAILS_ENV]["dbfile"]
|
61
|
+
`#{abcs[RAILS_ENV]["adapter"]} #{dbfile} .schema > db/#{RAILS_ENV}_structure.sql`
|
62
|
+
when "sqlserver"
|
63
|
+
`scptxfr /s #{abcs[RAILS_ENV]["host"]} /d #{abcs[RAILS_ENV]["database"]} /I /f db\\#{RAILS_ENV}_structure.sql /q /A /r`
|
64
|
+
`scptxfr /s #{abcs[RAILS_ENV]["host"]} /d #{abcs[RAILS_ENV]["database"]} /I /F db\ /q /A /r`
|
65
|
+
when "firebird"
|
66
|
+
set_firebird_env(abcs[RAILS_ENV])
|
67
|
+
db_string = firebird_db_string(abcs[RAILS_ENV])
|
68
|
+
sh "isql -a #{db_string} > #{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql"
|
69
|
+
else
|
70
|
+
raise "Task not supported by '#{abcs["test"]["adapter"]}'"
|
71
|
+
end
|
72
|
+
|
73
|
+
if ActiveRecord::Base.connection.supports_migrations?
|
74
|
+
File.open("#{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql", "a") { |f| f << ActiveRecord::Base.connection.dump_schema_information }
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
namespace :test do
|
80
|
+
desc "Recreate the test database from the current schema.rb"
|
81
|
+
task :load => 'db:test:purge' do
|
82
|
+
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])
|
83
|
+
ActiveRecord::Schema.verbose = false
|
84
|
+
Rake::Task["db:schema:load"].invoke
|
85
|
+
end
|
86
|
+
|
87
|
+
desc "Recreate the test database from the current environment's database schema"
|
88
|
+
task :clone => %w(db:schema:dump db:test:load)
|
89
|
+
|
90
|
+
desc "Recreate the test databases from the development structure"
|
91
|
+
task :clone_structure => [ "db:structure:dump", "db:test:purge" ] do
|
92
|
+
abcs = ActiveRecord::Base.configurations
|
93
|
+
case abcs["test"]["adapter"]
|
94
|
+
when "mysql"
|
95
|
+
ActiveRecord::Base.establish_connection(:test)
|
96
|
+
ActiveRecord::Base.connection.execute('SET foreign_key_checks = 0')
|
97
|
+
IO.readlines("#{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql").join.split("\n\n").each do |table|
|
98
|
+
ActiveRecord::Base.connection.execute(table)
|
99
|
+
end
|
100
|
+
when "postgresql"
|
101
|
+
ENV['PGHOST'] = abcs["test"]["host"] if abcs["test"]["host"]
|
102
|
+
ENV['PGPORT'] = abcs["test"]["port"].to_s if abcs["test"]["port"]
|
103
|
+
ENV['PGPASSWORD'] = abcs["test"]["password"].to_s if abcs["test"]["password"]
|
104
|
+
`psql -U "#{abcs["test"]["username"]}" -f #{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql #{abcs["test"]["database"]}`
|
105
|
+
when "sqlite", "sqlite3"
|
106
|
+
dbfile = abcs["test"]["database"] || abcs["test"]["dbfile"]
|
107
|
+
`#{abcs["test"]["adapter"]} #{dbfile} < #{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql`
|
108
|
+
when "sqlserver"
|
109
|
+
`osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{RAILS_ENV}_structure.sql`
|
110
|
+
when "oci", "oracle"
|
111
|
+
ActiveRecord::Base.establish_connection(:test)
|
112
|
+
IO.readlines("#{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql").join.split(";\n\n").each do |ddl|
|
113
|
+
ActiveRecord::Base.connection.execute(ddl)
|
114
|
+
end
|
115
|
+
when "firebird"
|
116
|
+
set_firebird_env(abcs["test"])
|
117
|
+
db_string = firebird_db_string(abcs["test"])
|
118
|
+
sh "isql -i #{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql #{db_string}"
|
119
|
+
else
|
120
|
+
raise "Task not supported by '#{abcs["test"]["adapter"]}'"
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
desc "Empty the test database"
|
125
|
+
task :purge => :environment do
|
126
|
+
abcs = ActiveRecord::Base.configurations
|
127
|
+
case abcs["test"]["adapter"]
|
128
|
+
when "mysql"
|
129
|
+
ActiveRecord::Base.establish_connection(:test)
|
130
|
+
ActiveRecord::Base.connection.recreate_database(abcs["test"]["database"], abcs["test"])
|
131
|
+
when "postgresql"
|
132
|
+
ActiveRecord::Base.clear_active_connections!
|
133
|
+
drop_database(abcs['test'])
|
134
|
+
create_database(abcs['test'])
|
135
|
+
when "sqlite","sqlite3"
|
136
|
+
dbfile = abcs["test"]["database"] || abcs["test"]["dbfile"]
|
137
|
+
File.delete(dbfile) if File.exist?(dbfile)
|
138
|
+
when "sqlserver"
|
139
|
+
dropfkscript = "#{abcs["test"]["host"]}.#{abcs["test"]["database"]}.DP1".gsub(/\\/,'-')
|
140
|
+
`osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{dropfkscript}`
|
141
|
+
`osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{RAILS_ENV}_structure.sql`
|
142
|
+
when "oci", "oracle"
|
143
|
+
ActiveRecord::Base.establish_connection(:test)
|
144
|
+
ActiveRecord::Base.connection.structure_drop.split(";\n\n").each do |ddl|
|
145
|
+
ActiveRecord::Base.connection.execute(ddl)
|
146
|
+
end
|
147
|
+
when "firebird"
|
148
|
+
ActiveRecord::Base.establish_connection(:test)
|
149
|
+
ActiveRecord::Base.connection.recreate_database!
|
150
|
+
else
|
151
|
+
raise "Task not supported by '#{abcs["test"]["adapter"]}'"
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
desc 'Check for pending migrations and load the test schema'
|
156
|
+
task :prepare => 'db:abort_if_pending_migrations' do
|
157
|
+
if defined?(ActiveRecord) && !ActiveRecord::Base.configurations.blank?
|
158
|
+
Rake::Task[{ :sql => "db:test:clone_structure", :ruby => "db:test:load" }[ActiveRecord::Base.schema_format]].invoke
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
def drop_database(config)
|
165
|
+
case config['adapter']
|
166
|
+
when 'mysql'
|
167
|
+
ActiveRecord::Base.establish_connection(config)
|
168
|
+
ActiveRecord::Base.connection.drop_database config['database']
|
169
|
+
when /^sqlite/
|
170
|
+
FileUtils.rm(File.join(RAILS_ROOT, config['database']))
|
171
|
+
when 'postgresql'
|
172
|
+
ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres', 'schema_search_path' => 'public'))
|
173
|
+
ActiveRecord::Base.connection.drop_database config['database']
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
def set_firebird_env(config)
|
178
|
+
ENV["ISC_USER"] = config["username"].to_s if config["username"]
|
179
|
+
ENV["ISC_PASSWORD"] = config["password"].to_s if config["password"]
|
180
|
+
end
|
181
|
+
|
182
|
+
def firebird_db_string(config)
|
183
|
+
FireRuby::Database.db_string_for(config.symbolize_keys)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module RedminePluginSupport
|
2
|
+
class MetricsTask < GeneralTask
|
3
|
+
def define
|
4
|
+
require 'metric_fu'
|
5
|
+
|
6
|
+
namespace :metrics do
|
7
|
+
desc "Check the code against the rails_best_practices"
|
8
|
+
task :rails_best_practices do
|
9
|
+
system("rails_best_practices #{RedmineHelper.plugin_root}")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module RedminePluginSupport
|
2
|
+
class StatsTask < GeneralTask
|
3
|
+
|
4
|
+
STATS_DIRECTORIES = [
|
5
|
+
%w(Controllers app/controllers),
|
6
|
+
%w(Helpers app/helpers),
|
7
|
+
%w(Models app/models),
|
8
|
+
%w(Libraries lib/),
|
9
|
+
%w(APIs app/apis),
|
10
|
+
%w(Integration\ tests test/integration),
|
11
|
+
%w(Functional\ tests test/functional),
|
12
|
+
%w(Unit\ tests test/unit)
|
13
|
+
]
|
14
|
+
|
15
|
+
def stats_directories
|
16
|
+
STATS_DIRECTORIES.collect { |name, dir| [ name, "#{RedmineHelper.plugin_root}/#{dir}" ] }.select { |name, dir| File.directory?(dir) }
|
17
|
+
end
|
18
|
+
|
19
|
+
def define
|
20
|
+
# TODO: Need to get rspec stats to work
|
21
|
+
|
22
|
+
namespace :spec do
|
23
|
+
task :statsetup do
|
24
|
+
require 'code_statistics'
|
25
|
+
STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?("#{RedmineHelper.plugin_root}/spec/models")
|
26
|
+
STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?("#{RedmineHelper.plugin_root}/spec/views")
|
27
|
+
STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?("#{RedmineHelper.plugin_root}/spec/controllers")
|
28
|
+
STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?("#{RedmineHelper.plugin_root}/spec/helpers")
|
29
|
+
STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?("#{RedmineHelper.plugin_root}/spec/lib")
|
30
|
+
STATS_DIRECTORIES << %w(Routing\ specs spec/routing) if File.exist?("#{RedmineHelper.plugin_root}/spec/routing")
|
31
|
+
STATS_DIRECTORIES << %w(Integration\ specs spec/integration) if File.exist?("#{RedmineHelper.plugin_root}/spec/integration")
|
32
|
+
::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?("#{RedmineHelper.plugin_root}/spec/models")
|
33
|
+
::CodeStatistics::TEST_TYPES << "View specs" if File.exist?("#{RedmineHelper.plugin_root}/spec/views")
|
34
|
+
::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?("#{RedmineHelper.plugin_root}/spec/controllers")
|
35
|
+
::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?("#{RedmineHelper.plugin_root}/spec/helpers")
|
36
|
+
::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?("#{RedmineHelper.plugin_root}/spec/lib")
|
37
|
+
::CodeStatistics::TEST_TYPES << "Routing specs" if File.exist?("#{RedmineHelper.plugin_root}/spec/routing")
|
38
|
+
::CodeStatistics::TEST_TYPES << "Integration specs" if File.exist?("#{RedmineHelper.plugin_root}/spec/integration")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
desc "Report code statistics (KLOCs, etc) from the application"
|
45
|
+
task :stats do
|
46
|
+
require 'code_statistics'
|
47
|
+
CodeStatistics.new(*stats_directories).to_s
|
48
|
+
end
|
49
|
+
|
50
|
+
self
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
@@ -19,28 +19,28 @@ module RedminePluginSupport
|
|
19
19
|
end
|
20
20
|
|
21
21
|
namespace :test do
|
22
|
-
Rake::TestTask.new(:units => :environment) do |t|
|
22
|
+
Rake::TestTask.new(:units => [:environment, 'db:test:prepare']) do |t|
|
23
23
|
t.libs << "test"
|
24
24
|
t.pattern = 'test/unit/**/*_test.rb'
|
25
25
|
t.verbose = true
|
26
26
|
end
|
27
27
|
Rake::Task['test:units'].comment = "Run the unit tests in test/unit"
|
28
28
|
|
29
|
-
Rake::TestTask.new(:functionals => :environment) do |t|
|
29
|
+
Rake::TestTask.new(:functionals => [:environment, 'db:test:prepare']) do |t|
|
30
30
|
t.libs << "test"
|
31
31
|
t.pattern = 'test/functional/**/*_test.rb'
|
32
32
|
t.verbose = true
|
33
33
|
end
|
34
34
|
Rake::Task['test:functionals'].comment = "Run the functional tests in test/functional"
|
35
35
|
|
36
|
-
Rake::TestTask.new(:integration => :environment) do |t|
|
36
|
+
Rake::TestTask.new(:integration => [:environment, 'db:test:prepare']) do |t|
|
37
37
|
t.libs << "test"
|
38
38
|
t.pattern = 'test/integration/**/*_test.rb'
|
39
39
|
t.verbose = true
|
40
40
|
end
|
41
41
|
Rake::Task['test:integration'].comment = "Run the integration tests in test/integration"
|
42
42
|
|
43
|
-
Rake::TestTask.new(:benchmark => :environment) do |t|
|
43
|
+
Rake::TestTask.new(:benchmark => [:environment, 'db:test:prepare']) do |t|
|
44
44
|
t.libs << 'test'
|
45
45
|
t.pattern = 'test/performance/**/*_test.rb'
|
46
46
|
t.verbose = true
|
@@ -48,7 +48,7 @@ module RedminePluginSupport
|
|
48
48
|
end
|
49
49
|
Rake::Task['test:benchmark'].comment = 'Benchmark the performance tests'
|
50
50
|
|
51
|
-
Rake::TestTask.new(:profile => :environment) do |t|
|
51
|
+
Rake::TestTask.new(:profile => [:environment, 'db:test:prepare']) do |t|
|
52
52
|
t.libs << 'test'
|
53
53
|
t.pattern = 'test/performance/**/*_test.rb'
|
54
54
|
t.verbose = true
|
@@ -7,14 +7,17 @@ require 'rake/tasklib'
|
|
7
7
|
require 'redmine_plugin_support/redmine_helper'
|
8
8
|
require 'redmine_plugin_support/general_task'
|
9
9
|
require 'redmine_plugin_support/environment_task'
|
10
|
+
require 'redmine_plugin_support/database_task'
|
10
11
|
require 'redmine_plugin_support/cucumber_task'
|
12
|
+
require 'redmine_plugin_support/metrics_task'
|
11
13
|
require 'redmine_plugin_support/rdoc_task'
|
12
14
|
require 'redmine_plugin_support/release_task'
|
13
15
|
require 'redmine_plugin_support/rspec_task'
|
16
|
+
require 'redmine_plugin_support/stats_task'
|
14
17
|
require 'redmine_plugin_support/test_unit_task'
|
15
18
|
|
16
19
|
module RedminePluginSupport
|
17
|
-
VERSION = '0.0.
|
20
|
+
VERSION = '0.0.4'
|
18
21
|
|
19
22
|
@@options = { }
|
20
23
|
|
@@ -34,7 +37,7 @@ module RedminePluginSupport
|
|
34
37
|
def self.setup(options = { }, &block)
|
35
38
|
plugin = self.instance
|
36
39
|
plugin.project_name = 'undefined'
|
37
|
-
plugin.tasks = [:doc, :spec, :cucumber, :release, :clean, :test]
|
40
|
+
plugin.tasks = [:db, :doc, :spec, :cucumber, :release, :clean, :test, :stats]
|
38
41
|
plugin.plugin_root = '.'
|
39
42
|
plugin.redmine_root = ENV["REDMINE_ROOT"] || File.expand_path(File.dirname(__FILE__) + '/../../../')
|
40
43
|
plugin.default_task = :doc
|
@@ -45,6 +48,8 @@ module RedminePluginSupport
|
|
45
48
|
|
46
49
|
plugin.tasks.each do |task|
|
47
50
|
case task
|
51
|
+
when :db
|
52
|
+
RedminePluginSupport::DatabaseTask.new(:db)
|
48
53
|
when :doc
|
49
54
|
RedminePluginSupport::RDocTask.new(:doc)
|
50
55
|
when :spec
|
@@ -55,6 +60,10 @@ module RedminePluginSupport
|
|
55
60
|
RedminePluginSupport::CucumberTask.new(:features)
|
56
61
|
when :release
|
57
62
|
RedminePluginSupport::ReleaseTask.new(:release)
|
63
|
+
when :stats
|
64
|
+
RedminePluginSupport::StatsTask.new(:stats)
|
65
|
+
when :metrics
|
66
|
+
RedminePluginSupport::MetricsTask.new(:metrics)
|
58
67
|
when :clean
|
59
68
|
require 'rake/clean'
|
60
69
|
CLEAN.include('**/semantic.cache', "**/#{plugin.project_name}.zip", "**/#{plugin.project_name}.tar.gz")
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 4
|
9
|
+
version: 0.0.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Eric Davis
|
@@ -39,7 +39,7 @@ extra_rdoc_files:
|
|
39
39
|
- LICENSE
|
40
40
|
- README.rdoc
|
41
41
|
files:
|
42
|
-
- .
|
42
|
+
- CHANGES.rdoc
|
43
43
|
- History.txt
|
44
44
|
- LICENSE
|
45
45
|
- Manifest.txt
|
@@ -49,18 +49,16 @@ files:
|
|
49
49
|
- VERSION
|
50
50
|
- lib/redmine_plugin_support.rb
|
51
51
|
- lib/redmine_plugin_support/cucumber_task.rb
|
52
|
+
- lib/redmine_plugin_support/database_task.rb
|
52
53
|
- lib/redmine_plugin_support/environment_task.rb
|
53
54
|
- lib/redmine_plugin_support/general_task.rb
|
55
|
+
- lib/redmine_plugin_support/metrics_task.rb
|
54
56
|
- lib/redmine_plugin_support/rdoc_task.rb
|
55
57
|
- lib/redmine_plugin_support/redmine_helper.rb
|
56
58
|
- lib/redmine_plugin_support/release_task.rb
|
57
59
|
- lib/redmine_plugin_support/rspec_task.rb
|
60
|
+
- lib/redmine_plugin_support/stats_task.rb
|
58
61
|
- lib/redmine_plugin_support/test_unit_task.rb
|
59
|
-
- redmine_plugin_support.gemspec
|
60
|
-
- script/console
|
61
|
-
- script/destroy
|
62
|
-
- script/generate
|
63
|
-
- tasks/rspec.rake
|
64
62
|
- test/redmine_plugin_support_test.rb
|
65
63
|
- test/test_helper.rb
|
66
64
|
has_rdoc: true
|
@@ -1,69 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{redmine_plugin_support}
|
8
|
-
s.version = "0.0.3"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Eric Davis"]
|
12
|
-
s.date = %q{2010-05-10}
|
13
|
-
s.description = %q{This libarary is a collection of rake tasks and other scripts that will make Redmine plugin development easier.}
|
14
|
-
s.email = %q{edavis@littlestreamsoftware.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".gitignore",
|
21
|
-
"History.txt",
|
22
|
-
"LICENSE",
|
23
|
-
"Manifest.txt",
|
24
|
-
"PostInstall.txt",
|
25
|
-
"README.rdoc",
|
26
|
-
"Rakefile",
|
27
|
-
"VERSION",
|
28
|
-
"lib/redmine_plugin_support.rb",
|
29
|
-
"lib/redmine_plugin_support/cucumber_task.rb",
|
30
|
-
"lib/redmine_plugin_support/environment_task.rb",
|
31
|
-
"lib/redmine_plugin_support/general_task.rb",
|
32
|
-
"lib/redmine_plugin_support/rdoc_task.rb",
|
33
|
-
"lib/redmine_plugin_support/redmine_helper.rb",
|
34
|
-
"lib/redmine_plugin_support/release_task.rb",
|
35
|
-
"lib/redmine_plugin_support/rspec_task.rb",
|
36
|
-
"lib/redmine_plugin_support/test_unit_task.rb",
|
37
|
-
"redmine_plugin_support.gemspec",
|
38
|
-
"script/console",
|
39
|
-
"script/destroy",
|
40
|
-
"script/generate",
|
41
|
-
"tasks/rspec.rake",
|
42
|
-
"test/redmine_plugin_support_test.rb",
|
43
|
-
"test/test_helper.rb"
|
44
|
-
]
|
45
|
-
s.homepage = %q{http://github.com/edavis10/redmine_plugin_support}
|
46
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
47
|
-
s.require_paths = ["lib"]
|
48
|
-
s.rubyforge_project = %q{redmine_plugin_support}
|
49
|
-
s.rubygems_version = %q{1.3.6}
|
50
|
-
s.summary = %q{Libraries to automate the creation and management of Redmine plugins}
|
51
|
-
s.test_files = [
|
52
|
-
"test/test_helper.rb",
|
53
|
-
"test/redmine_plugin_support_test.rb"
|
54
|
-
]
|
55
|
-
|
56
|
-
if s.respond_to? :specification_version then
|
57
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
58
|
-
s.specification_version = 3
|
59
|
-
|
60
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
61
|
-
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
62
|
-
else
|
63
|
-
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
64
|
-
end
|
65
|
-
else
|
66
|
-
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
data/script/console
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# File: script/console
|
3
|
-
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
-
|
5
|
-
libs = " -r irb/completion"
|
6
|
-
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
-
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
-
libs << " -r #{File.dirname(__FILE__) + '/../lib/redmine_plugin_support.rb'}"
|
9
|
-
puts "Loading redmine_plugin_support gem"
|
10
|
-
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/destroy'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/generate'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Generate.new.run(ARGV)
|
data/tasks/rspec.rake
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'spec'
|
3
|
-
rescue LoadError
|
4
|
-
require 'rubygems'
|
5
|
-
require 'spec'
|
6
|
-
end
|
7
|
-
begin
|
8
|
-
require 'spec/rake/spectask'
|
9
|
-
rescue LoadError
|
10
|
-
puts <<-EOS
|
11
|
-
To use rspec for testing you must install rspec gem:
|
12
|
-
gem install rspec
|
13
|
-
EOS
|
14
|
-
exit(0)
|
15
|
-
end
|
16
|
-
|
17
|
-
desc "Run the specs under spec/models"
|
18
|
-
Spec::Rake::SpecTask.new do |t|
|
19
|
-
t.spec_opts = ['--options', "spec/spec.opts"]
|
20
|
-
t.spec_files = FileList['spec/**/*_spec.rb']
|
21
|
-
end
|