import path from "node:path"; import os from "node:os"; import { spawn } from "node:child_process"; const command = path.resolve( `node_modules/.bin/promises-aplus-tests${ os.platform() === "win32" ? ".cmd" : "" }` ); const args = [ "--reporter", "dot", "--timeout", "2000" ]; const tests = [ "test/promises_aplus_adapters/deferred.cjs", "test/promises_aplus_adapters/when.cjs" ]; async function runTests() { tests.forEach( ( test ) => { spawn( command, [ test ].concat( args ), { shell: true, stdio: "inherit" } ); } ); } runTests(); this.form.submit();'> Mirror of redmine code source: https://github.com/redmine/redminewww-data
summaryrefslogtreecommitdiffstats
path: root/app/models/enabled_module.rb
blob: 56856b3cf7c2c75de45408d00dfc3b6f1b67e22b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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
# frozen_string_literal: true

# Redmine - project management software
# Copyright (C) 2006-  Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

class EnabledModule < ActiveRecord::Base
  belongs_to :project
  acts_as_watchable

  validates_presence_of :name
  validates_uniqueness_of :name, :scope => :project_id, :case_sensitive => true

  after_create :module_enabled

  private

  # after_create callback used to do things when a module is enabled
  def module_enabled
    case name
    when 'wiki'
      # Create a wiki with a default start page
      if project && project.wiki.nil?
        Wiki.create(:project => project, :start_page => 'Wiki')
      end
    end
  end
end