Class: Buildr::IntellijIdea::IdeaProject
- Defined in:
- lib/buildr/ide/idea.rb
Overview
IdeaModule represents an .ipr file
Constant Summary
Constants inherited from IdeaFile
Buildr::IntellijIdea::IdeaFile::DEFAULT_LOCAL_REPOSITORY_ENV_OVERRIDE, Buildr::IntellijIdea::IdeaFile::DEFAULT_PREFIX, Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX
Instance Attribute Summary collapse
-
#artifacts ⇒ Object
Returns the value of attribute artifacts.
-
#configurations ⇒ Object
Returns the value of attribute configurations.
-
#data_sources ⇒ Object
Returns the value of attribute data_sources.
-
#extra_modules ⇒ Object
Returns the value of attribute extra_modules.
- #jdk_version ⇒ Object
-
#nonnull_assertions ⇒ Object
writeonly
Sets the attribute nonnull_assertions.
- #version ⇒ Object
Attributes inherited from IdeaFile
#buildr_project, #id, #local_repository_env_override, #prefix, #suffix, #template
Instance Method Summary collapse
- #add_artifact(name, type, build_on_make = false) ⇒ Object
- #add_code_insight_settings(options = {}) ⇒ Object
- #add_configuration(name, type, factory_name = nil, default = false, options = {}) ⇒ Object
- #add_data_source(name, options = {}) ⇒ Object
- #add_default_configuration(type, factory_name) ⇒ Object
- #add_default_testng_configuration(options = {}) ⇒ Object
- #add_exploded_ear_artifact(project, options = {}) ⇒ Object
- #add_exploded_ejb_artifact(project, options = {}) ⇒ Object
- #add_exploded_war_artifact(project, options = {}) ⇒ Object
- #add_glassfish_configuration(project, options = {}) ⇒ Object
- #add_glassfish_remote_configuration(project, options = {}) ⇒ Object
- #add_gwt_configuration(project, options = {}) ⇒ Object
- #add_jar_artifact(project, options = {}) ⇒ Object
- #add_java_configuration(project, classname, options = {}) ⇒ Object
- #add_javac_settings(javac_args) ⇒ Object
- #add_less_compiler_component(project, options = {}) ⇒ Object
- #add_nullable_manager ⇒ Object
- #add_postgres_data_source(name, options = {}) ⇒ Object
- #add_ruby_script_configuration(project, script, options = {}) ⇒ Object
- #add_sql_server_data_source(name, options = {}) ⇒ Object
- #add_testng_configuration(name, options = {}) ⇒ Object
- #add_war_artifact(project, options = {}) ⇒ Object
- #compiler_configuration_options ⇒ Object
-
#initialize(buildr_project) ⇒ IdeaProject
constructor
A new instance of IdeaProject.
- #mssql_dialect_mapping ⇒ Object
- #nonnull_assertions? ⇒ Boolean
- #postgres_dialect_mapping ⇒ Object
- #sql_dialect_mappings(mappings) ⇒ Object
- #wildcard_resource_patterns ⇒ Object
Methods inherited from IdeaFile
#add_component, #add_component_from_artifact, #add_component_from_file, #add_component_in_lambda, #filename, #name, #write
Constructor Details
#initialize(buildr_project) ⇒ IdeaProject
Returns a new instance of IdeaProject.
711 712 713 714 715 716 717 718 |
# File 'lib/buildr/ide/idea.rb', line 711 def initialize(buildr_project) super() @buildr_project = buildr_project @extra_modules = [] @artifacts = [] @data_sources = [] @configurations = [] end |
Instance Attribute Details
#artifacts ⇒ Object
Returns the value of attribute artifacts.
705 706 707 |
# File 'lib/buildr/ide/idea.rb', line 705 def artifacts @artifacts end |
#configurations ⇒ Object
Returns the value of attribute configurations.
707 708 709 |
# File 'lib/buildr/ide/idea.rb', line 707 def configurations @configurations end |
#data_sources ⇒ Object
Returns the value of attribute data_sources.
706 707 708 |
# File 'lib/buildr/ide/idea.rb', line 706 def data_sources @data_sources end |
#extra_modules ⇒ Object
Returns the value of attribute extra_modules.
704 705 706 |
# File 'lib/buildr/ide/idea.rb', line 704 def extra_modules @extra_modules end |
#jdk_version ⇒ Object
724 725 726 |
# File 'lib/buildr/ide/idea.rb', line 724 def jdk_version @jdk_version ||= buildr_project.compile..source || '1.7' end |
#nonnull_assertions=(value) ⇒ Object (writeonly)
Sets the attribute nonnull_assertions
736 737 738 |
# File 'lib/buildr/ide/idea.rb', line 736 def nonnull_assertions=(value) @nonnull_assertions = value end |
#version ⇒ Object
720 721 722 |
# File 'lib/buildr/ide/idea.rb', line 720 def version @version || '13' end |
Instance Method Details
#add_artifact(name, type, build_on_make = false) ⇒ Object
742 743 744 745 746 747 748 |
# File 'lib/buildr/ide/idea.rb', line 742 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| yield xml if block_given? end end end |
#add_code_insight_settings(options = {}) ⇒ Object
832 833 834 835 836 837 838 839 840 841 842 |
# File 'lib/buildr/ide/idea.rb', line 832 def add_code_insight_settings( = {}) excluded_names = [:excluded_names] || default_code_sight_excludes excluded_names += ([:extra_excluded_names] || []) add_component('JavaProjectCodeInsightSettings') do |xml| xml.tag!('excluded-names') do excluded_names.each do |excluded_name| xml << "<name>#{excluded_name}</name>" end end end end |
#add_configuration(name, type, factory_name = nil, default = false, options = {}) ⇒ Object
750 751 752 753 754 755 756 757 758 759 760 761 |
# File 'lib/buildr/ide/idea.rb', line 750 def add_configuration(name, type, factory_name = nil, default = false, = {}) add_to_composite_component(self.configurations) do |xml| params = .dup params[:type] = type params[:factoryName] = factory_name if factory_name params[:name] = name unless default params[:default] = !!default xml.configuration(params) do yield xml if block_given? end end end |
#add_data_source(name, options = {}) ⇒ Object
899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 |
# File 'lib/buildr/ide/idea.rb', line 899 def add_data_source(name, = {}) add_to_composite_component(self.data_sources) do |xml| = { :source => 'LOCAL', :name => name, :uuid => SecureRandom.uuid } classpath = [:classpath] || [] xml.tag!('data-source', ) do |xml| xml.tag!('synchronize', ([:synchronize] || 'true')) xml.tag!('jdbc-driver', [:driver]) if [:driver] xml.tag!('jdbc-url', [:url]) if [:url] xml.tag!('user-name', [:username]) if [:username] xml.tag!('user-password', encrypt([:password])) if [:password] xml.tag!('schema-pattern', [:schema_pattern]) if [:schema_pattern] xml.tag!('default-schemas', [:default_schemas]) if [:default_schemas] xml.tag!('table-pattern', [:table_pattern]) if [:table_pattern] xml.tag!('default-dialect', [:dialect]) if [: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)) end end end if classpath.size > 0 end end end |
#add_default_configuration(type, factory_name) ⇒ Object
763 764 765 766 767 |
# File 'lib/buildr/ide/idea.rb', line 763 def add_default_configuration(type, factory_name) add_configuration(nil, type, factory_name, true) do |xml| yield xml if block_given? end end |
#add_default_testng_configuration(options = {}) ⇒ Object
1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 |
# File 'lib/buildr/ide/idea.rb', line 1357 def add_default_testng_configuration( = {}) jvm_args = [:jvm_args] || '-ea' dir = [:dir] || '$PROJECT_DIR$' add_default_configuration('TestNG', 'TestNG') do |xml| xml.extension(:name => 'coverage', :enabled => 'false', :merge => 'false', :sample_coverage => 'true', :runner => 'idea') xml.module(:name => '') xml.option(:name => 'ALTERNATIVE_JRE_PATH_ENABLED', :value => 'false') xml.option(:name => 'ALTERNATIVE_JRE_PATH') xml.option(:name => 'SUITE_NAME') xml.option(:name => 'PACKAGE_NAME') xml.option(:name => 'MAIN_CLASS_NAME') xml.option(:name => 'METHOD_NAME') xml.option(:name => 'GROUP_NAME') xml.option(:name => 'TEST_OBJECT', :value => 'CLASS') xml.option(:name => 'VM_PARAMETERS', :value => jvm_args) xml.option(:name => 'PARAMETERS') xml.option(:name => 'WORKING_DIRECTORY', :value => dir) xml.option(:name => 'OUTPUT_DIRECTORY') xml.option(:name => 'ANNOTATION_TYPE') xml.option(:name => 'ENV_VARIABLES') xml.option(:name => 'PASS_PARENT_ENVS', :value => 'true') xml.option(:name => 'TEST_SEARCH_SCOPE') do |opt| opt.value(:defaultName => 'moduleWithDependencies') end xml.option(:name => 'USE_DEFAULT_REPORTERS', :value => 'false') xml.option(:name => 'PROPERTIES_FILE') xml.envs xml.properties xml.listeners xml.method end end |
#add_exploded_ear_artifact(project, options = {}) ⇒ Object
1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 |
# File 'lib/buildr/ide/idea.rb', line 1009 def add_exploded_ear_artifact(project, = {}) artifact_name = to_artifact_name(project, ) add_artifact(artifact_name, 'exploded-ear', build_on_make()) do |xml| dependencies = ([:dependencies] || ([project] + project.compile.dependencies)).flatten libraries, projects = partition_dependencies(dependencies) emit_output_path(xml, artifact_name, ) xml.root :id => 'root' do emit_module_output(xml, projects) xml.element :id => 'directory', :name => 'lib' do emit_libraries(xml, libraries) end end end end |
#add_exploded_ejb_artifact(project, options = {}) ⇒ Object
1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 |
# File 'lib/buildr/ide/idea.rb', line 1042 def add_exploded_ejb_artifact(project, = {}) artifact_name = to_artifact_name(project, ) add_artifact(artifact_name, 'exploded-ejb', build_on_make()) do |xml| dependencies = ([: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, ) xml.root :id => 'root' do artifact_content(xml, project, projects, ) end end end |
#add_exploded_war_artifact(project, options = {}) ⇒ Object
970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 |
# File 'lib/buildr/ide/idea.rb', line 970 def add_exploded_war_artifact(project, = {}) artifact_name = to_artifact_name(project, ) artifacts = [:artifacts] || [] add_artifact(artifact_name, 'exploded-war', build_on_make()) do |xml| dependencies = ([:dependencies] || ([project] + project.compile.dependencies)).flatten libraries, projects = partition_dependencies(dependencies) emit_output_path(xml, artifact_name, ) 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, ) end xml.element :id => 'directory', :name => 'lib' do emit_libraries(xml, libraries) emit_jar_artifacts(xml, artifacts) end end if [:enable_war].nil? || [:enable_war] || ([:war_module_names] && [:war_module_names].size > 0) module_names = [:war_module_names] || [project.iml.name] module_names.each do |module_name| facet_name = [:war_facet_name] || 'Web' xml.element :id => 'javaee-facet-resources', :facet => "#{module_name}/web/#{facet_name}" end end if [:enable_gwt] || ([:gwt_module_names] && [:gwt_module_names].size > 0) module_names = [:gwt_module_names] || [project.iml.name] module_names.each do |module_name| facet_name = [:gwt_facet_name] || 'GWT' xml.element :id => 'gwt-compiler-output', :facet => "#{module_name}/gwt/#{facet_name}" end end end end end |
#add_glassfish_configuration(project, options = {}) ⇒ Object
1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 |
# File 'lib/buildr/ide/idea.rb', line 1158 def add_glassfish_configuration(project, = {}) version = [:version] || '4.1.0' server_name = [:server_name] || "GlassFish #{version}" configuration_name = [:configuration_name] || server_name domain_name = [:domain] || project.iml.id domain_port = [:port] || '9009' packaged = [:packaged] || {} exploded = [:exploded] || {} artifacts = [:artifacts] || {} add_to_composite_component(self.configurations) do |xml| xml.configuration(:name => configuration_name, :type => 'GlassfishConfiguration', :factoryName => 'Local', :default => false, :APPLICATION_SERVER_NAME => server_name) do |xml| xml.option(:name => 'OPEN_IN_BROWSER', :value => 'false') xml.option(:name => 'UPDATING_POLICY', :value => 'restart-server') xml.deployment do |deployment| packaged.each do |name, deployable| artifact = Buildr.artifact(deployable) artifact.invoke deployment.file(:path => resolve_path(artifact.to_s)) do |file| file.settings do |settings| settings.option(:name => 'contextRoot', :value => "/#{name}") settings.option(:name => 'defaultContextRoot', :value => 'false') end end end exploded.each do |deployable_name, context_root| deployment.artifact(:name => deployable_name) do |file| file.settings do |settings| settings.option(:name => 'contextRoot', :value => "/#{context_root}") settings.option(:name => 'defaultContextRoot', :value => 'false') end end end artifacts.each do |deployable_name, context_root| deployment.artifact(:name => deployable_name) do |file| file.settings do |settings| settings.option(:name => 'contextRoot', :value => "/#{context_root}") settings.option(:name => 'defaultContextRoot', :value => 'false') end end end end xml.tag! 'server-settings' do |server_settings| server_settings.option(:name => 'VIRTUAL_SERVER') server_settings.option(:name => 'DOMAIN', :value => domain_name.to_s) server_settings.option(:name => 'PRESERVE', :value => 'false') server_settings.option(:name => 'USERNAME', :value => 'admin') server_settings.option(:name => 'PASSWORD', :value => '') end xml.predefined_log_file(:id => 'GlassFish', :enabled => 'true') xml.extension(:name => 'coverage', :enabled => 'false', :merge => 'false', :sample_coverage => 'true', :runner => 'idea') xml.RunnerSettings(:RunnerId => 'Cover') add_glassfish_runner_settings(xml, 'Cover') add_glassfish_configuration_wrapper(xml, 'Cover') add_glassfish_runner_settings(xml, 'Debug', { :DEBUG_PORT => domain_port.to_s, :TRANSPORT => '0', :LOCAL => 'true', }) add_glassfish_configuration_wrapper(xml, 'Debug') add_glassfish_runner_settings(xml, 'Run') add_glassfish_configuration_wrapper(xml, 'Run') xml.method do |method| method.option(:name => 'BuildArtifacts', :enabled => 'true') do |option| exploded.keys.each do |deployable_name| option.artifact(:name => deployable_name) end artifacts.keys.each do |deployable_name| option.artifact(:name => deployable_name) end end end end end end |
#add_glassfish_remote_configuration(project, options = {}) ⇒ Object
1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 |
# File 'lib/buildr/ide/idea.rb', line 1243 def add_glassfish_remote_configuration(project, = {}) artifact_name = [:name] || project.iml.id version = [:version] || '4.1.0' server_name = [:server_name] || "GlassFish #{version}" configuration_name = [:configuration_name] || "Remote #{server_name}" domain_port = [:port] || '9009' packaged = [:packaged] || {} exploded = [:exploded] || {} artifacts = [:artifacts] || {} add_to_composite_component(self.configurations) do |xml| xml.configuration(:name => configuration_name, :type => 'GlassfishConfiguration', :factoryName => 'Remote', :default => false, :APPLICATION_SERVER_NAME => server_name) do |xml| xml.option(:name => 'LOCAL', :value => 'false') xml.option(:name => 'OPEN_IN_BROWSER', :value => 'false') xml.option(:name => 'UPDATING_POLICY', :value => 'redeploy-artifacts') xml.deployment do |deployment| packaged.each do |name, deployable| artifact = Buildr.artifact(deployable) artifact.invoke deployment.file(:path => resolve_path(artifact.to_s)) do |file| file.settings do |settings| settings.option(:name => 'contextRoot', :value => "/#{name}") settings.option(:name => 'defaultContextRoot', :value => 'false') end end end exploded.each do |deployable_name, context_root| deployment.artifact(:name => deployable_name) do |file| file.settings do |settings| settings.option(:name => 'contextRoot', :value => "/#{context_root}") settings.option(:name => 'defaultContextRoot', :value => 'false') end end end artifacts.each do |deployable_name, context_root| deployment.artifact(:name => deployable_name) do |file| file.settings do |settings| settings.option(:name => 'contextRoot', :value => "/#{context_root}") settings.option(:name => 'defaultContextRoot', :value => 'false') end end end end xml.tag! 'server-settings' do |server_settings| server_settings.option(:name => 'VIRTUAL_SERVER') server_settings.data do |data| data.option(:name => 'adminServerHost', :value => '') data.option(:name => 'clusterName', :value => '') data.option(:name => 'stagingRemotePath', :value => '') data.option(:name => 'transportHostId') data.option(:name => 'transportStagingTarget') do |option| option.TransportTarget do |tt| tt.option(:name => 'id', :value => 'X') end end end end xml.predefined_log_file(:id => 'GlassFish', :enabled => 'true') add_glassfish_runner_settings(xml, 'Debug', { :DEBUG_PORT => domain_port.to_s, :TRANSPORT => '0', :LOCAL => 'false', }) add_glassfish_configuration_wrapper(xml, 'Debug') add_glassfish_runner_settings(xml, 'Run') add_glassfish_configuration_wrapper(xml, 'Run') xml.method do |method| method.option(:name => 'BuildArtifacts', :enabled => 'true') do |option| exploded.keys.each do |deployable_name| option.artifact(:name => deployable_name) end artifacts.keys.each do |deployable_name| option.artifact(:name => deployable_name) end end end end end end |
#add_gwt_configuration(project, options = {}) ⇒ Object
1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 |
# File 'lib/buildr/ide/idea.rb', line 1121 def add_gwt_configuration(project, = {}) launch_page = [:launch_page] name = [:name] || (launch_page ? "Run #{launch_page}" : "Run #{project.name} DevMode") shell_parameters = [:shell_parameters] vm_parameters = [:vm_parameters] || '-Xmx512m' singleton = [:singleton].nil? ? true : !![:singleton] super_dev = [:super_dev].nil? ? true : !![:super_dev] gwt_module = [:gwt_module] start_javascript_debugger = [:start_javascript_debugger].nil? ? true : !![:start_javascript_debugger] add_configuration(name, 'GWT.ConfigurationType', 'GWT Configuration', false, :singleton => singleton) do |xml| xml.module(:name => [:iml_name] || project.iml.name) xml.option(:name => 'VM_PARAMETERS', :value => vm_parameters) xml.option(:name => 'RUN_PAGE', :value => launch_page) if launch_page xml.option(:name => 'GWT_MODULE', :value => gwt_module) if gwt_module # noinspection RubySimplifyBooleanInspection xml.option(:name => 'OPEN_IN_BROWSER', :value => false) if [:open_in_browser] == false xml.option(:name => 'START_JAVASCRIPT_DEBUGGER', :value => start_javascript_debugger) xml.option(:name => 'USE_SUPER_DEV_MODE', :value => super_dev) xml.option(:name => 'SHELL_PARAMETERS', :value => shell_parameters) if shell_parameters xml.RunnerSettings(:RunnerId => 'Debug') do xml.option(:name => 'DEBUG_PORT', :value => '') xml.option(:name => 'TRANSPORT', :value => 0) xml.option(:name => 'LOCAL', :value => true) end xml.RunnerSettings(:RunnerId => 'Run') xml.ConfigurationWrapper(:RunnerId => 'Run') xml.ConfigurationWrapper(:RunnerId => 'Debug') xml.method end end |
#add_jar_artifact(project, options = {}) ⇒ Object
1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 |
# File 'lib/buildr/ide/idea.rb', line 1026 def add_jar_artifact(project, = {}) artifact_name = to_artifact_name(project, ) dependencies = ([:dependencies] || [project]).flatten libraries, projects = partition_dependencies(dependencies) 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()) do |xml| emit_output_path(xml, artifact_name, ) xml.root(:id => 'archive', :name => jar_name) do artifact_content(xml, project, projects, ) end end end |
#add_java_configuration(project, classname, options = {}) ⇒ Object
1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 |
# File 'lib/buildr/ide/idea.rb', line 1057 def add_java_configuration(project, classname, = {}) args = [:args] || '' dir = [:dir] || 'file://$PROJECT_DIR$/' debug_port = [:debug_port] || 2599 module_name = [:module_name] || project.iml.name jvm_args = [:jvm_args] || '' name = [:name] || classname add_to_composite_component(self.configurations) do |xml| xml.configuration(:name => name, :type => 'Application', :factoryName => 'Application', :default => !![:default]) do |xml| xml.extension(:name => 'coverage', :enabled => 'false', :merge => 'false', :sample_coverage => 'true', :runner => 'idea') xml.option(:name => 'MAIN_CLASS_NAME', :value => classname) xml.option(:name => 'VM_PARAMETERS', :value => jvm_args) xml.option(:name => 'PROGRAM_PARAMETERS', :value => args) xml.option(:name => 'WORKING_DIRECTORY', :value => dir) xml.option(:name => 'ALTERNATIVE_JRE_PATH_ENABLED', :value => 'false') xml.option(:name => 'ALTERNATIVE_JRE_PATH', :value => '') xml.option(:name => 'ENABLE_SWING_INSPECTOR', :value => 'false') xml.option(:name => 'ENV_VARIABLES') xml.option(:name => 'PASS_PARENT_ENVS', :value => 'true') xml.module(:name => module_name) xml.envs xml.RunnerSettings(:RunnerId => 'Debug') do |xml| xml.option(:name => 'DEBUG_PORT', :value => debug_port.to_s) xml.option(:name => 'TRANSPORT', :value => '0') xml.option(:name => 'LOCAL', :value => 'true') end xml.RunnerSettings(:RunnerId => 'Run') xml.ConfigurationWrapper(:RunnerId => 'Debug') xml.ConfigurationWrapper(:RunnerId => 'Run') xml.method end end end |
#add_javac_settings(javac_args) ⇒ Object
826 827 828 829 830 |
# File 'lib/buildr/ide/idea.rb', line 826 def add_javac_settings(javac_args) add_component('JavacSettings') do |xml| xml.option(:name => 'ADDITIONAL_OPTIONS_STRING', :value => javac_args) end end |
#add_less_compiler_component(project, options = {}) ⇒ Object
867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 |
# File 'lib/buildr/ide/idea.rb', line 867 def add_less_compiler_component(project, = {}) source_dir = [:source_dir] || project._(:source, :main, :webapp, :less).to_s source_pattern = [:pattern] || '*.less' exclude_pattern = [:exclude_pattern] || '_*.less' target_subdir = [:target_subdir] || 'css' target_dir = [:target_dir] || project._(:artifacts, project.name) add_component('LessManager') do |component| component.option :name => 'lessProfiles' do |outer_option| outer_option.map do |map| map.entry :key => project.name do |entry| entry.value do |value| value.LessProfile do |profile| profile.option :name => 'cssDirectories' do |option| option.list do |list| list.CssDirectory do |css_dir| css_dir.option :name => 'path', :value => "#{target_dir}#{target_subdir.nil? ? '' : "/#{target_subdir}"}" end end end profile.option :name => 'includePattern', :value => source_pattern profile.option :name => 'excludePattern', :value => exclude_pattern profile.option :name => 'lessDirPath', :value => source_dir profile.option :name => 'name', :value => project.name end end end end end end end |
#add_nullable_manager ⇒ Object
844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 |
# File 'lib/buildr/ide/idea.rb', line 844 def add_nullable_manager add_component('NullableNotNullManager') do |component| component.option :name => 'myDefaultNullable', :value => 'javax.annotation.Nullable' component.option :name => 'myDefaultNotNull', :value => 'javax.annotation.Nonnull' component.option :name => 'myNullables' do |option| option.value do |value| value.list :size => '2' do |list| list.item :index => '0', :class => 'java.lang.String', :itemvalue => 'org.jetbrains.annotations.Nullable' list.item :index => '1', :class => 'java.lang.String', :itemvalue => 'javax.annotation.Nullable' end end end component.option :name => 'myNotNulls' do |option| option.value do |value| value.list :size => '2' do |list| list.item :index => '0', :class => 'java.lang.String', :itemvalue => 'org.jetbrains.annotations.NotNull' list.item :index => '1', :class => 'java.lang.String', :itemvalue => 'javax.annotation.Nonnull' end end end end end |
#add_postgres_data_source(name, options = {}) ⇒ Object
786 787 788 789 790 791 792 793 794 795 796 797 798 799 |
# File 'lib/buildr/ide/idea.rb', line 786 def add_postgres_data_source(name, = {}) if [:url].nil? && [:database] default_url = "jdbc:postgresql://#{([:host] || '127.0.0.1')}:#{([:port] || '5432')}/#{[:database]}" end params = { :driver => 'org.postgresql.Driver', :url => default_url, :username => ENV['USER'], :dialect => 'PostgreSQL', :classpath => ['org.postgresql:postgresql:jar:9.2-1003-jdbc4'] }.merge() add_data_source(name, params) end |
#add_ruby_script_configuration(project, script, options = {}) ⇒ Object
1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 |
# File 'lib/buildr/ide/idea.rb', line 1092 def add_ruby_script_configuration(project, script, = {}) args = [:args] || '' path = ::Buildr::Util.relative_path(File.(script), project.base_dir) name = [:name] || File.basename(script) dir = [:dir] || "$MODULE_DIR$/#{path}" sdk = [:sdk] add_to_composite_component(self.configurations) do |xml| xml.configuration(:name => name, :type => 'RubyRunConfigurationType', :factoryName => 'Ruby', :default => !![:default]) do |xml| xml.module(:name => project.iml.name) xml.RUBY_RUN_CONFIG(:NAME => 'RUBY_ARGS', :VALUE => '-e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift)') xml.RUBY_RUN_CONFIG(:NAME => 'WORK DIR', :VALUE => dir) xml.RUBY_RUN_CONFIG(:NAME => 'SHOULD_USE_SDK', :VALUE => 'true') xml.RUBY_RUN_CONFIG(:NAME => 'ALTERN_SDK_NAME', :VALUE => sdk) xml.RUBY_RUN_CONFIG(:NAME => 'myPassParentEnvs', :VALUE => 'true') xml.envs xml.EXTENSION(:ID => 'BundlerRunConfigurationExtension', :bundleExecEnabled => 'false') xml.EXTENSION(:ID => 'JRubyRunConfigurationExtension') xml.RUBY_RUN_CONFIG(:NAME => 'SCRIPT_PATH', :VALUE => script) xml.RUBY_RUN_CONFIG(:NAME => 'SCRIPT_ARGS', :VALUE => args) xml.RunnerSettings(:RunnerId => 'RubyDebugRunner') xml.ConfigurationWrapper(:RunnerId => 'RubyDebugRunner') end end end |
#add_sql_server_data_source(name, options = {}) ⇒ Object
801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 |
# File 'lib/buildr/ide/idea.rb', line 801 def add_sql_server_data_source(name, = {}) default_url = nil if [:url].nil? && [:database] default_url = "jdbc:jtds:sqlserver://#{([:host] || '127.0.0.1')}:#{([:port] || '1433')}/#{[:database]}" end params = { :driver => 'net.sourceforge.jtds.jdbc.Driver', :url => default_url, :username => ENV['USER'], :dialect => 'TSQL', :classpath => ['net.sourceforge.jtds:jtds:jar:1.2.7'] }.merge() if params[:url] if /jdbc:jtds:sqlserver:\/\/[^:\\]+(:\d+)?\/([^;]*)(;.*)?/ =~ params[:url] database_name = $2 params[:schema_pattern] = "#{database_name}.*" params[:default_schemas] = "#{database_name}.*" end end add_data_source(name, params) end |
#add_testng_configuration(name, options = {}) ⇒ Object
1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 |
# File 'lib/buildr/ide/idea.rb', line 1329 def add_testng_configuration(name, = {}) jvm_args = [:jvm_args] || '-ea' module_name = [:module] || '' dir = [:dir] opts = {} opts[:folderName] = [:folderName] if [:folderName] add_configuration(name, 'TestNG', nil, false, opts) do |xml| xml.module(:name => module_name) xml.option(:name => 'SUITE_NAME', :value => '') xml.option(:name => 'PACKAGE_NAME', :value => [:package_name] || '') xml.option(:name => 'MAIN_CLASS_NAME', :value => [:class_name] || '') xml.option(:name => 'METHOD_NAME', :value => [:method_name] || '') xml.option(:name => 'GROUP_NAME', :value => [:group_name] || '') xml.option(:name => 'TEST_OBJECT', :value => (![:class_name].nil? ? 'CLASS' : 'PACKAGE')) xml.option(:name => 'VM_PARAMETERS', :value => jvm_args) xml.option(:name => 'PARAMETERS', :value => '-configfailurepolicy continue') xml.option(:name => 'WORKING_DIRECTORY', :value => dir) if dir xml.option(:name => 'OUTPUT_DIRECTORY', :value => '') xml.option(:name => 'PROPERTIES_FILE', :value => '') xml.properties xml.listeners xml.method(:v => '2') do xml.option(:name => 'Make', :enabled => 'true') end end end |
#add_war_artifact(project, options = {}) ⇒ Object
931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 |
# File 'lib/buildr/ide/idea.rb', line 931 def add_war_artifact(project, = {}) artifact_name = to_artifact_name(project, ) artifacts = [:artifacts] || [] add_artifact(artifact_name, 'war', build_on_make()) do |xml| dependencies = ([:dependencies] || ([project] + project.compile.dependencies)).flatten libraries, projects = partition_dependencies(dependencies) emit_output_path(xml, artifact_name, ) xml.root :id => 'archive', :name => "#{artifact_name}.war" do xml.element :id => 'directory', :name => 'WEB-INF' do xml.element :id => 'directory', :name => 'classes' do artifact_content(xml, project, projects, ) end xml.element :id => 'directory', :name => 'lib' do emit_libraries(xml, libraries) emit_jar_artifacts(xml, artifacts) end end if [:enable_war].nil? || [:enable_war] || ([:war_module_names] && [:war_module_names].size > 0) module_names = [:war_module_names] || [project.iml.name] module_names.each do |module_name| facet_name = [:war_facet_name] || 'Web' xml.element :id => 'javaee-facet-resources', :facet => "#{module_name}/web/#{facet_name}" end end if [:enable_gwt] || ([:gwt_module_names] && [:gwt_module_names].size > 0) module_names = [:gwt_module_names] || [project.iml.name] module_names.each do |module_name| facet_name = [:gwt_facet_name] || 'GWT' xml.element :id => 'gwt-compiler-output', :facet => "#{module_name}/gwt/#{facet_name}" end end end end end |
#compiler_configuration_options ⇒ Object
728 729 730 |
# File 'lib/buildr/ide/idea.rb', line 728 def @compiler_configuration_options ||= {} end |
#mssql_dialect_mapping ⇒ Object
769 770 771 |
# File 'lib/buildr/ide/idea.rb', line 769 def mssql_dialect_mapping sql_dialect_mappings(buildr_project.base_dir => 'TSQL') end |
#nonnull_assertions? ⇒ Boolean
732 733 734 |
# File 'lib/buildr/ide/idea.rb', line 732 def nonnull_assertions? @nonnull_assertions.nil? ? true : !!@nonnull_assertions end |
#postgres_dialect_mapping ⇒ Object
773 774 775 |
# File 'lib/buildr/ide/idea.rb', line 773 def postgres_dialect_mapping sql_dialect_mappings(buildr_project.base_dir => 'PostgreSQL') end |
#sql_dialect_mappings(mappings) ⇒ Object
777 778 779 780 781 782 783 784 |
# File 'lib/buildr/ide/idea.rb', line 777 def sql_dialect_mappings(mappings) add_component('SqlDialectMappings') do |component| mappings.each_pair do |path, dialect| file_path = file_path(path).gsub(/\/.$/, '') component.file :url => file_path, :dialect => dialect end end end |
#wildcard_resource_patterns ⇒ Object
738 739 740 |
# File 'lib/buildr/ide/idea.rb', line 738 def wildcard_resource_patterns @wildcard_resource_patterns ||= %w(!?*.java !?*.form !?*.class !?*.groovy !?*.scala !?*.flex !?*.kt !?*.clj !?*.aj) end |