sappho-data-publisher 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sappho-data-publisher/atlassian_app.rb +3 -3
- data/lib/sappho-data-publisher/configuration.rb +2 -2
- data/lib/sappho-data-publisher/custom_liquid.rb +2 -4
- data/lib/sappho-data-publisher/publisher.rb +3 -5
- data/lib/sappho-data-publisher/version.rb +1 -1
- data/lib/sappho-data-publisher.rb +4 -9
- data/test/ruby/confluence_test.rb +0 -1
- data/test/ruby/custom_liquid_test.rb +1 -4
- data/test/ruby/helper.rb +11 -15
- data/test/ruby/jira_test.rb +0 -1
- metadata +20 -5
- data/lib/sappho-data-publisher/modules.rb +0 -49
@@ -3,7 +3,7 @@
|
|
3
3
|
# See http://www.gnu.org/licenses/agpl.html for full details of the license terms.
|
4
4
|
# Copyright 2012 Andrew Heald.
|
5
5
|
|
6
|
-
require 'sappho-
|
6
|
+
require 'sappho-basics/module_register'
|
7
7
|
|
8
8
|
module Sappho
|
9
9
|
module Data
|
@@ -19,9 +19,9 @@ module Sappho
|
|
19
19
|
|
20
20
|
def connect
|
21
21
|
raise "you have already attempted to connect to #{@appName}" if @appServer or @loggedIn
|
22
|
-
modules =
|
22
|
+
modules = Sappho::ModuleRegister.instance
|
23
23
|
@config = modules.get :configuration
|
24
|
-
@logger = modules.get :
|
24
|
+
@logger = modules.get :log
|
25
25
|
url = @config.data["#{@appName.downcase}.url"]
|
26
26
|
mock = "mock#{@appName}"
|
27
27
|
@appServer = modules.set?(mock) ? modules.get(mock).mockInstance(url) : yield(url)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# See http://www.gnu.org/licenses/agpl.html for full details of the license terms.
|
4
4
|
# Copyright 2012 Andrew Heald.
|
5
5
|
|
6
|
-
require 'sappho-
|
6
|
+
require 'sappho-basics/module_register'
|
7
7
|
require 'yaml'
|
8
8
|
|
9
9
|
module Sappho
|
@@ -17,7 +17,7 @@ module Sappho
|
|
17
17
|
def initialize filename = ARGV[0]
|
18
18
|
filename = File.expand_path(filename || 'config.yml')
|
19
19
|
@data = YAML.load_file filename
|
20
|
-
|
20
|
+
Sappho::ModuleRegister.instance.get(:log).info "configuration loaded from #{filename}"
|
21
21
|
end
|
22
22
|
|
23
23
|
end
|
@@ -3,10 +3,8 @@
|
|
3
3
|
# See http://www.gnu.org/licenses/agpl.html for full details of the license terms.
|
4
4
|
# Copyright 2012 Andrew Heald.
|
5
5
|
|
6
|
-
require 'rubygems'
|
7
|
-
gem 'liquid'
|
8
6
|
require 'liquid'
|
9
|
-
require 'sappho-
|
7
|
+
require 'sappho-basics/module_register'
|
10
8
|
|
11
9
|
module Sappho
|
12
10
|
module Data
|
@@ -24,7 +22,7 @@ module Sappho
|
|
24
22
|
|
25
23
|
def fullname username
|
26
24
|
begin
|
27
|
-
name =
|
25
|
+
name = Sappho::ModuleRegister.instance.get('AddressBook').getUserFullName(username)
|
28
26
|
raise 'unknown person' unless name and name.length > 0
|
29
27
|
rescue
|
30
28
|
name = '** John Doe **'
|
@@ -3,11 +3,9 @@
|
|
3
3
|
# See http://www.gnu.org/licenses/agpl.html for full details of the license terms.
|
4
4
|
# Copyright 2012 Andrew Heald.
|
5
5
|
|
6
|
-
require 'rubygems'
|
7
|
-
gem 'liquid'
|
8
6
|
require 'liquid'
|
9
7
|
require 'yaml'
|
10
|
-
require 'sappho-
|
8
|
+
require 'sappho-basics/module_register'
|
11
9
|
|
12
10
|
module Sappho
|
13
11
|
module Data
|
@@ -16,8 +14,8 @@ module Sappho
|
|
16
14
|
class Publisher
|
17
15
|
|
18
16
|
def publish
|
19
|
-
modules =
|
20
|
-
logger = modules.get :
|
17
|
+
modules = Sappho::ModuleRegister.instance
|
18
|
+
logger = modules.get :log
|
21
19
|
configurator = modules.get modules.get(:configuration).data['config.module']
|
22
20
|
globalScript = ''
|
23
21
|
configurator.getScript(configurator.getGlobalConfiguration) { |configChunk| globalScript += configChunk }
|
@@ -3,8 +3,7 @@
|
|
3
3
|
# See http://www.gnu.org/licenses/agpl.html for full details of the license terms.
|
4
4
|
# Copyright 2012 Andrew Heald.
|
5
5
|
|
6
|
-
require '
|
7
|
-
require 'sappho-data-publisher/modules'
|
6
|
+
require 'sappho-basics/module_register'
|
8
7
|
require 'sappho-data-publisher/publisher'
|
9
8
|
require 'sappho-data-publisher/configuration'
|
10
9
|
require 'sappho-data-publisher/confluence'
|
@@ -19,13 +18,9 @@ module Sappho
|
|
19
18
|
class CommandLine
|
20
19
|
|
21
20
|
def CommandLine.process
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
logger.formatter = proc { |severity, datetime, progname, msg| "#{msg}\n" }
|
26
|
-
logger.info "sappho-data-publisher version #{VERSION} - #{HOMEPAGE}"
|
27
|
-
modules = Modules.instance
|
28
|
-
modules.set :logger, logger
|
21
|
+
ENV['application.log.detail'] = 'message'
|
22
|
+
modules = Sappho::ModuleRegister.instance
|
23
|
+
modules.get(:log).info "sappho-data-publisher version #{VERSION} - #{HOMEPAGE}"
|
29
24
|
modules.set :configuration, Configuration.new
|
30
25
|
jira = Jira.new
|
31
26
|
jira.connect
|
@@ -3,16 +3,13 @@
|
|
3
3
|
# See http://www.gnu.org/licenses/agpl.html for full details of the license terms.
|
4
4
|
# Copyright 2012 Andrew Heald.
|
5
5
|
|
6
|
-
require '
|
7
|
-
gem 'liquid', '>= 2.3.0'
|
6
|
+
require 'helper'
|
8
7
|
require 'liquid'
|
9
8
|
require 'sappho-data-publisher/custom_liquid'
|
10
|
-
require 'helper'
|
11
9
|
|
12
10
|
class CustomLiquidTest < Test::Unit::TestCase
|
13
11
|
|
14
12
|
def setup
|
15
|
-
setupLogging
|
16
13
|
setupConfiguration
|
17
14
|
setupJira 'AddressBook'
|
18
15
|
@jira.connect
|
data/test/ruby/helper.rb
CHANGED
@@ -3,10 +3,12 @@
|
|
3
3
|
# See http://www.gnu.org/licenses/agpl.html for full details of the license terms.
|
4
4
|
# Copyright 2012 Andrew Heald.
|
5
5
|
|
6
|
-
require
|
7
|
-
|
6
|
+
require 'rubygems'
|
7
|
+
gem 'liquid'
|
8
|
+
gem 'sappho-basics'
|
9
|
+
require 'test/unit'
|
8
10
|
require 'yaml'
|
9
|
-
require 'sappho-
|
11
|
+
require 'sappho-basics/module_register'
|
10
12
|
require 'sappho-data-publisher/configuration'
|
11
13
|
require 'sappho-data-publisher/jira'
|
12
14
|
require 'sappho-data-publisher/confluence'
|
@@ -15,33 +17,27 @@ require 'mock_confluence'
|
|
15
17
|
|
16
18
|
class Test::Unit::TestCase
|
17
19
|
|
18
|
-
def setupLogging
|
19
|
-
@logger = Logger.new STDOUT
|
20
|
-
@logger.level = Logger::DEBUG
|
21
|
-
Sappho::Data::Publisher::Modules.instance.set :logger, @logger
|
22
|
-
end
|
23
|
-
|
24
20
|
def setupConfiguration (filename = testFilename('config/config.yml'))
|
25
21
|
config = Sappho::Data::Publisher::Configuration.new filename
|
26
|
-
Sappho::
|
22
|
+
Sappho::ModuleRegister.instance.set :configuration, config
|
27
23
|
end
|
28
24
|
|
29
25
|
def setupJira (moduleName, dataFilename = testFilename('data/jira.yml'))
|
30
26
|
@mockJira = MockJira.new dataFilename
|
31
|
-
Sappho::
|
27
|
+
Sappho::ModuleRegister.instance.set 'mockJira', @mockJira
|
32
28
|
@jira = Sappho::Data::Publisher::Jira.new
|
33
|
-
Sappho::
|
29
|
+
Sappho::ModuleRegister.instance.set moduleName, @jira
|
34
30
|
end
|
35
31
|
|
36
32
|
def setupConfluence moduleName
|
37
33
|
@mockConfluence = MockConfluence.new
|
38
|
-
Sappho::
|
34
|
+
Sappho::ModuleRegister.instance.set 'mockConfluence', @mockConfluence
|
39
35
|
@confluence = Sappho::Data::Publisher::Confluence.new
|
40
|
-
Sappho::
|
36
|
+
Sappho::ModuleRegister.instance.set moduleName, @confluence
|
41
37
|
end
|
42
38
|
|
43
39
|
def teardown
|
44
|
-
Sappho::
|
40
|
+
Sappho::ModuleRegister.instance.shutdown
|
45
41
|
end
|
46
42
|
|
47
43
|
def testFilename filename
|
data/test/ruby/jira_test.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sappho-data-publisher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 9
|
10
|
+
version: 0.1.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrew Heald
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-03-
|
18
|
+
date: 2012-03-15 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rake
|
@@ -50,6 +50,22 @@ dependencies:
|
|
50
50
|
version: 2.3.0
|
51
51
|
type: :runtime
|
52
52
|
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: sappho-basics
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 29
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
- 0
|
65
|
+
- 1
|
66
|
+
version: 0.0.1
|
67
|
+
type: :runtime
|
68
|
+
version_requirements: *id003
|
53
69
|
description: See the project home page for more information
|
54
70
|
email:
|
55
71
|
- andrew@heald.co.uk
|
@@ -66,7 +82,6 @@ files:
|
|
66
82
|
- lib/sappho-data-publisher/confluence.rb
|
67
83
|
- lib/sappho-data-publisher/custom_liquid.rb
|
68
84
|
- lib/sappho-data-publisher/jira.rb
|
69
|
-
- lib/sappho-data-publisher/modules.rb
|
70
85
|
- lib/sappho-data-publisher/publisher.rb
|
71
86
|
- lib/sappho-data-publisher/version.rb
|
72
87
|
- lib/sappho-data-publisher.rb
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# See https://github.com/sappho/sappho-data-publisher/wiki for project documentation.
|
2
|
-
# This software is licensed under the GNU Affero General Public License, version 3.
|
3
|
-
# See http://www.gnu.org/licenses/agpl.html for full details of the license terms.
|
4
|
-
# Copyright 2012 Andrew Heald.
|
5
|
-
|
6
|
-
require 'singleton'
|
7
|
-
|
8
|
-
module Sappho
|
9
|
-
module Data
|
10
|
-
module Publisher
|
11
|
-
|
12
|
-
class Modules
|
13
|
-
|
14
|
-
include Singleton
|
15
|
-
|
16
|
-
def initialize
|
17
|
-
@modules = {}
|
18
|
-
end
|
19
|
-
|
20
|
-
def set name, mod
|
21
|
-
@modules[name] = mod
|
22
|
-
end
|
23
|
-
|
24
|
-
def get name
|
25
|
-
@modules[name]
|
26
|
-
end
|
27
|
-
|
28
|
-
def set? name
|
29
|
-
@modules.has_key? name
|
30
|
-
end
|
31
|
-
|
32
|
-
def shutdown
|
33
|
-
each { |mod| mod.shutdown }
|
34
|
-
end
|
35
|
-
|
36
|
-
def each
|
37
|
-
@modules.each do |name, mod|
|
38
|
-
begin
|
39
|
-
yield mod
|
40
|
-
rescue
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|