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
|
# File 'lib/capsulecd/javascript/javascript_engine.rb', line 10
def build_step
super
@_is_bower = File.exist?(@source_git_local_path + '/bower.json')
@_is_npm = File.exist?(@source_git_local_path + '/package.json')
if !@_is_bower && !@_is_npm
fail CapsuleCD::Error::BuildPackageInvalid, 'package.json or bower.json file must be present for Javascript packages'
end
sync_versions
if @_is_bower
bower_file = File.read(@source_git_local_path + '/bower.json')
bower_data = JSON.parse(bower_file)
next_version = bump_version(SemVer.parse(bower_data['version']))
bower_data['version'] = next_version.to_s
File.write(@source_git_local_path + '/bower.json', JSON.pretty_generate(bower_data))
end
unless File.exist?(@source_git_local_path + '/test')
FileUtils.mkdir(@source_git_local_path + '/test')
end
unless File.exist?(@source_git_local_path + '/.gitignore')
CapsuleCD::GitUtils.create_gitignore(@source_git_local_path, ['Node','Yeoman'])
end
end
|