trackman 0.6.11 → 0.6.12

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -4,4 +4,5 @@ Gemfile.lock
4
4
  pkg/*
5
5
  *.orig
6
6
  *.DS_Store
7
- .rspec
7
+ .rspec
8
+ *.swp
data/Gemfile CHANGED
@@ -1,5 +1,3 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gemspec
4
-
5
- gem 'rest-client', :git => 'git@github.com:jfabre/rest-client.git'
3
+ gemspec
data/Rakefile CHANGED
@@ -1,4 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
2
4
 
3
5
  desc "creates a new app to the server and outputs the credentials"
4
6
  task :create_app do
@@ -49,3 +51,35 @@ namespace :setup do
49
51
  end
50
52
  end
51
53
  end
54
+
55
+ namespace :ci do
56
+ namespace :setup do
57
+ task :server do
58
+ to_unset = ENV.select{|k,v| k.include? 'BUNDLE' }
59
+ to_unset.each_key { |k| to_unset[k] = nil }
60
+
61
+ pid = spawn(to_unset, "update_trackman_server")
62
+ Process.wait(pid)
63
+
64
+ spawn(to_unset, "start_trackman_server")
65
+
66
+ sleep(10)
67
+ end
68
+ end
69
+ namespace :kill do
70
+ task :server do
71
+ result = `lsof -i :3000`
72
+ pid = result.match(/ruby\ +(\d+)/)[1].to_i
73
+
74
+ puts "Killing #{pid}"
75
+ Process.kill 9, pid
76
+ end
77
+ end
78
+ end
79
+
80
+ RSpec::Core::RakeTask.new do |task|
81
+ task.pattern = Dir['spec'].sort
82
+ task.rspec_opts = Dir.glob("[0-9][0-9][0-9]_*").collect { |x| "-I#{x}" }
83
+ task.rspec_opts << '--color -f d'
84
+ end
85
+
@@ -1,7 +1,7 @@
1
1
  require 'rest-client'
2
2
  require 'trackman'
3
3
 
4
- #only load this rakefil for sinatra/rack apps
4
+ #only load this rakefile for sinatra/rack apps
5
5
  namespace :trackman do
6
6
  desc "Syncs your assets with the server, this is what gets executed when you deploy to heroku."
7
7
  task :sync do
@@ -10,7 +10,6 @@ namespace :trackman do
10
10
 
11
11
  desc "Sets up the heroku configs required by Trackman"
12
12
  task :setup, :app do |t, args|
13
- heroku_version = Gem.loaded_specs["heroku"].version.to_s
14
- Trackman::Utility::Configuration.new(heroku_version, :app => args[:app]).setup
13
+ Trackman::Utility::Configuration.new(:app => args[:app]).setup
15
14
  end
16
- end
15
+ end
@@ -2,17 +2,17 @@ require 'versionomy'
2
2
 
3
3
  module Trackman
4
4
  module Utility
5
- class Configuration
6
- @@ERROR = 'ERROR_PAGE_URL'
7
- @@MAINTENANCE = 'MAINTENANCE_PAGE_URL'
5
+ class Configuration
6
+ @@ERROR = 'ERROR_PAGE_URL'
7
+ @@MAINTENANCE = 'MAINTENANCE_PAGE_URL'
8
8
  @@TRACKMAN_ERROR = 'TRACKMAN_ERROR_PAGE_URL'
9
9
  @@TRACKMAN_MAINTENANCE = 'TRACKMAN_MAINTENANCE_PAGE_URL'
10
10
 
11
11
  attr_accessor :configs, :heroku_version, :options
12
12
 
13
- def initialize(heroku_version, options = {})
13
+ def initialize(options = {})
14
14
  self.options = options
15
- self.heroku_version = heroku_version
15
+ self.heroku_version = get_version
16
16
  self.configs = get_configs
17
17
  end
18
18
 
@@ -23,11 +23,23 @@ module Trackman
23
23
  puts "Done!"
24
24
  end
25
25
 
26
+ def get_version
27
+ Bundler.with_clean_env do
28
+ which_result = `which heroku`
29
+ raise 'Could not find heroku toolbelt or gem. Make sure you installed one of them.' unless which_result && which_result.length > 0
30
+
31
+ heroku_version = `heroku --version`
32
+ heroku_version.match(/heroku-.*(\d+\.?\d+\.?\d+).*\(/)[1]
33
+ end
34
+ end
35
+
26
36
  def get_configs
27
- result = run "heroku config -s" do |option|
28
- "heroku config -s #{option}"
37
+ Bundler.with_clean_env do
38
+ result = run "heroku config -s" do |option|
39
+ "heroku config -s #{option}"
40
+ end
41
+ self.class.s_to_h(result)
29
42
  end
30
- self.class.s_to_h(result)
31
43
  end
32
44
 
33
45
 
@@ -77,12 +89,14 @@ module Trackman
77
89
 
78
90
  private
79
91
  def is_heroku_valid
80
- Versionomy.parse(heroku_version) >= Versionomy.parse("2.26.2")
92
+ Versionomy.parse(heroku_version) >= Versionomy.parse("2.26.2")
81
93
  end
82
94
 
83
95
  def add_config add
84
- run "heroku config:add #{add}" do |option|
85
- "heroku config:add #{option} #{add}"
96
+ Bundler.with_clean_env do
97
+ run "heroku config:add #{add}" do |option|
98
+ "heroku config:add #{option} #{add}"
99
+ end
86
100
  end
87
101
  end
88
102
 
@@ -1,3 +1,3 @@
1
1
  module Trackman
2
- VERSION = "0.6.11"
2
+ VERSION = "0.6.12"
3
3
  end
@@ -9,7 +9,6 @@ namespace :trackman do
9
9
 
10
10
  desc "Sets up the heroku configs required by Trackman"
11
11
  task :setup, :app do |t, args|
12
- heroku_version = Gem.loaded_specs["heroku"].version.to_s
13
- Trackman::Utility::Configuration.new(heroku_version, :app => args[:app]).setup
12
+ Trackman::Utility::Configuration.new(:app => args[:app]).setup
14
13
  end
15
- end
14
+ end
data/trackman.gemspec CHANGED
@@ -22,9 +22,9 @@ Gem::Specification.new do |s|
22
22
  s.add_runtime_dependency "json"
23
23
  s.add_runtime_dependency "nokogiri"
24
24
  s.add_runtime_dependency "rack"
25
- s.add_runtime_dependency "heroku", ">= 2.26.2"
26
25
  s.add_runtime_dependency "versionomy"
27
-
26
+
28
27
  s.add_development_dependency "rspec"
29
28
  s.add_development_dependency "sprockets"
29
+ s.add_development_dependency "rake"
30
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.11
4
+ version: 0.6.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-10-19 00:00:00.000000000 Z
13
+ date: 2012-11-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rest-client
@@ -77,13 +77,13 @@ dependencies:
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  - !ruby/object:Gem::Dependency
80
- name: heroku
80
+ name: versionomy
81
81
  requirement: !ruby/object:Gem::Requirement
82
82
  none: false
83
83
  requirements:
84
84
  - - ! '>='
85
85
  - !ruby/object:Gem::Version
86
- version: 2.26.2
86
+ version: '0'
87
87
  type: :runtime
88
88
  prerelease: false
89
89
  version_requirements: !ruby/object:Gem::Requirement
@@ -91,16 +91,16 @@ dependencies:
91
91
  requirements:
92
92
  - - ! '>='
93
93
  - !ruby/object:Gem::Version
94
- version: 2.26.2
94
+ version: '0'
95
95
  - !ruby/object:Gem::Dependency
96
- name: versionomy
96
+ name: rspec
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  none: false
99
99
  requirements:
100
100
  - - ! '>='
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
- type: :runtime
103
+ type: :development
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
106
106
  none: false
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rspec
112
+ name: sprockets
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  none: false
115
115
  requirements:
@@ -125,7 +125,7 @@ dependencies:
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
127
  - !ruby/object:Gem::Dependency
128
- name: sprockets
128
+ name: rake
129
129
  requirement: !ruby/object:Gem::Requirement
130
130
  none: false
131
131
  requirements:
@@ -511,12 +511,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
511
511
  - - ! '>='
512
512
  - !ruby/object:Gem::Version
513
513
  version: '0'
514
+ segments:
515
+ - 0
516
+ hash: -1816326835647719649
514
517
  required_rubygems_version: !ruby/object:Gem::Requirement
515
518
  none: false
516
519
  requirements:
517
520
  - - ! '>='
518
521
  - !ruby/object:Gem::Version
519
522
  version: '0'
523
+ segments:
524
+ - 0
525
+ hash: -1816326835647719649
520
526
  requirements: []
521
527
  rubyforge_project:
522
528
  rubygems_version: 1.8.24