Class: Omnibus::Generator
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Omnibus::Generator
- Includes:
- Thor::Actions
- Defined in:
- lib/omnibus/generator.rb
Class Method Summary collapse
-
.source_root ⇒ Object
Set the source root for Thor.
Instance Method Summary collapse
- #create_appx_assets ⇒ Object
- #create_bff_assets ⇒ Object
- #create_deb_assets ⇒ Object
- #create_dmg_assets ⇒ Object
- #create_example_software_definitions ⇒ Object
- #create_kitchen_files ⇒ Object
- #create_msi_assets ⇒ Object
- #create_package_scripts ⇒ Object
- #create_pkg_assets ⇒ Object
- #create_project_definition ⇒ Object
- #create_project_files ⇒ Object
- #create_rpm_assets ⇒ Object
Class Method Details
.source_root ⇒ Object
Set the source root for Thor
75 76 77 |
# File 'lib/omnibus/generator.rb', line 75 def source_root File.("generator_files", __dir__) end |
Instance Method Details
#create_appx_assets ⇒ Object
112 113 114 115 116 117 |
# File 'lib/omnibus/generator.rb', line 112 def create_appx_assets return unless [:appx_assets] copy_file(resource_path("appx/AppxManifest.xml.erb"), "#{target}/resources/#{name}/appx/AppxManifest.xml.erb") copy_file(resource_path("appx/assets/clear.png"), "#{target}/resources/#{name}/appx/assets/clear.png") end |
#create_bff_assets ⇒ Object
119 120 121 122 123 |
# File 'lib/omnibus/generator.rb', line 119 def create_bff_assets return unless [:bff_assets] copy_file(resource_path("bff/gen.template.erb"), "#{target}/resources/#{name}/bff/gen.template.erb") end |
#create_deb_assets ⇒ Object
125 126 127 128 129 130 131 |
# File 'lib/omnibus/generator.rb', line 125 def create_deb_assets return unless [:deb_assets] copy_file(resource_path("deb/conffiles.erb"), "#{target}/resources/#{name}/deb/conffiles.erb") copy_file(resource_path("deb/control.erb"), "#{target}/resources/#{name}/deb/control.erb") copy_file(resource_path("deb/md5sums.erb"), "#{target}/resources/#{name}/deb/md5sums.erb") end |
#create_dmg_assets ⇒ Object
133 134 135 136 137 138 |
# File 'lib/omnibus/generator.rb', line 133 def create_dmg_assets return unless [:dmg_assets] copy_file(resource_path("dmg/background.png"), "#{target}/resources/#{name}/dmg/background.png") copy_file(resource_path("dmg/icon.png"), "#{target}/resources/#{name}/dmg/icon.png") end |
#create_example_software_definitions ⇒ Object
91 92 93 94 |
# File 'lib/omnibus/generator.rb', line 91 def create_example_software_definitions template("config/software/zlib.rb.erb", "#{target}/config/software/#{name}-zlib.rb", ) template("config/software/preparation.rb.erb", "#{target}/config/software/preparation.rb", ) end |
#create_kitchen_files ⇒ Object
96 97 98 99 100 |
# File 'lib/omnibus/generator.rb', line 96 def create_kitchen_files template(".kitchen.local.yml.erb", "#{target}/.kitchen.local.yml", ) template(".kitchen.yml.erb", "#{target}/.kitchen.yml", ) template("Berksfile.erb", "#{target}/Berksfile", ) end |
#create_msi_assets ⇒ Object
140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/omnibus/generator.rb', line 140 def create_msi_assets return unless [:msi_assets] copy_file(resource_path("msi/localization-en-us.wxl.erb"), "#{target}/resources/#{name}/msi/localization-en-us.wxl.erb") copy_file(resource_path("msi/parameters.wxi.erb"), "#{target}/resources/#{name}/msi/parameters.wxi.erb") copy_file(resource_path("msi/source.wxs.erb"), "#{target}/resources/#{name}/msi/source.wxs.erb") copy_file(resource_path("msi/assets/LICENSE.rtf"), "#{target}/resources/#{name}/msi/assets/LICENSE.rtf") copy_file(resource_path("msi/assets/banner_background.bmp"), "#{target}/resources/#{name}/msi/assets/banner_background.bmp") copy_file(resource_path("msi/assets/dialog_background.bmp"), "#{target}/resources/#{name}/msi/assets/dialog_background.bmp") copy_file(resource_path("msi/assets/project.ico"), "#{target}/resources/#{name}/msi/assets/project.ico") copy_file(resource_path("msi/assets/project_16x16.ico"), "#{target}/resources/#{name}/msi/assets/project_16x16.ico") copy_file(resource_path("msi/assets/project_32x32.ico"), "#{target}/resources/#{name}/msi/assets/project_32x32.ico") end |
#create_package_scripts ⇒ Object
102 103 104 105 106 107 108 109 110 |
# File 'lib/omnibus/generator.rb', line 102 def create_package_scripts %w{preinst prerm postinst postrm}.each do |package_script| script_path = "#{target}/package-scripts/#{name}/#{package_script}" template("package_scripts/#{package_script}.erb", script_path, ) # Ensure the package script is executable chmod(script_path, 0755) end end |
#create_pkg_assets ⇒ Object
155 156 157 158 159 160 161 162 |
# File 'lib/omnibus/generator.rb', line 155 def create_pkg_assets return unless [:pkg_assets] copy_file(resource_path("pkg/background.png"), "#{target}/resources/#{name}/pkg/background.png") copy_file(resource_path("pkg/license.html.erb"), "#{target}/resources/#{name}/pkg/license.html.erb") copy_file(resource_path("pkg/welcome.html.erb"), "#{target}/resources/#{name}/pkg/welcome.html.erb") copy_file(resource_path("pkg/distribution.xml.erb"), "#{target}/resources/#{name}/pkg/distribution.xml.erb") end |
#create_project_definition ⇒ Object
87 88 89 |
# File 'lib/omnibus/generator.rb', line 87 def create_project_definition template("config/projects/project.rb.erb", "#{target}/config/projects/#{name}.rb", ) end |
#create_project_files ⇒ Object
80 81 82 83 84 85 |
# File 'lib/omnibus/generator.rb', line 80 def create_project_files template("Gemfile.erb", "#{target}/Gemfile", ) template("gitignore.erb", "#{target}/.gitignore", ) template("README.md.erb", "#{target}/README.md", ) template("omnibus.rb.erb", "#{target}/omnibus.rb", ) end |
#create_rpm_assets ⇒ Object
164 165 166 167 168 169 170 |
# File 'lib/omnibus/generator.rb', line 164 def create_rpm_assets return unless [:rpm_assets] copy_file(resource_path("rpm/rpmmacros.erb"), "#{target}/resources/#{name}/rpm/rpmmacros.erb") copy_file(resource_path("rpm/signing.erb"), "#{target}/resources/#{name}/rpm/signing.erb") copy_file(resource_path("rpm/spec.erb"), "#{target}/resources/#{name}/rpm/spec.erb") end |