postini 0.0.6 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/History.txt +4 -0
  2. data/Manifest.txt +12 -26
  3. data/README.txt +11 -4
  4. data/Rakefile +27 -4
  5. data/features/development.feature +13 -0
  6. data/features/step_definitions/common_steps.rb +172 -0
  7. data/features/support/common.rb +29 -0
  8. data/features/support/env.rb +6 -0
  9. data/features/support/matchers.rb +11 -0
  10. data/lib/postini/automated_batch_service.rb +464 -0
  11. data/lib/postini/configuration_check.rb +25 -0
  12. data/lib/postini/endpoint_resolver_service.rb +41 -0
  13. data/lib/postini/endpoints.rb +26 -0
  14. data/lib/postini/exceptions.rb +85 -0
  15. data/lib/postini.rb +74 -102
  16. data/script/console +1 -1
  17. data/script/txt2html +5 -16
  18. data/spec/exceptions_spec.rb +19 -0
  19. data/spec/postini_spec.rb +5 -38
  20. data/spec/rcov.opts +1 -0
  21. data/spec/spec_helper.rb +1 -1
  22. data/tasks/rspec.rake +1 -19
  23. data/vendor/automatedbatch.wsdl +1 -1
  24. metadata +21 -54
  25. data/config/hoe.rb +0 -76
  26. data/config/requirements.rb +0 -15
  27. data/lib/postini/api/automatedbatch/AutomatedBatch.rb +0 -1244
  28. data/lib/postini/api/automatedbatch/AutomatedBatchDriver.rb +0 -216
  29. data/lib/postini/api/automatedbatch/AutomatedBatchMappingRegistry.rb +0 -1883
  30. data/lib/postini/api/automatedbatch/AutomatedBatchServiceClient.rb +0 -523
  31. data/lib/postini/api/endpointresolver/EndpointResolver.rb +0 -121
  32. data/lib/postini/api/endpointresolver/EndpointResolverDriver.rb +0 -51
  33. data/lib/postini/api/endpointresolver/EndpointResolverMappingRegistry.rb +0 -268
  34. data/lib/postini/api/endpointresolver/EndpointResolverServiceClient.rb +0 -38
  35. data/lib/postini/api.rb +0 -8
  36. data/lib/postini/domain.rb +0 -72
  37. data/lib/postini/helpers/attributes.rb +0 -94
  38. data/lib/postini/helpers.rb +0 -13
  39. data/lib/postini/user.rb +0 -91
  40. data/lib/postini/users/aliases.rb +0 -55
  41. data/lib/postini/version.rb +0 -9
  42. data/spec/attribute_helper_spec.rb +0 -47
  43. data/spec/domain_spec.rb +0 -36
  44. data/spec/user_spec.rb +0 -142
  45. data/website/index.html +0 -89
  46. data/website/index.txt +0 -60
  47. data/website/javascripts/rounded_corners_lite.inc.js +0 -285
  48. data/website/spam_box.png +0 -0
  49. data/website/stylesheets/screen.css +0 -143
  50. data/website/template.html.erb +0 -56
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.1.0 2009-06-12
2
+
3
+ * Completely rewritten to use handsoap
4
+
1
5
  == 0.0.4 2008-10-02
2
6
 
3
7
  * Minor internal reworkings
data/Manifest.txt CHANGED
@@ -5,44 +5,30 @@ PostInstall.txt
5
5
  README.txt
6
6
  Rakefile
7
7
  TODO
8
- config/hoe.rb
9
- config/requirements.rb
8
+ features/development.feature
9
+ features/step_definitions/common_steps.rb
10
+ features/support/common.rb
11
+ features/support/env.rb
12
+ features/support/matchers.rb
10
13
  lib/postini.rb
11
- lib/postini/api.rb
12
- lib/postini/api/automatedbatch/AutomatedBatch.rb
13
- lib/postini/api/automatedbatch/AutomatedBatchDriver.rb
14
- lib/postini/api/automatedbatch/AutomatedBatchMappingRegistry.rb
15
- lib/postini/api/automatedbatch/AutomatedBatchServiceClient.rb
16
- lib/postini/api/endpointresolver/EndpointResolver.rb
17
- lib/postini/api/endpointresolver/EndpointResolverDriver.rb
18
- lib/postini/api/endpointresolver/EndpointResolverMappingRegistry.rb
19
- lib/postini/api/endpointresolver/EndpointResolverServiceClient.rb
20
- lib/postini/domain.rb
21
- lib/postini/helpers.rb
22
- lib/postini/helpers/attributes.rb
23
- lib/postini/user.rb
24
- lib/postini/users/aliases.rb
25
- lib/postini/version.rb
14
+ lib/postini/automated_batch_service.rb
15
+ lib/postini/configuration_check.rb
16
+ lib/postini/endpoint_resolver_service.rb
17
+ lib/postini/endpoints.rb
18
+ lib/postini/exceptions.rb
26
19
  script/console
