Top Level Namespace

Defined Under Namespace

Modules: Opener

Instance Method Summary collapse

Instance Method Details

#cleanObject

These Rake tasks require the following constants to be predefined:

  • TMP_DIRECTORY: path to the local tmp/ directory


7
8
9
10
11
12
13
14
15
16
17
# File 'lib/opener/build-tools/tasks/clean.rb', line 7

namespace :clean do
  desc 'Removes tmp files'
  task :tmp do
    sh("rm -f #{File.join(TMP_DIRECTORY, '*.*')}")
  end

  desc 'Removes all built Gem files'
  task :gems do
    sh('rm -f pkg/*.gem')
  end
end

#javaObject

The Java Rake tasks require the following constant to be defined:

  • CORE_DIRECTORY: path containing the Java source code.


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/opener/build-tools/tasks/java.rb', line 7

namespace :java do
  desc 'Installs Java packages in core/'
  task :compile do
    Dir.chdir(CORE_DIRECTORY) do
      sh "mvn package"
    end
  end

  namespace :clean do
    desc 'Removes built Java packages'
    task :packages do
      Dir.chdir(CORE_DIRECTORY) do
        sh 'mvn clean'
      end
    end
  end
end

#pythonObject

The Python Rake tasks require the following constants to be defined:

  • PRE_BUILD_REQUIREMENTS: pip requirements to be installed before building the Gem.
  • PRE_INSTALL_REQUIREMENTS: pip requirements to be installed upon Gem installation.
  • PYTHON_SITE_PACKAGES: path to the local site-packages directory, only used by the python_packages task.


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
42
43
44
45
# File 'lib/opener/build-tools/tasks/python.rb', line 12

namespace :python do
  desc 'Installs Python packages in core/site-packages'
  task :compile => :requirements do
    requirements = {
      PRE_BUILD_REQUIREMENTS   => 'pre_build',
      PRE_INSTALL_REQUIREMENTS => 'pre_install'
    }

    requirements.each do |file, directory|
      path = File.join(PYTHON_SITE_PACKAGES, directory)

      if File.file?(file)
        Opener::BuildTools::Python.install_python_packages(file, path)
      end
    end
  end

  namespace :clean do
    desc 'Removes built Python packages'
    task :packages do
      each_file(PYTHON_SITE_PACKAGES) do |group|
        each_file(group) do |directory|
          sh("rm -rf #{directory}")
        end
      end
    end

    desc 'Removes Python bytecode files'
    task :bytecode do
      sh('find . -name "*.pyc" -delete')
      sh('find . -name "*.pyo" -delete')
    end
  end
end