adaptation 0.1.6 → 0.1.7

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/CHANGELOG CHANGED
@@ -52,3 +52,9 @@
52
52
  - added deprecated method Adaptation::Message#check for backwards compatibility
53
53
  - corrected path in base.rb to find settings.yml using ADAPTOR_ROOT
54
54
  - forced ActiveRecord versions 2.2.2 (2.3.x breaks tests)
55
+ * 0.1.7
56
+ - improved documentation (README)
57
+ - console options, ruby-debug optional
58
+ - console options: environment
59
+ - boot is (usually) done using config/boot.rb, except when forcing the
60
+ environment
data/README CHANGED
@@ -2,52 +2,148 @@
2
2
 
3
3
  Adaptation is a framework that tries to facilitate data interchange
4
4
  between applications. Applications send and receive xml messages through
5
- a message oriented middleware using a publish/subscribe pattern:
5
+ a message oriented middleware (<b>mom</b>) using a <b>publish/subscribe</b> pattern:
6
6
 
7
- Application A publishes messages on topic A, and all applications interested
8
- on reading messages from A subscribe to its topic.
7
+ Example:
8
+
9
+ Application A publishes messages on topic "messages from A", and all
10
+ applications interested on reading messages from A subscribe to that topic.
9
11
 
10
12
  Adaptation focuses on facilitate building _adaptors_. _adaptors_ are programs
11
13
  that are executed for an application subscribed to a topic, when a message is
12
14
  received on that topic.
13
15
 
