[PATCH aggregator] Remove the left sidebar.
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
It doesn't make sense to display the sidebar all the time -- even when
nobody's logged in. This removes it from most of the pages.
To select a specific pool, go to Instances in the main menu.
To see a list of providers, go to the Settings menu.
Note that the layout is likely to change in the near future.
---
src/app/stylesheets/dcloud.sass | 4 ++--
src/app/stylesheets/layout.sass | 16 +++++++++++-----
src/app/views/layouts/_main_nav.html.erb | 23 +----------------------
src/app/views/layouts/aggregator.haml | 12 ++++++------
src/app/views/settings/index.haml | 11 +++++++++--
5 files changed, 29 insertions(+), 37 deletions(-)
diff --git a/src/app/stylesheets/dcloud.sass b/src/app/stylesheets/dcloud.sass
index 841dda4..92da051 100644
--- a/src/app/stylesheets/dcloud.sass
+++ b/src/app/stylesheets/dcloud.sass
@@ -103,7 +103,7 @@ input, select
/* Styles for table
-#content_area table
+#main table
width: 100%
border-collapse: collapse
th, td
@@ -132,7 +132,6 @@ input, select
ul#providers + a.actionlink
display: block
- border-bottom: 1px solid #ccc
.submit_link
background: none
@@ -169,6 +168,7 @@ ul
display: block
line-height: 36px
padding-left: 32px
+ width: 224px
&:hover
background: #efefef url($provider_icon) no-repeat 2px 50%
color: #000
diff --git a/src/app/stylesheets/layout.sass b/src/app/stylesheets/layout.sass
index 7a0667f..129571e 100644
--- a/src/app/stylesheets/layout.sass
+++ b/src/app/stylesheets/layout.sass
@@ -35,13 +35,22 @@ h2, h3
overflow: hidden
background: #535353 url(/images/bg_header.png) repeat-x top
+#content
+ position: absolute
+ top: 70px
+ left: 0px
+ right: 0px
+ bottom: 0px
+ overflow: hidden
+ background-color: #FFFFFF
+
#side
padding: 5px 0 0 5px
+ float: left
margin: 0
- position: absolute
top: 70px
left: 0px
- bottom: 0px
+ height: 100%
overflow: auto
width: 224px
background-color: #FFFFFF
@@ -55,10 +64,7 @@ h2, h3
#main
padding: 0
margin-left: 0
- position: absolute
top: 70px
- left: 230px
- right: 0px
bottom: 0px
overflow: auto
background-color: #FFFFFF
diff --git a/src/app/views/layouts/_main_nav.html.erb b/src/app/views/layouts/_main_nav.html.erb
index 8f4612a..b764e19 100644
--- a/src/app/views/layouts/_main_nav.html.erb
+++ b/src/app/views/layouts/_main_nav.html.erb
@@ -1,26 +1,5 @@
+<% cur_id = params[:id].to_i %>
-
-<h3>Providers</h3>
-<ul id="providers">
- <% cur_id = params[:id].to_i %>
- <% if !(a)providers.nil? %>
- <% @providers.each { |provider| %>
- <%#Note that this is a temporary way to selected proper list item for demo, and is not expected to stay this way%>
- <% if controller.controller_name == "provider" && provider.id == cur_id
- selected_provider = "selected"
- else
- selected_provider = ""
- end %>
- <li><%= link_to provider.name,
- {:controller => "provider", :action => "show", :id => provider},
- :class => "providername #{selected_provider}"%>
- </li>
- <% } %>
- <% end %>
-</ul>
-<% if BasePermissionObject.general_permission_scope.has_privilege(@current_user, Privilege::PROVIDER_MODIFY) %>
- <%= link_to "Add a provider", {:controller => "provider", :action => "new"}, :class => "actionlink" %>
-<% end %>
<h3>Pools</h3>
<ul id="pools">
<% if !(a)pools.nil? %>
diff --git a/src/app/views/layouts/aggregator.haml b/src/app/views/layouts/aggregator.haml
index 8243ba1..ccaacdb 100644
--- a/src/app/views/layouts/aggregator.haml
+++ b/src/app/views/layouts/aggregator.haml
@@ -24,10 +24,10 @@
%body
#header
= render :partial => '/layouts/header'
- #side
- = render :partial => '/layouts/main_nav' unless @current_user.nil?
- #tabs-and-content-container
+ #content
+ - if ['instance', 'pool'].include? controller.controller_name
+ #side
+ = render :partial => '/layouts/main_nav' unless @current_user.nil?
#main
- #content_area
- = render :partial => '/layouts/notification'
- = (yield(:content) or yield) # content is set if we're using a sub template
+ = render :partial => '/layouts/notification'
+ = (yield(:content) or yield) # content is set if we're using a sub template
diff --git a/src/app/views/settings/index.haml b/src/app/views/settings/index.haml
index 1647eb1..e7030de 100644
--- a/src/app/views/settings/index.haml
+++ b/src/app/views/settings/index.haml
@@ -1,2 +1,9 @@
-%h1 Settings/index
-%p located in app/view/settings/index.haml
+%h1 Settings
+
+%h2 Providers
+%ul#providers
+ - @providers.each do |provider|
+ %li
+ = link_to provider.name, {:controller => "provider", :action => "show", :id => provider }, :class => "providername"
+- if BasePermissionObject.general_permission_scope.has_privilege(@current_user, Privilege::PROVIDER_MODIFY)
+ = link_to "Add a provider", {:controller => "provider", :action => "new"}, :class => "actionlink"
--
1.7.1.1
13 years, 10 months
[PATCH aggregator] Increased factory_girl's version
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
Required version increased to 1.3.1 because of bug in factories
autoloading in some previous versions.
---
src/config/environments/cucumber.rb | 2 +-
src/config/environments/test.rb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/config/environments/cucumber.rb b/src/config/environments/cucumber.rb
index 5f0e38b..1e4a75d 100644
--- a/src/config/environments/cucumber.rb
+++ b/src/config/environments/cucumber.rb
@@ -26,4 +26,4 @@ config.gem 'database_cleaner', :lib => false, :version => '>=0.5.0' unless File.
config.gem 'webrat', :lib => false, :version => '>=0.7.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
config.gem 'rspec', :lib => false, :version => '>=1.3.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
config.gem 'rspec-rails', :lib => false, :version => '>=1.3.2' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
-config.gem "factory_girl", :lib => "factory_girl", :version => ">=1.2.3"
+config.gem "factory_girl", :lib => "factory_girl", :version => ">=1.3.1"
diff --git a/src/config/environments/test.rb b/src/config/environments/test.rb
index 188f711..abe146a 100644
--- a/src/config/environments/test.rb
+++ b/src/config/environments/test.rb
@@ -38,4 +38,4 @@ config.action_controller.perform_caching = false
config.action_mailer.delivery_method = :test
config.gem 'rspec-rails', :version => '>= 1.3.2', :lib => false unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
-config.gem "factory_girl", :lib => "factory_girl", :version => ">=1.2.3"
+config.gem "factory_girl", :lib => "factory_girl", :version => ">=1.3.1"
--
1.7.0.1
13 years, 10 months
[PATCH aggregator] POC - Content API integration
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
Makes aggregator compatible with pulp/contentapi with
minimal effort. This patch is only example how we can
integrate contentapi (it shouldn't be pushed to master).
To try this patch, you need a running pulp server.
---
src/app/util/repository_manager.rb | 124 +------------------
.../util/repository_manager/comps_repository.rb | 111 +++++++++++++++++
src/app/util/repository_manager/pulp_repository.rb | 34 ++++++
src/app/util/repository_manager/repository.rb | 6 +
.../image_descriptor_package_repositories.yml | 8 +-
5 files changed, 165 insertions(+), 118 deletions(-)
create mode 100644 src/app/util/repository_manager/comps_repository.rb
create mode 100644 src/app/util/repository_manager/pulp_repository.rb
create mode 100644 src/app/util/repository_manager/repository.rb
diff --git a/src/app/util/repository_manager.rb b/src/app/util/repository_manager.rb
index 05cc5da..ad719bf 100644
--- a/src/app/util/repository_manager.rb
+++ b/src/app/util/repository_manager.rb
@@ -17,125 +17,11 @@
# MA 02110-1301, USA. A copy of the GNU General Public License is
# also available at http://www.gnu.org/copyleft/gpl.html.
-require 'open-uri'
require 'yaml'
+require 'util/repository_manager/comps_repository'
+require 'util/repository_manager/pulp_repository'
class RepositoryManager
- class CompsRepository
- def initialize(baseurl, id)
- @id = id
- @baseurl = baseurl
- end
-
- def get_packages
- packages = []
- get_packages_nodes.each do |node|
- name = node.at_xpath('./xmlns:name/child::text()')
- group = node.at_xpath('./xmlns:format/rpm:group/child::text()')
- description = node.at_xpath('./xmlns:description/child::text()')
- next unless name and group
- packages << {
- :repository_id => @id,
- :name => name.text,
- :group => group.text,
- :description => description ? description.text : '',
- }
- end
- return packages
- end
-
- def get_groups
- groups = {}
- get_groups_nodes.each do |g|
- pkgs = get_group_packages(g)
- next if pkgs.empty?
- name = g.at_xpath('name').text
- groups[name] = {
- :name => name,
- :description => (t = g.at_xpath('description')) ? t.text : '',
- :packages => pkgs,
- }
- end
- return groups
- end
-
- def download_xml(type)
- begin
- url = get_url(type)
- rescue
- return ''
- end
-
- xml_data = open(url)
- if url =~ /\.gz$/
- return Zlib::GzipReader.new(xml_data).read
- else
- return xml_data.read
- end
- end
-
- private
-
- def get_xml(type)
- # FIXME: I'm not sure config is right dir for automatic storing of
- # xml files, but this should be temporary solution until Image Repo is
- # done
- xml_dir = "#{RAILS_ROOT}/config/image_descriptor_xmls"
- xml_file = "#{xml_dir}/#{(a)id}.#{type}.xml"
- begin
- return File.open(xml_file) { |f| f.read }
- rescue
- xml = download_xml(type)
- Dir.mkdir(xml_dir) unless File.directory?(xml_dir)
- File.open(xml_file, 'w') { |f| f.write xml }
- return xml
- end
- end
-
- def get_group_packages(group_node)
- pkgs = {}
- group_node.xpath('packagelist/packagereq').each do |p|
- pkgs[p.text] = p.attr('type')
- end
- return pkgs
- end
-
- def get_packages_nodes
- unless @packages_nodes
- data = get_xml('primary')
- xml = Nokogiri::XML(data)
- @packages_nodes = xml.xpath('/xmlns:metadata/xmlns:package')
- end
- return @packages_nodes
- end
-
- def get_groups_nodes
- unless @groups_nodes
- data = get_xml('group')
- xml = Nokogiri::XML(data)
- @groups_nodes = xml.xpath('/comps/group')
- end
- return @groups_nodes
- end
-
- def get_url(type)
- if type == 'repomd'
- return File.join(@baseurl, 'repodata', 'repomd.xml')
- else
- location = repomd.xpath("/xmlns:repomd/xmlns:data[@type=\"#{type}\"]/xmlns:location").first
- raise "location for #{type} data not found" unless location
- return File.join(@baseurl, location['href'])
- end
- end
-
- def repomd
- unless @repomd
- @repomd = Nokogiri::XML(get_xml('repomd'))
- end
- return @repomd
- end
- end
-
def initialize
@config = YAML.load_file("#{RAILS_ROOT}/config/image_descriptor_package_repositories.yml")
end
@@ -143,7 +29,11 @@ class RepositoryManager
def get_repository(repository_id)
repo = @config[repository_id]
raise "Repository '#{repository_id}' doesn't exist" unless repo
- return CompsRepository.new(repo['baseurl'], repository_id)
+ if repo['type'] == 'pulp'
+ return PulpRepository.new(repo['baseurl'], repository_id)
+ else
+ return CompsRepository.new(repo['baseurl'], repository_id)
+ end
end
def repositories
diff --git a/src/app/util/repository_manager/comps_repository.rb b/src/app/util/repository_manager/comps_repository.rb
new file mode 100644
index 0000000..4646f7f
--- /dev/null
+++ b/src/app/util/repository_manager/comps_repository.rb
@@ -0,0 +1,111 @@
+require 'util/repository_manager/repository'
+require 'open-uri'
+
+class CompsRepository < Repository
+ def get_packages
+ packages = []
+ get_packages_nodes.each do |node|
+ name = node.at_xpath('./xmlns:name/child::text()')
+ group = node.at_xpath('./xmlns:format/rpm:group/child::text()')
+ description = node.at_xpath('./xmlns:description/child::text()')
+ next unless name and group
+ packages << {
+ :repository_id => @id,
+ :name => name.text,
+ :description => description ? description.text : '',
+ }
+ end
+ return packages
+ end
+
+ def get_groups
+ groups = {}
+ get_groups_nodes.each do |g|
+ pkgs = get_group_packages(g)
+ next if pkgs.empty?
+ name = g.at_xpath('name').text
+ groups[name] = {
+ :name => name,
+ :description => (t = g.at_xpath('description')) ? t.text : '',
+ :packages => pkgs,
+ }
+ end
+ return groups
+ end
+
+ def download_xml(type)
+ begin
+ url = get_url(type)
+ rescue
+ return ''
+ end
+
+ xml_data = open(url)
+ if url =~ /\.gz$/
+ return Zlib::GzipReader.new(xml_data).read
+ else
+ return xml_data.read
+ end
+ end
+
+ private
+
+ def get_xml(type)
+ # FIXME: I'm not sure config is right dir for automatic storing of
+ # xml files, but this should be temporary solution until Image Repo is
+ # done
+ xml_dir = "#{RAILS_ROOT}/config/image_descriptor_xmls"
+ xml_file = "#{xml_dir}/#{(a)id}.#{type}.xml"
+ begin
+ return File.open(xml_file) { |f| f.read }
+ rescue
+ xml = download_xml(type)
+ Dir.mkdir(xml_dir) unless File.directory?(xml_dir)
+ File.open(xml_file, 'w') { |f| f.write xml }
+ return xml
+ end
+ end
+
+ def get_group_packages(group_node)
+ pkgs = {}
+ group_node.xpath('packagelist/packagereq').each do |p|
+ pkgs[p.text] = p.attr('type')
+ end
+ return pkgs
+ end
+
+ def get_packages_nodes
+ unless @packages_nodes
+ data = get_xml('primary')
+ xml = Nokogiri::XML(data)
+ @packages_nodes = xml.xpath('/xmlns:metadata/xmlns:package')
+ end
+ return @packages_nodes
+ end
+
+ def get_groups_nodes
+ unless @groups_nodes
+ data = get_xml('group')
+ xml = Nokogiri::XML(data)
+ @groups_nodes = xml.xpath('/comps/group')
+ end
+ return @groups_nodes
+ end
+
+ def get_url(type)
+ if type == 'repomd'
+ return File.join(@baseurl, 'repodata', 'repomd.xml')
+ else
+ location = repomd.xpath("/xmlns:repomd/xmlns:data[@type=\"#{type}\"]/xmlns:location").first
+ raise "location for #{type} data not found" unless location
+ return File.join(@baseurl, location['href'])
+ end
+ end
+
+ def repomd
+ unless @repomd
+ @repomd = Nokogiri::XML(get_xml('repomd'))
+ end
+ return @repomd
+ end
+end
diff --git a/src/app/util/repository_manager/pulp_repository.rb b/src/app/util/repository_manager/pulp_repository.rb
new file mode 100644
index 0000000..585b3fc
--- /dev/null
+++ b/src/app/util/repository_manager/pulp_repository.rb
@@ -0,0 +1,34 @@
+require 'util/repository_manager/repository'
+require 'restclient'
+require 'json'
+
+class PulpRepository < Repository
+ def get_packages
+ packages = []
+ JSON.parse(RestClient.get "#{@baseurl}/repositories/#{@id}/packages/").each_value do |info|
+ packages << {
+ :repository_id => @id,
+ :name => info['name'],
+ :description => info['description'],
+ }
+ end
+ return packages
+ end
+
+ def get_groups
+ groups = {}
+ JSON.parse(RestClient.get "#{@baseurl}/repositories/#{@id}/packagegroups/").each do |name, info|
+ pkgs = {}
+ info['default_package_names'].each {|p| pkgs[p] = 'default'}
+ info['optional_package_names'].each {|p| pkgs[p] = 'optional'}
+ info['mandatory_package_names'].each {|p| pkgs[p] = 'mandatory'}
+ next if pkgs.empty?
+ groups[name] = {
+ :name => name,
+ :description => info['description'].to_s,
+ :packages => pkgs,
+ }
+ end
+ return groups
+ end
+end
diff --git a/src/app/util/repository_manager/repository.rb b/src/app/util/repository_manager/repository.rb
new file mode 100644
index 0000000..9d29bc8
--- /dev/null
+++ b/src/app/util/repository_manager/repository.rb
@@ -0,0 +1,6 @@
+class Repository
+ def initialize(baseurl, id)
+ @id = id
+ @baseurl = baseurl
+ end
+end
diff --git a/src/config/image_descriptor_package_repositories.yml b/src/config/image_descriptor_package_repositories.yml
index 40335ea..884ce17 100644
--- a/src/config/image_descriptor_package_repositories.yml
+++ b/src/config/image_descriptor_package_repositories.yml
@@ -1,6 +1,12 @@
fedora:
name: Fedora
baseurl: http://download.fedoraproject.org/pub/fedora/linux/releases/11/Everything...
+ type: xml
+#jboss:
+# name: JBoss
+# baseurl: http://repo.oddthesis.org/cirras/packages/fedora/11/RPMS/noarch/
+# type: xml
jboss:
name: JBoss
- baseurl: http://repo.oddthesis.org/cirras/packages/fedora/11/RPMS/noarch/
+ baseurl: https://localhost:8811/
+ type: pulp
--
1.7.0.1
13 years, 10 months
[PATCH aggregator] Fix Factory::DuplicateDefinitionError in rake spec.
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
A previous commit added explicit loading of the factories when running
rake spec. However, when the factories are loaded automatically (as they sholud
be), this breaks the tests.
This commit resets the previous change.
---
src/spec/spec_helper.rb | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/src/spec/spec_helper.rb b/src/spec/spec_helper.rb
index 4a72e06..5181389 100644
--- a/src/spec/spec_helper.rb
+++ b/src/spec/spec_helper.rb
@@ -13,9 +13,6 @@ require 'authlogic/test_case'
# in ./support/ and its subdirectories.
Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
-# factories are not loaded automatically (at least with rspec 1.3.0 on Fedora 13)
-Dir[File.expand_path(File.join(File.dirname(__FILE__),'factories','**','*.rb'))].each {|f| puts f;require f}
-
Spec::Runner.configure do |config|
# If you're not using ActiveRecord you should remove these
# lines, delete config/database.yml and disable :active_record
--
1.7.1.1
13 years, 11 months
[PATCH docs] Update the core setup instructions.
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
---
README | 12 +++++-------
docs/drivers.mdown | 20 ++++++++------------
2 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/README b/README
index 6fd4a4d..e0ffe63 100644
--- a/README
+++ b/README
@@ -11,18 +11,16 @@ It depends on [Condor][condor] for its task implementation system.
In addition, we use the **docs** repository that contains the project
documentation and the sources of the <http://deltacloud.org> website.
-The Deltacloud Core repository is hosted on [Apache Incubator][incubator]. To get the
-latest code:
+The Deltacloud Core repository is hosted on [Apache Incubator][incubator].
+Apache uses Subversion, but there is a git mirror available:
$ mkdir deltacloud
$ cd deltacloud
- $ git svn init -s https://svn.apache.org/repos/asf/incubator/deltacloud
- $ git svn fetch --log-window-size 10000
+ $ git clone git://git.apache.org/deltacloud.git core
-**Note**: You can use git-svn, but be aware that it takes well over an hour to
-fetch the complete revision history.
+You can find the Subversion repository at: <https://svn.apache.org/repos/asf/incubator/deltacloud>.
-The sources for Aggregator and docs are in git repositories:
+To get Aggregator and Docs:
$ git clone --branch next git://git.fedorahosted.org/git/deltacloud/aggregator.git/
$ git clone --branch next git://git.fedorahosted.org/git/deltacloud/docs.git/
diff --git a/docs/drivers.mdown b/docs/drivers.mdown
index d0c588f..f952875 100644
--- a/docs/drivers.mdown
+++ b/docs/drivers.mdown
@@ -9,25 +9,21 @@ drivers and their capabilities are:
## Setting up the code
-To set up a Deltacloud core, and one of its drivers, currently, you must
-checkout the code from the core repository:
+To set up a Deltacloud core and the drivers, install the
+[deltacloud-core][coregem] Ruby gem:
- mkdir deltacloud
- cd deltacloud
- git svn init -s https://svn.apache.org/repos/asf/incubator/deltacloud
- git svn fetch --log-window-size 10000
- cd core/server
- rake package
- sudo gem install pkg/deltacloud-core-<version>.gem
+[coregem]: http://rubygems.org/gems/deltacloud-core
-The core will soon be available both as a Ruby gem and RPM packages.
+ # gem install deltacloud-core
+
+RPM package will be available soon.
## Launch the server
The server is launched with the `deltacloudd` command and pass it the name
of the driver you want to use:
- deltacloudd -i mock
+ $ deltacloudd -i mock
This will start a webserver running the mock driver on
`http://localhost:3001/api`; you can simply browse to that URL to get a
@@ -37,7 +33,7 @@ pretty view of the objects the driver deals with.
For the Amazon EC2 you need to install the `amazon-ec2` Ruby gem:
- sudo gem install amazon-ec2
+ # gem install amazon-ec2
When using the driver for Amazon EC2, the credentials passed in
response to the HTTP 401 authentication challenge should be your
--
1.7.1.1
13 years, 11 months
[PATCH docs] Proof of concept for twitter/identi.ca news feed.
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
Not for regular use yet. This displays the Red Hat news from the Twitter feed
while replacing the old Deltacloud news.
---
deltacloud.org/content/index.haml | 7 +-
deltacloud.org/content/jquery.twit/MIT-LICENSE.txt | 25 ++++
.../content/jquery.twit/jquery.twit.0.2.0.css | 48 ++++++
.../content/jquery.twit/jquery.twit.0.2.0.js | 152 ++++++++++++++++++++
.../content/jquery.twit/jquery.twit.0.2.0.min.js | 24 +++
deltacloud.org/content/styles/firstpage.css | 24 +++-
deltacloud.org/layouts/default.txt | 8 +
7 files changed, 276 insertions(+), 12 deletions(-)
create mode 100644 deltacloud.org/content/jquery.twit/MIT-LICENSE.txt
create mode 100644 deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.css
create mode 100644 deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.js
create mode 100644 deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.min.js
create mode 100644 deltacloud.org/content/jquery.twit/version.txt
diff --git a/deltacloud.org/content/index.haml b/deltacloud.org/content/index.haml
index 066110b..34a086c 100644
--- a/deltacloud.org/content/index.haml
+++ b/deltacloud.org/content/index.haml
@@ -46,12 +46,7 @@ filter: haml
providers to add their cloud to the Deltacloud common API.
#news
.recent
- %h2
- News
- %ul
- - all_news.each do |item|
- %li
- = item
+
%br
%br
.section.video{ :style => "margin-top:16px;" }
diff --git a/deltacloud.org/content/jquery.twit/MIT-LICENSE.txt b/deltacloud.org/content/jquery.twit/MIT-LICENSE.txt
new file mode 100644
index 0000000..f0f2ba9
--- /dev/null
+++ b/deltacloud.org/content/jquery.twit/MIT-LICENSE.txt
@@ -0,0 +1,25 @@
+Copyright (c) 2009 Paul Bakaus, http://jqueryui.com/
+
+This software consists of voluntary contributions made by many
+individuals (AUTHORS.txt, http://jqueryui.com/about) For exact
+contribution history, see the revision history and logs, available
+at http://jquery-ui.googlecode.com/svn/
+
+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/deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.css b/deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.css
new file mode 100644
index 0000000..7ad6708
--- /dev/null
+++ b/deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.css
@@ -0,0 +1,48 @@
+/** Twit **/
+.twit {
+ background-color: #cbf2ff;
+ padding: 7px;
+}
+.twitHeader {
+ background-color: #fff;
+ margin: 0;
+ padding: 7px 7px 0 7px;
+}
+.twitLabel {
+ font-weight: bold;
+ font-size: 22px;
+ color: #33ccff;
+}
+.twitTitle {
+ font-weight: bold;
+}
+.twitUser {
+ background-color: #fff;
+ border-bottom: none;
+ font-size:160%;
+ padding: 7px;
+}
+.twitUser a{
+ color:#222;
+ font-weight:bold;
+ text-decoration: none;
+}
+.twitBody {
+ background-color: #ffffff;
+ padding: 0 7px 7px 7px;
+ margin: 0;
+ list-style: none;
+}
+.twitEntry {
+ padding: 6px 8px;
+ margin: 0;
+ border-bottom: dashed 1px #ccc;
+ height: auto !important;
+}
+.twitNavi {
+ clear: both;
+ text-align: center;
+ margin-top: 0;
+ padding: 5px;
+ background-color: #ffffff;
+}
diff --git a/deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.js b/deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.js
new file mode 100644
index 0000000..4120dc1
--- /dev/null
+++ b/deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.js
@@ -0,0 +1,152 @@
+/**
+ * Twit
+ * jQuery Plugin to Display Twitter Tweets on a Blog.
+ * http://code.google.com/p/jquery-twit/
+ *
+ * Copyright (c) 2010 Yusuke Horie
+ *
+ * Released under the MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * Since : 0.1.0 - 08/26/2009
+ * Version: 0.2.0 - 02/17/2010
+ */
+(function(jQuery){
+
+ var _i = 0;
+
+ /** public methods **/
+
+ jQuery.fn.twit = function (user, options) {
+ if (typeof user != 'string') return this;
+
+ var
+ opts = jQuery.extend({}, jQuery.fn.twit.defaults, options),
+ c = jQuery.isFunction(opts.callback) ? opts.callback: _callback,
+ url = 'http://twitter.com/statuses/user_timeline/' + user + '.json',
+ params = {};
+
+ opts.user = user;
+ params.count = opts.count;
+
+ return this.each(function(i, e) {
+ var $e = $(e);
+ if (!$e.hasClass('twit')) $e.addClass('twit');
+
+ jQuery.ajax({
+ url: url,
+ data: params,
+ dataType: 'jsonp',
+ success: function (o) {
+ c.apply(this, [(o.results) ? o.results: o, e, opts]);
+ }
+ });
+ });
+ };
+
+ jQuery.fn.twit.defaults = {
+ user: null,
+ callback: null,
+ icon: true,
+ username: true,
+ text: true,
+ count: 200,
+ limit: 7,
+ label: 'Twitter',
+ title: ''
+ };
+
+ /** private method **/
+
+ var _callback = function (o, e, opts) {
+ var $this = $(e);
+ if (!o || o.length == 0 || $this.length == 0) return false;
+ $this.data('_inc', 1);
+ _i++;
+
+ var username = o[0].user.screen_name,
+ icon = o[0].user.profile_image_url;
+
+ var h =
+ '<div class="twitHeader">' +
+ ' <span class="twitLabel">' + opts.label + '</span> ' +
+ ' <span class="twitTitle">' + opts.title + '</span>' +
+ '</div>';
+ if (opts.icon || opts.username) {
+ h += '<div class="twitUser">';
+ if (opts.icon)
+ h +=
+ ' <a href="http://twitter.com/' + username + '/">' +
+ ' <img src="' + icon + '" alt="' + username + '" title="' + username + '" style="vertical-align:middle;" />' +
+ ' </a> ';
+ if (opts.username)
+ h += '<a href="http://twitter.com/' + username + '/">' + username + '</a>';
+ h += '</div>';
+ }
+ h += '<ul class="twitBody" id="twitList' + _i + '">' + _build(o, $this, opts) + '</ul>';
+
+ $this.html(h);
+
+ $('a.twitEntryShow', '#twitList' + _i).live('click', function (e) {
+ e.preventDefault();
+ var $t = $(this);
+
+ $t.parent().fadeOut(400, function () {
+ var i = $this.data('_inc');
+ i++;
+ $this.data('_inc', i);
+
+ if ($t.hasClass('twitEntryAll')) {
+ $t.die('click');
+ var start = (i*opts.limit) - opts.limit;
+ $(this).after(_build(o, $this, opts, start, o.length)).remove();
+ } else {
+ $(this).after(_build(o, $this, opts)).remove();
+ }
+ });
+ });
+
+ };
+
+ var _build = function (o, $t, opts, s, e) {
+ var
+ h = '',
+ inc = $t.data('_inc'),
+ start = s || (inc*opts.limit) - opts.limit,
+ end = e || ((o.length > start + opts.limit) ? start + opts.limit: o.length);
+
+ for (var i=start; i<end; i++) {
+ var
+ t = o[i],
+ username = t.user.screen_name,
+ icon = t.user.profile_image_url;
+
+ h += '<li class="twitEntry">';
+ if (opts.text) {
+ var text = t.text
+ .replace(/(https?:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/, function (u) {
+ var shortUrl = (u.length > 30) ? u.substr(0, 30) + '...': u;
+ return '<a href="' + u + '">' + shortUrl + '</a>';
+ })
+ .replace(/@([a-zA-Z0-9_]+)/g, '@<a href="http://twitter.com/$1">$1</a>')
+ .replace(/(?:^|\s)#([^\s\.\+:!]+)/g, function (a, u) {
+ return ' <a href="http://twitter.com/search?q=' + encodeURIComponent(u) + '">#' + u + '</a>';
+ });
+ h += ' <span>' + text + '</span>';
+ }
+
+ h += '</li>';
+ }
+
+ if (o.length > end) {
+ h +=
+ '<li class="twitNavi">' +
+ '<a href="#" class="twitEntryShow">more</a> / ';
+ if (o.length > opts.limit)
+ h += '<a href="#" class="twitEntryShow twitEntryAll">all</a>';
+ h += '</li>';
+ }
+ return h;
+ };
+
+})(jQuery);
diff --git a/deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.min.js b/deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.min.js
new file mode 100644
index 0000000..110cdf6
--- /dev/null
+++ b/deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.min.js
@@ -0,0 +1,24 @@
+/**
+ * Twit
+ * jQuery Plugin to Display Twitter Tweets on a Blog.
+ * http://code.google.com/p/jquery-twit/
+ *
+ * Copyright (c) 2010 Yusuke Horie
+ *
+ * Released under the MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * Since : 0.1.0 - 08/26/2009
+ * Version: 0.2.0 - 02/17/2010
+ */
+(function(jQuery){var _i=0;jQuery.fn.twit=function(user,options){if(typeof user!='string')return this;var
+opts=jQuery.extend({},jQuery.fn.twit.defaults,options),c=jQuery.isFunction(opts.callback)?opts.callback:_callback,url='http://twitter.com/statuses/user_timeline/'+user+'.json',params={};opts.user=user;params.count=opts.count;return this.each(function(i,e){var $e=$(e);if(!$e.hasClass('twit'))$e.addClass('twit');jQuery.ajax({url:url,data:params,dataType:'jsonp',success:function(o){c.apply(this,[(o.results)?o.results:o,e,opts]);}});});};jQuery.fn.twit.defaults={user:null,callback:null,icon:true,username:true,text:true,count:200,limit:7,label:'Twitter',title:''};var _callback=function(o,e,opts){var $this=$(e);if(!o||o.length==0||$this.length==0)return false;$this.data('_inc',1);_i++;var username=o[0].user.screen_name,icon=o[0].user.profile_image_url;var h='<div class="twitHeader">'+' <span class="twitLabel">'+opts.label+'</span> '+' <span class="twitTitle">'+opts.title+'</span>'+'</div>';if(opts.icon||opts.username){h+='<div class="twitUser">';if(opts.icon)
+h+=' <a href="http://twitter.com/'+username+'/">'+' <img src="'+icon+'" alt="'+username+'" title="'+username+'" style="vertical-align:middle;" />'+' </a> ';if(opts.username)
+h+='<a href="http://twitter.com/'+username+'/">'+username+'</a>';h+='</div>';}
+h+='<ul class="twitBody" id="twitList'+_i+'">'+_build(o,$this,opts)+'</ul>';$this.html(h);$('a.twitEntryShow','#twitList'+_i).live('click',function(e){e.preventDefault();var $t=$(this);$t.parent().fadeOut(400,function(){var i=$this.data('_inc');i++;$this.data('_inc',i);if($t.hasClass('twitEntryAll')){$t.die('click');var start=(i*opts.limit)-opts.limit;$(this).after(_build(o,$this,opts,start,o.length)).remove();}else{$(this).after(_build(o,$this,opts)).remove();}});});};var _build=function(o,$t,opts,s,e){var
+h='',inc=$t.data('_inc'),start=s||(inc*opts.limit)-opts.limit,end=e||((o.length>start+opts.limit)?start+opts.limit:o.length);for(var i=start;i<end;i++){var
+t=o[i],username=t.user.screen_name,icon=t.user.profile_image_url;h+='<li class="twitEntry">';if(opts.text){var text=t.text.replace(/(https?:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/,function(u){var shortUrl=(u.length>30)?u.substr(0,30)+'...':u;return'<a href="'+u+'">'+shortUrl+'</a>';}).replace(/@([a-zA-Z0-9_]+)/g,'@<a href="http://twitter.com/$1">$1</a>').replace(/(?:^|\s)#([^\s\.\+:!]+)/g,function(a,u){return' <a href="http://twitter.com/search?q='+encodeURIComponent(u)+'">#'+u+'</a>';});h+=' <span>'+text+'</span>';}
+h+='</li>';}
+if(o.length>end){h+='<li class="twitNavi">'+'<a href="#" class="twitEntryShow">more</a> / ';if(o.length>opts.limit)
+h+='<a href="#" class="twitEntryShow twitEntryAll">all</a>';h+='</li>';}
+return h;};})(jQuery);
\ No newline at end of file
diff --git a/deltacloud.org/content/jquery.twit/version.txt b/deltacloud.org/content/jquery.twit/version.txt
new file mode 100644
index 0000000..e69de29
diff --git a/deltacloud.org/content/styles/firstpage.css b/deltacloud.org/content/styles/firstpage.css
index fc25d1e..786cf52 100644
--- a/deltacloud.org/content/styles/firstpage.css
+++ b/deltacloud.org/content/styles/firstpage.css
@@ -60,12 +60,6 @@ than the rest of the site */
line-height: 30px;
}
-#news h2 {
- border-bottom:none;
- color:#cc0000;
- margin-top: 0;
-}
-
#news ul {
margin-left:15px;
@@ -94,6 +88,24 @@ than the rest of the site */
-webkit-border-radius: 10px;
}
+#news .twitUser {
+ display: none;
+}
+
+#news .twitHeader .twitLabel {
+ border-bottom:none;
+ color:#cc0000;
+ margin-top: 0;
+}
+
+#news li.twitEntry {
+ border-bottom: none !important;
+}
+
+#news .twitNavi {
+ display: none;
+}
+
#news .section {
background-color:transparent;
margin-bottom: 2em;
diff --git a/deltacloud.org/layouts/default.txt b/deltacloud.org/layouts/default.txt
index 00a0402..3fac780 100644
--- a/deltacloud.org/layouts/default.txt
+++ b/deltacloud.org/layouts/default.txt
@@ -18,9 +18,11 @@ filter: haml
- if @page.filename == "index"
%link{ :href => "./styles/firstpage.css", :rel => "stylesheet", :type => "text/css" }
%link{ :href => "./jquery.fancybox/jquery.fancybox-1.3.1.css", :rel => "stylesheet", :type => "text/css", :media => "screen" }
+ %link{ :href => "./jquery.twit/jquery.twit.0.2.0.css", :rel => "stylesheet", :type => "text/css", :media => "screen" }
%script{ :type => "text/javascript", :src => "./jquery.fancybox/jquery-1.3.2.min.js" }
%script{ :type => "text/javascript", :src => "./jquery.fancybox/jquery.easing-1.3.pack.js" }
%script{ :type => "text/javascript", :src => "./jquery.fancybox/jquery.fancybox-1.3.1.pack.js" }
+ %script{ :type => "text/javascript", :src => "./jquery.twit/jquery.twit.0.2.0.min.js" }
%script{ :src => "Scripts/swfobject_modified.js", :type => "text/javascript" }
%script{ :type => "text/javascript" }
$(document).ready(function() {
@@ -32,6 +34,12 @@ filter: haml
$("a.providers").fancybox({ 'hideOnContentClick': true, 'padding': 0, 'margin': 0, 'width': 958,
'height': 528, 'scrolling': 'no', 'autoDimensions': false, 'autoScale': true });
}
+ $("#news .recent").twit("redhatnews", {
+ count: 10,
+ limit: 4,
+ label: "News",
+ icon: false
+ });
});
--
1.7.1.1
13 years, 11 months
[PATCH aggregator] Updated API Doc
by Martyn Taylor
From: martyntaylor <mtaylor(a)redhat.com>
---
docs/api.mdown | 50 +++++++++++++++++++++-----------------------------
1 files changed, 21 insertions(+), 29 deletions(-)
diff --git a/docs/api.mdown b/docs/api.mdown
index 4dc897b..f0822a3 100644
--- a/docs/api.mdown
+++ b/docs/api.mdown
@@ -74,16 +74,15 @@ include more aspects, including number and speed of CPUs available.
Each provider is free to define as many (or as few) hardware profiles
as desired.
- <hardware-profiles>
- <hardware-profile href='http://fancycloudprovider.com/api/hardware_profiles/m1-small'>
- <id>m1-small</id>
+ <hardware_profiles>
+ <hardware_profile href='http://fancycloudprovider.com/api/hardware_profiles/m1-small' id='m1-small'>
<property kind='fixed' name='storage' unit='GB' value='160' />
<property kind='fixed' name='architecture' unit='label' value='i386' />
<property kind='fixed' name='cpu' unit='count' value='1' />
<property kind='fixed' name='memory' unit='MB' value='1740.8' />
- </hardware-profile>
+ </hardware_profile>
-Each `<hardware-profile>` block shall contain an `href` attribute providing a
+Each `<hardware_profile>` block shall contain an `href` attribute providing a
URL to manipulate a specific profile, along with property elements for each
attribute of the hardware.
@@ -105,8 +104,7 @@ that specifies the allowed values and the second with a way of picking a value.
In the non-fixed case, the `value` property attribute specifies the default value.
- <hardware-profile href='http://fancycloudprovider.com/api/hardware_profiles/m1-xlarge'>
- <id>m1-xlarge</id>
+ <hardware_profile href='http://fancycloudprovider.com/api/hardware_profiles/m1-xlarge' id='m1-xlarge'>
<property kind='enum' name='storage' unit='GB' value='1024'>
<param href='http://fancycloudprovider.com/api/instances' method='post' name='hwp_storage' operation='create' />
<enum>
@@ -121,8 +119,8 @@ In the non-fixed case, the `value` property attribute specifies the default valu
<param href='http://fancycloudprovider.com/api/instances' method='post' name='hwp_memory' operation='create' />
<range first='12288' last='32768' />
</property>
- </hardware-profile>
- </hardware-profiles>
+ </hardware_profile>
+ </hardware_profiles>
At this time, hardware profile resources are immutable and read-only. In a
@@ -140,14 +138,12 @@ volumes may only be allowed to be mounted to instances within the same
realm.
<realms>
- <realm href="http://fancycloudprovider.com/api/realms/us">
- <id>us</id>
+ <realm href="http://fancycloudprovider.com/api/realms/us" id='us'>
<name>United States</name>
<state>AVAILABLE</state>
<limit/>
</realm>
- <realm href="http://fancycloudprovider.com/api/realms/eu">
- <id>eu</id>
+ <realm href="http://fancycloudprovider.com/api/realms/eu" id='eu'>
<name>Europe</name>
<state>AVAILABLE</state>
<limit/>
@@ -175,22 +171,19 @@ The instances collection will return a set of all images available to
the current user.
<images>
- <image href="http://fancycloudprovider.com/api/images/img1">
- <id>img1</id>
+ <image href="http://fancycloudprovider.com/api/images/img1" id='img1'>
<owner_id>fedoraproject</owner_id>
<name>Fedora 10</name>
<description>Fedora 10</description>
<architecture>x86_64</architecture>
</image>
- <image href="http://fancycloudprovider.com/api/images/img2">
- <id>img2</id>
+ <image href="http://fancycloudprovider.com/api/images/img2" id='img2'>
<owner_id>fedoraproject</owner_id>
<name>Fedora 10</name>
<description>Fedora 10</description>
<architecture>i386</architecture>
</image>
- <image href="http://fancycloudprovider.com/api/images/img3">
- <id>img3</id>
+ <image href="http://fancycloudprovider.com/api/images/img3" id='img3'>
<owner_id>ted</owner_id>
<name>JBoss</name>
<description>JBoss</description>
@@ -225,12 +218,11 @@ images collection may be obtained by following the link from the
primary entry-point.
<instances>
- <instance href="http://fancycloudprovider.com/api/instances/inst1">
- <id>inst1</id>
+ <instance href="http://fancycloudprovider.com/api/instances/inst1" id='inst1'>
<owner_id>larry</owner_id>
<name>Production JBoss Instance</name>
<image href="http://fancycloudprovider.com/api/images/img3"/>
- <hardware-profile href="http://fancycloudprovider.com/api/hardware_profiles/m1-small"/>
+ <hardware_profile href="http://fancycloudprovider.com/api/hardware_profiles/m1-small"/>
<realm href="http://fancycloudprovider.com/api/realms/us"/>
<state>RUNNING</state>
@@ -238,13 +230,13 @@ primary entry-point.
<link rel="reboot" href="http://fancycloudprovider.com/api/instances/inst1/reboot"/>
<link rel="stop" href="http://fancycloudprovider.com/api/instances/inst1/stop"/>
</actions>
- <public-addresses>
+ <public_addresses>
<address>inst1.larry.fancycloudprovider.com</address>
- </public-addresses>
+ </public_addresses>
- <private-addresses>
+ <private_addresses>
<address>inst1.larry.internal</address>
- </private-addresses>
+ </private_addresses>
</instance>
</instances>
@@ -260,7 +252,7 @@ Simple attributes include
- **`owner_id`** An opaque identifier which indicates the owner of an instance
- **`name`** An _optional_ short label describing the instance
- **`image`** Provides a link to the platonic image from which the instance is based
-- **`hardware-profile`** Provides a link to the hardware profile in use by the instance
+- **`hardware_profile`** Provides a link to the hardware profile in use by the instance
- **`realm`** Provides a link to the realm where the instance is deployed
- **`state`** Indicator of the instance's current state
- `PENDING`
@@ -269,8 +261,8 @@ Simple attributes include
Multiple-valued attributes include
-- **`public-addresses`** Publicly routable IP addresses or names for the instance
-- **`private-addresses`** Private network IP addresses or names for the instance
+- **`public_addresses`** Publicly routable IP addresses or names for the instance
+- **`private_addresses`** Private network IP addresses or names for the instance
In addition to the abovementioned attributes, each `<instance>` may contain an
`<actions>` block specifying valid actions for the instance, along with the URL
--
1.7.1.1
13 years, 11 months