Repository: buildr Updated Branches: refs/heads/master 5563e85ab -> 4bb361e2d
Prefer single quotes Project: http://git-wip-us.apache.org/repos/asf/buildr/repo Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/aaaf510c Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/aaaf510c Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/aaaf510c Branch: refs/heads/master Commit: aaaf510ce503673068e10f80f1252b0e2906e613 Parents: 5563e85 Author: Peter Donald <[email protected]> Authored: Sun Oct 26 08:37:28 2014 +1100 Committer: Peter Donald <[email protected]> Committed: Sun Oct 26 08:48:43 2014 +1100 ---------------------------------------------------------------------- lib/buildr/ide/idea.rb | 252 ++++++++++++++++++++++---------------------- 1 file changed, 126 insertions(+), 126 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/buildr/blob/aaaf510c/lib/buildr/ide/idea.rb ---------------------------------------------------------------------- diff --git a/lib/buildr/ide/idea.rb b/lib/buildr/ide/idea.rb index ea80039..d5005ce 100644 --- a/lib/buildr/ide/idea.rb +++ b/lib/buildr/ide/idea.rb @@ -21,8 +21,8 @@ module Buildr #:nodoc: # Abstract base class for IdeaModule and IdeaProject class IdeaFile - DEFAULT_SUFFIX = "" - DEFAULT_LOCAL_REPOSITORY_ENV_OVERRIDE = "MAVEN_REPOSITORY" + DEFAULT_SUFFIX = '' + DEFAULT_LOCAL_REPOSITORY_ENV_OVERRIDE = 'MAVEN_REPOSITORY' attr_reader :buildr_project attr_writer :suffix @@ -146,7 +146,7 @@ module Buildr #:nodoc: end if self.template template_doc = load_document(self.template) - REXML::XPath.each(template_doc, "//component") do |element| + REXML::XPath.each(template_doc, '//component') do |element| inject_component(doc, element) end end @@ -179,7 +179,7 @@ module Buildr #:nodoc: # IdeaModule represents an .iml file class IdeaModule < IdeaFile - DEFAULT_TYPE = "JAVA_MODULE" + DEFAULT_TYPE = 'JAVA_MODULE' attr_accessor :type attr_accessor :group @@ -199,11 +199,11 @@ module Buildr #:nodoc: end def jdk_version - @jdk_version || buildr_project.compile.options.source || "1.6" + @jdk_version || buildr_project.compile.options.source || '1.6' end def extension - "iml" + 'iml' end def main_source_directories @@ -267,7 +267,7 @@ module Buildr #:nodoc: end def add_gwt_facet(modules = {}, options = {}) - name = options[:name] || "GWT" + name = options[:name] || 'GWT' detected_gwt_version = nil if options[:gwt_dev_artifact] a = Buildr.artifact(options[:gwt_dev_artifact]) @@ -277,10 +277,10 @@ module Buildr #:nodoc: settings = { - :webFacet => "Web", - :compilerMaxHeapSize => "512", - :compilerParameters => "-draftCompile -localWorkers 2 -strict", - :gwtScriptOutputStyle => "PRETTY" + :webFacet => 'Web', + :compilerMaxHeapSize => '512', + :compilerParameters => '-draftCompile -localWorkers 2 -strict', + :gwtScriptOutputStyle => 'PRETTY' }.merge(options[:settings] || {}) buildr_project.compile.dependencies.each do |d| @@ -292,12 +292,12 @@ module Buildr #:nodoc: if detected_gwt_version settings[:gwtSdkUrl] = resolve_path(File.dirname(detected_gwt_version)) - settings[:gwtSdkType] = "maven" + settings[:gwtSdkType] = 'maven' else - settings[:gwtSdkUrl] = "file://$GWT_TOOLS$" + settings[:gwtSdkUrl] = 'file://$GWT_TOOLS$' end - add_facet(name, "gwt") do |f| + add_facet(name, 'gwt') do |f| f.configuration do |c| settings.each_pair do |k, v| c.setting :name => k.to_s, :value => v.to_s @@ -312,10 +312,10 @@ module Buildr #:nodoc: end def add_web_facet(options = {}) - name = options[:name] || "Web" + name = options[:name] || 'Web' default_webroots = {} - default_webroots[buildr_project._(:source, :main, :webapp)] = "/" if File.exist?(buildr_project._(:source, :main, :webapp)) - buildr_project.assets.paths.each {|p| default_webroots[p] = "/" } + default_webroots[buildr_project._(:source, :main, :webapp)] = '/' if File.exist?(buildr_project._(:source, :main, :webapp)) + buildr_project.assets.paths.each {|p| default_webroots[p] = '/' } webroots = options[:webroots] || default_webroots default_deployment_descriptors = [] ['web.xml', 'sun-web.xml', 'glassfish-web.xml', 'jetty-web.xml', 'geronimo-web.xml', @@ -324,14 +324,14 @@ module Buildr #:nodoc: 'ibm-web-bnd.xml', 'ibm-web-ext.xml', 'ibm-web-ext-pme.xml']. each do |descriptor| webroots.each_pair do |path, relative_url| - next unless relative_url == "/" + next unless relative_url == '/' d = "#{path}/WEB-INF/#{descriptor}" default_deployment_descriptors << d if File.exist?(d) end end deployment_descriptors = options[:deployment_descriptors] || default_deployment_descriptors - add_facet(name, "web") do |f| + add_facet(name, 'web') do |f| f.configuration do |c| c.descriptors do |d| deployment_descriptors.each do |deployment_descriptor| @@ -354,22 +354,22 @@ module Buildr #:nodoc: end def add_jruby_facet(options = {}) - name = options[:name] || "JRuby" + name = options[:name] || 'JRuby' ruby_version_file = buildr_project._('.ruby-version') default_jruby_version = File.exist?(ruby_version_file) ? "rbenv: #{IO.read(ruby_version_file).strip}" : 'jruby-1.6.7.2' jruby_version = options[:jruby_version] || default_jruby_version - add_facet(name, "JRUBY") do |f| + add_facet(name, 'JRUBY') do |f| f.configuration do |c| - c.JRUBY_FACET_CONFIG_ID :NAME => "JRUBY_SDK_NAME", :VALUE => jruby_version - c.LOAD_PATH :number => "0" - c.I18N_FOLDERS :number => "0" + c.JRUBY_FACET_CONFIG_ID :NAME => 'JRUBY_SDK_NAME', :VALUE => jruby_version + c.LOAD_PATH :number => '0' + c.I18N_FOLDERS :number => '0' end end end def add_jpa_facet(options = {}) - name = options[:name] || "JPA" + name = options[:name] || 'JPA' source_roots = [buildr_project.iml.main_source_directories, buildr_project.compile.sources, buildr_project.resources.sources].flatten.compact default_deployment_descriptors = [] @@ -399,11 +399,11 @@ module Buildr #:nodoc: end end - add_facet(name, "jpa") do |f| + add_facet(name, 'jpa') do |f| f.configuration do |c| if provider - c.setting :name => "validation-enabled", :value => validation_enabled - c.setting :name => "provider-name", :value => provider + c.setting :name => 'validation-enabled', :value => validation_enabled + c.setting :name => 'provider-name', :value => provider end c.tag!('datasource-mapping') do |ds| ds.tag!('factory-entry', :name => factory_entry) @@ -416,7 +416,7 @@ module Buildr #:nodoc: end def add_ejb_facet(options = {}) - name = options[:name] || "EJB" + name = options[:name] || 'EJB' default_ejb_roots = [buildr_project.iml.main_source_directories, buildr_project.compile.sources, buildr_project.resources.sources].flatten.compact ejb_roots = options[:ejb_roots] || default_ejb_roots @@ -435,7 +435,7 @@ module Buildr #:nodoc: end deployment_descriptors = options[:deployment_descriptors] || default_deployment_descriptors - add_facet(name, "ejb") do |facet| + add_facet(name, 'ejb') do |facet| facet.configuration do |c| c.descriptors do |d| deployment_descriptors.each do |deployment_descriptor| @@ -479,7 +479,7 @@ module Buildr #:nodoc: def base_document target = StringIO.new - Builder::XmlMarkup.new(:target => target).module(:version => "4", :relativePaths => "true", :type => self.type) + Builder::XmlMarkup.new(:target => target).module(:version => '4', :relativePaths => 'true', :type => self.type) Buildr::IntellijIdea.new_document(target.string) end @@ -495,11 +495,11 @@ module Buildr #:nodoc: end def facet_component - create_composite_component("FacetManager", {}, self.facets) + create_composite_component('FacetManager', {}, self.facets) end def module_root_component - create_component("NewModuleRootManager", "inherit-compiler-output" => "false") do |xml| + create_component('NewModuleRootManager', 'inherit-compiler-output' => 'false') do |xml| generate_compile_output(xml) generate_content(xml) unless skip_content? generate_initial_order_entries(xml) @@ -550,17 +550,17 @@ module Buildr #:nodoc: end def resolve_path(path) - resolve_path_from_base(path, "$MODULE_DIR$") + resolve_path_from_base(path, '$MODULE_DIR$') end def generate_compile_output(xml) xml.output(:url => file_path(self.main_output_dir.to_s)) - xml.tag!("output-test", :url => file_path(self.test_output_dir.to_s)) - xml.tag!("exclude-output") + xml.tag!('output-test', :url => file_path(self.test_output_dir.to_s)) + xml.tag!('exclude-output') end def generate_content(xml) - xml.content(:url => "file://$MODULE_DIR$") do + xml.content(:url => 'file://$MODULE_DIR$') do # Source folders { :main => self.main_source_directories, @@ -582,16 +582,16 @@ module Buildr #:nodoc: end def relative_dir_inside_dir?(dir) - !dir.include?("../") + !dir.include?('../') end def generate_initial_order_entries(xml) - xml.orderEntry :type => "sourceFolder", :forTests => "false" - xml.orderEntry :type => "jdk", :jdkName => jdk_version, :jdkType => "JavaSDK" + xml.orderEntry :type => 'sourceFolder', :forTests => 'false' + xml.orderEntry :type => 'jdk', :jdkName => jdk_version, :jdkType => 'JavaSDK' end def generate_project_dependency(xml, other_project, export, test = false) - attribs = {:type => 'module', "module-name" => other_project} + attribs = {:type => 'module', 'module-name' => other_project} attribs[:exported] = '' if export attribs[:scope] = 'TEST' if test xml.orderEntry attribs @@ -648,16 +648,16 @@ module Buildr #:nodoc: end def version - @version || "12" + @version || '12' end def jdk_version - @jdk_version ||= buildr_project.compile.options.source || "1.6" + @jdk_version ||= buildr_project.compile.options.source || '1.6' end def add_artifact(name, type, build_on_make = false) add_to_composite_component(self.artifacts) do |xml| - xml.artifact(:name => name, :type => type, :"build-on-make" => build_on_make) do |xml| + xml.artifact(:name => name, :type => type, 'build-on-make' => build_on_make) do |xml| yield xml if block_given? end end @@ -682,15 +682,15 @@ module Buildr #:nodoc: def add_postgres_data_source(name, options = {}) if options[:url].nil? && options[:database] - default_url = "jdbc:postgresql://#{(options[:host] || "127.0.0.1")}:#{(options[:port] || "5432")}/#{options[:database]}" + default_url = "jdbc:postgresql://#{(options[:host] || '127.0.0.1')}:#{(options[:port] || '5432')}/#{options[:database]}" end params = { :driver => 'org.postgresql.Driver', :url => default_url, - :username => ENV["USER"], + :username => ENV['USER'], :dialect => 'PostgreSQL', - :classpath => ["org.postgresql:postgresql:jar:9.2-1003-jdbc4"] + :classpath => ['org.postgresql:postgresql:jar:9.2-1003-jdbc4'] }.merge(options) add_data_source(name, params) end @@ -698,13 +698,13 @@ module Buildr #:nodoc: def add_sql_server_data_source(name, options = {}) default_url = nil if options[:url].nil? && options[:database] - default_url = "jdbc:jtds:sqlserver://#{(options[:host] || "127.0.0.1")}:#{(options[:port] || "1433")}/#{options[:database]}" + default_url = "jdbc:jtds:sqlserver://#{(options[:host] || '127.0.0.1')}:#{(options[:port] || '1433')}/#{options[:database]}" end params = { :driver => 'net.sourceforge.jtds.jdbc.Driver', :url => default_url, - :username => ENV["USER"], + :username => ENV['USER'], :dialect => 'TSQL', :classpath => ['net.sourceforge.jtds:jtds:jar:1.2.7'] }.merge(options) @@ -723,28 +723,28 @@ module Buildr #:nodoc: def add_data_source(name, options = {}) add_to_composite_component(self.data_sources) do |xml| data_source_options = { - :source => "LOCAL", + :source => 'LOCAL', :name => name, :uuid => Buildr::Util.uuid } classpath = options[:classpath] || [] - xml.tag!("data-source", data_source_options) do |xml| - xml.tag!("synchronize", (options[:synchronize]||"true")) - xml.tag!("jdbc-driver", options[:driver]) if options[:driver] - xml.tag!("jdbc-url", options[:url]) if options[:url] - xml.tag!("user-name", options[:username]) if options[:username] - xml.tag!("user-password", encrypt(options[:password])) if options[:password] - xml.tag!("schema-pattern", options[:schema_pattern]) if options[:schema_pattern] - xml.tag!("default-schemas", options[:default_schemas]) if options[:default_schemas] - xml.tag!("table-pattern", options[:table_pattern]) if options[:table_pattern] - xml.tag!("default-dialect", options[:dialect]) if options[:dialect] + xml.tag!('data-source', data_source_options) do |xml| + xml.tag!('synchronize', (options[:synchronize]||'true')) + xml.tag!('jdbc-driver', options[:driver]) if options[:driver] + xml.tag!('jdbc-url', options[:url]) if options[:url] + xml.tag!('user-name', options[:username]) if options[:username] + xml.tag!('user-password', encrypt(options[:password])) if options[:password] + xml.tag!('schema-pattern', options[:schema_pattern]) if options[:schema_pattern] + xml.tag!('default-schemas', options[:default_schemas]) if options[:default_schemas] + xml.tag!('table-pattern', options[:table_pattern]) if options[:table_pattern] + xml.tag!('default-dialect', options[:dialect]) if options[:dialect] xml.libraries do |xml| classpath.each do |classpath_element| a = Buildr.artifact(classpath_element) a.invoke xml.library do |xml| - xml.tag!("url", resolve_path(a.to_s)) + xml.tag!('url', resolve_path(a.to_s)) end end end if classpath.size > 0 @@ -756,17 +756,17 @@ module Buildr #:nodoc: artifact_name = to_artifact_name(project, options) artifacts = options[:artifacts] || [] - add_artifact(artifact_name, "exploded-war", build_on_make(options)) do |xml| + add_artifact(artifact_name, 'exploded-war', build_on_make(options)) do |xml| dependencies = (options[:dependencies] || ([project] + project.compile.dependencies)).flatten libraries, projects = partition_dependencies(dependencies) emit_output_path(xml, artifact_name, options) - xml.root :id => "root" do - xml.element :id => "directory", :name => "WEB-INF" do - xml.element :id => "directory", :name => "classes" do + xml.root :id => 'root' do + xml.element :id => 'directory', :name => 'WEB-INF' do + xml.element :id => 'directory', :name => 'classes' do artifact_content(xml, project, projects, options) end - xml.element :id => "directory", :name => "lib" do + xml.element :id => 'directory', :name => 'lib' do emit_libraries(xml, libraries) emit_jar_artifacts(xml, artifacts) end @@ -775,16 +775,16 @@ module Buildr #:nodoc: if options[:enable_war].nil? || options[:enable_war] || (options[:war_module_names] && options[:war_module_names].size > 0) module_names = options[:war_module_names] || [project.iml.id] module_names.each do |module_name| - facet_name = options[:war_facet_name] || "Web" - xml.element :id => "javaee-facet-resources", :facet => "#{module_name}/web/#{facet_name}" + facet_name = options[:war_facet_name] || 'Web' + xml.element :id => 'javaee-facet-resources', :facet => "#{module_name}/web/#{facet_name}" end end if options[:enable_gwt] || (options[:gwt_module_names] && options[:gwt_module_names].size > 0) module_names = options[:gwt_module_names] || [project.iml.id] module_names.each do |module_name| - facet_name = options[:gwt_facet_name] || "GWT" - xml.element :id => "gwt-compiler-output", :facet => "#{module_name}/gwt/#{facet_name}" + facet_name = options[:gwt_facet_name] || 'GWT' + xml.element :id => 'gwt-compiler-output', :facet => "#{module_name}/gwt/#{facet_name}" end end end @@ -794,14 +794,14 @@ module Buildr #:nodoc: def add_exploded_ear_artifact(project, options ={}) artifact_name = to_artifact_name(project, options) - add_artifact(artifact_name, "exploded-ear", build_on_make(options)) do |xml| + add_artifact(artifact_name, 'exploded-ear', build_on_make(options)) do |xml| dependencies = (options[:dependencies] || ([project] + project.compile.dependencies)).flatten libraries, projects = partition_dependencies(dependencies) emit_output_path(xml, artifact_name, options) - xml.root :id => "root" do + xml.root :id => 'root' do emit_module_output(xml, projects) - xml.element :id => "directory", :name => "lib" do + xml.element :id => 'directory', :name => 'lib' do emit_libraries(xml, libraries) end end @@ -816,9 +816,9 @@ module Buildr #:nodoc: raise "Unable to add non-project dependencies (#{libraries.inspect}) to jar artifact" if libraries.size > 0 jar_name = "#{artifact_name}.jar" - add_artifact(jar_name, "jar", build_on_make(options)) do |xml| + add_artifact(jar_name, 'jar', build_on_make(options)) do |xml| emit_output_path(xml, artifact_name, options) - xml.root(:id => "archive", :name => jar_name) do + xml.root(:id => 'archive', :name => jar_name) do artifact_content(xml, project, projects, options) end end @@ -827,13 +827,13 @@ module Buildr #:nodoc: def add_exploded_ejb_artifact(project, options = {}) artifact_name = to_artifact_name(project, options) - add_artifact(artifact_name, "exploded-ejb", build_on_make(options)) do |xml| + add_artifact(artifact_name, 'exploded-ejb', build_on_make(options)) do |xml| dependencies = (options[:dependencies] || [project]).flatten libraries, projects = partition_dependencies(dependencies) raise "Unable to add non-project dependencies (#{libraries.inspect}) to ejb artifact" if libraries.size > 0 emit_output_path(xml, artifact_name, options) - xml.root :id => "root" do + xml.root :id => 'root' do artifact_content(xml, project, projects, options) end end @@ -841,7 +841,7 @@ module Buildr #:nodoc: def add_java_configuration(project, classname, options = {}) args = options[:args] || '' - dir = options[:dir] || "file://$PROJECT_DIR$/" + dir = options[:dir] || 'file://$PROJECT_DIR$/' debug_port = options[:debug_port] || 2599 module_name = options[:module_name] || project.iml.id jvm_args = options[:jvm_args] || '' @@ -905,17 +905,17 @@ module Buildr #:nodoc: def add_gwt_configuration(launch_page, project, options = {}) name = options[:name] || "Run #{launch_page}" - shell_parameters = options[:shell_parameters] || "" - vm_parameters = options[:vm_parameters] || "-Xmx512m" + shell_parameters = options[:shell_parameters] || '' + vm_parameters = options[:vm_parameters] || '-Xmx512m' - add_configuration(name, "GWT.ConfigurationType", "GWT Configuration") do |xml| + add_configuration(name, 'GWT.ConfigurationType', 'GWT Configuration') do |xml| xml.module(:name => project.iml.id) - xml.option(:name => "RUN_PAGE", :value => launch_page) - xml.option(:name => "SHELL_PARAMETERS", :value => shell_parameters) - xml.option(:name => "VM_PARAMETERS", :value => vm_parameters) + xml.option(:name => 'RUN_PAGE', :value => launch_page) + xml.option(:name => 'SHELL_PARAMETERS', :value => shell_parameters) + xml.option(:name => 'VM_PARAMETERS', :value => vm_parameters) - xml.RunnerSettings(:RunnerId => "Run") - xml.ConfigurationWrapper(:RunnerId => "Run") + xml.RunnerSettings(:RunnerId => 'Run') + xml.ConfigurationWrapper(:RunnerId => 'Run') xml.method() end end @@ -1056,12 +1056,12 @@ module Buildr #:nodoc: end def extension - "ipr" + 'ipr' end def base_document target = StringIO.new - Builder::XmlMarkup.new(:target => target).project(:version => "4") + Builder::XmlMarkup.new(:target => target).project(:version => '4') Buildr::IntellijIdea.new_document(target.string) end @@ -1091,25 +1091,25 @@ module Buildr #:nodoc: def project_root_manager_component attribs = {} - attribs["version"] = "2" - attribs["languageLevel"] = "JDK_#{self.jdk_version.gsub('.', '_')}" - attribs["assert-keyword"] = "true" - attribs["jdk-15"] = (jdk_version >= "1.5").to_s - attribs["project-jdk-name"] = self.jdk_version - attribs["project-jdk-type"] = "JavaSDK" - create_component("ProjectRootManager", attribs) do |xml| - xml.output("url" => file_path(buildr_project._(:target, :idea, :project_out))) + attribs['version'] = '2' + attribs['languageLevel'] = "JDK_#{self.jdk_version.gsub('.', '_')}" + attribs['assert-keyword'] = 'true' + attribs['jdk-15'] = (jdk_version >= '1.5').to_s + attribs['project-jdk-name'] = self.jdk_version + attribs['project-jdk-type'] = 'JavaSDK' + create_component('ProjectRootManager', attribs) do |xml| + xml.output('url' => file_path(buildr_project._(:target, :idea, :project_out))) end end def project_details_component - create_component("ProjectDetails") do |xml| - xml.option("name" => "projectName", "value" => self.name) + create_component('ProjectDetails') do |xml| + xml.option('name' => 'projectName', 'value' => self.name) end end def modules_component - create_component("ProjectModuleManager") do |xml| + create_component('ProjectModuleManager') do |xml| xml.modules do buildr_project.projects.select { |subp| subp.iml? }.each do |subproject| module_path = subproject.base_dir.gsub(/^#{buildr_project.base_dir}\//, '') @@ -1146,15 +1146,15 @@ module Buildr #:nodoc: project_directories.each do |dir| if File.directory?("#{dir}/.git") - mappings[dir] = "Git" + mappings[dir] = 'Git' elsif File.directory?("#{dir}/.svn") - mappings[dir] = "svn" + mappings[dir] = 'svn' end end return nil if 0 == mappings.size - create_component("VcsDirectoryMappings") do |xml| + create_component('VcsDirectoryMappings') do |xml| mappings.each_pair do |dir, vcs_type| resolved_dir = resolve_path(dir) mapped_dir = resolved_dir == '$PROJECT_DIR$/.' ? buildr_project.base_dir : resolved_dir @@ -1164,19 +1164,19 @@ module Buildr #:nodoc: end def data_sources_component - create_composite_component("DataSourceManagerImpl", {:format => "xml", :hash => "3208837817"}, self.data_sources) + create_composite_component('DataSourceManagerImpl', {:format => 'xml', :hash => '3208837817'}, self.data_sources) end def artifacts_component - create_composite_component("ArtifactManager", {}, self.artifacts) + create_composite_component('ArtifactManager', {}, self.artifacts) end def configurations_component - create_composite_component("ProjectRunConfigurationManager", {}, self.configurations) + create_composite_component('ProjectRunConfigurationManager', {}, self.configurations) end def resolve_path(path) - resolve_path_from_base(path, "$PROJECT_DIR$") + resolve_path_from_base(path, '$PROJECT_DIR$') end private @@ -1191,19 +1191,19 @@ module Buildr #:nodoc: def emit_jar_artifacts(xml, artifacts) artifacts.each do |p| - xml.element :id => "artifact", 'artifact-name' => "#{p}.jar" + xml.element :id => 'artifact', 'artifact-name' => "#{p}.jar" end end def emit_libraries(xml, libraries) libraries.each(&:invoke).map(&:to_s).each do |dependency_path| - xml.element :id => "file-copy", :path => resolve_path(dependency_path) + xml.element :id => 'file-copy', :path => resolve_path(dependency_path) end end def emit_module_output(xml, projects) projects.each do |p| - xml.element :id => "module-output", :name => p.iml.id + xml.element :id => 'module-output', :name => p.iml.id end end @@ -1217,8 +1217,8 @@ module Buildr #:nodoc: if options[:enable_ejb] || (options[:ejb_module_names] && options[:ejb_module_names].size > 0) module_names = options[:ejb_module_names] || [project.iml.id] module_names.each do |module_name| - facet_name = options[:ejb_facet_name] || "EJB" - xml.element :id => "javaee-facet-resources", :facet => "#{module_name}/ejb/#{facet_name}" + facet_name = options[:ejb_facet_name] || 'EJB' + xml.element :id => 'javaee-facet-resources', :facet => "#{module_name}/ejb/#{facet_name}" end end end @@ -1227,14 +1227,14 @@ module Buildr #:nodoc: if options[:enable_jpa] || (options[:jpa_module_names] && options[:jpa_module_names].size > 0) module_names = options[:jpa_module_names] || [project.iml.id] module_names.each do |module_name| - facet_name = options[:jpa_facet_name] || "JPA" - xml.element :id => "jpa-descriptors", :facet => "#{module_name}/jpa/#{facet_name}" + facet_name = options[:jpa_facet_name] || 'JPA' + xml.element :id => 'jpa-descriptors', :facet => "#{module_name}/jpa/#{facet_name}" end end end def encrypt(password) - password.bytes.inject("") { |x, y| x + (y ^ 0xdfaa).to_s(16) } + password.bytes.inject('') { |x, y| x + (y ^ 0xdfaa).to_s(16) } end def partition_dependencies(dependencies) @@ -1244,7 +1244,7 @@ module Buildr #:nodoc: dependencies.each do |dependency| artifacts = Buildr.artifacts(dependency) artifacts_as_strings = artifacts.map(&:to_s) - all_projects = Buildr::Project.instance_variable_get("@projects").keys + all_projects = Buildr::Project.instance_variable_get('@projects').keys project = Buildr.projects(all_projects).detect do |project| [project.packages, project.compile.target, project.resources.target, project.test.compile.target, project.test.resources.target].flatten. detect { |component| artifacts_as_strings.include?(component.to_s) } @@ -1263,20 +1263,20 @@ module Buildr #:nodoc: include Extension first_time do - desc "Generate Intellij IDEA artifacts for all projects" - Project.local_task "idea" => "artifacts" + desc 'Generate Intellij IDEA artifacts for all projects' + Project.local_task 'idea' => 'artifacts' - desc "Delete the generated Intellij IDEA artifacts" - Project.local_task "idea:clean" + desc 'Delete the generated Intellij IDEA artifacts' + Project.local_task 'idea:clean' end before_define do |project| - project.recursive_task("idea") - project.recursive_task("idea:clean") + project.recursive_task('idea') + project.recursive_task('idea:clean') end after_define do |project| - idea = project.task("idea") + idea = project.task('idea') files = [ (project.iml if project.iml?), @@ -1288,10 +1288,10 @@ module Buildr #:nodoc: idea.enhance do |task| mkdir_p module_dir info "Writing #{ideafile.filename}" - t = Tempfile.open("buildr-idea") + t = Tempfile.open('buildr-idea') temp_filename = t.path t.close! - File.open(temp_filename, "w") do |f| + File.open(temp_filename, 'w') do |f| ideafile.write f end mv temp_filename, ideafile.filename @@ -1302,7 +1302,7 @@ module Buildr #:nodoc: end end - project.task("idea:clean") do + project.task('idea:clean') do files.each do |f| info "Removing #{f.filename}" if File.exist?(f.filename) rm_rf f.filename @@ -1314,7 +1314,7 @@ module Buildr #:nodoc: if ipr? @ipr ||= IdeaProject.new(self) else - raise "Only the root project has an IPR" + raise 'Only the root project has an IPR' end end
