bosdk_designer 0.1.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.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Shane Emmons
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,18 @@
1
+ = bosdk_designer
2
+
3
+ This library gives you access to the Business Objects Universe Designer through
4
+ the Ruby WIN32 API.
5
+
6
+ == Note on Patches/Pull Requests
7
+
8
+ * Fork the project.
9
+ * Make your feature addition or bug fix.
10
+ * Add tests for it. This is important so I don't break it in a
11
+ future version unintentionally.
12
+ * Commit, do not mess with rakefile, version, or history.
13
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
14
+ * Send me a pull request. Bonus points for topic branches.
15
+
16
+ == Copyright
17
+
18
+ Copyright (c) 2010 Shane Emmons. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,49 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "bosdk_designer"
8
+ gem.summary = %Q{Access the Business Objects Universe Designer using Ruby}
9
+ gem.description = %Q{This library gives you access to the Business Objects Universe Designer through the Ruby WIN32 API.}
10
+ gem.email = "semmons99@gmail.com"
11
+ gem.homepage = "http://semmons99.github.com/bosdk_designer"
12
+ gem.authors = ["Shane Emmons"]
13
+ gem.rubyforge_project = "bosdk-designer"
14
+ gem.add_development_dependency "rspec", "~> 1.3.0"
15
+ end
16
+ Jeweler::GemcutterTasks.new
17
+ Jeweler::RubyforgeTasks.new do |rubyforge|
18
+ rubyforge.doc_task = "rdoc"
19
+ rubyforge.remote_doc_path = ""
20
+ end
21
+ rescue LoadError
22
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
23
+ end
24
+
25
+ require 'spec/rake/spectask'
26
+ Spec::Rake::SpecTask.new(:spec) do |spec|
27
+ spec.libs << 'lib' << 'spec'
28
+ spec.spec_files = FileList['spec/**/*_spec.rb']
29
+ end
30
+
31
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
32
+ spec.libs << 'lib' << 'spec'
33
+ spec.pattern = 'spec/**/*_spec.rb'
34
+ spec.rcov = true
35
+ end
36
+
37
+ task :spec => :check_dependencies
38
+
39
+ task :default => :spec
40
+
41
+ require 'rake/rdoctask'
42
+ Rake::RDocTask.new do |rdoc|
43
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
44
+
45
+ rdoc.rdoc_dir = 'rdoc'
46
+ rdoc.title = "bosdk_designer #{version}"
47
+ rdoc.rdoc_files.include('README*')
48
+ rdoc.rdoc_files.include('lib/**/*.rb')
49
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,36 @@
1
+ require 'win32ole'
2
+
3
+ module BOSDK
4
+ # Wrapper to the Business Objects Universe Designer API
5
+ class Designer
6
+ # Open the Designer Application
7
+ def initialize(username, password, cms, args = {})
8
+ @designer = WIN32OLE.new('Designer.Application')
9
+ @designer.Logon(
10
+ username,
11
+ password,
12
+ cms,
13
+ args[:authtype] || 'secEnterprise'
14
+ )
15
+ @designer.Visible = args[:visible] || false
16
+ @designer.Interactive = args[:interactive] || false
17
+ end
18
+
19
+ # Open the specified universe
20
+ def open_universe(universe_folder, universe_name, lock = false)
21
+ @designer.Universes.OpenFromEnterprise(
22
+ universe_folder, universe_name, lock
23
+ )
24
+ end
25
+
26
+ # Checks if the underlying Designer Application responds to the method
27
+ def method_missing(method, *args)
28
+ ole_method_name = method.to_s.sub(/=$/, '')
29
+ if @designer.ole_respond_to?(ole_method_name)
30
+ @designer.send(method, *args)
31
+ else
32
+ super
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1 @@
1
+ require 'bosdk_designer/designer'
@@ -0,0 +1,64 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ module BOSDK
4
+ describe Designer do
5
+ before(:each) do
6
+ @application = mock('Designer.Application')
7
+
8
+ WIN32OLE.should_receive(:new).at_least(1).with('Designer.Application').and_return(@application)
9
+ @application.should_receive(:Logon).at_least(1).with('Administrator', '', 'cms', 'secEnterprise')
10
+ @application.should_receive(:Visible=).at_least(1).with(false)
11
+ @application.should_receive(:Interactive=).at_least(1).with(false)
12
+
13
+ @designer = Designer.new('Administrator', '', 'cms')
14
+ end
15
+
16
+ describe '#new' do
17
+ it 'should accept an optional authtype' do
18
+ @application.should_receive(:Logon).once.with('Administrator', '', 'cms', 'secWinAD')
19
+
20
+ Designer.new('Administrator', '', 'cms', :authtype => 'secWinAD')
21
+ end
22
+
23
+ it 'should accept an optional visible' do
24
+ @application.should_receive(:Visible=).once.with(true)
25
+
26
+ Designer.new('Administrator', '', 'cms', :visible => true)
27
+ end
28
+
29
+ it 'should accept an optional interactive' do
30
+ @application.should_receive(:Interactive=).once.with(true)
31
+
32
+ Designer.new('Administrator', '', 'cms', :interactive => true)
33
+ end
34
+ end
35
+
36
+ describe '#open_universe' do
37
+ before(:each) do
38
+ @universes = mock('Designer.Universes')
39
+ @application.should_receive(:Universes).once.with.and_return(@universes)
40
+ end
41
+
42
+ it 'should open a universe' do
43
+ @universes.should_receive(:OpenFromEnterprise).once.with('/', 'eFashion', false)
44
+
45
+ @designer.open_universe('/', 'eFashion')
46
+ end
47
+
48
+ it 'should optionally lock the opened universe' do
49
+ @universes.should_receive(:OpenFromEnterprise).once.with('/', 'eFashion', true)
50
+
51
+ @designer.open_universe('/', 'eFashion', true)
52
+ end
53
+ end
54
+
55
+ describe '#method_missing' do
56
+ it 'should check if the underlying designer responds to the method' do
57
+ @application.should_receive(:ole_respond_to?).once.with('Visible').and_return(true)
58
+ @application.should_receive(:Visible=).once.with(true)
59
+
60
+ @designer.Visible = true
61
+ end
62
+ end
63
+ end
64
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,9 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'bosdk_designer'
4
+ require 'spec'
5
+ require 'spec/autorun'
6
+
7
+ Spec::Runner.configure do |config|
8
+
9
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bosdk_designer
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Shane Emmons
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-02-25 00:00:00 -05:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rspec
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 3
30
+ - 0
31
+ version: 1.3.0
32
+ type: :development
33
+ version_requirements: *id001
34
+ description: This library gives you access to the Business Objects Universe Designer through the Ruby WIN32 API.
35
+ email: semmons99@gmail.com
36
+ executables: []
37
+
38
+ extensions: []
39
+
40
+ extra_rdoc_files:
41
+ - LICENSE
42
+ - README.rdoc
43
+ files:
44
+ - .document
45
+ - .gitignore
46
+ - LICENSE
47
+ - README.rdoc
48
+ - Rakefile
49
+ - VERSION
50
+ - lib/bosdk_designer.rb
51
+ - lib/bosdk_designer/designer.rb
52
+ - spec/designer_spec.rb
53
+ - spec/spec.opts
54
+ - spec/spec_helper.rb
55
+ has_rdoc: true
56
+ homepage: http://semmons99.github.com/bosdk_designer
57
+ licenses: []
58
+
59
+ post_install_message:
60
+ rdoc_options:
61
+ - --charset=UTF-8
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ segments:
69
+ - 0
70
+ version: "0"
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ segments:
76
+ - 0
77
+ version: "0"
78
+ requirements: []
79
+
80
+ rubyforge_project: bosdk-designer
81
+ rubygems_version: 1.3.6
82
+ signing_key:
83
+ specification_version: 3
84
+ summary: Access the Business Objects Universe Designer using Ruby
85
+ test_files:
86
+ - spec/designer_spec.rb
87
+ - spec/spec_helper.rb