[SCM] ci-tooling packaging branch, master, updated. 8a97c0b50c2ff63a730cd250b4e50a9bdca1b4e9

Harald Sitter apachelogger-guest at moszumanska.debian.org
Wed May 6 05:25:03 UTC 2015


Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=c0a470a

The following commit has been merged in the master branch:
commit c0a470ab95b0554959fd0eebc29a0901a5a08119
Author: Harald Sitter <sitter at kde.org>
Date:   Wed May 6 07:15:55 2015 +0200

    add new kci module
    
    this is supposed to control globally reappearing consts such as series to
    build as well as types and architectures
---
 data/kci.yaml    | 10 ++++++++++
 lib/kci.rb       | 36 ++++++++++++++++++++++++++++++++++++
 test/test_kci.rb | 25 +++++++++++++++++++++++++
 3 files changed, 71 insertions(+)

diff --git a/data/kci.yaml b/data/kci.yaml
new file mode 100644
index 0000000..4afe4ad
--- /dev/null
+++ b/data/kci.yaml
@@ -0,0 +1,10 @@
+series:
+  wily: "15.10"
+  vivid: "15.04"
+  utopic: "14.10"
+architectures:
+  - amd64
+  - i386
+types:
+  - stable
+  - unstable
diff --git a/lib/kci.rb b/lib/kci.rb
new file mode 100644
index 0000000..c6fe025
--- /dev/null
+++ b/lib/kci.rb
@@ -0,0 +1,36 @@
+require 'yaml'
+require 'ostruct'
+
+# Kubuntu CI specific stuff.
+module KCI
+  # @return [OpenStruct] distribution series
+  def self.series
+    data['series']
+  end
+
+  # @return [Array<String>] architectues to integrate
+  def self.architectures
+    data['architectures']
+  end
+
+  # @return [Array<String>] types to integrate (stable/unstable)
+  def self.types
+    data['types']
+  end
+
+  private
+
+  def self.data
+    return @data if defined?(@data)
+    base = File.expand_path(File.dirname(File.dirname(__FILE__)))
+    file = File.join(base, 'data', 'kci.yaml')
+    @data = YAML.load(File.read(file))
+  end
+
+  # def self.data
+  #   return @data if defined?(@data)
+  #   base = File.expand_path(File.dirname(File.dirname(__FILE__)))
+  #   file = File.join(base, 'data', 'kci.json')
+  #   @data = JSON.parse(File.read(file), object_class: OpenStruct)
+  # end
+end
diff --git a/test/test_kci.rb b/test/test_kci.rb
new file mode 100644
index 0000000..175b0f4
--- /dev/null
+++ b/test/test_kci.rb
@@ -0,0 +1,25 @@
+require_relative '../lib/kci'
+require_relative 'lib/testcase'
+
+# Test kci
+class KCITest < TestCase
+  def assert_equal_collection(expected, actual)
+    assert_equal(expected.sort, actual.sort)
+  end
+
+  def test_types
+    assert_equal_collection(%w(stable unstable), KCI.types)
+  end
+
+  def test_architectures
+    assert_equal_collection(%w(amd64 i386), KCI.architectures)
+  end
+
+  def test_series
+    assert_equal_collection(%w(wily vivid utopic), KCI.series.keys)
+    assert_equal_collection(%w(15.10 15.04 14.10), KCI.series.values)
+    assert_equal('15.10', KCI.series['wily'])
+    assert_equal('15.04', KCI.series['vivid'])
+    assert_equal('14.10', KCI.series['utopic'])
+  end
+end

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list