dumb-logger 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,66 @@
1
+ # -*- coding: utf-8 -*-
2
+ #--
3
+ # Copyright © 2015 Ken Coar
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #++
17
+
18
+ require('rubygems')
19
+ require('versionomy')
20
+
21
+ class DumbLogger
22
+
23
+ #
24
+ # Initial starting point.
25
+ #
26
+ @version = Versionomy.parse('0.0.1')
27
+
28
+ #
29
+ # First actual release: 1.0.0!
30
+ #
31
+ @version = @version.change(:major => 1,
32
+ :tiny => 0)
33
+
34
+ #
35
+ # How to advance the version number.
36
+ #
37
+ #@version = @version.bump(:minor)
38
+
39
+ @version.freeze
40
+
41
+ #
42
+ # Frozen string representation of the module version number.
43
+ #
44
+ VERSION = @version.to_s.freeze
45
+
46
+ #
47
+ # Returns the {http://rubygems.org/gems/versionomy Versionomy}
48
+ # representation of the package version number.
49
+ #
50
+ # @return [Versionomy]
51
+ #
52
+ def self.version
53
+ return @version
54
+ end # def self.version
55
+
56
+ #
57
+ # Returns the package version number as a string.
58
+ #
59
+ # @return [String]
60
+ # Package version number.
61
+ #
62
+ def self.VERSION
63
+ return self.const_get('VERSION')
64
+ end # def self.VERSION
65
+
66
+ end # class DumbLogger
data/lib/dumblogger.rb ADDED
@@ -0,0 +1,21 @@
1
+ # -*- coding: utf-8 -*-
2
+ #--
3
+ # Copyright © 2015 Ken Coar
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #++
17
+
18
+ #
19
+ # Provide an alternate name for require statements.
20
+ #
21
+ require('dumb-logger')
@@ -0,0 +1,71 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright © (c) 2015 Ken Coar
3
+ #
4
+ # This software is licensed to you under the GNU General Public License,
5
+ # version 2 (GPLv2). There is NO WARRANTY for this software, express or
6
+ # implied, including the implied warranties of MERCHANTABILITY or FITNESS
7
+ # FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
8
+ # along with this software; if not, see
9
+ # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
10
+ #
11
+ # Based on
12
+ # https://github.com/dgoodwin/tito/blob/master/src/tito/tagger/main.py
13
+ #
14
+ """
15
+ Code for tagging Ruby gems based on their <gemname>::VERSION constant.
16
+ """
17
+
18
+ import os
19
+ import re
20
+ import rpm
21
+ import shutil
22
+ import subprocess
23
+ import tempfile
24
+ import textwrap
25
+ import sys
26
+
27
+ from string import Template
28
+
29
+ from time import strftime
30
+
31
+ from tito.common import (debug, error_out, run_command,
32
+ find_file_with_extension, find_spec_file,
33
+ get_project_name, get_latest_tagged_version,
34
+ get_spec_version_and_release,
35
+ replace_version, tag_exists_locally,
36
+ tag_exists_remotely, head_points_to_tag,
37
+ undo_tag, increase_version, reset_release,
38
+ increase_zstream, BUILDCONFIG_SECTION,
39
+ get_relative_project_dir_cwd)
40
+ from tito.compat import *
41
+ from tito.exception import TitoException
42
+ from tito.config_object import ConfigObject
43
+ from tito.tagger import VersionTagger
44
+
45
+ class GemTagger(VersionTagger):
46
+ """
47
+ Releases will be tagged by obtaining the value of the VERSION constant
48
+ from the gem.
49
+ """
50
+
51
+ def __init__(self, config=None, keep_version=False, offline=False, user_config=None):
52
+ VersionTagger.__init__(self, config=config)
53
+ self.gemspec_file_name = find_file_with_extension(suffix=".gemspec")
54
+
55
+ def _tag_release(self):
56
+ """
57
+ Tag a new version of the package based upon the gem version.
58
+ """
59
+ self._make_changelog()
60
+ new_version = subprocess.check_output(
61
+ [
62
+ "ruby",
63
+ "-e",
64
+ "gspec = eval(File.read('" + self.gemspec_file_name + "')); " +
65
+ "print(gspec.version)"
66
+ ])
67
+ self._check_tag_does_not_exist(self._get_new_tag(new_version))
68
+ self._update_changelog(new_version)
69
+ self._update_setup_py(new_version)
70
+ self._update_package_metadata(new_version)
71
+
@@ -0,0 +1,3 @@
1
+ the rel-eng/packages directory contains metadata files
2
+ named after their packages. Each file has the latest tagged
3
+ version and the project's relative directory.
@@ -0,0 +1,6 @@
1
+ [buildconfig]
2
+ builder = tito.builder.Builder
3
+ tagger = GemTagger
4
+ lib_dir = rel-eng/custom/
5
+ changelog_do_not_remove_cherrypick = 0
6
+ changelog_format = %s (%ae)
@@ -0,0 +1,86 @@
1
+ %global gem_name dumb-logger
2
+ %global rubyabi 1.9.1
3
+
4
+ Name: rubygem-%{gem_name}
5
+ Version: 0.0.0
6
+ Release: 1%{?dist}
7
+
8
+ Summary: A very basic level-or-mask status logger.
9
+
10
+ Group: Development/Languages
11
+
12
+ License: Apache 2.0 or GPLv2
13
+ URL: git@github.com:RoUS/dumb-logger.git
14
+ Source0: %{gem_name}-%{version}.gem
15
+
16
+ BuildRequires: ruby(abi) = %{rubyabi}
17
+ BuildRequires: ruby-devel
18
+ BuildRequires: rubygems-devel
19
+ BuildRequires: rubygem(rake)
20
+ BuildRequires: rubygem(aruba)
21
+ BuildRequires: rubygem(bundler)
22
+ BuildRequires: rubygem(cucumber)
23
+ BuildRequires: rubygem(yard)
24
+ Requires: ruby(abi) = %{rubyabi}
25
+ Requires: rubygems
26
+ Provides: rubygem(dumb-logger) = %{version}
27
+
28
+
29
+ %description
30
+ This provides a simple text-based logger class that can deliver
31
+ messages to files or Ruby IO streams based on logging levels or
32
+ bitmasks.
33
+
34
+
35
+ %prep
36
+ %setup -q -c -T
37
+ mkdir -p ./%{gem_dir}
38
+
39
+
40
+ %build
41
+ export CONFIGURE_ARGS="--with-cflags='%{optflags}'"
42
+ gem install --local --install-dir .%{gem_dir} -V --force %{SOURCE0}
43
+
44
+
45
+ %install
46
+ mkdir -p $RPM_BUILD_ROOT%{gem_dir}
47
+ mkdir -p $RPM_BUILD_ROOT%{gem_extdir}/ext/%{gem_name}/ext
48
+
49
+ cp -a .%{gem_dir}/* %{buildroot}/%{gem_dir}
50
+
51
+ # Let's move arch dependent files to arch specific directory
52
+ cp -a ./%{gem_instdir}/ext/json/ext/json \
53
+ $RPM_BUILD_ROOT%{gem_extdir}/ext/%{gem_name}/ext
54
+
55
+ chmod 0644 $RPM_BUILD_ROOT%{gem_instdir}/install.rb
56
+ chmod 0644 $RPM_BUILD_ROOT%{gem_instdir}/tests/*.rb
57
+ # Let's move arch dependent files to arch specific directory
58
+ cp -a ./%{gem_instdir}/ext/json/ext/json \
59
+ $RPM_BUILD_ROOT%{gem_extdir}/ext/%{gem_name}/ext
60
+
61
+ chmod -R 0655 $RPM_BUILD_ROOT%{gem_instdir}/features
62
+
63
+ # We don't need those files anymore.
64
+ rm -rf $RPM_BUILD_ROOT%{gem_instdir}/{.require_paths,.gitignore,.travis.yml}
65
+
66
+
67
+ %check
68
+ pushd .%{gem_instdir}
69
+ ruby -S testrb -Ilib:ext/%{gem_name}/ext $(ls -1 tests/test_*.rb | sort)
70
+ popd
71
+
72
+
73
+ %files
74
+ %defattr(-,root,root,-)
75
+ %doc %{gem_instdir}/[A-Z]*
76
+ %exclude %{gem_instdir}/Rakefile
77
+ %dir %{gem_instdir}
78
+ %dir %{gem_instdir}/lib
79
+ %dir %{gem_instdir}/lib/%{gem_name}
80
+ %{gem_instdir}/tools/
81
+ %{gem_instdir}/lib/%{gem_name}.rb
82
+ %{gem_instdir}/lib/%{gem_name}/version.rb
83
+ %{gem_spec}
84
+
85
+
86
+ %changelog
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dumb-logger
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Ken Coar
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: versionomy
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Primitive no-frills level/mask-driven stream logger.
56
+ email:
57
+ - kcoar@redhat.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - .yardopts
64
+ - Gemfile
65
+ - LICENCE.md
66
+ - README.md
67
+ - Rakefile
68
+ - dumb-logger.gemspec
69
+ - features/attributes.feature
70
+ - features/bitmasks.feature
71
+ - features/labels.feature
72
+ - features/levels.feature
73
+ - features/output.feature
74
+ - features/step_definitions/parts.rb
75
+ - features/support/env.rb
76
+ - features/support/hooks.rb
77
+ - lib/dumb-logger.rb
78
+ - lib/dumb-logger/version.rb
79
+ - lib/dumblogger.rb
80
+ - rel-eng/custom/GemTagger.py
81
+ - rel-eng/packages/.readme
82
+ - rel-eng/tito.props
83
+ - rubygem-dumb-logger.spec
84
+ homepage: ''
85
+ licenses:
86
+ - Apache 2.0
87
+ metadata: {}
88
+ post_install_message:
89
+ rdoc_options: []
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ requirements: []
103
+ rubyforge_project:
104
+ rubygems_version: 2.1.3
105
+ signing_key:
106
+ specification_version: 4
107
+ summary: Primitive level/mask-driven stream logger.
108
+ test_files:
109
+ - features/attributes.feature
110
+ - features/bitmasks.feature
111
+ - features/labels.feature
112
+ - features/levels.feature
113
+ - features/output.feature
114
+ - features/step_definitions/parts.rb
115
+ - features/support/env.rb
116
+ - features/support/hooks.rb
117
+ has_rdoc: