bring deltacloud more in line w/ rails based projects standards --- Makefile.am | 56 -------- Rakefile | 54 ++++++-- autogen.sh | 66 --------- config/contrib/deltacloud-aggregator.spec.in | 21 ++-- configure.ac | 11 -- src/.gitignore | 1 - src/.project | 12 -- src/README | 182 -------------------------- 8 files changed, 51 insertions(+), 352 deletions(-) delete mode 100644 Makefile.am delete mode 100755 autogen.sh delete mode 100644 configure.ac delete mode 100644 src/.gitignore delete mode 100644 src/.project delete mode 100644 src/README
diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index 7984035..0000000 --- a/Makefile.am +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (C) 2008 Red Hat, Inc. -# -# This program 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; version 2 of the License. -# -# 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 Street, Fifth Floor, Boston, -# MA 02110-1301, USA. A copy of the GNU General Public License is -# also available at http://www.gnu.org/copyleft/gpl.html. - -DELTACLOUD_CACHE_DIR ?= $(HOME)/deltacloud-cache - -EXTRA_DIST = \ - .gitignore \ - deltacloud-aggregator.spec \ - deltacloud-aggregator.spec.in \ - conf \ - src - -DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz - -# For Release: 0..., set _deltacloud_dev=1 so that we get extra_release.GIT- -# annotated rpm version strings. -_deltacloud_dev = \ - $(shell grep -q '^[[:space:]]*Release:[[:space:]]*0' \ - $(srcdir)/*.spec.in && echo 1 || :) - -git_head = $$(git log -1 --pretty=format:%h) -GIT_RELEASE = $$(date --utc +%Y%m%d%H%M%S)git$(git_head) -RPMDIR = $$(rpm --eval '%{_rpmdir}') -RPM_FLAGS = --define "deltacloud_cache_dir $(DELTACLOUD_CACHE_DIR)" -RPM_FLAGS += $(if $(_deltacloud_dev),--define "extra_release .$(GIT_RELEASE)") - -rpms: dist - rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz - -srpms: dist - rpmbuild $(RPM_FLAGS) -ts $(distdir).tar.gz - -publish: rpms - mkdir -p $(DELTACLOUD_CACHE_DIR) - rsync -aq $(shell rpm --eval '%{_rpmdir}')/ $(DELTACLOUD_CACHE_DIR)/deltacloud/ - rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(DELTACLOUD_CACHE_DIR)/deltacloud/src - createrepo $(DELTACLOUD_CACHE_DIR)/deltacloud - -genlangs: - cd src && rake updatepo && rake makemo - -.PHONY: rpms publish srpms genlangs diff --git a/Rakefile b/Rakefile index eebf798..a69e348 100644 --- a/Rakefile +++ b/Rakefile @@ -7,23 +7,49 @@ require(File.join(File.dirname(__FILE__), 'config', 'boot')) require 'rake' require 'rake/testtask' require 'rake/rdoctask' +require 'rake/gempackagetask' require 'tasks/rails' -# Do not require 'gettext/utils' here, it breaks rdoc, -# require it in tasks that actually need it instead -desc "Create mo-files for L10n" -task :makemo do - require 'gettext/utils' - GetText.create_mofiles(true, "po", "locale") +PKG_NAME='deltacloud-aggregator' +GEM_NAME=PKG_NAME +PKG_VERSION='0.0.2' +SPEC_FILE="deltacloud-aggregator.spec" + +PKG_FILES = FileList[ + "app/**/*", "config/**/*", "db/**/*", "dutils/**/*", "features/**/*", + "lib/**/*", "public/**/*", "script/**/*", "spec/**/*", "src/**/*", + "test/**/*", "vendor/**/*", "README", "AUTHORS", "COPYING", "Rakefile", "config.ru" +] + +DIST_FILES = FileList[ + "pkg/*.tgz", "pkg/*.gem" +] + +SPEC = Gem::Specification.new do |s| + s.name = GEM_NAME + s.version = PKG_VERSION + s.email = "[email protected]", + s.homepage = "http://deltacloud.org" + s.summary = "An API that abstracts the differences between clouds" + s.files = PKG_FILES + s.required_ruby_version = '>= 1.8.1' + s.description = "An API that abstracts the differences between clouds" +end + +Rake::GemPackageTask.new(SPEC) do |pkg| + pkg.need_tar = true + pkg.need_zip = true end -desc "Update pot/po files to match new version." -task :updatepo do - require 'gettext/utils' - MY_APP_TEXT_DOMAIN = "ovirt" - MY_APP_VERSION = "ovirt 0.0.1" - GetText.update_pofiles(MY_APP_TEXT_DOMAIN, - Dir.glob("{app,lib}/**/*.{rb,rhtml}"), - MY_APP_VERSION) +desc "Build (S)RPM for #{PKG_NAME}" +task :rpm => [ :package ] do |t| + system("sed -e 's/@VERSION@/#{PKG_VERSION}/' config/contrib/#{SPEC_FILE}.in > pkg/#{SPEC_FILE}") + Dir::chdir("pkg") do |dir| + dir = File::expand_path(".") + system("rpmbuild --define '_topdir #{dir}' --define '_sourcedir #{dir}' --define '_srcrpmdir #{dir}' --define '_rpmdir #{dir}' --define '_builddir #{dir}' -ba #{SPEC_FILE} > rpmbuild.log 2>&1") + if $? != 0 + raise "rpmbuild failed" + end + end end diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 72f9114..0000000 --- a/autogen.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh -# Run this to generate configure and Makefile - -srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. - -THEDIR=`pwd` -( - cd $srcdir - die=0 - - (autoconf --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have autoconf installed." - echo "Download the appropriate package for your distribution," - echo "or see http://www.gnu.org/software/autoconf" - die=1 - } - - # Require libtool only if one of of LT_INIT, - # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac. - grep -E '^[[:blank:]]*(LT_INIT|A[CM]_PROG_LIBTOOL)' configure.ac >/dev/null \ - && { - (libtool --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have libtool installed." - echo "Download the appropriate package for your distribution," - echo "or see http://www.gnu.org/software/libtool" - die=1 - } - } - - (automake --version) < /dev/null > /dev/null 2>&1 || { - echo - die=1 - echo "You must have automake installed." - echo "Download the appropriate package for your distribution," - echo "or see http://www.gnu.org/software/automake" - } - - test $die = 1 && exit 1 - - test -f deltacloud-aggregator.spec.in || { - echo "You must run this script in the top-level directory" - exit 1 - } - - if test -z "$*"; then - echo "I am going to run ./configure with no arguments - if you wish " - echo "to pass any to it, please specify them on the $0 command line." - fi - - aclocal - - # Run autoheader only if needed - grep '^[[:blank:]]*AC_CONFIG_HEADERS' configure.ac >/dev/null && autoheader - - automake --add-missing - autoconf - ./configure "$@" -) - -if test "x$OBJ_DIR" != x; then - mkdir -p "$OBJ_DIR" - cd "$OBJ_DIR" -fi diff --git a/config/contrib/deltacloud-aggregator.spec.in b/config/contrib/deltacloud-aggregator.spec.in index aee50ee..0ce8ef2 100644 --- a/config/contrib/deltacloud-aggregator.spec.in +++ b/config/contrib/deltacloud-aggregator.spec.in @@ -13,7 +13,7 @@ URL: http://deltacloud.org # until official source tarballs exist, checkout from source via # git clone git://git.fedorahosted.org/deltacloud/portal.git deltacloud-aggregator-0.0.2 # tar czvf deltacloud-aggregator-0.0.2.tar.gz deltacloud-aggregator-0.0.2 -Source0: deltacloud-aggregator-%{version}.tar.gz +Source0: deltacloud-aggregator-%{version}.tgz BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) BuildArch: noarch @@ -72,21 +72,22 @@ Documentation and tests for the Deltacloud Aggregator %{__mkdir} -p %{buildroot}%{_localstatedir}/log/%{name} %{__mkdir} -p %{buildroot}%{_localstatedir}/run/%{name} -# copy over all of the src directory... -%{__cp} -R src/* %{buildroot}/%{app_root} ++# copy rails project to app root ++%{__cp} -R ./* %{buildroot}%{app_root} # move documentation to the correct place -mv %{buildroot}/%{app_root}/doc %{buildroot}/%{app_root}/test %{buildroot}/%{doc_root} +%{__mv} %{buildroot}%{app_root}/features %{buildroot}%{app_root}/spec %{buildroot}%{app_root}/test %{buildroot}%{doc_root} # copy over init scripts and various config -%{__cp} conf/deltacloud-aggregator %{buildroot}%{_initrddir} -%{__cp} conf/deltacloud-portal.conf %{buildroot}%{_sysconfdir}/httpd/conf.d/deltacloud-aggregator.conf -%{__cp} conf/deltacloud-portal.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/deltacloud-aggregator -%{__cp} conf/deltacloud-aggregator.sysconf %{buildroot}%{_sysconfdir}/sysconfig/deltacloud-aggregator -%{__cp} conf/deltacloud-rails.sysconf %{buildroot}%{_sysconfdir}/sysconfig/deltacloud-rails +%{__mv} %{buildroot}%{app_root}/config/contrib/deltacloud-aggregator %{buildroot}%{_initrddir} +%{__mv} %{buildroot}%{app_root}/config/contrib/deltacloud-portal.conf %{buildroot}%{_sysconfdir}/httpd/conf.d/deltacloud-aggregator.conf +%{__mv} %{buildroot}%{app_root}/config/contrib/deltacloud-portal.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/deltacloud-aggregator +%{__mv} %{buildroot}%{app_root}/config/contrib/deltacloud-aggregator.sysconf %{buildroot}%{_sysconfdir}/sysconfig/deltacloud-aggregator +%{__mv} %{buildroot}%{app_root}/config/contrib/deltacloud-rails.sysconf %{buildroot}%{_sysconfdir}/sysconfig/deltacloud-rails + # move rails config to /etc, creating symlinks -%{__mv} %{buildroot}%{app_root}/config/database.yml %{buildroot}%{_sysconfdir}/%{name} +%{__mv} %{buildroot}%{app_root}/config/database.pg %{buildroot}%{_sysconfdir}/%{name}/database.yml %{__mv} %{buildroot}%{app_root}/config/environments/development.rb %{buildroot}%{_sysconfdir}/%{name} %{__mv} %{buildroot}%{app_root}/config/environments/production.rb %{buildroot}%{_sysconfdir}/%{name} %{__mv} %{buildroot}%{app_root}/config/environments/test.rb %{buildroot}%{_sysconfdir}/%{name} diff --git a/configure.ac b/configure.ac deleted file mode 100644 index e11158b..0000000 --- a/configure.ac +++ /dev/null @@ -1,11 +0,0 @@ -AC_INIT([deltacloud-aggregator], [0.0.2], [[email protected]]) -AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability tar-pax]) -AC_PROG_CC -AC_CONFIG_HEADERS([config.h]) - -# If using gcc and default CFLAGS, enable some warnings. -test x"$ac_ct_CC:$CFLAGS" = 'xgcc:-g -O2' \ - && CFLAGS="$CFLAGS -Wshadow -Wall -Werror" - -AC_CONFIG_FILES([Makefile deltacloud-aggregator.spec]) -AC_OUTPUT diff --git a/src/.gitignore b/src/.gitignore deleted file mode 100644 index 6cddb31..0000000 --- a/src/.gitignore +++ /dev/null @@ -1 +0,0 @@ -po diff --git a/src/.project b/src/.project deleted file mode 100644 index 244f341..0000000 --- a/src/.project +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>oVirt Server</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - </buildSpec> - <natures> - <nature>com.aptana.ide.project.nature.web</nature> - </natures> -</projectDescription> diff --git a/src/README b/src/README deleted file mode 100644 index 0d6affd..0000000 --- a/src/README +++ /dev/null @@ -1,182 +0,0 @@ -== Welcome to Rails - -Rails is a web-application and persistence framework that includes everything -needed to create database-backed web-applications according to the -Model-View-Control pattern of separation. This pattern splits the view (also -called the presentation) into "dumb" templates that are primarily responsible -for inserting pre-built data in between HTML tags. The model contains the -"smart" domain objects (such as Account, Product, Person, Post) that holds all -the business logic and knows how to persist themselves to a database. The -controller handles the incoming requests (such as Save New Account, Update -Product, Show Post) by manipulating the model and directing data to the view. - -In Rails, the model is handled by what's called an object-relational mapping -layer entitled Active Record. This layer allows you to present the data from -database rows as objects and embellish these data objects with business logic -methods. You can read more about Active Record in -link:files/vendor/rails/activerecord/README.html. - -The controller and view are handled by the Action Pack, which handles both -layers by its two parts: Action View and Action Controller. These two layers -are bundled in a single package due to their heavy interdependence. This is -unlike the relationship between the Active Record and Action Pack that is much -more separate. Each of these packages can be used independently outside of -Rails. You can read more about Action Pack in -link:files/vendor/rails/actionpack/README.html. - - -== Getting started - -1. At the command prompt, start a new rails application using the rails command - and your application name. Ex: rails myapp - (If you've downloaded rails in a complete tgz or zip, this step is already done) -2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options) -3. Go to http://localhost:3000/ and get "Welcome aboard: Youâre riding the Rails!" -4. Follow the guidelines to start developing your application - - -== Web Servers - -By default, Rails will try to use Mongrel and lighttpd if they are installed, otherwise -Rails will use the WEBrick, the webserver that ships with Ruby. When you run script/server, -Rails will check if Mongrel exists, then lighttpd and finally fall back to WEBrick. This ensures -that you can always get up and running quickly. - -Mongrel is a Ruby-based webserver with a C-component (which requires compilation) that is -suitable for development and deployment of Rails applications. If you have Ruby Gems installed, -getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>. -More info at: http://mongrel.rubyforge.org - -If Mongrel is not installed, Rails will look for lighttpd. It's considerably faster than -Mongrel and WEBrick and also suited for production use, but requires additional -installation and currently only works well on OS X/Unix (Windows users are encouraged -to start with Mongrel). We recommend version 1.4.11 and higher. You can download it from -http://www.lighttpd.net. - -And finally, if neither Mongrel or lighttpd are installed, Rails will use the built-in Ruby -web server, WEBrick. WEBrick is a small Ruby web server suitable for development, but not -for production. - -But of course its also possible to run Rails on any platform that supports FCGI. -Apache, LiteSpeed, IIS are just a few. For more information on FCGI, -please visit: http://wiki.rubyonrails.com/rails/pages/FastCGI - - -== Debugging Rails - -Have "tail -f" commands running on the server.log and development.log. Rails will -automatically display debugging and runtime information to these files. Debugging -info will also be shown in the browser on requests from 127.0.0.1. - - -== Breakpoints - -Breakpoint support is available through the script/breakpointer client. This -means that you can break out of execution at any point in the code, investigate -and change the model, AND then resume execution! Example: - - class WeblogController < ActionController::Base - def index - @posts = Post.find(:all) - breakpoint "Breaking out from the list" - end - end - -So the controller will accept the action, run the first line, then present you -with a IRB prompt in the breakpointer window. Here you can do things like: - -Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint' - - >> @posts.inspect - => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>, - #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]" - >> @posts.first.title = "hello from a breakpoint" - => "hello from a breakpoint" - -...and even better is that you can examine how your runtime objects actually work: - - >> f = @posts.first - => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}> - >> f. - Display all 152 possibilities? (y or n) - -Finally, when you're ready to resume execution, you press CTRL-D - - -== Console - -You can interact with the domain model by starting the console through <tt>script/console</tt>. -Here you'll have all parts of the application configured, just like it is when the -application is running. You can inspect domain models, change values, and save to the -database. Starting the script without arguments will launch it in the development environment. -Passing an argument will specify a different environment, like <tt>script/console production</tt>. - -To reload your controllers and models after launching the console run <tt>reload!</tt> - -To reload your controllers and models after launching the console run <tt>reload!</tt> - - - -== Description of contents - -app - Holds all the code that's specific to this particular application. - -app/controllers - Holds controllers that should be named like weblogs_controller.rb for - automated URL mapping. All controllers should descend from ApplicationController - which itself descends from ActionController::Base. - -app/models - Holds models that should be named like post.rb. - Most models will descend from ActiveRecord::Base. - -app/views - Holds the template files for the view that should be named like - weblogs/index.rhtml for the WeblogsController#index action. All views use eRuby - syntax. - -app/views/layouts - Holds the template files for layouts to be used with views. This models the common - header/footer method of wrapping views. In your views, define a layout using the - <tt>layout :default</tt> and create a file named default.rhtml. Inside default.rhtml, - call <% yield %> to render the view using this layout. - -app/helpers - Holds view helpers that should be named like weblogs_helper.rb. These are generated - for you automatically when using script/generate for controllers. Helpers can be used to - wrap functionality for your views into methods. - -config - Configuration files for the Rails environment, the routing map, the database, and other dependencies. - -components - Self-contained mini-applications that can bundle together controllers, models, and views. - -db - Contains the database schema in schema.rb. db/migrate contains all - the sequence of Migrations for your schema. - -doc - This directory is where your application documentation will be stored when generated - using <tt>rake doc:app</tt> - -lib - Application specific libraries. Basically, any kind of custom code that doesn't - belong under controllers, models, or helpers. This directory is in the load path. - -public - The directory available for the web server. Contains subdirectories for images, stylesheets, - and javascripts. Also contains the dispatchers and the default HTML files. This should be - set as the DOCUMENT_ROOT of your web server. - -script - Helper scripts for automation and generation. - -test - Unit and functional tests along with fixtures. When using the script/generate scripts, template - test files will be generated for you and placed in this directory. - -vendor - External libraries that the application depends on. Also includes the plugins subdirectory. - This directory is in the load path. -- 1.6.2.5
_______________________________________________ deltacloud-devel mailing list [email protected] https://fedorahosted.org/mailman/listinfo/deltacloud-devel
