Skip to content

Commit d514f48

Browse files
author
gdgate
authored
Merge pull request #1762 from hung-nguyen-hoang/BCO-1300-license
CONFIG: Update license file when release gem Reviewed-by: https://github.com/sangtm
2 parents 8972d41 + 113666e commit d514f48

2 files changed

Lines changed: 36 additions & 7 deletions

File tree

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ stages:
77
if: type IN (api, cron)
88
- name: platform-cleanup
99
if: type IN (cron)
10+
- name: license-update
11+
if: branch = master AND type = push
1012
- name: gem-release
1113
if: branch = master AND type = push
1214
- name: gem-smoke-test
@@ -346,6 +348,16 @@ jobs:
346348
rvm: jruby-9.1.14
347349
osx_image: xcode9.4
348350

351+
- stage: license-update
352+
name: Update license file
353+
rvm: 2.3
354+
script: |
355+
bundle exec rake license:update
356+
- stage: license-update
357+
name: Update license file
358+
rvm: jruby-9.1.14
359+
script: |
360+
bundle exec rake license:update
349361
- stage: gem-release
350362
name: deploy MRI gem
351363
rvm: 2.3

Rakefile

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,13 @@ namespace :gem do
3333
desc "Release gem version #{GoodData::VERSION} to rubygems"
3434
task :release do
3535
gem = "gooddata-#{GoodData::VERSION}.gem"
36-
origin_license_file = 'LICENSE'
37-
new_license_file = 'LICENSE_FOR_RUBY_SDK_COMPONENT.txt'
3836
notices_file = 'NOTICES.txt'
39-
File.delete(origin_license_file) if File.exist?(origin_license_file)
40-
File.delete(notices_file) if File.exist?(notices_file)
41-
puts "Deleted files: #{origin_license_file} and #{notices_file}"
42-
File.rename(new_license_file, origin_license_file) if File.exists?(new_license_file)
43-
puts "Renamed file #{new_license_file} to #{origin_license_file}"
37+
38+
if File.exist?(notices_file)
39+
File.delete(notices_file)
40+
puts "Deleted files: #{notices_file}"
41+
end
42+
4443
puts "Building #{gem} ..."
4544
res = `gem build ./gooddata.gemspec`
4645
file = res.match('File: (.*)')[1]
@@ -112,6 +111,24 @@ namespace :license do
112111
puts 'All licenses seem to be OK'
113112
end
114113

114+
desc 'Update LICENSE file'
115+
task :update do
116+
origin_license_file = 'LICENSE'
117+
new_license_file = 'LICENSE_FOR_RUBY_SDK_COMPONENT.txt'
118+
119+
if File.exist?(origin_license_file)
120+
File.delete(origin_license_file)
121+
puts "Deleted files: #{origin_license_file}"
122+
end
123+
124+
if File.exists?(new_license_file)
125+
File.rename(new_license_file, origin_license_file)
126+
puts "Renamed file #{new_license_file} to #{origin_license_file}"
127+
end
128+
129+
puts 'Update LICENSE seem to be OK'
130+
end
131+
115132
desc 'Add license header to each file'
116133
task :add do
117134
spec = Gem::Specification.load('gooddata.gemspec')

0 commit comments

Comments
 (0)