bard 0.42.0 → 0.44.2

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
  SHA256:
3
- metadata.gz: 8ede698ef957275736c6d373ab637f83e9a676bf3a7214a789d4314ee69f3532
4
- data.tar.gz: c0ac00d558f50fa633858358d2387f68095810e8741b13b4227a08cfd3f9c5c4
3
+ metadata.gz: 288f1c3a327eaae2a435b6eee1b594918a7ebbebadecfacad4528c0b2fcb449d
4
+ data.tar.gz: ded1ce27cbbea6cac5909f58c3a9af849bb1809c13bf3d3f0b6d14511cbd6341
5
5
  SHA512:
6
- metadata.gz: a237a2cc3ddc4611486f1dfe6b14a8c282daa7656330bc0748c960f668c4e5ec213ebd7cb9b7cd0671de95476a4a61b0e6763bb5588cda63dc08ab2d0809f9f0
7
- data.tar.gz: 6861a6cf67056c5762144eb4fafc809c3a7a1040a8213a5bcac5860bc4f33aec9d44dccd7567e761f96465b20e0f14e5fa4a45aadcd96217a47b92ac7c8ce008
6
+ metadata.gz: f1b77d4d3245b43c06ca21204a0c8df9331fb76cb2dfa1fcace64861125c456bf40f80a731c08ec00defa6736c915626b9edd6c253c043f78aba4895d5c8c10a
7
+ data.tar.gz: 35e484be233cd029d01afe30b53c345ab15f40c458ddfc5b5b2f4d294103896699fc8c9b75d047cf33309218a043c176e2d2d50a42b155d88338ec7f5d7c0c14
@@ -1,45 +1,31 @@
1
1
  module SpecifiedNode
2
- class NVMError < StandardError; end
3
-
4
- NVM_PATH = File.expand_path("~/.nvm/nvm.sh")
5
-
6
2
  extend self
7
3
 
4
+ NODE_VERSION = "v12.16.1"
5
+ NODE_PATH = "tmp/node-#{NODE_VERSION}-linux-x64/bin/node"
6
+
8
7
  def ensure!
9
- install_nvm unless nvm_installed?
10
- restart unless nvm_active?
11
8
  install_node unless node_installed?
12
- "true"
9
+ install_binstub
10
+ "bin/node --version"
13
11
  end
14
12
 
15
13
  private
16
14
 
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
15
  def install_node
27
- nvm "install" or raise NVMError.new($?.exitstatus)
28
- end
29
-
30
- def node_installed?
31
- nvm "use"
16
+ system("wget -cO- https://nodejs.org/dist/#{NODE_VERSION}/node-#{NODE_VERSION}-linux-x64.tar.xz | tar xJ -C tmp/")
32
17
  end
33
18
 
34
- def restart
35
- exec %(bash -lc ". #{NVM_PATH}; #{$0}")
19
+ def install_binstub
20
+ system("cd bin && ln -fs ../#{NODE_PATH}")
36
21
  end
37
22
 
38
- def nvm_active?
39
- ENV.key?("NVM_DIR")
23
+ def node_installed?
24
+ File.exist?(NODE_PATH) && `#{NODE_PATH} --version`.chomp == NODE_VERSION
40
25
  end
41
26
 
42
- def nvm command
43
- system(". #{NVM_PATH}; nvm #{command}")
27
+ def binstub_installed?
28
+ File.exist?("bin/node")
44
29
  end
45
30
  end
31
+
@@ -1,34 +1,31 @@
1
1
  module SpecifiedYarn
2
2
  extend self
3
3
 
4
- YARN_PATH = "node_modules/yarn/bin/yarn"
4
+ YARN_VERSION = "v1.22.0"
5
+ YARN_PATH = "tmp/yarn-#{YARN_VERSION}/bin/yarn.js"
5
6
 
6
7
  def ensure!
7
8
  install_yarn unless yarn_installed?
8
- install_binstub unless binstub_installed?
9
+ install_binstub
9
10
  "bin/yarn install"
10
11
  end
11
12
 
12
13
  private
13
14
 
14
15
  def install_yarn
15
- system(". ~/.nvm/nvm.sh && npm install yarn@#{version} --no-save")
16
+ system("wget -cO- https://github.com/yarnpkg/yarn/releases/download/#{YARN_VERSION}/yarn-#{YARN_VERSION}.tar.gz | tar -xz -C tmp/")
16
17
  end
17
18
 
18
19
  def install_binstub
19
- system("cd bin && ln -s ../#{YARN_PATH}")
20
+ system("cd bin && ln -fs ../#{YARN_PATH}")
20
21
  end
21
22
 
22
23
  def yarn_installed?
23
- File.exist?(YARN_PATH) && `#{YARN_PATH} --version`.chomp == version
24
+ File.exist?(YARN_PATH) && `bin/node #{YARN_PATH} --version`.chomp == YARN_VERSION[1..-1]
24
25
  end
25
26
 
26
27
  def binstub_installed?
