gaptool-server 0.6.0 → 0.6.3

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: e207c02d589d8bfb58e728c7b9b62aa529a4dafa
4
- data.tar.gz: a260e393c04319f65e9d805c5b2efd67834dc264
3
+ metadata.gz: 8792919d9131ecb815486fc8d6fdf6c3f1edc7b8
4
+ data.tar.gz: e049f30e8197148073679ac57ac39b8aae9708dc
5
5
  SHA512:
6
- metadata.gz: 029ec75667629cab21f13458344987e3c76430e9d7aba798b92d088bccdf0e0b339bb8f374ea1db7db30839b83ec5de7bb4f1621855db260b57f0ac7e0fab924
7
- data.tar.gz: e80e3092bfd5d8fa3ae1fe44c09ed21a09a97794c1ee968b8fd395c7304554b8cceea10634abcd904a8375c6511cee49222f50be72e6f4f9dfa171b8580447f1
6
+ metadata.gz: a24f502022c705b4498c20274493b0149dba3c5ee04dfd9e5dbe1d6c8a6cf0e1f5e759375f9fd04e31bf844e1bfa992f16a7719e531e32926e194d9840a8b2a1
7
+ data.tar.gz: 7fdfa9f7660507edbede8aafa9b7fd9db2401275e570ea7e72998d1224f4f4e0df2d060240bac4be21a8f014a533871ca20845ef6db53abb2e6829e6eb966a18
data/Rakefile CHANGED
@@ -30,7 +30,12 @@ unless File.exists?('/.dockerenv')
30
30
 
31
31
  desc "Start the HTTP server"
32
32
  task :server do
33
- exec "unicorn #{Shellwords.join(ARGV[1..-1])}"
33
+ exec "unicorn -p 3000 #{Shellwords.join(ARGV[1..-1])}"
34
+ end
35
+
36
+ desc "Tag git with VERSION"
37
+ task :tag do
38
+ exec "git tag v$(cat VERSION)"
34
39
  end
35
40
  end
36
41
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.0
1
+ 0.6.3
data/lib/app.rb CHANGED
@@ -36,9 +36,9 @@ class GaptoolServer < Sinatra::Application
36
36
  end
37
37
 
38
38
  configure do
39
- unless ENV['GAPTOOL_AIRBRAKE_KEY'].nil?
39
+ unless ENV['AIRBRAKE_API_KEY'].nil?
40
40
  Airbrake.configure do |cfg|
41
- cfg.api_key = ENV['GAPTOOL_AIRBRAKE_KEY']
41
+ cfg.api_key = ENV['AIRBRAKE_API_KEY']
42
42
  end
43
43
  use Airbrake::Sinatra
44
44
  end
data/lib/helpers/data.rb CHANGED
@@ -235,7 +235,7 @@ module Gaptool
235
235
  $redis.multi do |m|
236
236
  m.del(key)
237
237
  m.srem("apps", name)
238
- m.srem("role:#{role}")
238
+ m.srem("role:#{role}:apps", name)
239
239
  end
240
240
  else
241
241
  $redis.unwatch
@@ -244,7 +244,8 @@ module Gaptool
244
244
  end
245
245
 
246
246
  def self.get_app_data(app)
247
- {"role" => $redis.get("app:#{app}")}
247
+ role = $redis.get("app:#{app}")
248
+ return {"role" => role } unless role.nil?
248
249
  end
249
250
 
250
251
  def self.apps
data/tasks/app.rb CHANGED
@@ -12,9 +12,22 @@ namespace :app do
12
12
  end
13
13
 
14
14
  desc "Remove an application"
15
- task :delete, [:app] do |t, args|
16
- DH.remove_app(args[:app])
17
- puts "Removed app #{args[:app]}"
15
+ task :del, [:app] do |t, args|
16
+ unless args[:app].nil? || args[:app].empty?
17
+ DH.remove_app(args[:app])
18
+ puts "Removed app #{args[:app]}"
19
+ end
20
+ end
21
+
22
+ desc "Print app info"
23
+ task :info, [:app] do |t, args|
24
+ info = DH.get_app_data(args[:app])
25
+ if info.nil? || info.empty?
26
+ puts "No such app #{args[:app]}"
27
+ else
28
+ puts " * #{args[:app]} => #{info["role"]}"
29
+ end
30
+
18
31
  end
