bard 0.37.1 → 0.38.0

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: d679d96650e54e2cceed8e2df0d38b383e1903da
4
- data.tar.gz: e654d4014bf6f6b0838e4bc6f5d2b87125941b24
3
+ metadata.gz: ad6c6dd51289d7cb6595a4fe877d62be3e77060e
4
+ data.tar.gz: 210071b747c8402d99ec65645b908662513048ce
5
5
  SHA512:
6
- metadata.gz: ec5be7e4bd20e4ecbb32f8fdc492a518b1532b58bf8b9b397e54d83964af4119c03de7049163bde847c68db92c3ab328c1251bbd96189a168f066f4c587a9ef0
7
- data.tar.gz: 8041d817cd17541185e733a0480bec3108aaddc2c251ce9d648081a6147aaf9ebdb87386aee0b863bceeaad96ca44528945cf0094419dc6d12567b2b70ce5111
6
+ metadata.gz: 70a0edbbc9d106e9a68ffc7cb219fcda5e5012d35daada8532592767416ce0c77b0ba7c6bca4dae13f05d926f231c2186990a78813eaf310ab3e449e4415a343
7
+ data.tar.gz: 661c0fcc2f256135c0b3e43406d79588da0bed14a540ce1763b5ce508a795956dd53afe49ad38290f2ad7ae4b56d878a742bcc996ecba533cf66cd72e10ab0b4
data/bard.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.executables = ["bard"]
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/install_files/setup CHANGED
@@ -1,10 +1,15 @@
1
1
  #!/usr/bin/env ruby
2
2
  require_relative './specified_ruby'
3
3
  require_relative './specified_bundler'
4
+ require_relative './specified_node'
5
+ require_relative './specified_yarn'
4
6
 
5
7
  Dir.chdir File.expand_path("..", __dir__) do
6
- SpecifiedRuby.ensure!
7
- SpecifiedBundler.ensure!
8
- exec "bundle check || bundle install && bundle exec rake bootstrap"
8
+ exec [
9
+ SpecifiedRuby.ensure!,
10
+ SpecifiedBundler.ensure!,
11
+ SpecifiedNode.ensure!,
12
+ SpecifiedYarn.ensure!,
13
+ "bin/rake bootstrap",
14
+ ].join(" && ")
9
15
  end
10
-
@@ -3,6 +3,7 @@ module SpecifiedBundler
3
3
 
4
4
  def ensure!
5
5
  system("gem install bundler --conservative --version=#{bundler_version}") or raise "Cannot install bundler!"
6
+ "bundle check || bundle install"
6
7
  end
7
8
 
8
9
  private
@@ -0,0 +1,45 @@
1
+ module SpecifiedNode
2
+ class NVMError < StandardError; end
3
+
4
+ NVM_PATH = File.expand_path("~/.nvm/nvm.sh")
5
+
6
+ extend self
7
+
8
+ def ensure!
9
+ install_nvm unless nvm_installed?
10
+ restart unless nvm_active?
11
+ install_node unless node_installed?
12
+ "true"
13
+ end
14
+
15
+ private
16
+
17
+ def install_nvm
18
+ system("curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash")\
19
+ or raise "Couldn't install nvm"
20
+ end
21
+
22
+ def nvm_installed?
23
+ File.exist?(NVM_PATH)
24
+ end
25
+
26
+ def install_node
27
+ nvm "install" or raise NVMError.new($?.exitstatus)
28
+ end
29
+
30
+ def node_installed?
31
+ nvm "use"
32
+ end
33
+
34
+ def restart
35
+ exec %(bash -lc ". #{NVM_PATH}; #{$0}")
36
+ end
37
+
38
+ def nvm_active?
39
+ ENV.key?("NVM_DIR")
40
+ end
41
+
42
+ def nvm command
43
+ system(". #{NVM_PATH}; nvm #{command}")
44
+ end
45
+ end
@@ -6,6 +6,7 @@ module SpecifiedRuby
6
6
  def ensure!
7
7
  install unless installed?
8
8
  restart unless current?
9
+ "true"
9
10
  end
10
11
 
11
12
  private
@@ -0,0 +1,34 @@
1
+ module SpecifiedYarn
2
+ extend self
3
+
4
+ YARN_PATH = "node_modules/yarn/bin/yarn"
5
+
6
+ def ensure!
7
+ install_yarn unless yarn_installed?
8
+ install_binstub unless binstub_installed?
9
+ "bin/yarn install"
10
+ end
11
+
12
+ private
13
+
14
+ def install_yarn
15
+ system(". ~/.nvm/nvm.sh && npm install yarn@#{version} --no-save")
16
+ end
17
+
18
+ def install_binstub
19
+ system("cd bin && ln -s ../#{YARN_PATH}")
20
+ end
21
+
22
+ def yarn_installed?
23
+ File.exist?(YARN_PATH) && `#{YARN_PATH} --version`.chomp == version
24
+ end
25
+
26
+ def binstub_installed?
27
+ File.exist?("bin/yarn")
28
+ end
29
+
30
+ def version
31
+ File.read("package.json")[/"yarn": "([0-9\.]+)"/, 1]
32
+ end
33
+ end
34
+
data/lib/bard.rb CHANGED
@@ -41,8 +41,9 @@ class Bard::CLI < Thor
41
41
  else
42
42
  run_crucial "git fetch origin master:master"
43
43
 
44
- if not Git.fast_forward_merge? "master", branch
45
- raise "The master branch has advanced since last deploy, probably due to a bugfix.\n Rebase your branch on top of it, and check for breakage."
44
+ if not Git.fast_forward_merge? "origin/master", branch
45
+ puts "The master branch has advanced. Attempting rebase..."
46
+ run_crucial "git rebase origin/master"
46
47
  end
47
48
 
48
49
  run_crucial "git push -f origin #{branch}:#{branch}"
data/lib/bard/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Bard
2
- VERSION = "0.37.1"
2
+ VERSION = "0.38.0"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.37.1
4
+ version: 0.38.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-31 00:00:00.000000000 Z
11
+ date: 2019-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -182,6 +182,7 @@ files:
182
182
  - Rakefile
183
183
  - bard.gemspec
184
184
  - bin/bard
185
+ - bin/setup
185
186
  - features/bard_check.feature
186
187
  - features/bard_deploy.feature
187
188
  - features/bard_pull.feature
@@ -197,7 +198,9 @@ files:
197
198
  - install_files/ci
198
199
  - install_files/setup
199
200
  - install_files/specified_bundler.rb
201
+ - install_files/specified_node.rb
200
202
  - install_files/specified_ruby.rb
203
+ - install_files/specified_yarn.rb
201
204
  - lib/bard.rb
202
205
  - lib/bard/base.rb
203
206
  - lib/bard/capistrano.rb
@@ -226,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
229
  version: '0'
227
230
  requirements: []
228
231
  rubyforge_project:
229
- rubygems_version: 2.4.8
232
+ rubygems_version: 2.6.14
230
233
  signing_key:
231
234
  specification_version: 4
232
235
  summary: CLI to automate common development tasks.