27
28
  File.exist?("bin/yarn")
28
29
  end
29
-
30
- def version
31
- File.read("package.json")[/"yarn": "([0-9\.]+)"/, 1]
32
- end
33
30
  end
34
31
 
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+ argv0=$(echo "$0" | sed -e 's,\\,/,g')
3
+ basedir=$(dirname "$(readlink -f "$0" || echo "$argv0")")
4
+ exec "$basedir/node" "$basedir/yarn.js" "$@"
5
+
data/lib/bard.rb CHANGED
@@ -14,7 +14,8 @@ class Bard::CLI < Thor
14
14
  end
15
15
 
16
16
  desc "data [FROM=production, TO=local]", "copy database and assets from FROM to TO"
17
- def data(from="production", to="local")
17
+ def data(from=nil, to="local")
18
+ from ||= @config.servers.key?(:production) ? "production" : "staging"
18
19
  Data.new(self, from, to).call
19
20
  end
20
21
 
@@ -125,6 +126,13 @@ class Bard::CLI < Thor
125
126
  end
126
127
  end
127
128
 
129
+ desc "open [SERVER=production]", "opens the url in the web browser."
130
+ def open server=nil
131
+ server ||= @config.servers.key?(:production) ? :production : :staging
132
+ server = @config.servers[server.to_sym]
133
+ exec "xdg-open #{server.default_ping}"
134
+ end
135
+
128
136
  desc "hurt", "reruns a command until it fails"
129
137
  def hurt *args
130
138
  1.upto(Float::INFINITY) do |count|
@@ -170,7 +178,7 @@ class Bard::CLI < Thor
170
178
 
171
179
  command = "curl -sfL #{url} 2>&1 1>/dev/null"
172
180
  unless system command
173
- puts "#{server.to_s.capitalize} is down!"
181
+ puts "#{server.key.to_s.capitalize} is down!"
174
182
  exit 1
175
183
  end
176
184
  end
data/lib/bard/ci.rb CHANGED
@@ -38,11 +38,11 @@ class Bard::CLI < Thor
38
38
  end
39
39
 
40
40
  def exists?
41
- `curl -s -I #{ci_host}/?token=botandrose` =~ /\b200 OK\b/
41
+ `curl -s -I #{ci_host}/` =~ /\b200 OK\b/
42
42
  end
43
43
 
44
44
  def console
45
- raw = `curl -s #{ci_host}/lastBuild/console?token=botandrose`
45
+ raw = `curl -s #{ci_host}/lastBuild/console`
46
46
  raw[%r{<pre.*?>(.+)</pre>}m, 1]
47
47
  end
48
48
 
@@ -51,17 +51,21 @@ class Bard::CLI < Thor
51
51
  private
52
52
 
53
53
  def get_last_time_elapsed
54
- response = `curl -s #{ci_host}/lastStableBuild/api/xml?token=botandrose`
54
+ response = `curl -s #{ci_host}/lastStableBuild/api/xml`
55
55
  response.match(/<duration>(\d+)<\/duration>/)
56
56
  $1 ? $1.to_i / 1000 : nil
57
57
  end
58
58
 
59
+ def auth
60
+ "botandrose:11cc2ba6ef2e43fbfbedc1f466724f6290"
61
+ end
62
+
59
63
  def ci_host
60
- "http://botandrose:thecakeisalie!@ci.botandrose.com/job/#{project_name}"
64
+ "http://#{auth}@ci.botandrose.com/job/#{project_name}"
61
65
  end
62
66
 
63
67
  def start
64
- command = "curl -s -I -X POST '#{ci_host}/buildWithParameters?token=botandrose&GIT_REF=#{sha}'"
68
+ command = "curl -s -I -X POST -L '#{ci_host}/buildWithParameters?GIT_REF=#{sha}'"
65
69
  output = `#{command}`
66
70
  @queueId = output[%r{Location: .+/queue/item/(\d+)/}, 1].to_i
67
71
  end
data/lib/bard/config.rb CHANGED
@@ -77,8 +77,14 @@ class Bard::CLI < Thor
77
77
  "http://#{uri.host}"
78
78
  end
79
79
 
80
- def path
81
- super || project_name
80
+ def path(*args)
81
+ if args.length == 1
82
+ self.path = args.first
83
+ elsif args.length == 0
84
+ super() || project_name
85
+ else
86
+ raise ArgumentError
87
+ end
82
88
  end
83
89
  end
84
90
  end
data/lib/bard/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Bard
2
- VERSION = "0.42.0"
2
+ VERSION = "0.44.2"
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.42.0
4
+ version: 0.44.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-08 00:00:00.000000000 Z
11
+ date: 2021-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -143,6 +143,7 @@ files:
143
143
  - install_files/specified_node.rb
144
144
  - install_files/specified_ruby.rb
145
145
  - install_files/specified_yarn.rb
146
+ - install_files/yarn
146
147
  - lib/bard.rb
147
148
  - lib/bard/base.rb
148
149
  - lib/bard/ci.rb