Class: Buildr::IntellijIdea::IdeaFile
Overview
Abstract base class for IdeaModule and IdeaProject
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_PREFIX =
''
- DEFAULT_SUFFIX =
''
- DEFAULT_LOCAL_REPOSITORY_ENV_OVERRIDE =
'MAVEN_REPOSITORY'
Instance Attribute Summary collapse
-
#buildr_project ⇒ Object
readonly
Returns the value of attribute buildr_project.
- #id ⇒ Object
-
#local_repository_env_override ⇒ Object
Returns the value of attribute local_repository_env_override.
- #prefix ⇒ Object
- #suffix ⇒ Object
-
#template ⇒ Object
Returns the value of attribute template.
Instance Method Summary collapse
- #add_component(name, attrs = {}, &xml) ⇒ Object
- #add_component_from_artifact(artifact) ⇒ Object
- #add_component_from_file(filename) ⇒ Object
- #filename ⇒ Object
-
#initialize ⇒ IdeaFile
constructor
A new instance of IdeaFile.
- #name ⇒ Object
-
#write(f) ⇒ Object
IDEA can not handle text content with indents so need to removing indenting Can not pass true as third argument as the ruby library seems broken.
Constructor Details
#initialize ⇒ IdeaFile
Returns a new instance of IdeaFile.
35 36 37 |
# File 'lib/buildr/ide/idea.rb', line 35 def initialize @local_repository_env_override = DEFAULT_LOCAL_REPOSITORY_ENV_OVERRIDE end |
Instance Attribute Details
#buildr_project ⇒ Object (readonly)
Returns the value of attribute buildr_project.
28 29 30 |
# File 'lib/buildr/ide/idea.rb', line 28 def buildr_project @buildr_project end |
#id ⇒ Object
51 52 53 |
# File 'lib/buildr/ide/idea.rb', line 51 def id @id ||= buildr_project.name.split(':').last end |
#local_repository_env_override ⇒ Object
Returns the value of attribute local_repository_env_override.
33 34 35 |
# File 'lib/buildr/ide/idea.rb', line 33 def local_repository_env_override @local_repository_env_override end |
#prefix ⇒ Object
39 40 41 |
# File 'lib/buildr/ide/idea.rb', line 39 def prefix @prefix ||= DEFAULT_PREFIX end |
#suffix ⇒ Object
43 44 45 |
# File 'lib/buildr/ide/idea.rb', line 43 def suffix @suffix ||= DEFAULT_SUFFIX end |
#template ⇒ Object
Returns the value of attribute template.
32 33 34 |
# File 'lib/buildr/ide/idea.rb', line 32 def template @template end |
Instance Method Details
#add_component(name, attrs = {}, &xml) ⇒ Object
55 56 57 |
# File 'lib/buildr/ide/idea.rb', line 55 def add_component(name, attrs = {}, &xml) self.components << create_component(name, attrs, &xml) end |
#add_component_from_artifact(artifact) ⇒ Object
66 67 68 69 70 71 72 |
# File 'lib/buildr/ide/idea.rb', line 66 def add_component_from_artifact(artifact) self.components << lambda do a = Buildr.artifact(artifact) a.invoke Buildr::IntellijIdea.new_document(IO.read(a.to_s)).root end end |
#add_component_from_file(filename) ⇒ Object
59 60 61 62 63 64 |
# File 'lib/buildr/ide/idea.rb', line 59 def add_component_from_file(filename) self.components << lambda do raise "Unable to locate file #{filename} adding component to idea file" unless File.exist?(filename) Buildr::IntellijIdea.new_document(IO.read(filename)).root end end |
#filename ⇒ Object
47 48 49 |
# File 'lib/buildr/ide/idea.rb', line 47 def filename buildr_project.path_to("#{name}.#{extension}") end |
#name ⇒ Object
80 81 82 |
# File 'lib/buildr/ide/idea.rb', line 80 def name "#{prefix}#{self.id}#{suffix}" end |