datadog-sdk-testing 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a5e778a7c72e505f4b955419d51b86b1e46b331
4
- data.tar.gz: 472674321283a3a475b7a79cd2780feb4ba3a970
3
+ metadata.gz: d246a78322ac6b3a9f1f826e4aac6ccb88bdb3b2
4
+ data.tar.gz: cb0d8786701dceec9b2a84c4ee0d459fe472936b
5
5
  SHA512:
6
- metadata.gz: 7bd029a224dbd0d79c438d0bdd94bf389394149a460b8e25a028ac5d1ade601125099d4cb0c2f42adfcd4669f448eaa4637ff965076e749416b8f3b7b99d2225
7
- data.tar.gz: 239610171877a7fc21786ff4546f46c405cf5f35d953b8a1770feb250c04e8b3519d7dd67263f6c884ff907ae8a63ff5e12e0701d8c31722fad96bbd6421da4a
6
+ metadata.gz: 67060013935baf4f2a263e6a07a82cb7d7c6c306bbd240569321182d0a07c5a132a7eac99c614ce06503fd9db264ecfaf309030d08bb68f9912a606d8756d11c
7
+ data.tar.gz: c219200d56d414d0534f08c40055200adb0af8b30f6ee477031c578ad3f48e1aa788b192e6ea860517f582781e1d8e25ba51964a63eea0e0c98e6bbcb86d43a5
@@ -74,6 +74,52 @@ def integration_tests(root_dir)
74
74
  [testable, untested]
75
75
  end
76
76
 
77
+ def create_skeleton(integration)
78
+ if File.directory?("#{ENV['SDK_HOME']}/#{integration}")
79
+ puts "directory already exists for #{integration} - bailing out."
80
+ return
81
+ end
82
+
83
+ puts "generating skeleton files for #{integration}"
84
+ gem_home = Bundler.rubygems.find_name('datadog-sdk-testing').first.full_gem_path
85
+ capitalized = integration.capitalize
86
+ sh "mkdir -p #{ENV['SDK_HOME']}/#{integration}/ci"
87
+ sh "cp #{gem_home}/lib/config/ci/skeleton.rake #{ENV['SDK_HOME']}/#{integration}/ci/#{integration}.rake"
88
+ sh "cp #{gem_home}/lib/config/manifest.json #{ENV['SDK_HOME']}/#{integration}/manifest.json"
89
+ sh "cp #{gem_home}/lib/config/check.py #{ENV['SDK_HOME']}/#{integration}/check.py"
90
+ sh "cp #{gem_home}/lib/config/test_skeleton.py #{ENV['SDK_HOME']}/#{integration}/test_#{integration}.py"
91
+ sh "cp #{gem_home}/lib/config/metadata.csv #{ENV['SDK_HOME']}/#{integration}/metadata.csv"
92
+ sh "cp #{gem_home}/lib/config/requirements.txt #{ENV['SDK_HOME']}/#{integration}/requirements.txt"
93
+ sh "cp #{gem_home}/lib/config/README.md #{ENV['SDK_HOME']}/#{integration}/README.md"
94
+ Dir.glob("#{ENV['SDK_HOME']}/#{integration}/**/*") do |f|
95
+ if File.file?(f)
96
+ sed(f, 'skeleton', "#{integration}", 'g')
97
+ sed(f, 'Skeleton', "#{capitalized}", 'g')
98
+ end
99
+ end
100
+ sh "git add #{ENV['SDK_HOME']}/#{integration}/"
101
+
102
+ new_file = "#{ENV['SDK_HOME']}/circle.yml.new"
103
+ File.open(new_file, 'w') do |fo|
104
+ File.foreach("#{ENV['SDK_HOME']}/circle.yml") do |line|
105
+ fo.puts " - rake ci:run[#{integration}]" if line =~ /bundle\ exec\ rake\ requirements/
106
+ fo.puts line
107
+ end
108
+ end
109
+ File.delete("#{ENV['SDK_HOME']}/circle.yml")
110
+ File.rename(new_file, "#{ENV['SDK_HOME']}/circle.yml")
111
+
112
+ new_file = "#{ENV['SDK_HOME']}/.travis.yml.new"
113
+ File.open(new_file, 'w') do |fo|
114
+ File.foreach("#{ENV['SDK_HOME']}/.travis.yml") do |line|
115
+ fo.puts " - rake ci:run[#{integration}]" if line =~ /bundle\ exec\ rake\ requirements/
116
+ fo.puts line
117
+ end
118
+ end
119
+ File.delete("#{ENV['SDK_HOME']}/.travis.yml")
120
+ File.rename(new_file, "#{ENV['SDK_HOME']}/.travis.yml")
121
+ end
122
+
77
123
  # helper class to wait for TCP/HTTP services to boot
