Tag: 木偶

Marionette CompositeView为Collection中的每个Model而不是ItemView(Marionette Rails)渲染自己

基本上,我正在尝试将CompositeView渲染为带有表头的简单四列列表,其中集合中的每个模型都呈现为a并附加到。 我跟着Derick的一个例子非常接近,只有一点变化,但不幸的是有一些非常奇怪的结果。 视图不是呈现每个itemView,而是引用自身并为集合中的每个项重新呈现,从而生成新的表和表头。 在此之前,它正在渲染复合视图。 我有一个itemView,其模板是一组项目,以及一个引用它的复合视图,它是一个表 CompositeView: class App.module(‘Views.Parts’).Index extends Backbone.Marionette.CompositeView template: ‘parts/index’ itemView: App.Views.Parts.Part tagName: ‘table’ itemViewContainer: ‘tbody’ appendHtml: (collectionView, itemView, index)-> collectionView.$el.append(itemView.el) ItemView: class App.module(‘Views.Parts’).Part extends Backbone.App.ItemView tagName: ‘tr’ template: ‘parts/part’ events: “click .destroy”: “destroy” destroy: (e) -> e.preventDefault() @model.destroy() onRender: -> @stickIt() 控制器 class App.Controllers.Parts constructor: -> @parts = new App.Collections.Parts @parts.reset(App.parts) App.parts […]

Marionette.js与Rails(设计)认证

好奇人们通常如何处理这个问题。 我的策略是拥有授权的根路由和未经授权的根路由。 授权用户将直接发送到我的marionette.js单页应用程序,未经过授权的用户将被发送到标准的rails登录页面,并可选择登录或注册。 您似乎可以将这些全部组合到单页应用程序中。 您可以根据附加到元素的类来显示/隐藏ui元素,这些元素基于查看它们所需的授权(注册,管理,管理员等)。 您还可以在路由器中添加某种“before_filter”,以检查用户是否可以根据其角色访问此路由。 在这种情况下,我不确定如何处理登录/注册。 您可以设置自己的api路由,这些路由可以通过POST来传递设计工作吗? 思考? 策略? 这里最好的做法是什么?

无法在定义的类型中创建文件

我想在定义的类型中创建文件。 我已经尝试了几种方法,但无法解决问题。 让我解释一下我的情况。 我正在使用temapltes创建一些文件,我可以完美地完成该操作。 我使用下面的ruby函数来收集文件名,位置类型的数据 require ‘rexml/document’ include REXML module Puppet::Parser::Functions newfunction(:getConfigFileDetails, :type => :rvalue ) do |args| fileDetails= [] doc = REXML::Document.new args[0] doc.elements.each(“node/congfigurations/config”) { |config| fileName= config.elements[“@fileName”].value fileLocation= config.elements[“@location”].value fileDetails < fileName, ‘filelocation’=> fileLocation} } return fileDetails end end 我在我的puppet类中使用这个函数,它对我来说很好 define fill_templates() { $fileName = $name[“filename”] $fileLocation = $name[‘filelocation’] file { “${fileLocation}/${fileName}/”: ensure […]

用puppet设置环境变量

我正在尝试找出用puppet设置一些环境变量的最佳方法。 我可以使用exec,只是export VAR=blah 。 但是,这只会持续到本届会议。 我还想过将它添加到文件的末尾,比如bashrc。 然而,我不认为有一种可靠的方法可以检查它是否已经准备就绪; 所以它最终会被添加到每一轮木偶中。

未定义的局部变量或方法 – 使用Beaker测试Puppet模块

我对这一切都很陌生。 我正在尝试使用Beaker测试一个木偶模块。 我一直这样: NoMethodError: undefined method `describe’ for #Beaker::TestCase:0x007fd6f95e6460 /Users/user1/beaker/Puppet/puppet-files/spec/classes/unit_spec.rb:3 /Users/user1/.rvm/gems/ruby-2.2.7/gems/beaker-3.24.0/bin/beaker:9 /Users/user1/.rvm/gems/ruby-2.2.7/bin/ruby_executable_hooks:15 /Users/user1/.rvm/gems/ruby-2.2.7/bin/ruby_executable_hooks:15. This is the command that I’m running – “beaker –hosts myhost.yaml –pre-suite spec”. 我的unit_spec.rb包含: require ‘puppetlabs_spec_helper/rake_tasks’ describe ‘application’ do context ‘applied to supported operating system’ do on_supported_os.each do |os, facts| context “#{os}” do let(:facts) do facts end context “without any parameters” do […]

在ruby中将ip地址转换为32位整数

我试图找到一种方法将Ruby地址转换为32位整数,用于木偶模板。 这就是我在bash中进行转换的方式。 root@ubuntu-server2:~# cat test.sh #!/bin/bash #eth0 address is 10.0.2.15 privip=`ifconfig eth0 | grep “inet addr:” | cut -d : -f 2 | cut -d ” ” -f 1` ; echo “Private IP: ${privip}” ; # Turn it into unsigned 32-bit integer ipiter=3 ; for ipoctet in `echo ${privip} | tr . ” “` ; […]