14
- _adaptors_ are built in a similar way that web apps are built using
15
- the Ruby on Rails framework. This way adaptation uses a nice pattern
16
- of separation between data input/output and logic. When building an
17
- _adaptor_, logic will be stored under __Adaptors__ (in Rails these would
18
- be Controllers) , and xml data interaction with the middleware will be
19
- performed by a __Message__. __adaptors__ also can use ActiveRecord based
20
- models for data interaction with applications database, like Rails does, if
21
- adapting a database-backed application.
22
-
23
-
24
- == Getting started
25
-
26
- 1. At the command prompt, start a new adaptation adaptor using the adaptation command
27
- and your adaptor name. Ex: adaptation myadaptor
28
- This will generate a an adaptor file tree.
29
- 2. If no message oriented middleware has been alreay set, change directory into myadaptor
30
- and start the mom (message oriented middleware):
31
- <tt>script/mom</tt>
32
- This will start a mom in localhost (default), listening on port 8080 (default).
33
- 3. Subscribe your adaptor to the mom, so it will be executed when a message is received on
34
- a topic your adaaptor is interested in:
35
- <tt>script/subscribe</tt>
36
- By default this will try to subscribe to a mom listening on localhost:8080, using port
37
- 8081 to subscribe. These values can be changed editing <tt>config/mom.yml</tt>. In mom.yml
16
+ Adaptation is highly inspired by {Ruby on Rails}[http://rubyonrails.org] web
17
+ framework, so _adaptors_ are built in a similar way that web apps are built
18
+ using the RoR[http://rubyonrails.org] framework.
19
+
20
+ When building an _adaptor_, logic will be stored into Adaptation::Adaptor objects, and
21
+ mapping of xml data messages will be performed by Adaptation::Message objects.
22
+
23
+ Adaptation can use ActiveRecord[http://api.rubyonrails.org/classes/ActiveRecord/Base.html]
24
+ based models for data interaction with databases.
25
+
26
+
27
+ == Installation
28
+
29
+ Adaptation is available as a ruby gem, so the easiest way should be:
30
+
31
+ > gem install adaptation
32
+
33
+
34
+ == Usage
35
+
36
+ 1. At the command prompt, start a new adaptation adaptor using the _adaptation_ command
37
+ and your adaptor name:
38
+
39
+ > adaptation myadaptor
40
+
41
+ This will generate a an adaptor file tree under folder _myadaptor_.
42
+
43
+ 2. If no message oriented middleware has been already set, change directory into _myadaptor_
44
+ and start the <b>mom</b>:
45
+
46
+ > mom
47
+
48
+ This will start a <b>mom</b> in _localhost_ (default), listening on port <em>8080</em> (default).
49
+
50
+ 3. Subscribe your adaptor to the <b>mom</b>, so it will be executed when a message is received on
51
+ a topic your adaptor is interested in:
52
+
53
+ > script/subscribe
54
+
55
+ By default this will try to subscribe to a *mom* listening on <em>localhost:8080</em>, using port
56
+ <em>8081</em> to subscribe (subscribing means starting a new server that listens for
57
+ message publication notifications). These values can be changed editing <em>config/mom.yml</em>. In <em>mom.yml</em>
38
58
  you can also specify wich topics your adaptor is interested in.
39
- 4. Start developing your adaptor, probably generating __Adaptors__[link:../rdoc/classes/Adaptation/Adaptor.html], __Messages__[link:../rdoc/classes/Adaptation/Message.html]
40
- and __Models__[http://api.rubyonrails.org/classes/ActiveRecord/Base.html].
41
59
 
60
+ 4. Right now you should have a <b>mom</b>_ listening for messages on <em>localhost:8080</em>, and an _adaptor_
61
+ subscribed to that *mom* and listening on <em>localhost:8081</em>, and interested in all topics available.
62
+
63
+ This environment can be tested by executing the following from _myadaptor_ folder:
64
+
65
+ > ruby script/publish NEWS '<helloworld/>'
66
+
67
+ The previous command should publish de xml <em><helloworld/></em> message into topic _NEWS_ from the *mom*.
68
+ This message should be displayed in the subscriber terminal when delivered by the *mom*.
69
+ Nothing would be executed, because a _Helloworld_ message[link:../rdoc/classes/Adaptation/Message.html] to
70
+ map this xml message and a _HelloworldAdaptor_[link:../rdoc/classes/Adaptation/Adaptor.html] to process it don't
71
+ exist yet. Since these classes aren't implemented, Adaptation will pass the message as a xml _String_ to the
72
+ default _ApplicationAdaptor_ adaptor, but its _process_ method is still empty, so nothing will happen.
73
+
74
+ To see something happening the _process_ method in the default _ApplicationAdaptor_ could be implemented,
75
+ editing file <em>myadaptor/app/adaptors/application.rb</em>:
76
+
77
+ class ApplicationAdaptor < Adaptation::Adaptor
78
+
79
+ def process message
80
+ logger.info "Received message #{message}"
81
+ end
82
+
83
+ end
84
+
85
+ Now, if the previous <em><helloword/></em> message is published, that should be visible
86
+ in <em>log/development.log</em>.
87
+
88
+ The other way this can be done is by creating _Helloworld_ Adaptation::Message class to
89
+ map the xml data:
90
+
91
+ > ruby script/generate message helloworld
92
+ exists app/messages/
93
+ exists test/unit/
94
+ exists test/fixtures/
95
+ create app/messages/helloworld.rb
96
+ create test/unit/helloworld_test.rb
97
+ create test/fixtures/helloworld.xml
98
+
99
+ The file we care about right now is <em>app/messages/helloworld.rb</em>:
100
+
101
+ class Helloworld < Adaptation::Message
102
+ end
103
+
104
+ We can leave it like this by now, and proceed to generate the _HelloworldAdaptor_ Adaptation::Adaptor class:
105
+
106
+ > ruby script/generate adaptor helloworld
107
+ exists app/adaptors/
108
+ exists test/functional/
109
+ create app/adaptors/helloworld_adaptor.rb
110
+ create test/functional/helloworld_adaptor_test.rb
111
+
112
+ and to edit <em>app/adaptors/helloworld_adaptor</em> to make something happen
113
+ when a message is received:
114
+
115
+ class HelloworldAdaptor < ApplicationAdaptor
116
+
117
+ def process helloworld
118
+ logger.info "Received message: #{helloworld.to_xml.to_s}"
119
+ end
120
+
121
+ end
122
+
123
+ We can notice that _helloworld_ variable is not a _String_ now, because Adaptation
124
+ has been able to map it to a Adaptation::Message object, and that the _HelloworldAdaptor_
125
+ inherits from _ApplicationAdaptor_, so functionality repeated in different _Adaptors_[link:../rdoc/classes/Adaptation/Adaptor.html]
126
+ can be placed in _ApplicationAdaptor_.
127
+
42
128
 
43
129
  == Moms
44
130
 
45
- By default, Adaptation will try to use druby to execute the built-in Ruby mom. This
46
- mom is suitable for development, but not for production. For a production environment
131
+ By default, Adaptation will try to use druby to execute the built-in Ruby *mom*. This
132
+ *mom* is suitable for development, but not for production. For a production environment
47
133
  a more stable solution like Xmlblaster[http://www.xmlblaster.org] should be chosen.
48
134
 
135
+ Different message brokers can be configured in <em>config/mom.yml</em>, and example
136
+ configuration for supported *moms* are present in the same file when an _adaptor_ is
137
+ generated with the <em>adaptation</em> command.
49
138
 
50
- == Description of contents
139
+ When we want to publish/subscribe to a *mom* different than the default druby, we
140
+ can do so by adding the <em>MOM=mom_type</em> option:
141
+
142
+ > ruby script/subscribe MOM=xmlblaster
143
+ > ruby script/publish MOM=xmlblaster topic message
144
+
145
+
146
+ == Description of an _adaptor_ file tree:
51
147
 
52
148
  app
53
149
  Holds all the code that's specific to this particular adaptor.
@@ -79,8 +175,7 @@ lib
79
175
  belong under adaptors, models, or messages.
80
176
 
81
177
  public
82
- The directory available for the calling the adaptor and for utilities the adaptaed
83
- application must be aware of, like a tool for publishing messages to the mom.
178
+ The directory available for calling the adaptor (contains dispatch.rb).
84
179
 
85
180
  script
86
181
  Helper scripts for automation and generation.
@@ -89,3 +184,9 @@ test
89
184
  Unit and functional tests along with fixtures. When using the script/generate scripts, template
90
185
  test files will be generated for you and placed in this directory.
91
186
 
187
+
188
+ == Debugging
189
+ <em>TODO: ruby script/console + ruby-debug</em>
190
+
191
+ == Testing
192
+ <em>TODO</em>
data/bin/about CHANGED
@@ -1,5 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
2
  require File.dirname(__FILE__) + '/../config/boot'
3
- require 'rubygems'
4
- gem 'adaptation'
5
3
  require 'commands/about'
data/bin/console CHANGED
@@ -1,9 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
- unless defined? ADAPTOR_ROOT
3
- ADAPTOR_ROOT = File.expand_path(File.dirname(__FILE__) + '/..')
4
- end
5
- require "#{ADAPTOR_ROOT}/config/boot"
2
+
3
+ ADAPTOR_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(ADAPTOR_ROOT)
6
4
  require 'rubygems'
7
- gem 'adaptation'
5
+ require 'adaptation'
6
+
8
7
  require 'commands/console'
9
8
 
data/bin/destroy CHANGED
@@ -1,5 +1,15 @@
1
1
  #!/usr/bin/env ruby
2
- require File.dirname(__FILE__) + '/../config/boot'
2
+
3
+ unless defined?(RAILS_ROOT)
4
+ root_path = File.join(File.dirname(__FILE__), '..')
5
+ unless RUBY_PLATFORM =~ /mswin32/
6
+ require 'pathname'
7
+ root_path = Pathname.new(root_path).cleanpath(true).to_s
8
+ end
9
+ RAILS_ROOT = root_path
10
+ end
11
+
3
12
  require 'rubygems'
4
13
  gem 'adaptation'
14
+
5
15
  require 'commands/destroy'
data/bin/generate CHANGED
@@ -1,5 +1,15 @@
1
1
  #!/usr/bin/env ruby
2
- require File.dirname(__FILE__) + '/../config/boot'
2
+
3
+ unless defined?(RAILS_ROOT)
4
+ root_path = File.join(File.dirname(__FILE__), '..')
5
+ unless RUBY_PLATFORM =~ /mswin32/
6
+ require 'pathname'
7
+ root_path = Pathname.new(root_path).cleanpath(true).to_s
8
+ end
9
+ RAILS_ROOT = root_path
10
+ end
11
+
3
12
  require 'rubygems'
4
13
  gem 'adaptation'
14
+
5
15
  require 'commands/generate'
data/bin/publish CHANGED
@@ -1,8 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
- unless defined? ADAPTOR_ROOT
3
- ADAPTOR_ROOT = File.expand_path(File.dirname(__FILE__) + '/..')
4
- end
5
- require 'rubygems'
6
- require 'adaptation'
7
-
2
+ require File.dirname(__FILE__) + '/../config/boot'
8
3
  require 'commands/publish'
data/bin/subscribe CHANGED
@@ -1,8 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
- unless defined? ADAPTOR_ROOT
3
- ADAPTOR_ROOT = File.expand_path(File.dirname(__FILE__) + '/..')
4
- end
5
- require 'rubygems'
6
- require 'adaptation'
7
-
2
+ require File.dirname(__FILE__) + '/../config/boot'
8
3
  require 'commands/subscribe'
data/configs/boot.rb CHANGED
@@ -1,10 +1,12 @@
1
- # Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
1
+ # Don't change this file. Configuration is done in config/environment.rb, config/environments/*.rb and settings.yml.
2
2
 
3
- unless defined?(RAILS_ROOT)
4
- root_path = File.join(File.dirname(__FILE__), '..')
5
- unless RUBY_PLATFORM =~ /mswin32/
6
- require 'pathname'
7
- root_path = Pathname.new(root_path).cleanpath(true).to_s
8
- end
9
- RAILS_ROOT = root_path
3
+ ADAPTOR_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(ADAPTOR_ROOT)
4
+
5
+ require 'rubygems'
6
+ require 'adaptation'
7
+
8
+ if defined? ADAPTOR_ENV
9
+ require ADAPTOR_ROOT + '/config/environments/' + ADAPTOR_ENV + '.rb'
10
10
  end
11
+
12
+ require ADAPTOR_ROOT + '/config/environment'
@@ -1,8 +1,4 @@
1
- unless defined? ADAPTOR_ROOT
2
- ADAPTOR_ROOT = File.expand_path(File.dirname(__FILE__) + '/..')
3
- end
4
- require 'rubygems'
5
- require 'adaptation'
1
+ require File.dirname(__FILE__) + '/../config/boot'
6
2
 
7
3
  a = Adaptation::Base.new
8
4
  a.process ARGV[0]
@@ -0,0 +1 @@
1
+ ADAPTOR_ENV="development" unless defined? ADAPTOR_ENV
@@ -0,0 +1,3 @@
1
+ ADAPTOR_ENV="development" unless defined? ADAPTOR_ENV
2
+
3
+ Adaptation::Initializer.run
@@ -0,0 +1 @@
1
+ ADAPTOR_ENV="test" unless defined? ADAPTOR_ENV
@@ -1,22 +1,20 @@
1
1
  module Adaptation
2
2
 
3
+ ADAPTOR_ENV = 'development' unless defined? ADAPTOR_ENV
4
+
3
5
  class Initializer
4
6
 
5
7
  def self.run
6
8
 
7
- unless defined? $environment
8
- $environment = "development"
9
- end
10
-
11
9
  if File.exists?("#{ADAPTOR_ROOT}/config/settings.yml")
12
- $config = YAML::load(File.open("#{ADAPTOR_ROOT}/config/settings.yml"))[$environment]
10
+ $config = YAML::load(File.open("#{ADAPTOR_ROOT}/config/settings.yml"))[ADAPTOR_ENV]
13
11
  end
14
12
 
15
13
  # connect with database -> this could also be avoided?
16
14
  if File.exists?("#{ADAPTOR_ROOT}/config/database.yml")
17
- environment_configurations = YAML::load(File.open("#{ADAPTOR_ROOT}/config/database.yml"))[$environment]
18
- ActiveRecord::Base.configurations.update($environment => environment_configurations)
19
- ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[$environment])
15
+ environment_configurations = YAML::load(File.open("#{ADAPTOR_ROOT}/config/database.yml"))[ADAPTOR_ENV]
16
+ ActiveRecord::Base.configurations.update(ADAPTOR_ENV => environment_configurations)
17
+ ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[ADAPTOR_ENV])
20
18
  end
21
19
 
22
20
  # require all adaptors
@@ -46,7 +44,7 @@ module Adaptation
46
44
 
47
45
  Initializer.run
48
46
 
49
- @@logger = Logger.new("#{ADAPTOR_ROOT}/log/#{$environment}.log")
47
+ @@logger = Logger.new("#{ADAPTOR_ROOT}/log/#{ADAPTOR_ENV}.log")
50
48
  ActiveRecord::Base.logger = @@logger
51
49
 
52
50
  end
@@ -1,5 +1,5 @@
1
1
  #set environment
2
- $environment = "test"
2
+ ADAPTOR_ENV = "test"
3
3
 
4
4
  Adaptation::Initializer.run
5
5
 
@@ -143,7 +143,7 @@ class Test::Unit::TestCase
143
143
 
144
144
  ActiveRecord::Base.remove_connection
145
145
 
146
- ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[$environment])
146
+ ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[ADAPTOR_ENV])
147
147
 
148
148
  database_exists = true
149
149
  begin
@@ -154,7 +154,7 @@ class Test::Unit::TestCase
154
154
 
155
155
  error = build_message error,
156
156
  "? database not found",
157
- ActiveRecord::Base.configurations[$environment][:database]
157
+ ActiveRecord::Base.configurations[ADAPTOR_ENV][:database]
158
158
  assert_block error do
159
159
  database_exists
160
160
  end
@@ -178,7 +178,7 @@ class Test::Unit::TestCase
178
178
 
179
179
  ActiveRecord::Base.remove_connection
180
180
 
181
- ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[$environment])
181
+ ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[ADAPTOR_ENV])
182
182
 
