Class: Frank::Plugins::Plugin
- Inherits:
-
Object
- Object
- Frank::Plugins::Plugin
- Defined in:
- lib/frank-cucumber/plugins/plugin.rb
Instance Attribute Summary collapse
-
#exclude_dependencies ⇒ Object
Returns the value of attribute exclude_dependencies.
-
#name ⇒ Object
Returns the value of attribute name.
-
#plugin_dir ⇒ Object
Returns the value of attribute plugin_dir.
Class Method Summary collapse
- .core_xcconfig_path ⇒ Object
- .from_plugin_directory(path) ⇒ Object
- .generate_core_xcconfig(plugins) ⇒ Object
Instance Method Summary collapse
- #dependency(lib, linker_flag = "-l#{lib}") ⇒ Object
-
#initialize(plugin_dir, name) ⇒ Plugin
constructor
A new instance of Plugin.
- #write_xcconfig(exclude_dependencies) ⇒ Object
- #xcconfig ⇒ Object
Constructor Details
#initialize(plugin_dir, name) ⇒ Plugin
Returns a new instance of Plugin.
9 10 11 12 |
# File 'lib/frank-cucumber/plugins/plugin.rb', line 9 def initialize(plugin_dir, name) self.plugin_dir= plugin_dir self.name = name end |
Instance Attribute Details
#exclude_dependencies ⇒ Object
Returns the value of attribute exclude_dependencies.
7 8 9 |
# File 'lib/frank-cucumber/plugins/plugin.rb', line 7 def exclude_dependencies @exclude_dependencies end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/frank-cucumber/plugins/plugin.rb', line 7 def name @name end |
#plugin_dir ⇒ Object
Returns the value of attribute plugin_dir.
7 8 9 |
# File 'lib/frank-cucumber/plugins/plugin.rb', line 7 def plugin_dir @plugin_dir end |
Class Method Details
.core_xcconfig_path ⇒ Object
51 52 53 |
# File 'lib/frank-cucumber/plugins/plugin.rb', line 51 def self.core_xcconfig_path File.(File.join(File.dirname(__FILE__), '..', 'frank.xcconfig.erb')) end |
.from_plugin_directory(path) ⇒ Object
40 41 42 43 |
# File 'lib/frank-cucumber/plugins/plugin.rb', line 40 def self.from_plugin_directory(path) plugin_name = File.basename(path) Plugin.new(path, plugin_name) end |
.generate_core_xcconfig(plugins) ⇒ Object
45 46 47 48 49 |
# File 'lib/frank-cucumber/plugins/plugin.rb', line 45 def self.generate_core_xcconfig(plugins) _template = ERB.new(File.read(core_xcconfig_path)) _template.result(binding) end |
Instance Method Details
#dependency(lib, linker_flag = "-l#{lib}") ⇒ Object
14 15 16 17 |
# File 'lib/frank-cucumber/plugins/plugin.rb', line 14 def dependency(lib,linker_flag="-l#{lib}") return linker_flag unless exclude_dependencies.include?(lib) '' end |
#write_xcconfig(exclude_dependencies) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/frank-cucumber/plugins/plugin.rb', line 19 def write_xcconfig(exclude_dependencies) self.exclude_dependencies= exclude_dependencies _xcconfig_erb = File.join(plugin_dir,"#{xcconfig}.erb") unless File.exist?(_xcconfig_erb) raise "Invalid plugin #{name} at #{File.join(plugin_dir)}.\nDoesn't have an erb file: #{_xcconfig_erb}" end _template = ERB.new(File.read(_xcconfig_erb)) result = _template.result(binding) output_path = File.join(plugin_dir, xcconfig) File.open(output_path,'w') {|f| f.write(result)} output_path end |
#xcconfig ⇒ Object
36 37 38 |
# File 'lib/frank-cucumber/plugins/plugin.rb', line 36 def xcconfig "#{name}.xcconfig" end |