ref: refs/heads/eula
commit c71cd8de35c72ca18ae74834884c928eee0b40f4
Author: J. Daniel Schmidt
Date: Tue Sep 29 18:58:39 2009 +0200
initial checkin of the registration module skeleton
---
plugins/registration/.gitignore | 5 +
plugins/registration/MIT-LICENSE | 20 +++++
plugins/registration/README | 7 ++
plugins/registration/Rakefile | 10 +++
.../app/controllers/registration_controller.rb | 17 ++++
plugins/registration/app/models/registration.rb | 8 ++
.../app/views/registration/show.html.erb | 1 +
.../app/views/registration/show.json.erb | 1 +
.../app/views/registration/show.xml.erb | 1 +
plugins/registration/config/rails_parent.rb | 15 ++++
.../registration/config/resources/registration.yml | 5 +
plugins/registration/doc/README_FOR_APP | 1 +
plugins/registration/init.rb | 1 +
plugins/registration/install.rb | 1 +
.../package/yast2-webservice-registration.changes | 5 +
.../package/yast2-webservice-registration.spec | 80 ++++++++++++++++++++
plugins/registration/tasks/registration_tasks.rake | 6 ++
.../functional/registration_controller_test.rb | 2 +
plugins/registration/test/test_helper.rb | 52 +++++++++++++
.../registration/test/unit/registration_test.rb | 2 +
plugins/registration/uninstall.rb | 1 +
21 files changed, 241 insertions(+), 0 deletions(-)
diff --git a/plugins/registration/.gitignore b/plugins/registration/.gitignore
new file mode 100644
index 0000000..d8d8ae2
--- /dev/null
+++ b/plugins/registration/.gitignore
@@ -0,0 +1,5 @@
+package/www/
+package/www.tar.bz2
+coverage
+doc/app
+nbproject
diff --git a/plugins/registration/MIT-LICENSE b/plugins/registration/MIT-LICENSE
new file mode 100644
index 0000000..61427ea
--- /dev/null
+++ b/plugins/registration/MIT-LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2009 J. Daniel Schmidt
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/plugins/registration/README b/plugins/registration/README
new file mode 100644
index 0000000..2723913
--- /dev/null
+++ b/plugins/registration/README
@@ -0,0 +1,7 @@
+Language
+==========
+
+REST interface for setting system language.
+
+
+Copyright (c) 2009 Novell, released under the MIT license
diff --git a/plugins/registration/Rakefile b/plugins/registration/Rakefile
new file mode 100644
index 0000000..8f4c2f2
--- /dev/null
+++ b/plugins/registration/Rakefile
@@ -0,0 +1,10 @@
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+require 'rake/packagetask'
+require File.join(File.dirname(__FILE__), 'config', 'rails_parent')
+require File.join(RailsParent.parent, 'config', 'boot')
+require 'tasks/rails'
+
+desc 'Default: run unit tests.'
+task :default => :test
diff --git a/plugins/registration/app/controllers/registration_controller.rb b/plugins/registration/app/controllers/registration_controller.rb
new file mode 100644
index 0000000..77f34c6
--- /dev/null
+++ b/plugins/registration/app/controllers/registration_controller.rb
@@ -0,0 +1,17 @@
+# = Registration controller
+# Provides access to the registration of the system at NCC/SMT.
+class RegistrationController < ApplicationController
+
+ before_filter :login_required
+
+
+ def update
+ end
+
+ def create
+ end
+
+ def show
+ end
+
+end
diff --git a/plugins/registration/app/models/registration.rb b/plugins/registration/app/models/registration.rb
new file mode 100644
index 0000000..da97670
--- /dev/null
+++ b/plugins/registration/app/models/registration.rb
@@ -0,0 +1,8 @@
+
+# = Registration model
+# Provides methods to call the registration in a RESTful environment.
+# The main goal is to provide easy access to the registration workflow,
+# the caller must interpret the result and maybe call it again with
+# changed values.
+class Registration
+end
diff --git a/plugins/registration/app/views/registration/show.html.erb b/plugins/registration/app/views/registration/show.html.erb
new file mode 100644
index 0000000..8625c48
--- /dev/null
+++ b/plugins/registration/app/views/registration/show.html.erb
@@ -0,0 +1 @@
+<%= @registration.to_xml -%>
diff --git a/plugins/registration/app/views/registration/show.json.erb b/plugins/registration/app/views/registration/show.json.erb
new file mode 100644
index 0000000..6214810
--- /dev/null
+++ b/plugins/registration/app/views/registration/show.json.erb
@@ -0,0 +1 @@
+<%= @registration.to_json -%>
diff --git a/plugins/registration/app/views/registration/show.xml.erb b/plugins/registration/app/views/registration/show.xml.erb
new file mode 100644
index 0000000..8625c48
--- /dev/null
+++ b/plugins/registration/app/views/registration/show.xml.erb
@@ -0,0 +1 @@
+<%= @registration.to_xml -%>
diff --git a/plugins/registration/config/rails_parent.rb b/plugins/registration/config/rails_parent.rb
new file mode 100644
index 0000000..b869908
--- /dev/null
+++ b/plugins/registration/config/rails_parent.rb
@@ -0,0 +1,15 @@
+class RailsParent
+
+ def RailsParent.parent
+ parent = ENV["RAILS_PARENT"]
+ unless parent
+ parent = File.expand_path(File.join('..','..','..', 'webservice'), File.dirname(__FILE__))
+ unless File.directory?( parent || "" )
+ $stderr.puts "Nope: #{parent}\nPlease set RAILS_PARENT environment"
+ exit 1
+ end
+ end
+ parent
+ end
+
+end
diff --git a/plugins/registration/config/resources/registration.yml b/plugins/registration/config/resources/registration.yml
new file mode 100644
index 0000000..7fecfcf
--- /dev/null
+++ b/plugins/registration/config/resources/registration.yml
@@ -0,0 +1,5 @@
+
+interface: org.opensuse.yast.modules.yapi.registration
+controller: registration
+singular: true
+
diff --git a/plugins/registration/doc/README_FOR_APP b/plugins/registration/doc/README_FOR_APP
new file mode 100644
index 0000000..cea2462
--- /dev/null
+++ b/plugins/registration/doc/README_FOR_APP
@@ -0,0 +1 @@
+Registration. Provides basic interface to register a system at NCC/SMT.
diff --git a/plugins/registration/init.rb b/plugins/registration/init.rb
new file mode 100644
index 0000000..3c19a74
--- /dev/null
+++ b/plugins/registration/init.rb
@@ -0,0 +1 @@
+# Include hook code here
diff --git a/plugins/registration/install.rb b/plugins/registration/install.rb
new file mode 100644
index 0000000..f7732d3
--- /dev/null
+++ b/plugins/registration/install.rb
@@ -0,0 +1 @@
+# Install hook code here
diff --git a/plugins/registration/package/yast2-webservice-registration.changes b/plugins/registration/package/yast2-webservice-registration.changes
new file mode 100644
index 0000000..4cca67e
--- /dev/null
+++ b/plugins/registration/package/yast2-webservice-registration.changes
@@ -0,0 +1,5 @@
+-------------------------------------------------------------------
+Tue Sep 29 18:44:28 CEST 2009 - jdsn@suse.de
+
+- initial checkin
+
diff --git a/plugins/registration/package/yast2-webservice-registration.spec b/plugins/registration/package/yast2-webservice-registration.spec
new file mode 100644
index 0000000..2d25920
--- /dev/null
+++ b/plugins/registration/package/yast2-webservice-registration.spec
@@ -0,0 +1,80 @@
+#
+# spec file for package yast2-webservice-registration
+#
+# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# This file and all modifications and additions to the pristine
+# package are under the same license as the package itself.
+#
+# Please submit bugfixes or comments via http://bugs.opensuse.org/
+#
+
+
+Name: yast2-webservice-registration
+PreReq: yast2-webservice
+Provides: yast2-webservice:/srv/www/yastws/app/controllers/registration_controller.rb
+License: MIT
+Group: Productivity/Networking/Web/Utilities
+Autoreqprov: on
+Version: 0.0.1
+Release: 0
+Summary: YaST2 - Webservice - Registration
+Source: www.tar.bz2
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+BuildArch: noarch
+BuildRequires: rubygem-mocha
+Requires: yast2-core > 2.18.14
+
+#
+%define pkg_user yastws
+%define plugin_name registration
+#
+
+
+%description
+YaST2 - Webservice - REST based interface for the registration of a system at NCC or SMT
+
+Authors:
+--------
+ J. Daniel Schmidt
+
+%prep
+%setup -q -n www
+
+%build
+
+%install
+
+#
+# Install all web and frontend parts.
+#
+mkdir -p $RPM_BUILD_ROOT/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}
+cp -a * $RPM_BUILD_ROOT/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+#
+# granting all permissions for root
+#
+/etc/yastws/tools/policyKit-rights.rb --user root --action grant >& /dev/null || :
+
+%files
+%defattr(-,root,root)
+%dir /srv/www/%{pkg_user}
+%dir /srv/www/%{pkg_user}/vendor
+%dir /srv/www/%{pkg_user}/vendor/plugins
+%dir /srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}
+%dir /srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/doc
+/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/MIT-LICENSE
+/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/README
+/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/Rakefile
+/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/init.rb
+/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/install.rb
+/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/uninstall.rb
+/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/app
+/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/config
+/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/tasks
+#/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/test
+/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/doc/README_FOR_APP
+
diff --git a/plugins/registration/tasks/registration_tasks.rake b/plugins/registration/tasks/registration_tasks.rake
new file mode 100644
index 0000000..aaab452
--- /dev/null
+++ b/plugins/registration/tasks/registration_tasks.rake
@@ -0,0 +1,6 @@
+begin
+ require 'tasks/webservice'
+rescue LoadError => e
+ $stderr.puts "Install rubygem-yast2-webservice-tasks.rpm"
+end
+
diff --git a/plugins/registration/test/functional/registration_controller_test.rb b/plugins/registration/test/functional/registration_controller_test.rb
new file mode 100644
index 0000000..ebe3e15
--- /dev/null
+++ b/plugins/registration/test/functional/registration_controller_test.rb
@@ -0,0 +1,2 @@
+class RegistrationControllerTest < ActionController::TestCase
+end
diff --git a/plugins/registration/test/test_helper.rb b/plugins/registration/test/test_helper.rb
new file mode 100644
index 0000000..54d2979
--- /dev/null
+++ b/plugins/registration/test/test_helper.rb
@@ -0,0 +1,52 @@
+ENV["RAILS_ENV"] = "test"
+# find the rails parent
+require File.join(File.dirname(__FILE__), '..', 'config', 'rails_parent')
+# first config rails
+require File.expand_path( File.join("config","environment"), RailsParent.parent )
+# then enable testing, this will get the routing right
+require 'test_help'
+
+class ActiveSupport::TestCase
+ # Transactional fixtures accelerate your tests by wrapping each test method
+ # in a transaction that's rolled back on completion. This ensures that the
+ # test database remains unchanged so your fixtures don't have to be reloaded
+ # between every test method. Fewer database queries means faster tests.
+ #
+ # Read Mike Clark's excellent walkthrough at
+ # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
+ #
+ # Every Active Record database supports transactions except MyISAM tables
+ # in MySQL. Turn off transactional fixtures in this case; however, if you
+ # don't care one way or the other, switching from MyISAM to InnoDB tables
+ # is recommended.
+ #
+ # The only drawback to using transactional fixtures is when you actually
+ # need to test transactions. Since your test is bracketed by a transaction,
+ # any transactions started in your code will be automatically rolled back.
+ self.use_transactional_fixtures = true
+
+ # Instantiated fixtures are slow, but give you @david where otherwise you
+ # would need people(:david). If you don't want to migrate your existing
+ # test cases which use the @david style and don't mind the speed hit (each
+ # instantiated fixtures translates to a database query per test method),
+ # then set this back to true.
+ self.use_instantiated_fixtures = false
+
+ # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
+ #
+ # Note: You'll currently still have to declare fixtures explicitly in integration tests
+ # -- they do not yet inherit this setting
+ fixtures :all
+
+ # Add more helper methods to be used by all tests here...
+
+ # See http://pennysmalls.com/2009/03/04/rails-23-breakage-and-fixage/
+ def clean_backtrace(&block)
+ yield
+ rescue ActiveSupport::TestCase::Assertion => error
+ framework_path = Regexp.new(File.expand_path("#{File.dirname(__FILE__)}/assertions"))
+ error.backtrace.reject! { |line| File.expand_path(line) =~ framework_path }
+ raise
+ end
+
+end
diff --git a/plugins/registration/test/unit/registration_test.rb b/plugins/registration/test/unit/registration_test.rb
new file mode 100644
index 0000000..038114b
--- /dev/null
+++ b/plugins/registration/test/unit/registration_test.rb
@@ -0,0 +1,2 @@
+class RegistrationTest < ActiveSupport::TestCase
+end
diff --git a/plugins/registration/uninstall.rb b/plugins/registration/uninstall.rb
new file mode 100644
index 0000000..9738333
--- /dev/null
+++ b/plugins/registration/uninstall.rb
@@ -0,0 +1 @@
+# Uninstall hook code here
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org