183
183
  database_exists = true
184
184
  begin
@@ -189,7 +189,7 @@ class Test::Unit::TestCase
189
189
 
190
190
  error = build_message error,
191
191
  "? database shouldn't exist",
192
- ActiveRecord::Base.configurations[$environment][:database]
192
+ ActiveRecord::Base.configurations[ADAPTOR_ENV][:database]
193
193
  assert_block error do
194
194
  !database_exists
195
195
  end
@@ -1,8 +1,8 @@
1
1
  module Adaptation
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 0
5
- TINY = 1
4
+ MINOR = 1
5
+ TINY = 7
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -1,32 +1,43 @@
1
1
  irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
2
2
 
3
+ require 'optparse'
4
+
5
+ options = { :irb => irb }
6
+ OptionParser.new do |opt|
7
+ opt.banner = "Usage: console [environment] [options]"
8
+ opt.on("--irb=[#{irb}]", 'Invoke a different irb.') { |v| options[:irb] = v }
9
+ opt.on("--debugger", 'Enable ruby-debugging for the console.') { |v| options[:debugger] = v }
10
+ opt.parse!(ARGV)
11
+ end
12
+
3
13
  libs = " -r irb/completion"
4
14
  libs << " -r readline"
5
- libs << " -r rubygems"
6
- require 'rubygems'
7
15
 