78
124
  class Wait
79
125
  DEFAULT_TIMEOUT = 10
@@ -150,6 +196,8 @@ namespace :ci do
150
196
  section('INSTALL')
151
197
  use_venv = in_venv
152
198
  pip_command = use_venv ? 'venv/bin/pip' : 'pip'
199
+ sdk_dir = ENV['SDK_HOME'] || Dir.pwd
200
+
153
201
  sh %(#{'python -m ' if Gem.win_platform?}#{pip_command} install --upgrade pip setuptools)
154
202
  install_requirements('requirements.txt',
155
203
  "--cache-dir #{ENV['PIP_CACHE']}",
@@ -160,6 +208,17 @@ namespace :ci do
160
208
  install_requirements('requirements-test.txt',
161
209
  "--cache-dir #{ENV['PIP_CACHE']}",
162
210
  "#{ENV['VOLATILE_DIR']}/ci.log", use_venv)
211
+
212
+ reqs = Dir.glob(File.join(sdk_dir, '**/requirements.txt')).reject do |path|
213
+ !%r{#{sdk_dir}/embedded/.*$}.match(path).nil? || !%r{#{sdk_dir}\/venv\/.*$}.match(path).nil?
214
+ end
215
+
216
+ reqs.each do |req|
217
+ install_requirements(req,
218
+ "--cache-dir #{ENV['PIP_CACHE']}",
219
+ "#{ENV['VOLATILE_DIR']}/ci.log", use_venv)
220
+ end
221
+
163
222
  t.reenable
164
223
  end
165
224
 
@@ -19,23 +19,11 @@ namespace :ci do
19
19
  end
20
20
  end
21
21
 
22
- task install: ['ci:common:install'] do
23
- sdk_dir = ENV['SDK_HOME'] || Dir.pwd
24
- reqs = Dir.glob(File.join(sdk_dir, '**/requirements.txt')).reject do |path|
25
- !%r{#{sdk_dir}/embedded/.*$}.match(path).nil? || !%r{#{sdk_dir}\/venv\/.*$}.match(path).nil?
26
- end
27
-
28
- use_venv = in_venv
29
- reqs.each do |req|
30
- install_requirements(req,
31
- "--cache-dir #{ENV['PIP_CACHE']}",
32
- "#{ENV['VOLATILE_DIR']}/ci.log", use_venv)
33
- end
34
- end
22
+ task install: ['ci:common:install']
35
23
 
36
24
  task before_script: ['ci:common:before_script']
37
25
 
38
- task lint: ['rubocop'] do
26
+ task lint: ['ci:common:install', 'rubocop'] do
39
27
  check_env
40
28
  sh %(flake8 #{ENV['SDK_HOME']})
41
29
  sh %(find #{ENV['SDK_HOME']} -name '*.py' -not\
@@ -55,7 +55,7 @@ desc 'Setup git hooks'
55
55
  task 'setup_hooks' do
56
56
  check_env
57
57
  gem_home = Bundler.rubygems.find_name('datadog-sdk-testing').first.full_gem_path
58
- sh "ln -sf #{gem_home}/lib/tasks/ci/hooks/pre-commit.py #{ENV['SDK_HOME']}}/.git/hooks/pre-commit"
58
+ sh "ln -sf #{gem_home}/lib/tasks/ci/hooks/pre-commit.py #{ENV['SDK_HOME']}/.git/hooks/pre-commit"
59
59
  end
60
60
 
61
61
  desc 'Pull latest agent code'
@@ -91,44 +91,7 @@ namespace :generate do
91
91
  desc 'Setup a development environment for the SDK'
92
92
  task :skeleton, :option do |_, args|
93
93
  check_env
94
- puts "generating skeleton files for #{args[:option]}"
95
- gem_home = Bundler.rubygems.find_name('datadog-sdk-testing').first.full_gem_path
96
- capitalized = args[:option].capitalize
97
- sh "mkdir -p #{ENV['SDK_HOME']}/#{args[:option]}/ci"
98
- sh "cp #{gem_home}/lib/config/ci/skeleton.rake #{ENV['SDK_HOME']}/#{args[:option]}/ci/#{args[:option]}.rake"
99
- sh "cp #{gem_home}/lib/config/manifest.json #{ENV['SDK_HOME']}/#{args[:option]}/manifest.json"
100
- sh "cp #{gem_home}/lib/config/check.py #{ENV['SDK_HOME']}/#{args[:option]}/check.py"
101
- sh "cp #{gem_home}/lib/config/test_skeleton.py #{ENV['SDK_HOME']}/#{args[:option]}/test_#{args[:option]}.py"
102
- sh "cp #{gem_home}/lib/config/metadata.csv #{ENV['SDK_HOME']}/#{args[:option]}/metadata.csv"
103
- sh "cp #{gem_home}/lib/config/requirements.txt #{ENV['SDK_HOME']}/#{args[:option]}/requirements.txt"
104
- sh "cp #{gem_home}/lib/config/README.md #{ENV['SDK_HOME']}/#{args[:option]}/README.md"
105
- Dir.glob("#{ENV['SDK_HOME']}/#{args[:option]}/**/*") do |f|
106
- if File.file?(f)
107
- sed(f, 'skeleton', "#{args[:option]}", 'g')
108
- sed(f, 'Skeleton', "#{capitalized}", 'g')
109
- end
110
- end
111
- sh "git add #{ENV['SDK_HOME']}/#{args[:option]}/"
112
-
113
- new_file = "#{ENV['SDK_HOME']}/circle.yml.new"
114
- File.open(new_file, 'w') do |fo|
115
- File.foreach("#{ENV['SDK_HOME']}/circle.yml") do |line|
116
- fo.puts " - rake ci:run[#{args[:option]}]" if line =~ /bundle\ exec\ rake\ requirements/
117
- fo.puts line
118
- end
119
- end
120
- File.delete("#{ENV['SDK_HOME']}/circle.yml")
121
- File.rename(new_file, "#{ENV['SDK_HOME']}/circle.yml")
122
-
123
- new_file = "#{ENV['SDK_HOME']}/.travis.yml.new"
124
- File.open(new_file, 'w') do |fo|
125
- File.foreach("#{ENV['SDK_HOME']}/.travis.yml") do |line|
126
- fo.puts " - rake ci:run[#{args[:option]}]" if line =~ /bundle\ exec\ rake\ requirements/
127
- fo.puts line
128
- end
129
- end
130
- File.delete("#{ENV['SDK_HOME']}/.travis.yml")
131
- File.rename(new_file, "#{ENV['SDK_HOME']}/.travis.yml")
94
+ create_skeleton(args[:option])
132
95
  end
133
96
  end
134
97
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datadog-sdk-testing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaime Fullaondo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-28 00:00:00.000000000 Z
11
+ date: 2016-07-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Datadog Integration SDK testing/scaffolding gem
14
14
  email: jaime.fullaondo@datadoghq.com