-
Notifications
You must be signed in to change notification settings - Fork 17
/
rakefile.rb
54 lines (47 loc) · 1.56 KB
/
rakefile.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# encoding: UTF-8
require 'rubygems'
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
require 'rake'
require 'rdoc/task'
require "rspec/core/rake_task"
desc "Run all test with spec"
RSpec::Core::RakeTask.new('spec') do |spec|
spec.rspec_opts = %w[--color]
spec.pattern = 'spec/*_spec.rb'
end
desc "Run tests"
task :default => :spec
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'BingAdsApi'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end
lib = File.expand_path('../lib/', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
# GENERATE API SERVICES
require 'ads_common_for_bing_ads'
require 'bing_ads_api/api_config'
require 'ads_common_for_bing_ads/api_config'
require 'ads_common_for_bing_ads/build/savon_registry'
desc 'Generate the Bing Ads API stubs.'
task :generate do
logger = Logger.new(STDOUT)
logger.level = Logger::INFO
api_config = BingAdsApi::ApiConfig
versions = api_config.versions()
versions.each do |version|
code_path = 'lib/%s/%s' % [api_config.api_name.to_s.snakecase, version]
wsdls = BingAdsApi::ApiConfig.get_wsdls(version)
wsdls.each do |service_name, wsdl_url|
logger.info('Processing %s at [%s]...' % [service_name, wsdl_url])
generator = AdsCommonForBingAds::Build::SavonGenerator.new(wsdl_url, code_path, api_config.api_name, version, service_name)
generator.process_wsdl()
end
end
end