8
- begin
9
- exists_debug_lib = require 'ruby-debug'
10
- if !exists_debug_lib.nil? && exists_debug_lib == true
16
+ if options[:debugger]
17
+ begin
18
+ require 'rubygems'
19
+ require 'ruby-debug'
11
20
  libs << " -r ruby-debug"
21
+ puts "=> Debugger enabled"
22
+ rescue Exception
23
+ puts "You need to install ruby-debug to run the console in debugging mode. With gems, use 'gem install ruby-debug'"
24
+ exit
12
25
  end
13
- rescue
14
26
  end
15
27
 
16
- libs << " -r adaptation"
17
-
18
- if RUBY_PLATFORM =~ /(:?mswin|mingw)/
19
- ENV_PATH = "/windows/temp"
20
- else
21
- ENV_PATH = "/tmp"
28
+ ADAPTOR_ENV = case ARGV.first
29
+ when "d"; "development"
30
+ when "t"; "test"
31
+ else
32
+ ARGV.first || 'development'
22
33
  end
23
34
 
24
- f = File.new("#{ENV_PATH}/adaptor_path.rb", "w")
25
- path="ADAPTOR_ROOT = \"" + "#{ADAPTOR_ROOT}\""
26
- f.write("#{path}")
27
- f.close
35
+ # set console environment
36
+ libs << " -r #{ADAPTOR_ROOT}/config/environments/#{ADAPTOR_ENV}.rb"
37
+
38
+ libs << " -r #{ADAPTOR_ROOT}/config/boot"
39
+
40
+ puts "Loading #{ADAPTOR_ENV} environment (Adaptation #{Adaptation::VERSION::STRING})"
28
41
 
