summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--History.txt5
-rw-r--r--Manifest.txt7
-rw-r--r--README.txt44
-rw-r--r--Rakefile21
-rw-r--r--bin/marionette0
-rw-r--r--lib/marionette.rb26
-rw-r--r--lib/marionette/helper.rb24
-rw-r--r--lib/marionette/resource.rb87
-rw-r--r--lib/marionette/resource/file.rb66
-rw-r--r--spec/spec_helper.rb20
-rw-r--r--spec/unit/marionette_spec.rb26
-rw-r--r--spec/unit/resource/file_spec.rb58
-rw-r--r--spec/unit/resource_spec.rb70
-rw-r--r--tasks/rspec.rb8
14 files changed, 462 insertions, 0 deletions
diff --git a/History.txt b/History.txt
new file mode 100644
index 0000000000..d7b1defce5
--- /dev/null
+++ b/History.txt
@@ -0,0 +1,5 @@
+=== 1.0.0 / 2008-03-05
+
+* 1 major enhancement
+ * Birthday!
+
diff --git a/Manifest.txt b/Manifest.txt
new file mode 100644
index 0000000000..990172d4b5
--- /dev/null
+++ b/Manifest.txt
@@ -0,0 +1,7 @@
+History.txt
+Manifest.txt
+README.txt
+Rakefile
+bin/marionette
+lib/marionette.rb
+test/test_marionette.rb \ No newline at end of file
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000000..5a4b5989de
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,44 @@
+= marionette
+
+* http://oss.hjksolutions.com/marionette
+
+== DESCRIPTION:
+
+Marionette is a configuration management tool inspired by Puppet.
+
+== FEATURES/PROBLEMS:
+
+* Uses a Ruby DSL in place of the puppet language
+* Drastically simpler implementation
+
+== SYNOPSIS:
+
+ FIX (code sample of usage)
+
+== REQUIREMENTS:
+
+* FIX (list of requirements)
+
+== INSTALL:
+
+* FIX (sudo gem install, anything else)
+
+== LICENSE:
+
+Marionette - A configuration management system
+
+Copyright 2008 HJK Solutions
+
+This program and entire repository is free software; you can
+redistribute it and/or modify it under the terms of the GNU
+General Public License as published by the Free Software
+Foundation; either version 2 of the License, or any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 0000000000..9ba3b6b619
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,21 @@
+# -*- ruby -*-
+
+require 'rubygems'
+require 'hoe'
+require './lib/marionette.rb'
+require './tasks/rspec.rb'
+# require Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rb')].sort.each do |lib|
+# require lib
+# end
+
+Hoe.new('marionette', Marionette::VERSION) do |p|
+ p.rubyforge_name = 'marionette'
+ p.author = 'Adam Jacob'
+ p.email = 'adam@hjksolutions.com'
+ p.summary = 'A configuration management system'
+ p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
+ p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
+ p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
+end
+
+# vim: syntax=Ruby
diff --git a/bin/marionette b/bin/marionette
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/bin/marionette
diff --git a/lib/marionette.rb b/lib/marionette.rb
new file mode 100644
index 0000000000..9ad45671f8
--- /dev/null
+++ b/lib/marionette.rb
@@ -0,0 +1,26 @@
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: GNU General Public License version 2 or later
+#
+# This program and entire repository is free software; you can
+# redistribute it and/or modify it under the terms of the GNU
+# General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+require 'rubygems'
+
+Dir[File.join(File.dirname(__FILE__), 'marionette/**/*.rb')].sort.each { |lib| require lib }
+
+class Marionette
+ VERSION = '0.0.1'
+end
diff --git a/lib/marionette/helper.rb b/lib/marionette/helper.rb
new file mode 100644
index 0000000000..922f9449e1
--- /dev/null
+++ b/lib/marionette/helper.rb
@@ -0,0 +1,24 @@
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: GNU General Public License version 2 or later
+#
+# This program and entire repository is free software; you can
+# redistribute it and/or modify it under the terms of the GNU
+# General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+class Marionette
+ module Helper
+
+ end
+end \ No newline at end of file
diff --git a/lib/marionette/resource.rb b/lib/marionette/resource.rb
new file mode 100644
index 0000000000..b821d6f90b
--- /dev/null
+++ b/lib/marionette/resource.rb
@@ -0,0 +1,87 @@
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: GNU General Public License version 2 or later
+#
+# This program and entire repository is free software; you can
+# redistribute it and/or modify it under the terms of the GNU
+# General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+require 'yaml'
+
+class Marionette
+ class Resource
+
+ attr_accessor :before, :require, :notify, :subscribe, :tag
+
+ def initialize(name)
+ @name = name
+ @tag = Array.new
+ @alias = nil
+ @noop = nil
+ @tag = nil
+ @before = nil
+ @require = nil
+ @notify = nil
+ @subscribe = nil
+ @tag = nil
+ end
+
+ def name
+ @name
+ end
+
+ def name=(name)
+ raise ArgumentError, "name must be a string!" unless name.kind_of?(String)
+ @name = name
+ end
+
+ def alias
+ @alias
+ end
+
+ def alias=(alias_name)
+ raise ArgumentError, "alias must be a string!" unless alias_name.kind_of?(String)
+ @alias = alias_name
+ end
+
+ def noop
+ @noop
+ end
+
+ def noop=(tf)
+ raise ArgumentError, "noop must be true or false!" unless tf == true || tf == false
+ @noop = tf
+ end
+
+ def tag
+ @tag
+ end
+
+ def tag=(args)
+ if args.kind_of?(Array)
+ args.each do |t|
+ @tag << t
+ end
+ else
+ @tag << args
+ end
+ @tag
+ end
+
+ def valid?()
+ return false unless self.name
+ true
+ end
+ end
+end \ No newline at end of file
diff --git a/lib/marionette/resource/file.rb b/lib/marionette/resource/file.rb
new file mode 100644
index 0000000000..f721a5f1b7
--- /dev/null
+++ b/lib/marionette/resource/file.rb
@@ -0,0 +1,66 @@
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: GNU General Public License version 2 or later
+#
+# This program and entire repository is free software; you can
+# redistribute it and/or modify it under the terms of the GNU
+# General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+class Marionette
+ class Resource
+ class File < Marionette::Resource
+ attr_accessor :backup, :checksum, :ensure, :force, :group, :ignore, :links,
+ :mode, :owner, :path, :purge, :recurse, :replace, :target
+
+ def initialize(name)
+ super(name)
+ @backup = true
+ @checksum = "md5sum"
+ end
+
+ def backup
+ @backup
+ end
+
+ def backup=(arg)
+ case arg
+ when true
+ @backup = true
+ when false
+ @backup = false
+ when Integer
+ @backup = arg
+ else
+ raise ArgumentError, "backup must be true, false, or a number!"
+ end
+ end
+
+ def checksum
+ @checksum
+ end
+
+ def checksum=(arg)
+ case arg
+ when "md5sum"
+ @checksum = arg
+ when "mtime"
+ @checksum = arg
+ else
+ raise ArgumentError, "checksum must be md5sum or mtime!"
+ end
+ end
+
+ end
+ end
+end \ No newline at end of file
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
new file mode 100644
index 0000000000..314c81a5d9
--- /dev/null
+++ b/spec/spec_helper.rb
@@ -0,0 +1,20 @@
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: GNU General Public License version 2 or later
+#
+# This program and entire repository is free software; you can
+# redistribute it and/or modify it under the terms of the GNU
+# General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+require File.join(File.dirname(__FILE__), "..", "lib", "marionette")
diff --git a/spec/unit/marionette_spec.rb b/spec/unit/marionette_spec.rb
new file mode 100644
index 0000000000..58302e8b87
--- /dev/null
+++ b/spec/unit/marionette_spec.rb
@@ -0,0 +1,26 @@
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: GNU General Public License version 2 or later
+#
+# This program and entire repository is free software; you can
+# redistribute it and/or modify it under the terms of the GNU
+# General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+require File.join(File.dirname(__FILE__), "..", "spec_helper")
+
+describe Marionette do
+ it "should have a version defined" do
+ Marionette::VERSION.should match(/(\d+)\.(\d+)\.(\d+)/)
+ end
+end \ No newline at end of file
diff --git a/spec/unit/resource/file_spec.rb b/spec/unit/resource/file_spec.rb
new file mode 100644
index 0000000000..14641e79cd
--- /dev/null
+++ b/spec/unit/resource/file_spec.rb
@@ -0,0 +1,58 @@
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: GNU General Public License version 2 or later
+#
+# This program and entire repository is free software; you can
+# redistribute it and/or modify it under the terms of the GNU
+# General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
+
+describe Marionette::Resource::File do
+
+ before(:each) do
+ @resource = Marionette::Resource::File.new("fakey_fakerton")
+ end
+
+ it "should create a new Marionette::Resource::File" do
+ @resource.should be_a_kind_of(Marionette::Resource)
+ @resource.should be_a_kind_of(Marionette::Resource::File)
+ end
+
+ it "should have a name" do
+ @resource.name.should eql("fakey_fakerton")
+ end
+
+ it "should be set to back up files by default" do
+ @resource.backup.should eql(true)
+ end
+
+ it "should only accept true, false, or a number for backup" do
+ lambda { @resource.backup = true }.should_not raise_error(ArgumentError)
+ lambda { @resource.backup = false }.should_not raise_error(ArgumentError)
+ lambda { @resource.backup = 10 }.should_not raise_error(ArgumentError)
+ lambda { @resource.backup = "blues" }.should raise_error(ArgumentError)
+ end
+
+ it "should use the md5sum for checking changes by default" do
+ @resource.checksum.should eql("md5sum")
+ end
+
+ it "should accept md5sum or mtime for checksum" do
+ lambda { @resource.checksum = "md5sum" }.should_not raise_error(ArgumentError)
+ lambda { @resource.checksum = "mtime" }.should_not raise_error(ArgumentError)
+ lambda { @resource.checksum = "blues" }.should raise_error(ArgumentError)
+ end
+
+end \ No newline at end of file
diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb
new file mode 100644
index 0000000000..b6bd113283
--- /dev/null
+++ b/spec/unit/resource_spec.rb
@@ -0,0 +1,70 @@
+# Author:: Adam Jacob (<adam@hjksolutions.com>)
+# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
+# License:: GNU General Public License version 2 or later
+#
+# This program and entire repository is free software; you can
+# redistribute it and/or modify it under the terms of the GNU
+# General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+require File.join(File.dirname(__FILE__), "..", "spec_helper")
+
+describe Marionette::Resource do
+ before(:each) do
+ @resource = Marionette::Resource.new("funk")
+ end
+
+ it "should have a name" do
+ @resource.name.should eql("funk")
+ end
+
+ it "should create a new Marionette::Resource" do
+ @resource.should be_a_kind_of(Marionette::Resource)
+ end
+
+ it "should not be valid without a name" do
+ lambda { @resource.name = nil }.should raise_error(ArgumentError)
+ end
+
+ it "should always have a string for name" do
+ lambda { @resource.name = Hash.new }.should raise_error(ArgumentError)
+ end
+
+ it "should have a string for alias" do
+ lambda { @resource.alias = nil }.should raise_error(ArgumentError)
+ lambda { @resource.alias = 'foo' }.should_not raise_error(ArgumentError)
+ @resource.alias.should eql("foo")
+ end
+
+ it "should accept true or false for noop" do
+ lambda { @resource.noop = true }.should_not raise_error(ArgumentError)
+ lambda { @resource.noop = false }.should_not raise_error(ArgumentError)
+ lambda { @resource.noop = "eat it" }.should raise_error(ArgumentError)
+ end
+
+ it "should serialize to yaml" do
+ yaml_output = <<-DESC
+--- !ruby/object:Marionette::Resource
+alias:
+before:
+name: funk
+noop:
+notify:
+require:
+subscribe:
+tag:
+DESC
+ @resource.to_yaml.should eql(yaml_output)
+ end
+
+end \ No newline at end of file
diff --git a/tasks/rspec.rb b/tasks/rspec.rb
new file mode 100644
index 0000000000..f3c2d7d25b
--- /dev/null
+++ b/tasks/rspec.rb
@@ -0,0 +1,8 @@
+require 'rubygems'
+require 'rake'
+require 'spec/rake/spectask'
+
+desc "Run all examples"
+Spec::Rake::SpecTask.new('spec') do |t|
+ t.spec_files = FileList[File.join(File.dirname(__FILE__), "..", "spec", "**", "*.rb")]
+end