lib/core/plugin/project.rb in nucleon-0.1.19 vs lib/core/plugin/project.rb in nucleon-0.2.0
- old
+ new
@@ -1,21 +1,23 @@
module Nucleon
module Plugin
-class Project < Base
+class Project < Nucleon.plugin_class(:nucleon, :base)
- @@ignore_lock = Mutex.new
-
- #---
-
@@projects = {}
#---
def self.collection
@@projects
end
+
+ #---
+
+ def self.register_ids
+ [ :name, :directory ]
+ end
#-----------------------------------------------------------------------------
# Constructor / Destructor
def self.open(directory, provider, options = {})
@@ -46,11 +48,11 @@
set_directory(Util::Disk.filename(get(:directory, Dir.pwd)))
register
set_url(get(:url)) if get(:url, false)
- myself.plugin_name = path if ! plugin_name || plugin_name == plugin_provider
+ myself.plugin_name = path if ! plugin_name || plugin_name.to_sym == plugin_provider
ui.resource = plugin_name
logger = plugin_name
if keys = delete(:keys, nil)
@@ -474,25 +476,23 @@
end
end
end
end
else
- logger.warn("Project #{name} does not meet the criteria for persistence and can be committed to")
+ logger.warn("Project #{name} does not meet the criteria for persistence and can not be committed to")
end
success
end
#---
def ignore(files)
return unless directory && manage_ignore?
- @@ignore_lock.synchronize do
- files = nil
- files = yield if block_given?
- commit(files, { :message => "Adding project ignores." }) if files
- end
+ files = nil
+ files = yield if block_given?
+ commit(files, { :message => "Adding project ignores." }) if files
end
#-----------------------------------------------------------------------------
# Subproject operations
@@ -872,13 +872,13 @@
end
#-----------------------------------------------------------------------------
# Utilities
- def self.build_info(type, data)
+ def self.build_info(namespace, plugin_type, data)
data = data.split(/\s*,\s*/) if data.is_a?(String)
- super(type, data)
+ super(namespace, plugin_type, data)
end
#---
def self.translate(data)
@@ -912,10 +912,10 @@
url = $2
revision = $3
logger.debug("Translating project reference: #{provider} #{url} #{revision}")
- if provider && Nucleon.loaded_plugins(:project).keys.include?(provider.to_sym)
+ if provider && Nucleon.loaded_plugins(:nucleon, :project).keys.include?(provider.to_sym)
klass = Nucleon.class_const([ :nucleon, :project, provider ])
expanded_url = klass.send(:expand_url, url, editable) if klass.respond_to?(:expand_url)
end
expanded_url = url unless expanded_url