29
- libs << " -r #{ENV_PATH}/adaptor_path.rb"
30
- libs << " -r adaptation/console/environment"
31
42
  exec "#{irb} #{libs} --simple-prompt"
32
43
 
@@ -1,5 +1,3 @@
1
- require 'adaptation'
2
-
3
1
  args = ARGV
4
2
  mom = "druby"
5
3
  ARGV.each do |arg|
@@ -47,18 +47,19 @@ class AppGenerator < Rails::Generator::Base
47
47
  # settings.yml
48
48
  m.template "configs/settings.yml", "config/settings.yml"
49
49
 
50
- # boot.rb, needed by some scripts
50
+ # boot.rb
51
51
  m.file "configs/boot.rb", "config/boot.rb"
52
52
 
53
53
  # Environments
54
54
  #m.file "environments/boot.rb", "config/boot.rb"
55
55
  #m.template "environments/environment.rb", "config/environment.rb", :assigns => { :freeze => options[:freeze] }
56
+ m.file "environments/environment.rb", "config/environment.rb"
56
57
  #m.file "environments/production.rb", "config/environments/production.rb"
57
- #m.file "environments/development.rb", "config/environments/development.rb"
58
- #m.file "environments/test.rb", "config/environments/test.rb"
58
+ m.file "environments/development.rb", "config/environments/development.rb"
59
+ m.file "environments/test.rb", "config/environments/test.rb"
59
60
 
