我最近重组了我的dotfiles,住在一个Git存储库中~/Dropbox/dotfiles,我正在使用病原体将所有Vim插件捆绑在里面~/Dropbox/dotfiles/home/.vim/bundle.这些插件作为Git子模块添加.
现在的问题是,当我运行Vim时,它会自动生成所有插件的文档,并将它们放在每个子模块目录中.这会将未跟踪的内容添加到子模块中,我希望避免这些内容.
ruby-1.8.7-p330@gs ~/Dropbox/dotfiles ‹master*› $ git st
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
# (commit or discard the untracked or modified content in submodules)
#
# modified: home/.vim/bundle/fuzzyfinder (untracked content)
# modified: home/.vim/bundle/l9 (untracked content)
# modified: home/.vim/bundle/matchit (untracked content)
# modified: home/.vim/bundle/ruby (untracked content)
# ...
no changes …Run Code Online (Sandbox Code Playgroud) 我正在使用Savon gem使用类似于下面的代码来发出SOAP请求.它工作正常,但我想查看/捕获请求XML而不实际调用他们的服务器.通过在请求之后粘贴调试器行并检查客户端变量,我可以在发出请求后立即查看它.
有没有人知道在不实际发出请求的情况下查看请求XML的方法?我希望能够使用Cucumber或Rspec对模式验证XML.
client = Savon::Client.new do |wsdl, http|
wsdl.document = "http://fakesite.org/fake.asmx?wsdl"
end
client.request(:testpostdata, :xmlns => "http://fakesite.org/") do
soap.header = { :cAuthentication => {"UserName" => "MyName", "Password" => "MyPassword" } }
soap.body = { :xml_data => to_xml }
end
Run Code Online (Sandbox Code Playgroud) 可能重复:
在"EVERY"选项卡中自动打开NERDTree
有没有办法:NERDTree在首次启动VIM时自动执行命令或将NERDTree配置为始终在启动时打开?
请关闭.刚刚注意到之前已经回答过这个问题:
在"EVERY"选项卡中自动打开NERDTree
全局配置RSpec是否可以为所有请求规范使用Capybara(默认或自定义)JavaScript驱动程序?我们有时会忘记手动添加js: true到每个请求规范,这有点烦人.
给出一个像这样的xml字符串:
<some><nested><xml>value</xml></nested></some>
Run Code Online (Sandbox Code Playgroud)
什么是最好的选择(使用ruby)将其格式化为可读的东西:
<some>
<nested>
<xml>value</xml>
</nested>
</some>
Run Code Online (Sandbox Code Playgroud) 我正在使用Savon为SOAP服务编写Ruby接口.它似乎正在工作,但我在命令行上出现了几个DEBUG消息
D, [2011-02-15T16:33:32.664620 #4140] DEBUG -- : HTTPI tried to use the httpclient adapter, but was unable to find the library in the LOAD_PATH. Falling back
using the net_http adapter now.
D, [2011-02-15T16:33:32.820863 #4140] DEBUG -- : HTTPI executes HTTP POST using the net_http adapter
D, [2011-02-15T16:33:32.664620 #4140] DEBUG -- : HTTPI tried to use the httpclient adapter, but was unable to find the library in the LOAD_PATH. Falling back
using the net_http adapter now.
D, [2011-02-15T16:33:32.820863 #4140] DEBUG -- …
我正在努力让Savon宝石连接到我们的服务器之一.我不断收到错误声明我无法通过ssl.我已经阅读了大量的教程和修复,但似乎都没有.
任何帮助表示赞赏 - 这将使我的星期一,如果我可以通过它:-).
错误:
D, [2011-06-20T09:43:02.002993 #10328] DEBUG -- : Retrieving WSDL from: http://path_to_wsdl:4443/sm/services/mailing/2009/03/02?wsdl
D, [2011-06-20T09:43:02.129057 #10328] DEBUG -- : HTTPI executes HTTP GET using the httpclient adapter
/.rvm/gems/ruby-1.9.2-p0/gems/httpclient-2.2.1/lib/httpclient/session.rb:276:in `connect': SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: sslv3 alert unexpected message (OpenSSL::SSL::SSLError)
Run Code Online (Sandbox Code Playgroud)
我的代码:
require 'savon'
client = Savon::Client.new "path_to_my_wsdl"
client.http.auth.ssl.cert_file = "path/cert.pem"
client.http.auth.ssl.cert_key_file = "/path/localhost.key"
client.http.auth.ssl.verify_mode = :none
client.wsse.credentials "username", "password"
client.wsdl.soap_actions
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用ruby和Savon来使用Web服务.
测试服务是http://www.webservicex.net/WS/WSDetails.aspx?WSID=9&CATID=2
require 'rubygems'
require 'savon'
client = Savon::Client.new "http://www.webservicex.net/stockquote.asmx?WSDL"
client.get_quote do |soap|
soap.body = {:symbol => "AAPL"}
end
返回SOAP异常.检查soap信封,它在我看来soap请求没有正确的命名空间.
任何人都可以建议我可以做些什么来使这项工作?我也遇到与其他Web服务端点相同的问题.
谢谢,
我在解析 SOAP 响应时遇到问题。
这是我的代码:
require 'rubygems'
require 'savon'
client = Savon::Client.new "http://1.2.3.4/xyz/abcd/fsds.wsdl"
res = client.query_unpaid_assesments do |soap,wsse|
soap.namespaces["xmlns:SOAP-ENV"] = "http://schemas.xmlsoap.org/soap/envelope/"
soap.namespaces["xmlns:xsi"] = "http://www.w3.org/2001/XMLSchema-instance"
soap.namespaces["xmlns:xsd"] = "http://www.w3.org/2001/XMLSchema"
wsse.username="xyz"
wsse.password="123"
soap.body = {:orderNumber => 111222333 }
end
response = Savon::Response#to_hash
hres = response.to_hash
all_data = hres[:response][:asses_data][:date][:amount][:assesReference][:year][:cusOffCode][:serie][:number][:date][:time]
Run Code Online (Sandbox Code Playgroud)
这是我遇到的错误:
Savon::Response:Class 的未定义方法to_hash(NoMethodError)
“res”给了我 xml 响应,我想在哈希中得到它。
我阅读了之前的相关问题,他们建议使用 response.to_hash ,我这样做了并且抛出了上面指定的错误。我怎样才能摆脱这个错误并将我的响应放入哈希中。
谢谢你的帮助
我忘记发布我想要解析的 xml 响应的正文:
<soapenv:Body>
<response>
<ns203:assesData xmlns:ns203="http://asdfsd.sdfsd.zbc.org">
<ns203:date>2010-09-01</ns203:date>
<ns203:amount>34400</ns203:amount>
<ns203:asesReference>
<ns203:year>2010</ns203:year>
<ns203:cusOffCode>098</ns203:customsOfficeCode>
<ns203:serie>F</ns203:serie>
<ns203:number>524332</ns203:number>
<ns203:date>2010-11-11</ns203:date>
<ns203:time>10:11:103</ns203:time>
</ns203:assesReference>
</ns203:assesData>
</response>
</soapenv:Body>
Run Code Online (Sandbox Code Playgroud) 是否有适用于ruby的subversion客户端,可用于管理来自subversion项目的文本文件,图像和其他文档?它需要能够签出项目,更新和合并内容(不是自动的,但在发生问题时用差异或某些东西做出响应),提交等等.
请不要问我,我们是如何到达那里;),但我们的CMS实际上只是一个SVN项目(包括文本文件,其中包括HTML,图像和其他文件),我们想建什么样的前端的红宝石人们可以在那里编辑文本文件,上传新文档等.
所以我们需要所有这些svn功能,我们希望以某种方式抽象它们,这样我们就不必使用与svn客户端安装交互的bash命令了.
我有一行Ruby代码看起来像这样:
words = params[:words].gsub("\n","").gsub("\s","")
Run Code Online (Sandbox Code Playgroud)
有没有更好的方法来执行此操作,因为代码占用所有空格和换行符并摆脱它们?只是好奇,如果有更好或更短的方式,在我的代码中过于重复的情况下.上面的代码对我有用,但我是编程的新手,并希望在可能的情况下做得更好/更美观.