27
20
  script/destroy
28
21
  script/generate
29
22
  script/txt2html
30
23
  setup.rb
31
- spec/attribute_helper_spec.rb
32
- spec/domain_spec.rb
24
+ spec/exceptions_spec.rb
33
25
  spec/postini_spec.rb
26
+ spec/rcov.opts
34
27
  spec/spec.opts
35
28
  spec/spec_helper.rb
36
- spec/user_spec.rb
37
29
  tasks/deployment.rake
38
30
  tasks/environment.rake
39
31
  tasks/rspec.rake
40
32
  tasks/website.rake
41
33
  vendor/automatedbatch.wsdl
42
34
  vendor/endpointresolver.wsdl
43
- website/index.html
44
- website/index.txt
45
- website/javascripts/rounded_corners_lite.inc.js
46
- website/spam_box.png
47
- website/stylesheets/screen.css
48
- website/template.html.erb
data/README.txt CHANGED
@@ -13,20 +13,27 @@ Rubyisms.
13
13
 
14
14
  == FEATURES/PROBLEMS:
15
15
 
16
- * FIX (list of features or problems)
16
+ * Built on top of handsoap[http://github.com/troelskn/handsoap], to
17
+ provide a lite hash-based interface to an otherwise crap API.
17
18
 
18
19
  == SYNOPSIS:
19
20
 
20
- FIX
21
+ Postini.api_key = 'your api key'
22
+ Postini.username = 'administrative username'
23
+ Postini.password = 'administrative password'
24
+ Postini.system_number = 8
25
+
26
+ Postini::AutomatedBatchService.test
21
27
 
22
28
  == REQUIREMENTS:
23
29
 
24
30
  * Approved access to the Postini Early Access Program (contact your Postini
25
31
  provider)
26
- * soap4r
32
+ * handsoap[http://github.com/troelskn/handsoap]
27
33
 
28
34
  == INSTALL:
29
35
 
36
+ * sudo gem install troelskn-handsoap --source http://gems.github.com
30
37
  * sudo gem install postini
31
38
 
32
39
  == TRADEMARKS:
@@ -59,4 +66,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
59
66
  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
60
67
  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
61
68
  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
62
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
69
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,6 +1,29 @@
1
- require 'config/requirements'
2
- require 'config/hoe' # setup Hoe + all gem configuration
1
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
2
+ %w[rake rake/clean fileutils newgem rubigen].each { |f| require f }
3
+ require File.dirname(__FILE__) + '/lib/postini'
3
4
 
4
- Dir['tasks/**/*.rake'].each { |rake| load rake }
5
+ # Generate all the Rake tasks
6
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
7
+ $hoe = Hoe.new('postini', Postini::VERSION) do |p|
8
+ p.developer('Kenneth Kalmer', 'kenneth.kalmer@gmail.com')
9
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
10
+ p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
11
+ p.rubyforge_name = 'postini4r' # TODO this is default value
12
+ # p.extra_deps = [
13
+ # ['activesupport','>= 2.0.2'],
14
+ # ]
15
+ p.extra_dev_deps = [
16
+ ['newgem', ">= #{::Newgem::VERSION}"]
17
+ ]
18
+
19
+ p.clean_globs |= %w[**/.DS_Store tmp *.log]
20
+ path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
21
+ p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
22
+ p.rsync_args = '-av --delete --ignore-errors'
23
+ end
5
24
 
6
- task :default => :spec
25
+ require 'newgem/tasks' # load /tasks/*.rake
26
+ Dir['tasks/**/*.rake'].each { |t| load t }
27
+
28
+ # TODO - want other tests/tasks run by default? Add them to the list
29
+ # task :default => [:spec, :features]
@@ -0,0 +1,13 @@
1
+ Feature: Development processes of newgem itself (rake tasks)
2
+
3
+ As a Newgem maintainer or contributor
4
+ I want rake tasks to maintain and release the gem
5
+ So that I can spend time on the tests and code, and not excessive time on maintenance processes
6
+
7
+ Scenario: Generate RubyGem
8
+ Given this project is active project folder
9
+ And "pkg" folder is deleted
10
+ When I invoke task "rake gem"
11
+ Then folder "pkg" is created
12
+ And file with name matching "pkg/*.gem" is created else you should run "rake manifest" to fix this
13
+ And gem spec key "rdoc_options" contains /--mainREADME.rdoc/
@@ -0,0 +1,172 @@
1
+ Given /^a safe folder/ do
2
+ FileUtils.rm_rf @tmp_root = File.dirname(__FILE__) + "/../../tmp"
3
+ FileUtils.mkdir_p @tmp_root
4
+ FileUtils.mkdir_p @home_path = File.expand_path(File.join(@tmp_root, "home"))
5
+ @lib_path = File.expand_path(File.dirname(__FILE__) + '/../../lib')
6
+ Given %Q{env variable $HOME set to "#{@home_path}"}
7
+ end
8
+
9
+ Given /^this project is active project folder/ do
10
+ Given "a safe folder"
11
+ @active_project_folder = File.expand_path(File.dirname(__FILE__) + "/../..")
12
+ end
13
+
14
+ Given /^env variable \$([\w_]+) set to "(.*)"/ do |env_var, value|
15
+ ENV[env_var] = value
16
+ end
17
+
18
+ Given /"(.*)" folder is deleted/ do |folder|
19
+ in_project_folder { FileUtils.rm_rf folder }
20
+ end
21
+
22
+ When /^I invoke "(.*)" generator with arguments "(.*)"$/ do |generator, arguments|
23
+ @stdout = StringIO.new
24
+ in_project_folder do
25
+ if Object.const_defined?("APP_ROOT")
26
+ APP_ROOT.replace(FileUtils.pwd)
27
+ else
28
+ APP_ROOT = FileUtils.pwd
29
+ end
30
+ run_generator(generator, arguments.split(' '), SOURCES, :stdout => @stdout)
31
+ end
32
+ File.open(File.join(@tmp_root, "generator.out"), "w") do |f|
33
+ @stdout.rewind
34
+ f << @stdout.read
35
+ end
36
+ end
37
+
38
+ When /^I run executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
39
+ @stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
40
+ in_project_folder do
41
+ system "#{executable} #{arguments} > #{@stdout} 2> #{@stdout}"
42
+ end
43
+ end
44
+
45
+ When /^I run project executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
46
+ @stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
47
+ in_project_folder do
48
+ system "ruby #{executable} #{arguments} > #{@stdout} 2> #{@stdout}"
49
+ end
50
+ end
51
+
52
+ When /^I run local executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
53
+ @stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
54
+ executable = File.expand_path(File.join(File.dirname(__FILE__), "/../../bin", executable))
55
+ in_project_folder do
56
+ system "ruby #{executable} #{arguments} > #{@stdout} 2> #{@stdout}"
57
+ end
58
+ end
59
+
60
+ When /^I invoke task "rake (.*)"/ do |task|
61
+ @stdout = File.expand_path(File.join(@tmp_root, "tests.out"))
62
+ in_project_folder do
63
+ system "rake #{task} --trace > #{@stdout} 2> #{@stdout}"
64
+ end
65
+ end
66
+
67
+ Then /^folder "(.*)" (is|is not) created/ do |folder, is|
68
+ in_project_folder do
69
+ File.exists?(folder).should(is == 'is' ? be_true : be_false)
70
+ end
71
+ end
72
+
73
+ Then /^file "(.*)" (is|is not) created/ do |file, is|
74
+ in_project_folder do
75
+ File.exists?(file).should(is == 'is' ? be_true : be_false)
76
+ end
77
+ end
78
+
79
+ Then /^file with name matching "(.*)" is created/ do |pattern|
80
+ in_project_folder do
81
+ Dir[pattern].should_not be_empty
82
+ end
83
+ end
84
+
85
+ Then /^file "(.*)" contents (does|does not) match \/(.*)\// do |file, does, regex|
86
+ in_project_folder do
87
+ actual_output = File.read(file)
88
+ (does == 'does') ?
89
+ actual_output.should(match(/#{regex}/)) :
90
+ actual_output.should_not(match(/#{regex}/))
91
+ end
92
+ end
93
+
94
+ Then /gem file "(.*)" and generated file "(.*)" should be the same/ do |gem_file, project_file|
95
+ File.exists?(gem_file).should be_true
96
+ File.exists?(project_file).should be_true
97
+ gem_file_contents = File.read(File.dirname(__FILE__) + "/../../#{gem_file}")
98
+ project_file_contents = File.read(File.join(@active_project_folder, project_file))
99
+ project_file_contents.should == gem_file_contents
100
+ end
101
+
102
+ Then /^(does|does not) invoke generator "(.*)"$/ do |does_invoke, generator|
103
+ actual_output = File.read(@stdout)
104
+ does_invoke == "does" ?
105
+ actual_output.should(match(/dependency\s+#{generator}/)) :
106
+ actual_output.should_not(match(/dependency\s+#{generator}/))
107
+ end
108
+
109
+ Then /help options "(.*)" and "(.*)" are displayed/ do |opt1, opt2|
110
+ actual_output = File.read(@stdout)
111
+ actual_output.should match(/#{opt1}/)
112
+ actual_output.should match(/#{opt2}/)
113
+ end
114
+
115
+ Then /^I should see$/ do |text|
116
+ actual_output = File.read(@stdout)
117
+ actual_output.should contain(text)
118
+ end
119
+
120
+ Then /^I should not see$/ do |text|
121
+ actual_output = File.read(@stdout)
122
+ actual_output.should_not contain(text)
123
+ end
124
+
125
+ Then /^I should see exactly$/ do |text|
126
+ actual_output = File.read(@stdout)
127
+ actual_output.should == text
128
+ end
129
+
130
+ Then /^I should see all (\d+) tests pass/ do |expected_test_count|
131
+ expected = %r{^#{expected_test_count} tests, \d+ assertions, 0 failures, 0 errors}
132
+ actual_output = File.read(@stdout)
133
+ actual_output.should match(expected)
134
+ end
135
+
136
+ Then /^I should see all (\d+) examples pass/ do |expected_test_count|
137
+ expected = %r{^#{expected_test_count} examples?, 0 failures}
138
+ actual_output = File.read(@stdout)
139
+ actual_output.should match(expected)
140
+ end
141
+
142
+ Then /^yaml file "(.*)" contains (\{.*\})/ do |file, yaml|
143
+ in_project_folder do
144
+ yaml = eval yaml
145
+ YAML.load(File.read(file)).should == yaml
146
+ end
147
+ end
148
+
149
+ Then /^Rakefile can display tasks successfully/ do
150
+ @stdout = File.expand_path(File.join(@tmp_root, "rakefile.out"))
151
+ in_project_folder do
152
+ system "rake -T > #{@stdout} 2> #{@stdout}"
153
+ end
154
+ actual_output = File.read(@stdout)
155
+ actual_output.should match(/^rake\s+\w+\s+#\s.*/)
156
+ end
157
+
158
+ Then /^task "rake (.*)" is executed successfully/ do |task|
159
+ @stdout.should_not be_nil
160
+ actual_output = File.read(@stdout)
161
+ actual_output.should_not match(/^Don't know how to build task '#{task}'/)
162
+ actual_output.should_not match(/Error/i)
163
+ end
164
+
165
+ Then /^gem spec key "(.*)" contains \/(.*)\// do |key, regex|
166
+ in_project_folder do
167
+ gem_file = Dir["pkg/*.gem"].first
168
+ gem_spec = Gem::Specification.from_yaml(`gem spec #{gem_file}`)
169
+ spec_value = gem_spec.send(key.to_sym)
170
+ spec_value.to_s.should match(/#{regex}/)
171
+ end
172
+ end
@@ -0,0 +1,29 @@
1
+ module CommonHelpers
2
+ def in_tmp_folder(&block)
3
+ FileUtils.chdir(@tmp_root, &block)
4
+ end
5
+
6
+ def in_project_folder(&block)
7
+ project_folder = @active_project_folder || @tmp_root
8
+ FileUtils.chdir(project_folder, &block)
9
+ end
10
+
11
+ def in_home_folder(&block)
12
+ FileUtils.chdir(@home_path, &block)
13
+ end
14
+
15
+ def force_local_lib_override(project_name = @project_name)
16
+ rakefile = File.read(File.join(project_name, 'Rakefile'))
17
+ File.open(File.join(project_name, 'Rakefile'), "w+") do |f|
18
+ f << "$:.unshift('#{@lib_path}')\n"
19
+ f << rakefile
20
+ end
21
+ end
22
+
23
+ def setup_active_project_folder project_name
24
+ @active_project_folder = File.join(@tmp_root, project_name)
25
+ @project_name = project_name
26
+ end
27
+ end
28
+
29
+ World(CommonHelpers)
@@ -0,0 +1,6 @@
1
+ require File.dirname(__FILE__) + "/../../lib/postini4r"
2
+
3
+ gem 'cucumber'
4
+ require 'cucumber'
5
+ gem 'rspec'
6
+ require 'spec'
@@ -0,0 +1,11 @@
1
+ module Matchers
2
+ def contain(expected)
3
+ simple_matcher("contain #{expected.inspect}") do |given, matcher|
4
+ matcher.failure_message = "expected #{given.inspect} to contain #{expected.inspect}"
5
+ matcher.negative_failure_message = "expected #{given.inspect} not to contain #{expected.inspect}"
6
+ given.index expected
7
+ end
8
+ end
9
+ end
10
+
11
+ World(Matchers)