60
61
  # Scripts
61
- %w( generate destroy about publish subscribe breakpointer console ).each do |file|
62
+ %w( generate destroy about publish subscribe console ).each do |file|
62
63
  m.file "bin/#{file}", "script/#{file}", script_options
63
64
  end
64
65
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adaptation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xavi Vila Morell
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-11 00:00:00 +01:00
12
+ date: 2009-04-01 00:00:00 +02:00
13
13
  default_executable: adaptation
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -44,7 +44,6 @@ extra_rdoc_files:
44
44
  files:
45
45
  - bin/subscribe
46
46
  - bin/destroy
47
- - bin/breakpointer
48
47
  - bin/about
49
48
  - bin/adaptation
50
49
  - bin/publish
@@ -54,7 +53,6 @@ files:
54
53
  - lib/adaptation
55
54
  - lib/adaptation/base.rb
56
55
  - lib/adaptation/console
57
- - lib/adaptation/console/environment.rb
58
56
  - lib/adaptation/version.rb
59
57
  - lib/adaptation/mom.rb
60
58
  - lib/adaptation/message.rb
@@ -119,7 +117,6 @@ files:
119
117
  - lib/commands/breakpointer.rb
120
118
  - lib/commands/console.rb
121
119
  - lib/commands/about.rb
122
- - lib/commands/adaptor_path.rb
123
120
  - lib/commands/subscribe.rb
124
121
  - lib/commands/destroy.rb
125
122
  - lib/commands/generate.rb
@@ -135,6 +132,9 @@ files:
135
132
  - configs/settings.yml
136
133
  - configs/empty.log
137
134
  - configs/boot.rb
135
+ - environments/environment.rb
136
+ - environments/development.rb
137
+ - environments/test.rb
138
138
  - dispatches/dispatch.rb
139
139
  - README
140
140
  - CHANGELOG
data/bin/breakpointer DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.dirname(__FILE__) + '/../config/boot'
3
- require 'commands/breakpointer'
@@ -1,42 +0,0 @@
1
- require 'yaml'
2
- $environment = "development"
3
- $config = YAML::load(File.open("#{ADAPTOR_ROOT}/config/settings.yml"))[$environment]
4
- Adaptation::Base.new
5
- # connect to test database
6
- require 'active_record'
7
-
8
- if File.exists?("#{ADAPTOR_ROOT}/config/database.yml")
9
- configurations = YAML::load(File.open("#{ADAPTOR_ROOT}/config/database.yml"))[$environment]
10
- ActiveRecord::Base.configurations.update($environment => configurations)
11
- ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[$environment])
12
- end
13
-
14
- if File.exists?("log")
15
- ActiveRecord::Base.logger = Logger.new("#{ADAPTOR_ROOT}/log/"+$environment+".log")
16
- end
17
-
18
- def get_xml_from_file xml_file
19
- contents = new Array
20
- File.open(xml_file).each { |line|
21
- unless line =~ /^ {0,}#/
22
- contents << line.strip.chomp
23
- end
24
- }
25
- "#{contents.chomp}"
26
- end
27
-
28
- def xml_to_object xml_message
29
- class_name = xml_message[1..(xml_message.index(/(>| )/) - 1)]
30
- message_class = Object.const_get(class_name.capitalize)
31
- message_object = message_class.to_object(xml_message)
32
- message_object
33
- end
34
-
35
- def xmlfile_to_object xml_file
36
- xml_message = get_xml_from_file(xml_file.to_s)
37
- message_object = xml_to_object xml_message
38
- message_object
39
- end
40
-
41
-
42
-
@@ -1 +0,0 @@
1
- ADAPTOR_ROOT = "/usr/share/oademand/sugarcrm4.5/installer"