Method: CapsuleCD::Javascript::JavascriptEngine#package_step

Defined in:
lib/capsulecd/javascript/javascript_engine.rb

#package_stepObject

run npm publish



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/capsulecd/javascript/javascript_engine.rb', line 121

def package_step
  super

  # commit changes to the cookbook. (test run occurs before this, and it should clean up any instrumentation files, created,
  # as they will be included in the commmit and any release artifacts)
  CapsuleCD::GitUtils.commit(@source_git_local_path, 'Committing automated changes before packaging.') rescue puts 'No changes to commit..'
  if @_is_bower && !@_is_npm
    bower_file = File.read(@source_git_local_path + '/bower.json')
    bower_data = JSON.parse(bower_file)
    next_version = SemVer.parse(bower_data['version'])
    @source_release_commit = CapsuleCD::GitUtils.tag(@source_git_local_path, "v#{next_version}")

  else

    # run npm publish
    Open3.popen3("npm version #{@config.engine_version_bump_type} -m '(v%s) Automated packaging of release by CapsuleCD'", chdir: @source_git_local_path) do |_stdin, stdout, stderr, external|
      { stdout: stdout, stderr: stderr }. each do |name, stream_buffer|
        Thread.new do
          until (line = stream_buffer.gets).nil?
            puts "#{name} -> #{line}"
          end
        end
      end
      # wait for process
      external.join
      fail 'npm version bump failed' unless external.value.success?
    end
    @source_release_commit = CapsuleCD::GitUtils.get_latest_tag_commit(@source_git_local_path)
  end


end