How to use desc method of Plugins Package

Best Inspec_ruby code snippet using Plugins.desc


Source:redmine.rake Github


Full Screen

...15# along with this program; if not, write to the Free Software16# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.17namespace :redmine do18 namespace :attachments do19 desc 'Removes uploaded files left unattached after one day.'20 task :prune => :environment do21 Attachment.prune22 end23 desc 'Moves attachments stored at the root of the file directory (ie. created before Redmine 2.3) to their subdirectories'24 task :move_to_subdirectories => :environment do25 Attachment.move_from_root_to_target_directory26 end27 desc 'Updates attachment digests to SHA256'28 task :update_digests => :environment do29 Attachment.update_digests_to_sha25630 end31 end32 namespace :tokens do33 desc 'Removes expired tokens.'34 task :prune => :environment do35 Token.destroy_expired36 end37 end38 namespace :watchers do39 desc 'Removes watchers from what they can no longer view.'40 task :prune => :environment do41 Watcher.prune42 end43 end44 desc 'Fetch changesets from the repositories'45 task :fetch_changesets => :environment do46 Repository.fetch_changesets47 end48 desc 'Migrates and copies plugins assets.'49 task :plugins do50 Rake::Task["redmine:plugins:migrate"].invoke51 Rake::Task["redmine:plugins:assets"].invoke52 end53desc <<-DESC54FOR EXPERIMENTAL USE ONLY, Moves Redmine data from production database to the development database.55This task should only be used when you need to move data from one DBMS to a different one (eg. MySQL to PostgreSQL).56WARNING: All data in the development database is deleted.57DESC58 task :migrate_dbms => :environment do59 ActiveRecord::Base.establish_connection :development60 target_tables = ActiveRecord::Base.connection.tables61 ActiveRecord::Base.remove_connection62 ActiveRecord::Base.establish_connection :production63 tables = ActiveRecord::Base.connection.tables.sort - %w(schema_migrations plugin_schema_info)64 if (tables - target_tables).any?65 list = (tables - target_tables).map {|table| "* #{table}"}.join("\n")66 abort "The following table(s) are missing from the target database:\n#{list}"67 end68 tables.each do |table_name|69 Source = Target = Target.establish_connection(:development)72 [Source, Target].each do |klass|73 klass.table_name = table_name74 klass.reset_column_information75 klass.inheritance_column = "foo"76 klass.record_timestamps = false77 end78 Target.primary_key = (Target.column_names.include?("id") ? "id" : nil)79 source_count = Source.count80 puts "Migrating %6d records from #{table_name}..." % source_count81 Target.delete_all82 offset = 083 while (objects = Source.offset(offset).limit(5000).order("1,2").to_a) && objects.any?84 offset += objects.size85 Target.transaction do86 objects.each do |object|87 new_object = = if Target.primary_key89 => false)90 end91 end92 end93 Target.connection.reset_pk_sequence!(table_name) if Target.primary_key94 target_count = Target.count95 abort "Some records were not migrated" unless source_count == target_count96 Object.send(:remove_const, :Target)97 Object.send(:remove_const, :Source)98 end99 end100 namespace :plugins do101 desc 'Migrates installed plugins.'102 task :migrate => :environment do103 name = ENV['NAME']104 version = nil105 version_string = ENV['VERSION']106 if version_string107 if version_string =~ /^\d+$/108 version = version_string.to_i109 if name.nil?110 abort "The VERSION argument requires a plugin NAME."111 end112 else113 abort "Invalid VERSION #{version_string} given."114 end115 end116 begin117 Redmine::Plugin.migrate(name, version)118 rescue Redmine::PluginNotFound119 abort "Plugin #{name} was not found."120 end121 case ActiveRecord::Base.schema_format122 when :ruby123 Rake::Task["db:schema:dump"].invoke124 when :sql125 Rake::Task["db:structure:dump"].invoke126 end127 end128 desc 'Copies plugins assets into the public directory.'129 task :assets => :environment do130 name = ENV['NAME']131 begin132 Redmine::Plugin.mirror_assets(name)133 rescue Redmine::PluginNotFound134 abort "Plugin #{name} was not found."135 end136 end137 desc 'Runs the plugins tests.'138 task :test do139 Rake::Task["redmine:plugins:test:units"].invoke140 Rake::Task["redmine:plugins:test:functionals"].invoke141 Rake::Task["redmine:plugins:test:integration"].invoke142 Rake::Task["redmine:plugins:test:system"].invoke143 end144 namespace :test do145 desc 'Runs the plugins unit tests.'146 task :units => "db:test:prepare" do |t|147 $: << "test"148 Rails::TestUnit::Runner.rake_run ["plugins/#{ENV['NAME'] || '*'}/test/unit/**/*_test.rb"]149 end150 desc 'Runs the plugins functional tests.'151 task :functionals => "db:test:prepare" do |t|152 $: << "test"153 Rails::TestUnit::Runner.rake_run ["plugins/#{ENV['NAME'] || '*'}/test/functional/**/*_test.rb"]154 end155 desc 'Runs the plugins integration tests.'156 task :integration => "db:test:prepare" do |t|157 $: << "test"158 Rails::TestUnit::Runner.rake_run ["plugins/#{ENV['NAME'] || '*'}/test/integration/**/*_test.rb"]159 end160 desc 'Runs the plugins system tests.'161 task :system => "db:test:prepare" do |t|162 $: << "test"163 Rails::TestUnit::Runner.rake_run ["plugins/#{ENV['NAME'] || '*'}/test/system/**/*_test.rb"]164 end165 desc 'Runs the plugins ui tests.'166 task :ui => "db:test:prepare" do |t|167 $: << "test"168 Rails::TestUnit::Runner.rake_run ["plugins/#{ENV['NAME'] || '*'}/test/ui/**/*_test.rb"]169 end170 end171 end172end173# Load plugins' rake tasks174Dir[File.join(Rails.root, "plugins/*/lib/tasks/**/*.rake")].sort.each { |ext| load ext }...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:


You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Inspec_ruby automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?