Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding edit project resolves #8

  • Loading branch information...
commit 7e1739096212e87fa3893548ce92fe1258aa90e1 1 parent 1a3213e
Joe Ferraro authored
View
8 Main.sublime-menu
@@ -17,10 +17,10 @@
"caption": "Checkout Project",
"command": "checkout_project"
},
- // {
- // "caption": "Edit Project",
- // "command": "edit_project"
- // },
+ {
+ "caption": "Edit Project",
+ "command": "edit_project"
+ },
{
"caption": "Clean Project",
"command": "clean_project"
View
5 commands/edit_project.rb
@@ -1,10 +1,7 @@
#!/usr/bin/env ruby -W0
-require "rubygems"
-require "savon"
-require "builder"
-require "zip/zipfilesystem"
require File.dirname(File.dirname(__FILE__)) + "/constants.rb"
include Constants
require SUPPORT + "/environment.rb"
require CONTROLLERS_ROOT + "/project_controller.rb"
+ENV["MM_CURRENT_PROJECT_DIRECTORY"] = ARGV[0]
dispatch :controller => "project", :action => "index_edit", :user_action => "edit"
View
7 mavensmate.py
@@ -81,6 +81,13 @@ def mm_workspace():
workspace = sublime.active_window().active_view().settings().get('mm_workspace')
return workspace
+#displays edit project dialog
+class EditProjectCommand(sublime_plugin.ApplicationCommand):
+ def run(command):
+ start_local_server()
+ temp_file_name = generate_ui("edit_project", mm_project_directory())
+ launch_mavens_mate_window(temp_file_name)
+
#displays new project dialog
class NewProjectCommand(sublime_plugin.ApplicationCommand):
def run(command):
View
10 support/app/controllers/deploy_controller.rb
@@ -11,16 +11,6 @@ class DeployController < ApplicationController
layout "base", :only => [:index, :index_new, :show_compile_result]
def index
- # if File.not.exist? "#{ENV['MM_CURRENT_PROJECT_DIRECTORY']}/config/.org_metadata"
- # MavensMate.build_index
- # else
- # confirmed = TextMate::UI.request_confirmation(
- # :title => "MavensMate",
- # :prompt => "Would you like to refresh the local index of your Salesforce.com org's metadata?",
- # :button1 => "Refresh",
- # :button2 => "No")
- # end
- #MavensMate.build_index
connections = []
begin
pconfig = MavensMate.get_project_config
View
144 support/app/controllers/project_controller.rb
@@ -15,105 +15,16 @@ class ProjectController < ApplicationController
layout "base", :only => [:index_new, :index_edit, :index_new_changeset]
def index_new
- kill_server
my_json = File.read("#{ENV['TM_BUNDLE_SUPPORT']}/conf/metadata_describe.json")
support_folder = ENV['TM_BUNDLE_SUPPORT']
sf = support_folder.gsub(/lib\/../, "")
render "_project_new", :locals => { :user_action => params[:user_action], :my_json => my_json, :child_metadata_definition => CHILD_META_DICTIONARY, :support_folder => sf}
end
- def index_edit
- kill_server
- if File.not.exist? "#{ENV['TM_PROJECT_DIRECTORY']}/config/.org_metadata"
- MavensMate.build_index
- else
- confirmed = TextMate::UI.request_confirmation(
- :title => "MavensMate",
- :prompt => "Would you like to refresh the local index of your Salesforce.com org's metadata?",
- :button1 => "Refresh",
- :button2 => "No")
- end
-
- MavensMate.build_index if confirmed
-
- project_array = eval(File.read("#{ENV['TM_PROJECT_DIRECTORY']}/config/.org_metadata")) #=> comprehensive list of server metadata
-
- require 'rubygems'
- require 'nokogiri'
- project_package = Nokogiri::XML(File.open("#{ENV['TM_PROJECT_DIRECTORY']}/src/package.xml"))
- project_package.remove_namespaces!
- project_package.xpath("//types/name").each do |node|
- object_definition = MavensMate::FileFactory.get_meta_type_by_name(node.text) || MavensMate::FileFactory.get_child_meta_type_by_name(node.text)
- #=> ApexClass
- is_parent = !object_definition[:parent_xml_name]
- server_object = project_array.detect { |f| f[:key] == node.text }
- next if server_object.nil? && is_parent
-
- if is_parent
- server_object[:selected] = "selected"
- server_object[:select_mode] = (node.previous_element.text == "*") ? "all" : "some"
- MavensMate.select_all(server_object) if server_object[:select_mode] == "all"
- next if server_object[:selected] == "all"
- end
-
- if not is_parent
- #=> CustomField
- parent_object_definition = MavensMate::FileFactory.get_meta_type_by_name(object_definition[:parent_xml_name]) #=> CustomObject
- prev_node = node.previous_element
- while prev_node.not.nil? && prev_node.node_name == "members"
- next if prev_node.text.not.include? "."
- obj_name = prev_node.text.split(".")[0] #=> Lead
- obj_attribute = prev_node.text.split(".")[1] #=> Field_Name__c
-
- server_object = project_array.detect { |f| f[:key] == object_definition[:parent_xml_name] } #=> CustomObject
- sobject = server_object[:children].detect {|f| f[:title] == obj_name } #=> Lead
- sobject_metadata = sobject[:children].detect {|f| f[:title] == object_definition[:tag_name] } #=> fields
- sobject_metadata[:children].each do |item|
- if item[:title] == obj_attribute
- item[:selected] = "selected"
- break
- end
- end
- prev_node = prev_node.previous_element || nil
- end
- end
-
- prev_node = node.previous_element
- while prev_node.not.nil? && prev_node.node_name == "members"
- #skip items in folders for now
- if prev_node.include? "/"
- prev_node = prev_node.previous_element || nil
- next
- end
- child_object = server_object[:children].detect {|f| f[:key] == prev_node.text }
- child_object[:selected] = "selected" if child_object.not.nil?
- MavensMate.select_all(child_object) if object_definition[:child_xml_names]
- prev_node = prev_node.previous_element || nil
- end
-
- prev_node = node.previous_element
- while prev_node.not.nil? && prev_node.node_name == "members"
- #process only items in folders
- if prev_node.text.not.include? "/"
- prev_node = prev_node.previous_element || nil
- next
- end
- child_object = server_object[:children].detect {|f| f[:key] == prev_node.text.split("/")[0]}
- begin
- child_object[:children].each do |gchild|
- gchild[:selected] = "selected" if gchild[:key] == prev_node.text
- end
- rescue Exception => e
- #puts e.message + "\n" + e.backtrace.join("\n")
- end
- prev_node = prev_node.previous_element || nil
- end
- end
-
+ def index_edit
pconfig = MavensMate.get_project_config
password = KeyChain::find_internet_password("#{pconfig['project_name']}-mm")
-
- render "_project_edit", :locals => { :package => project_package, :project_array => project_array, :child_metadata_definition => CHILD_META_DICTIONARY, :pname => pconfig['project_name'], :pun => pconfig['username'], :ppw => password, :pserver => pconfig['environment'] }
+ render "_project_edit", :locals => { :child_metadata_definition => CHILD_META_DICTIONARY, :pname => pconfig['project_name'], :pun => pconfig['username'], :ppw => password, :pserver => pconfig['environment'] }
end
#updates current project
@@ -126,56 +37,7 @@ def update
TextMate::UI.alert(:warning, "MavensMate", e.message + "\n" + e.backtrace.join("\n"))
end
end
-
- #update project creds
- def update_creds
- begin
- un = params[:un]
- pw = params[:pw]
- server_url = params[:server_url]
-
- TextMate.call_with_progress( :title => "MavensMate", :message => "Validating Salesforce.com Credentials" ) do
- client = MavensMate::Client.new({ :username => params[:un], :password => params[:pw], :endpoint => params[:server_url] })
- end
-
- TextMate.call_with_progress( :title => "MavensMate", :message => "Updating project configuration" ) do
- environment = (server_url.include? "test") ? "sandbox" : "production"
- require 'yaml'
- yml = YAML::load(File.open("#{ENV['TM_PROJECT_DIRECTORY']}/config/settings.yaml"))
- project_name = yml['project_name']
- yml['username'] = un
- yml['environment'] = environment
- File.open("#{ENV['TM_PROJECT_DIRECTORY']}/config/settings.yaml", 'w') { |f| YAML.dump(yml, f) }
- MavensMate.add_to_keychain(project_name, pw)
- end
- rescue Exception => e
- TextMate::UI.alert(:warning, "MavensMate", e.message)
- end
- end
-
- #checks provided salesforce.com credentials
- def login
- if params[:un].nil? || params[:pw].nil? || params[:server_url].nil?
- TextMate::UI.alert(:warning, "MavensMate", "Please provide Salesforce.com credentials before selecting metadata")
- abort
- end
-
- begin
- TextMate.call_with_progress( :title => "MavensMate", :message => "Validating Salesforce.com Credentials" ) do
- self.client = MavensMate::Client.new({ :username => params[:un], :password => params[:pw], :endpoint => params[:server_url] })
- end
- #$stdout.flush
- #flush
- if ! self.client.sid.nil? && ! self.client.metadata_server_url.nil?
- puts "<input type='hidden' value='#{self.client.sid}' id='sid'/>"
- puts "<input type='hidden' value='#{self.client.metadata_server_url}' id='murl'/>"
- end
- rescue Exception => e
- TextMate::UI.alert(:warning, "MavensMate", e.message)
- return
- end
- end
-
+
#creates new local project from selected salesforce data
def new_custom_project
begin
View
10 support/app/views/deploy/_metadata_tree.html.erb
@@ -1,23 +1,23 @@
-<% meta_array.each do |hash| %>
+<% metadata_array.each do |hash| %>
<%
next if !hash[:children]
next if hash[:children].size == 0
class_name = (hash[:children] && hash[:children].size > 0) ? "folder" : ""
%>
- <li data="level: 1, hasChildTypes: <%=hash[:hasChildTypes]%>, inFolder: <%=hash[:inFolder]%>" id="<%= hash[:key] %>" class="folder level1"><%= hash[:title] %>
+ <li data="level: 1, hasChildTypes: <%=hash[:hasChildTypes]%>, inFolder: <%=hash[:inFolder]%>" id="<%= hash[:key] %>" class="<%= hash[:selected] %> folder level1"><%= hash[:title] %>
<% if hash[:children] %>
<ul>
<% hash[:children].each do |child| %>
<% child_class_name = (child[:children] && child[:children].size > 0) ? "folder" : "" %>
- <li data="level: 2" id="<%= child[:key] %>" class="<%= child_class_name %> level2"><%= child[:title] %>
+ <li data="level: 2" id="<%= child[:key] %>" class="<%= child[:selected] %> <%= child_class_name %> level2"><%= child[:title] %>
<% if child[:children] && child[:children].size > 0 %>
<ul>
<% child[:children].each do |gchild| %>
- <li data="level: 3" class="level3"><%= gchild[:title] %>
+ <li data="level: 3" class="<%= gchild[:selected] %> level3"><%= gchild[:title] %>
<% if gchild[:children] && gchild[:children].size > 0 %>
<ul>
<% gchild[:children].each do |ggchild| %>
- <li data="level: 4" class="level4"><%= ggchild[:title] %></li>
+ <li data="level: 4" class="<%= ggchild[:selected] %> level4"><%= ggchild[:title] %></li>
<% end %>
</ul>
<% end %>
View
159 support/app/views/project/_project_edit.html.erb
@@ -1,7 +1,15 @@
-<div id="result_output">
-
+<div id="result_output" class="error">
+ <div id="result_wrapper" style="padding:0px 10px;">
+ <div class="alert-message error" style="display:none;">
+ <p id="error_message"></p>
+ </div>
+ <div class="alert-message success" style="display:none;">
+ <p id="success_message"></p>
+ </div>
+ </div>
</div>
+
<div class="content">
<ul class="tabs">
@@ -43,39 +51,7 @@
<div id="treewrapper" style="height:100%">
<div id="tree">
<ul>
- <% project_array.each do |hash| %>
- <%
- next if !hash[:children]
- #next if hash[:children].size == 0
- class_name = (hash[:children] && hash[:children].size > 0) ? "folder" : ""
- %>
- <li data="level: 1, hasChildTypes: <%=hash[:hasChildTypes]%>, inFolder: <%=hash[:inFolder]%>" id="<%= hash[:key] %>" class="<%= hash[:selected] %> folder level1"><%= hash[:title] %>
- <% if hash[:children] %>
- <ul>
- <% hash[:children].each do |child| %>
- <% child_class_name = (child[:children] && child[:children].size > 0) ? "folder" : "" %>
- <li data="level: 2" id="<%= child[:key] %>" class="<%= child[:selected] %> <%= child_class_name %> level2"><%= child[:title] %>
- <% if child[:children] && child[:children].size > 0 %>
- <ul>
- <% child[:children].each do |gchild| %>
- <li data="level: 3" class="<%= gchild[:selected] %> level3"><%= gchild[:title] %>
- <% if gchild[:children] && gchild[:children].size > 0 %>
- <ul>
- <% gchild[:children].each do |ggchild| %>
- <li data="level: 4" class="<%= ggchild[:selected] %> level4"><%= ggchild[:title] %></li>
- <% end %>
- </ul>
- <% end %>
- </li>
- <% end %>
- </ul>
- <% end %>
- </li>
- <% end %>
- </ul>
- <% end %>
- </li>
- <% end %>
+
</ul>
</div>
<div id="info"></div>
@@ -94,21 +70,106 @@
</div>
</fieldset>
</form>
+
+<div class="twipsy deploy_loading">
+ <div class="loading_indicator"></div>
+</div>
+<div class="deploy_wait_description">
+ Indexing metadata...
+</div>
<script type="text/javascript">
+ var mm_cpd = '<%= ENV["MM_CURRENT_PROJECT_DIRECTORY"] %>';
+ var has_indexed_metadata = <%= File.exist? "#{ENV["MM_CURRENT_PROJECT_DIRECTORY"]}/config/.org_metadata" %>;
+
var child_def = {}
<% child_metadata_definition.each do |child| %>
child_def['<%= child[:tag_name] %>'] = '<%= child[:xml_name] %>';
<% end %>
function updateProjectCreds() {
- dispatch({
- controller: "project",
- action: "update_creds",
- un: $("#un").val(),
- pw: $("#pw").val(),
- server_url: $("#server_url").val()
- })
+ console.log('updating project creds')
+ $.ajax({
+ type: "GET",
+ url: "http://127.0.0.1:7777/auth",
+ data: {
+ un: $("#un").val(),
+ pw: $("#pw").val(),
+ server_url: $("#server_url").val(),
+ override_session: true,
+ update_creds: true,
+ pd: mm_cpd
+ },
+ beforeSend: function() { showBlanket(); },
+ complete: function(data){
+ console.log(data)
+ var response = JSON.parse(data.responseText)
+ if (response["success"] == false) {
+ $("#error_message").html(response["message"])
+ $(".alert-message.success").hide()
+ $(".alert-message.error").show()
+ } else {
+ $("#success_message").html(response["message"])
+ $(".alert-message.error").hide()
+ $(".alert-message.success").show()
+ }
+ hideBlanket();
+ }
+ });
+ }
+
+ function updateProject() {
+ console.log('updating project')
+ $.ajax({
+ type: "POST",
+ url: "http://127.0.0.1:7777/project/edit",
+ data: {
+ tree: get_tree()
+ },
+ beforeSend: function() { showBlanket(); },
+ complete: function(data){
+ console.log(data)
+ var response = JSON.parse(data.responseText)
+ if (response["success"] == false) {
+ $("#error_message").html(response["message"])
+ $(".alert-message.error").show()
+ } else {
+ $("#success_message").html("OK!")
+ $(".alert-message.success").show()
+ }
+ hideBlanket();
+ }
+ });
+ }
+
+ function index_org(refresh) {
+ console.log('indexing org')
+ console.log(refresh)
+ $.ajax({
+ type: "GET",
+ url: "http://127.0.0.1:7777/metadata/index",
+ data: {
+ mm_current_project_directory: mm_cpd,
+ do_refresh: refresh,
+ mode: "edit"
+ },
+ beforeSend: function() { showBlanket(); },
+ complete: function(data){
+ console.log(data)
+ $("#tree").dynatree("destroy")
+ $("#tree ul").html(data.responseText);
+ $("#tree").dynatree({
+ persist: false,
+ checkbox: true,
+ selectMode: 3
+ });
+ $("#tree").dynatree("getRoot").visit(function(node) {
+ node.expand(false);
+ });
+ rootNode = $("#tree").dynatree("getRoot");
+ hideBlanket();
+ }
+ });
}
$(function() {
@@ -136,15 +197,15 @@
//resize elements
$("#project_wrapper").height($(window).height() - 175)
- //instantiate and populate metadata tree
- $("#tree").dynatree({
- persist: false,
- checkbox: true,
- selectMode: 3
- });
$(window).resize(function() {
$("#project_wrapper").height($(window).height() - 175)
});
- });
+
+ index_org(!has_indexed_metadata);
+ });
+
+ function showBlanket() { $('.deploy_loading').fadeIn(); }
+
+ function hideBlanket() { $('.deploy_loading').hide(); }
</script>
View
144 support/lib/local_server.rb
@@ -4,6 +4,7 @@
require File.dirname(File.dirname(File.dirname(__FILE__))) + "/constants.rb"
include Constants
require File.dirname(__FILE__) + '/lsof.rb'
+require File.dirname(__FILE__) + '/object.rb'
require File.dirname(__FILE__) + '/mavensmate.rb'
require 'webrick'
include WEBrick
@@ -20,6 +21,7 @@ def start_test
}
server.mount('/project', ProjectServlet)
+ server.mount('/project/edit', ProjectEditServlet)
server.mount('/metadata/list', MetadataListServlet)
server.mount('/vc', VersionControlServlet)
server.mount('/auth', AuthenticationServlet)
@@ -43,6 +45,7 @@ def start
}
server.mount('/project', ProjectServlet)
+ server.mount('/project/edit', ProjectEditServlet)
server.mount('/metadata/list', MetadataListServlet)
server.mount('/vc', VersionControlServlet)
server.mount('/auth', AuthenticationServlet)
@@ -95,8 +98,13 @@ def do_POST(req, resp)
class MetadataIndexServlet < WEBrick::HTTPServlet::AbstractServlet
def do_GET(req, resp)
begin
+ if RUBY_VERSION =~ /1.9/
+ Encoding.default_external = Encoding::UTF_8
+ Encoding.default_internal = Encoding::UTF_8
+ end
resp['Content-Type'] = 'html'
ENV["MM_CURRENT_PROJECT_DIRECTORY"] = req.query["mm_current_project_directory"]
+ mode = req.query["mode"] || ""
do_refresh = req.query["do_refresh"]
metadata_array = nil
if do_refresh == "true" or do_refresh == true
@@ -104,8 +112,83 @@ def do_GET(req, resp)
else
metadata_array = eval(File.read("#{ENV['MM_CURRENT_PROJECT_DIRECTORY']}/config/.org_metadata")) #=> comprehensive list of server metadata
end
+ if mode == "edit"
+ require 'rubygems'
+ require 'nokogiri'
+ project_package = Nokogiri::XML(File.open("#{ENV['MM_CURRENT_PROJECT_DIRECTORY']}/src/package.xml"))
+ project_package.remove_namespaces!
+ project_package.xpath("//types/name").each do |node|
+ object_definition = MavensMate::FileFactory.get_meta_type_by_name(node.text) || MavensMate::FileFactory.get_child_meta_type_by_name(node.text)
+ #=> ApexClass
+ is_parent = !object_definition[:parent_xml_name]
+ server_object = metadata_array.detect { |f| f[:key] == node.text }
+ next if server_object.nil? && is_parent
+
+ if is_parent
+ server_object[:selected] = "selected"
+ server_object[:select_mode] = (node.previous_element.text == "*") ? "all" : "some"
+ MavensMate.select_all(server_object) if server_object[:select_mode] == "all"
+ next if server_object[:selected] == "all"
+ end
+
+ if not is_parent
+ #=> CustomField
+ puts "not parent"
+ parent_object_definition = MavensMate::FileFactory.get_meta_type_by_name(object_definition[:parent_xml_name]) #=> CustomObject
+ prev_node = node.previous_element
+ while prev_node.not.nil? && prev_node.node_name == "members"
+ next if prev_node.text.not.include? "."
+ obj_name = prev_node.text.split(".")[0] #=> Lead
+ obj_attribute = prev_node.text.split(".")[1] #=> Field_Name__c
+
+ server_object = metadata_array.detect { |f| f[:key] == object_definition[:parent_xml_name] } #=> CustomObject
+ sobject = server_object[:children].detect {|f| f[:title] == obj_name } #=> Lead
+ sobject_metadata = sobject[:children].detect {|f| f[:title] == object_definition[:tag_name] } #=> fields
+ sobject_metadata[:children].each do |item|
+ if item[:title] == obj_attribute
+ item[:selected] = "selected"
+ break
+ end
+ end
+ prev_node = prev_node.previous_element || nil
+ end
+ end
+
+ prev_node = node.previous_element
+ while prev_node.not.nil? && prev_node.node_name == "members"
+ #skip items in folders for now
+ if prev_node.include? "/"
+ prev_node = prev_node.previous_element || nil
+ next
+ end
+ child_object = server_object[:children].detect {|f| f[:key] == prev_node.text }
+ child_object[:selected] = "selected" if child_object.not.nil?
+ MavensMate.select_all(child_object) if object_definition[:child_xml_names]
+ prev_node = prev_node.previous_element || nil
+ end
+
+ prev_node = node.previous_element
+ while prev_node.not.nil? && prev_node.node_name == "members"
+ #process only items in folders
+ if prev_node.text.not.include? "/"
+ prev_node = prev_node.previous_element || nil
+ next
+ end
+ child_object = server_object[:children].detect {|f| f[:key] == prev_node.text.split("/")[0]}
+ begin
+ child_object[:children].each do |gchild|
+ gchild[:selected] = "selected" if gchild[:key] == prev_node.text
+ end
+ rescue Exception => e
+ #puts e.message + "\n" + e.backtrace.join("\n")
+ end
+ prev_node = prev_node.previous_element || nil
+ end
+ end
+ end
+
ac = ApplicationController.new
- html = ac.render_to_string "deploy/_metadata_tree", :locals => { :meta_array => metadata_array }
+ html = ac.render_to_string "deploy/_metadata_tree", :locals => { :metadata_array => metadata_array, :mode => mode }
resp.body = html
rescue Exception => e
resp['Content-Type'] = 'json'
@@ -147,7 +230,6 @@ def do_POST(req, resp)
end
end
-
class ProjectServlet < WEBrick::HTTPServlet::AbstractServlet
def do_POST(req, resp)
begin
@@ -184,7 +266,23 @@ def do_POST(req, resp)
end
end
end
-
+
+ class ProjectEditServlet < WEBrick::HTTPServlet::AbstractServlet
+ def do_POST(req, resp)
+ begin
+ tree = eval(req.query["tree"])
+ result = MavensMate.clean_project({ :update_sobjects => false, :update_package => true, :package => tree, :force_return => true })
+ if result[:success] == true
+ `killAll MavensMate`
+ end
+ resp.body = result.to_json
+ rescue Exception => e
+ puts e.message + e.backtrace.join("\n")
+ resp.body = e.message.to_json
+ end
+ end
+ end
+
class MetadataNewServlet < WEBrick::HTTPServlet::AbstractServlet
def do_POST(req, resp)
begin
@@ -208,20 +306,46 @@ def do_POST(req, resp)
class AuthenticationServlet < WEBrick::HTTPServlet::AbstractServlet
def do_GET(req, resp)
begin
+ update_creds = req.query["update_creds"] || false
sid = nil
murl = nil
client = MavensMate::Client.new({
:username => req.query["un"],
:password => req.query["pw"],
- :endpoint => req.query["server_url"]
+ :endpoint => req.query["server_url"],
+ :override_session => req.query["override_session"] || false
})
if ! client.sid.nil? && ! client.metadata_server_url.nil?
- result = {
- :success => true,
- :sid => client.sid,
- :murl => client.metadata_server_url
- }
- resp.body = result.to_json
+ if update_creds
+ if RUBY_VERSION =~ /1.9/
+ Encoding.default_external = Encoding::UTF_8
+ Encoding.default_internal = Encoding::UTF_8
+ end
+ ENV['MM_CURRENT_PROJECT_DIRECTORY'] = req.query["pd"].to_s
+ un = req.query["un"].to_s
+ pw = req.query["pw"].to_s
+ server_url = req.query["server_url"].to_s
+ environment = (server_url.include? "test") ? "sandbox" : "production"
+ require 'yaml'
+ yml = YAML::load(File.open("#{ENV['MM_CURRENT_PROJECT_DIRECTORY']}/config/settings.yaml"))
+ project_name = yml['project_name'].to_s
+ yml['username'] = un
+ yml['environment'] = environment
+ File.open("#{ENV['MM_CURRENT_PROJECT_DIRECTORY']}/config/settings.yaml", 'w') { |f| YAML.dump(yml, f) }
+ MavensMate.add_to_keychain(project_name, pw)
+ result = {
+ :success => true,
+ :message => "Credentials successfully updated!"
+ }
+ resp.body = result.to_json
+ else
+ result = {
+ :success => true,
+ :sid => client.sid,
+ :murl => client.metadata_server_url
+ }
+ resp.body = result.to_json
+ end
end
rescue Exception => e
result = {
View
8 support/lib/mavensmate.rb
@@ -324,7 +324,7 @@ def self.clean_project(options={})
require 'fileutils'
FileUtils.rm_r "#{pd}/config/objects" if File.directory? "#{pd}/config/objects"
MavensMate::FileFactory.clean_directory("#{pd}/config/objects", ".object")
- client = MavensMate::Client.new
+ client = MavensMate::Client.new({:override_session => true})
threads << Thread.new {
thread_client = MavensMate::Client.new({ :sid => client.sid, :metadata_server_url => client.metadata_server_url })
if options[:package]
@@ -351,13 +351,15 @@ def self.clean_project(options={})
Dir.mkdir("#{ENV['MM_CURRENT_PROJECT_DIRECTORY']}/config") unless File.exists?("#{ENV['MM_CURRENT_PROJECT_DIRECTORY']}/config")
MavensMate::FileFactory.put_object_metadata(get_project_name, object_zip)
}
- threads.each { |aThread| aThread.join }
end
- result = { :success => true }
+ threads.each { |aThread| aThread.join }
+ result = { :success => true }
+ return result if options[:force_return]
puts result.to_json
rescue Exception => e
#alert e.message + "\n" + e.backtrace.join("\n")
result = { :success => false, :message => +e.message + "\n" + e.backtrace.join("\n") }
+ return result if options[:force_return]
puts result.to_json
end
end
View
11 support/resource/js/mavensmate.js
@@ -57,17 +57,6 @@ function submitFormOnEnter() {
});
}
-//update project
-function updateProject() {
- $('#result_output').html(
- dispatch({
- controller: 'project',
- action: 'update',
- tree: get_tree()
- })
- );
-}
-
//gets tree content in ruby hash form
function get_tree() {
var json = { }
Please sign in to comment.
Something went wrong with that request. Please try again.