Class: Autobuild::Ruby
- Inherits:
-
ImporterPackage
- Object
- Package
- ImporterPackage
- Autobuild::Ruby
- Defined in:
- lib/autobuild/packages/ruby.rb
Overview
Handling of “standard” Ruby packages
The package is expected to follow the general standards laid down by the bundler guys (i.e. look like a package generated by ‘bundler gem`)
Instance Attribute Summary collapse
-
#rake_clean_task ⇒ Object
The Rake task that is used to run cleanup.
-
#rake_doc_task ⇒ Object
The Rake task that is used to generate documentation.
-
#rake_setup_task ⇒ Object
The Rake task that is used to set up the package.
-
#rake_test_options ⇒ Object
Options that should be passed to the rake task.
-
#rake_test_task ⇒ Object
The Rake task that is used to run tests.
Attributes inherited from ImporterPackage
Attributes inherited from Package
#dependencies, #env, #failures, #importdir, #importer, #logdir, #name, #prefix, #srcdir, #statistics, #update, #updated, #utilities
Instance Method Summary collapse
-
#initialize(*args) ⇒ Ruby
constructor
A new instance of Ruby.
- #install ⇒ Object
- #invoke_rake(setup_task = rake_setup_task) ⇒ Object
-
#prepare_for_forced_build ⇒ Object
:nodoc:.
-
#prepare_for_rebuild ⇒ Object
:nodoc:.
- #update_environment ⇒ Object
- #with_doc ⇒ Object
- #with_tests ⇒ Object
Methods inherited from ImporterPackage
Methods inherited from Package
[], #add_env_op, #add_stat, #all_dependencies, #applied_post_install?, #apply_env, #apply_post_install, #checked_out?, clear, #depends_on, #depends_on?, #disable, #disable_doc, #disable_phases, #disabled?, #doc_dir, #doc_dir=, #doc_disabled, #doc_target_dir, #doc_target_dir=, #doc_task, each, #enable_doc, #env_add, #env_add_path, #env_add_prefix, #env_set, #env_source_after, #error, #failed?, #file, #find_in_path, #fingerprint, #full_env, #generates_doc?, #has_doc?, #import, #import=, #import_invoked?, #imported?, #in_dir, #inspect, #install_doc, #install_invoked?, #installed?, #installstamp, #isolate_errors, #message, #method_missing, #parallel_build_level, #parallel_build_level=, #post_install, #prepare, #process_formatting_string, #progress, #progress_done, #progress_start, #provides, #resolve_dependency_env, #resolved_env, #respond_to_missing?, #run, #self_fingerprint, #source_tree, #task, #to_s, #update?, #updated?, #utility, #warn, #working_directory
Constructor Details
#initialize(*args) ⇒ Ruby
Returns a new instance of Ruby.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/autobuild/packages/ruby.rb', line 22 def initialize(*args) self.rake_setup_task = "default" self.rake_doc_task = "redocs" self.rake_clean_task = "clean" self.rake_test_task = "test" self. = [] super exclude << /\.so$/ exclude << /Makefile$/ exclude << /mkmf.log$/ exclude << /\.o$/ exclude << /doc$/ end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Autobuild::Package
Instance Attribute Details
#rake_clean_task ⇒ Object
The Rake task that is used to run cleanup. Defaults to “clean”. Set to nil to disable tests for this package
20 21 22 |
# File 'lib/autobuild/packages/ruby.rb', line 20 def rake_clean_task @rake_clean_task end |
#rake_doc_task ⇒ Object
The Rake task that is used to generate documentation. Defaults to “doc”. Set to nil to disable documentation generation
12 13 14 |
# File 'lib/autobuild/packages/ruby.rb', line 12 def rake_doc_task @rake_doc_task end |
#rake_setup_task ⇒ Object
The Rake task that is used to set up the package. Defaults to “default”. Set to nil to disable setup altogether
9 10 11 |
# File 'lib/autobuild/packages/ruby.rb', line 9 def rake_setup_task @rake_setup_task end |
#rake_test_options ⇒ Object
Options that should be passed to the rake task
17 18 19 |
# File 'lib/autobuild/packages/ruby.rb', line 17 def @rake_test_options end |
#rake_test_task ⇒ Object
The Rake task that is used to run tests. Defaults to “test”. Set to nil to disable tests for this package
15 16 17 |
# File 'lib/autobuild/packages/ruby.rb', line 15 def rake_test_task @rake_test_task end |
Instance Method Details
#install ⇒ Object
70 71 72 73 74 75 76 |
# File 'lib/autobuild/packages/ruby.rb', line 70 def install progress_start "setting up Ruby package %s", done_message: 'set up Ruby package %s' do invoke_rake end super end |
#invoke_rake(setup_task = rake_setup_task) ⇒ Object
61 62 63 64 65 66 67 68 |
# File 'lib/autobuild/packages/ruby.rb', line 61 def invoke_rake(setup_task = rake_setup_task) if setup_task && File.file?(File.join(srcdir, 'Rakefile')) run 'post-install', Autobuild.tool_in_path('ruby'), '-S', Autobuild.tool('rake'), setup_task, working_directory: srcdir end end |
#prepare_for_forced_build ⇒ Object
:nodoc:
78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/autobuild/packages/ruby.rb', line 78 def prepare_for_forced_build # :nodoc: super %w[ext tmp].each do |extdir| if File.directory?(extdir) Find.find(extdir) do |file| next if file !~ /<Makefile>|<CMakeCache.txt>$/ FileUtils.rm_rf file end end end end |
#prepare_for_rebuild ⇒ Object
:nodoc:
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/autobuild/packages/ruby.rb', line 91 def prepare_for_rebuild # :nodoc: super if rake_clean_task && File.file?(File.join(srcdir, 'Rakefile')) begin run 'clean', Autobuild.tool_in_path('ruby'), '-S', Autobuild.tool('rake'), rake_clean_task, working_directory: srcdir rescue Autobuild::SubcommandFailed => e warn "%s: clean failed. If this package does not need a clean target," warn "%s: set pkg.rake_clean_task = nil in the package definition." warn "%s: see #{e.logfile} for more details" end end end |
#update_environment ⇒ Object
107 108 109 110 111 |
# File 'lib/autobuild/packages/ruby.rb', line 107 def update_environment env_add_prefix srcdir libdir = File.join(srcdir, 'lib') env_add_path 'RUBYLIB', libdir if File.directory?(libdir) end |
#with_doc ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/autobuild/packages/ruby.rb', line 37 def with_doc doc_task do progress_start "generating documentation for %s", done_message: 'generated documentation for %s' do run 'doc', Autobuild.tool_in_path('ruby'), '-S', Autobuild.tool('rake'), rake_doc_task, working_directory: srcdir end end end |
#with_tests ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/autobuild/packages/ruby.rb', line 49 def with_tests test_utility.task do progress_start "running tests for %s", done_message: 'tests passed for %s' do run 'test', Autobuild.tool_in_path('ruby'), '-S', Autobuild.tool('rake'), rake_test_task, *, working_directory: srcdir end end end |