19
32
  end
20
33
 
data/tasks/docker.rb CHANGED
@@ -10,26 +10,9 @@ unless File.exists?('/.dockerenv')
10
10
  printimages
11
11
  end
12
12
 
13
- desc "Build the release image"
14
- task :release do
15
- sys(%w(./scripts/build_docker_images.sh -t release))
16
- printimages
17
- end
18
-
19
13
  task :all => [:image]
20
14
  end
21
15
 
22
- namespace :push do
23
- task :release do
24
- sys(%w(docker push gild/gaptool:release))
25
- end
26
-
27
- desc 'Push all tags to the Docker Hub'
28
- task :all do
29
- sys(%w(docker push gild/gaptool))
30
- end
31
- end
32
-
33
16
  desc 'Build the docker image'
34
17
  task :build => 'build:image'
35
18
 
@@ -43,11 +26,6 @@ unless File.exists?('/.dockerenv')
43
26
  sys(%w(fig run --rm gaptool rake test))
44
27
  end
45
28
 
46
- desc "Rehash instances"
47
- task :rehash => :build do
48
- sys(%w(fig run --rm gaptool rake rehash))
49
- end
50
-
51
29
  desc "Stop docker containers"
52
30
  task :stop do
53
31
  sys(%w(fig stop))
@@ -77,11 +55,6 @@ unless File.exists?('/.dockerenv')
77
55
  task :run do
78
56
  exit sys(%W(fig run --rm gaptool #{ARGV[1..-1].shelljoin}))
79
57
  end
80
-
81
- desc "Run a rake task inside the docker container"
82
- task :rake do
83
- exit sys(%W(fig run --rm gaptool rake #{ARGV[1..-1].shelljoin}))
84
- end
85
58
  end
86
59
 
87
60
  desc "Bring up docker containers"
data/tasks/gem.rb CHANGED
@@ -8,7 +8,10 @@ unless File.exists?('/.dockerenv')
8
8
 
9
9
  desc "Clean built file"
10
10
  task :clean do
11
- sys(%w(rm -vf *.gem))
11
+ Dir.glob("*.gem") do |f|
12
+ puts " * #{f}"
13
+ File.unlink(f)
14
+ end
12
15
  end
13
16
 
14
17
  desc "Bump the version"
@@ -19,6 +22,9 @@ unless File.exists?('/.dockerenv')
19
22
  f.write(nver)
20
23
  f.close
21
24
  puts "Bumped #{version} => #{nver}"
25
+ exec "git commit -m 'Bump version to v#{nver}' VERSION"
26
+ Rake::Task["tag"].invoke
27
+ Rake::Task["gem:build"].invoke
22
28
  end
23
29
 
24
30
  desc "Push"
data/tasks/server.rb ADDED
@@ -0,0 +1,11 @@
1
+ namespace :server do
2
+ desc "Set terminable flag to true/false for the instance :instance"
3
+ task :set_terminable, [:instance, :value] do |t, args|
4
+ if args[:instance].nil? || args[:value].nil?
5
+ puts "You must specify instance and true/false"
6
+ return
7
+ end
8
+ DH.set_server_data_attr args[:instance], 'terminable', (args[:value] == "true" ? "true" : "false")
9
+ puts DH.get_server_data args[:instance]
10
+ end
11
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gaptool-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Bailey
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-12-09 00:00:00.000000000 Z
13
+ date: 2014-12-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sinatra
@@ -256,6 +256,7 @@ files:
256
256
  - tasks/config.rb
257
257
  - tasks/docker.rb
258
258
  - tasks/gem.rb
259
+ - tasks/server.rb
259
260
  - tasks/user.rb
260
261
  - test/api_test.rb
261
262
  - test/base_test.rb