vanity 1.9.3 → 2.0.0.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +0 -1
- data/.travis.yml +2 -53
- data/Appraisals +3 -12
- data/CHANGELOG +1 -5
- data/Gemfile +0 -10
- data/Gemfile.lock +3 -38
- data/README.rdoc +2 -13
- data/Rakefile +7 -13
- data/bin/vanity +0 -1
- data/doc/rails.textile +0 -12
- data/gemfiles/rails32.gemfile +2 -4
- data/gemfiles/rails32.gemfile.lock +6 -14
- data/gemfiles/rails4.gemfile +1 -4
- data/gemfiles/rails4.gemfile.lock +5 -15
- data/lib/vanity/adapters/active_record_adapter.rb +14 -10
- data/lib/vanity/experiment/ab_test.rb +1 -1
- data/lib/vanity/frameworks/rails.rb +11 -17
- data/lib/vanity/frameworks.rb +3 -10
- data/lib/vanity/metric/active_record.rb +20 -19
- data/lib/vanity/playground.rb +1 -3
- data/lib/vanity/version.rb +1 -1
- data/test/adapters/redis_adapter_test.rb +26 -27
- data/test/autoconnect_test.rb +19 -17
- data/test/cli_test.rb +19 -26
- data/test/experiment/ab_test.rb +2 -15
- data/test/experiment/base_test.rb +18 -22
- data/test/frameworks/rails/action_controller_test.rb +184 -0
- data/test/frameworks/rails/action_mailer_test.rb +65 -0
- data/test/{rails_helper_test.rb → frameworks/rails/action_view_test.rb} +1 -1
- data/test/frameworks/rails/rails_test.rb +285 -0
- data/test/helper_test.rb +13 -10
- data/test/metric/active_record_test.rb +50 -66
- data/test/metric/base_test.rb +39 -41
- data/test/metric/google_analytics_test.rb +13 -16
- data/test/metric/remote_test.rb +18 -19
- data/test/playground_test.rb +1 -1
- data/test/test_helper.rb +25 -43
- data/test/{rails_dashboard_test.rb → web/rails/dashboard_test.rb} +2 -1
- data/vanity.gemspec +3 -2
- metadata +33 -33
- data/gemfiles/rails3.gemfile +0 -32
- data/gemfiles/rails3.gemfile.lock +0 -172
- data/gemfiles/rails31.gemfile +0 -32
- data/gemfiles/rails31.gemfile.lock +0 -181
- data/generators/templates/vanity_migration.rb +0 -54
- data/generators/vanity_generator.rb +0 -8
- data/test/myapp/app/controllers/application_controller.rb +0 -2
- data/test/myapp/app/controllers/main_controller.rb +0 -7
- data/test/myapp/config/boot.rb +0 -110
- data/test/myapp/config/environment.rb +0 -10
- data/test/myapp/config/environments/production.rb +0 -0
- data/test/myapp/config/routes.rb +0 -3
- data/test/passenger_test.rb +0 -52
- data/test/rails_test.rb +0 -554
@@ -1,181 +0,0 @@
|
|
1
|
-
GIT
|
2
|
-
remote: git://github.com/zoltankiss/fastthread.git
|
3
|
-
revision: 56e6ce7c1780797a354d5befe9a9a9869bbc7e3e
|
4
|
-
specs:
|
5
|
-
fastthread (1.0.7)
|
6
|
-
|
7
|
-
PATH
|
8
|
-
remote: ..
|
9
|
-
specs:
|
10
|
-
vanity (1.9.3)
|
11
|
-
|
12
|
-
GEM
|
13
|
-
remote: https://rubygems.org/
|
14
|
-
specs:
|
15
|
-
RedCloth (4.2.9)
|
16
|
-
SystemTimer (1.2.3)
|
17
|
-
actionmailer (3.1.3)
|
18
|
-
actionpack (= 3.1.3)
|
19
|
-
mail (~> 2.3.0)
|
20
|
-
actionpack (3.1.3)
|
21
|
-
activemodel (= 3.1.3)
|
22
|
-
activesupport (= 3.1.3)
|
23
|
-
builder (~> 3.0.0)
|
24
|
-
erubis (~> 2.7.0)
|
25
|
-
i18n (~> 0.6)
|
26
|
-
rack (~> 1.3.5)
|
27
|
-
rack-cache (~> 1.1)
|
28
|
-
rack-mount (~> 0.8.2)
|
29
|
-
rack-test (~> 0.6.1)
|
30
|
-
sprockets (~> 2.0.3)
|
31
|
-
activemodel (3.1.3)
|
32
|
-
activesupport (= 3.1.3)
|
33
|
-
builder (~> 3.0.0)
|
34
|
-
i18n (~> 0.6)
|
35
|
-
activerecord (3.1.3)
|
36
|
-
activemodel (= 3.1.3)
|
37
|
-
activesupport (= 3.1.3)
|
38
|
-
arel (~> 2.2.1)
|
39
|
-
tzinfo (~> 0.3.29)
|
40
|
-
activeresource (3.1.3)
|
41
|
-
activemodel (= 3.1.3)
|
42
|
-
activesupport (= 3.1.3)
|
43
|
-
activesupport (3.1.3)
|
44
|
-
multi_json (~> 1.0)
|
45
|
-
addressable (2.2.7)
|
46
|
-
albino (1.3.3)
|
47
|
-
posix-spawn (>= 0.3.6)
|
48
|
-
appraisal (1.0.0.beta2)
|
49
|
-
bundler
|
50
|
-
rake
|
51
|
-
thor (>= 0.14.0)
|
52
|
-
arel (2.2.3)
|
53
|
-
backports (3.3.5)
|
54
|
-
bson (1.6.0)
|
55
|
-
bson_ext (1.6.0)
|
56
|
-
bson (= 1.6.0)
|
57
|
-
builder (3.0.0)
|
58
|
-
classifier (1.3.3)
|
59
|
-
fast-stemmer (>= 1.0.0)
|
60
|
-
crack (0.3.1)
|
61
|
-
daemon_controller (1.0.0)
|
62
|
-
directory_watcher (1.4.1)
|
63
|
-
erubis (2.7.0)
|
64
|
-
fast-stemmer (1.0.0)
|
65
|
-
garb (0.9.1)
|
66
|
-
activesupport (>= 2.2.0)
|
67
|
-
crack (>= 0.1.6)
|
68
|
-
i18n (0.6.0)
|
69
|
-
integration (0.1.0)
|
70
|
-
jekyll (0.11.2)
|
71
|
-
albino (~> 1.3)
|
72
|
-
classifier (~> 1.3)
|
73
|
-
directory_watcher (~> 1.1)
|
74
|
-
kramdown (~> 0.13)
|
75
|
-
liquid (~> 2.3)
|
76
|
-
maruku (~> 0.5)
|
77
|
-
json (1.6.5)
|
78
|
-
kramdown (0.13.5)
|
79
|
-
liquid (2.3.0)
|
80
|
-
mail (2.3.0)
|
81
|
-
i18n (>= 0.4.0)
|
82
|
-
mime-types (~> 1.16)
|
83
|
-
treetop (~> 1.4.8)
|
84
|
-
maruku (0.6.0)
|
85
|
-
syntax (>= 1.0.0)
|
86
|
-
metaclass (0.0.1)
|
87
|
-
mime-types (1.17.2)
|
88
|
-
mocha (0.10.5)
|
89
|
-
metaclass (~> 0.0.1)
|
90
|
-
mongo (1.6.0)
|
91
|
-
bson (= 1.6.0)
|
92
|
-
multi_json (1.1.0)
|
93
|
-
passenger (3.0.11)
|
94
|
-
daemon_controller (>= 0.2.5)
|
95
|
-
fastthread (>= 1.0.1)
|
96
|
-
rack
|
97
|
-
rake (>= 0.8.1)
|
98
|
-
polyglot (0.3.3)
|
99
|
-
posix-spawn (0.3.6)
|
100
|
-
rack (1.3.6)
|
101
|
-
rack-cache (1.1)
|
102
|
-
rack (>= 0.4)
|
103
|
-
rack-mount (0.8.3)
|
104
|
-
rack (>= 1.0.0)
|
105
|
-
rack-ssl (1.3.2)
|
106
|
-
rack
|
107
|
-
rack-test (0.6.1)
|
108
|
-
rack (>= 1.0)
|
109
|
-
rails (3.1.3)
|
110
|
-
actionmailer (= 3.1.3)
|
111
|
-
actionpack (= 3.1.3)
|
112
|
-
activerecord (= 3.1.3)
|
113
|
-
activeresource (= 3.1.3)
|
114
|
-
activesupport (= 3.1.3)
|
115
|
-
bundler (~> 1.0)
|
116
|
-
railties (= 3.1.3)
|
117
|
-
railties (3.1.3)
|
118
|
-
actionpack (= 3.1.3)
|
119
|
-
activesupport (= 3.1.3)
|
120
|
-
rack-ssl (~> 1.3.2)
|
121
|
-
rake (>= 0.8.7)
|
122
|
-
rdoc (~> 3.4)
|
123
|
-
thor (~> 0.14.6)
|
124
|
-
rake (0.9.2.2)
|
125
|
-
rdoc (3.12)
|
126
|
-
json (~> 1.4)
|
127
|
-
redis (3.0.6)
|
128
|
-
redis-namespace (1.3.2)
|
129
|
-
redis (~> 3.0.4)
|
130
|
-
rubystats (0.2.3)
|
131
|
-
shoulda (3.0.1)
|
132
|
-
shoulda-context (~> 1.0.0)
|
133
|
-
shoulda-matchers (~> 1.0.0)
|
134
|
-
shoulda-context (1.0.0)
|
135
|
-
shoulda-matchers (1.0.0)
|
136
|
-
sprockets (2.0.3)
|
137
|
-
rack (~> 1.0)
|
138
|
-
tilt (~> 1.1, != 1.3.0)
|
139
|
-
sqlite3 (1.3.8)
|
140
|
-
syntax (1.0.0)
|
141
|
-
thor (0.14.6)
|
142
|
-
tilt (1.3.3)
|
143
|
-
timecop (0.3.5)
|
144
|
-
treetop (1.4.10)
|
145
|
-
polyglot
|
146
|
-
polyglot (>= 0.3.1)
|
147
|
-
tzinfo (0.3.31)
|
148
|
-
webmock (1.8.0)
|
149
|
-
addressable (>= 2.2.7)
|
150
|
-
crack (>= 0.1.7)
|
151
|
-
yard (0.7.5)
|
152
|
-
|
153
|
-
PLATFORMS
|
154
|
-
ruby
|
155
|
-
|
156
|
-
DEPENDENCIES
|
157
|
-
RedCloth
|
158
|
-
SystemTimer (= 1.2.3)
|
159
|
-
appraisal (>= 1.0.0.beta2)
|
160
|
-
backports
|
161
|
-
bson_ext
|
162
|
-
bundler (>= 1.0.0)
|
163
|
-
fastthread!
|
164
|
-
garb
|
165
|
-
integration
|
166
|
-
jekyll
|
167
|
-
mocha
|
168
|
-
mongo
|
169
|
-
passenger (~> 3.0)
|
170
|
-
rack
|
171
|
-
rails (= 3.1.3)
|
172
|
-
rake
|
173
|
-
redis (>= 2.1)
|
174
|
-
redis-namespace (>= 1.1.0)
|
175
|
-
rubystats
|
176
|
-
shoulda
|
177
|
-
sqlite3
|
178
|
-
timecop
|
179
|
-
vanity!
|
180
|
-
webmock
|
181
|
-
yard
|
@@ -1,54 +0,0 @@
|
|
1
|
-
class VanityMigration < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :vanity_metrics do |t|
|
4
|
-
t.string :metric_id
|
5
|
-
t.datetime :updated_at
|
6
|
-
end
|
7
|
-
add_index :vanity_metrics, [:metric_id]
|
8
|
-
|
9
|
-
create_table :vanity_metric_values do |t|
|
10
|
-
t.integer :vanity_metric_id
|
11
|
-
t.integer :index
|
12
|
-
t.integer :value
|
13
|
-
t.string :date
|
14
|
-
end
|
15
|
-
add_index :vanity_metric_values, [:vanity_metric_id]
|
16
|
-
|
17
|
-
create_table :vanity_experiments do |t|
|
18
|
-
t.string :experiment_id
|
19
|
-
t.integer :outcome
|
20
|
-
t.datetime :created_at
|
21
|
-
t.datetime :completed_at
|
22
|
-
end
|
23
|
-
add_index :vanity_experiments, [:experiment_id]
|
24
|
-
|
25
|
-
create_table :vanity_conversions do |t|
|
26
|
-
t.integer :vanity_experiment_id
|
27
|
-
t.integer :alternative
|
28
|
-
t.integer :conversions
|
29
|
-
end
|
30
|
-
add_index :vanity_conversions, [:vanity_experiment_id, :alternative], :name => "by_experiment_id_and_alternative"
|
31
|
-
|
32
|
-
create_table :vanity_participants do |t|
|
33
|
-
t.string :experiment_id
|
34
|
-
t.string :identity
|
35
|
-
t.integer :shown
|
36
|
-
t.integer :seen
|
37
|
-
t.integer :converted
|
38
|
-
t.timestamps
|
39
|
-
end
|
40
|
-
add_index :vanity_participants, [:experiment_id]
|
41
|
-
add_index :vanity_participants, [:experiment_id, :identity], :name => "by_experiment_id_and_identity"
|
42
|
-
add_index :vanity_participants, [:experiment_id, :shown], :name => "by_experiment_id_and_shown"
|
43
|
-
add_index :vanity_participants, [:experiment_id, :seen], :name => "by_experiment_id_and_seen"
|
44
|
-
add_index :vanity_participants, [:experiment_id, :converted], :name => "by_experiment_id_and_converted"
|
45
|
-
end
|
46
|
-
|
47
|
-
def self.down
|
48
|
-
drop_table :vanity_metrics
|
49
|
-
drop_table :vanity_metric_values
|
50
|
-
drop_table :vanity_experiments
|
51
|
-
drop_table :vanity_conversions
|
52
|
-
drop_table :vanity_participants
|
53
|
-
end
|
54
|
-
end
|
data/test/myapp/config/boot.rb
DELETED
@@ -1,110 +0,0 @@
|
|
1
|
-
# Don't change this file!
|
2
|
-
# Configure your app in config/environment.rb and config/environments/*.rb
|
3
|
-
|
4
|
-
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
|
5
|
-
|
6
|
-
module Rails
|
7
|
-
class << self
|
8
|
-
def boot!
|
9
|
-
unless booted?
|
10
|
-
preinitialize
|
11
|
-
pick_boot.run
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def booted?
|
16
|
-
defined? Rails::Initializer
|
17
|
-
end
|
18
|
-
|
19
|
-
def pick_boot
|
20
|
-
(vendor_rails? ? VendorBoot : GemBoot).new
|
21
|
-
end
|
22
|
-
|
23
|
-
def vendor_rails?
|
24
|
-
File.exist?("#{RAILS_ROOT}/vendor/rails")
|
25
|
-
end
|
26
|
-
|
27
|
-
def preinitialize
|
28
|
-
load(preinitializer_path) if File.exist?(preinitializer_path)
|
29
|
-
end
|
30
|
-
|
31
|
-
def preinitializer_path
|
32
|
-
"#{RAILS_ROOT}/config/preinitializer.rb"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
class Boot
|
37
|
-
def run
|
38
|
-
load_initializer
|
39
|
-
Rails::Initializer.run(:set_load_path)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
class VendorBoot < Boot
|
44
|
-
def load_initializer
|
45
|
-
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
46
|
-
Rails::Initializer.run(:install_gem_spec_stubs)
|
47
|
-
Rails::GemDependency.add_frozen_gem_path
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
class GemBoot < Boot
|
52
|
-
def load_initializer
|
53
|
-
self.class.load_rubygems
|
54
|
-
load_rails_gem
|
55
|
-
require 'initializer'
|
56
|
-
end
|
57
|
-
|
58
|
-
def load_rails_gem
|
59
|
-
if version = self.class.gem_version
|
60
|
-
gem 'rails', version
|
61
|
-
else
|
62
|
-
gem 'rails'
|
63
|
-
end
|
64
|
-
rescue Gem::LoadError => load_error
|
65
|
-
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
|
66
|
-
exit 1
|
67
|
-
end
|
68
|
-
|
69
|
-
class << self
|
70
|
-
def rubygems_version
|
71
|
-
Gem::RubyGemsVersion rescue nil
|
72
|
-
end
|
73
|
-
|
74
|
-
def gem_version
|
75
|
-
if defined? RAILS_GEM_VERSION
|
76
|
-
RAILS_GEM_VERSION
|
77
|
-
elsif ENV.include?('RAILS_GEM_VERSION')
|
78
|
-
ENV['RAILS_GEM_VERSION']
|
79
|
-
else
|
80
|
-
parse_gem_version(read_environment_rb)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
def load_rubygems
|
85
|
-
min_version = '1.3.1'
|
86
|
-
require 'rubygems'
|
87
|
-
unless rubygems_version >= min_version
|
88
|
-
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
89
|
-
exit 1
|
90
|
-
end
|
91
|
-
|
92
|
-
rescue LoadError
|
93
|
-
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
|
94
|
-
exit 1
|
95
|
-
end
|
96
|
-
|
97
|
-
def parse_gem_version(text)
|
98
|
-
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
|
99
|
-
end
|
100
|
-
|
101
|
-
private
|
102
|
-
def read_environment_rb
|
103
|
-
File.read("#{RAILS_ROOT}/config/environment.rb")
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
# All that for this:
|
110
|
-
Rails.boot!
|
@@ -1,10 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'boot')
|
2
|
-
|
3
|
-
Rails::Initializer.run do |config|
|
4
|
-
config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
|
5
|
-
config.action_controller.session = { :key=>"_myapp_session", :secret=>"Stay hungry. Stay foolish. -- Steve Jobs" }
|
6
|
-
config.after_initialize do
|
7
|
-
$:.unshift File.dirname(__FILE__) + "/../../../lib/"
|
8
|
-
require "vanity"
|
9
|
-
end
|
10
|
-
end
|
File without changes
|
data/test/myapp/config/routes.rb
DELETED
data/test/passenger_test.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
require "test/test_helper"
|
2
|
-
|
3
|
-
# Not supported for rails3
|
4
|
-
if !defined?(Rails::Railtie) && ActiveRecord::Base.connected?
|
5
|
-
require "phusion_passenger/spawn_manager"
|
6
|
-
|
7
|
-
class PassengerTest < Test::Unit::TestCase
|
8
|
-
def setup
|
9
|
-
super
|
10
|
-
ActiveRecord::Base.connection.disconnect! # Otherwise AR metric tests fail
|
11
|
-
@original = Vanity.playground.connection
|
12
|
-
File.unlink "test/myapp/config/vanity.yml" rescue nil
|
13
|
-
File.open("test/myapp/config/vanity.yml", "w") do |io|
|
14
|
-
io.write YAML.dump({ "production"=>DATABASE })
|
15
|
-
end
|
16
|
-
@server = PhusionPassenger::SpawnManager.new
|
17
|
-
@server.start
|
18
|
-
Thread.pass until @server.started?
|
19
|
-
app_root = File.expand_path("myapp", File.dirname(__FILE__))
|
20
|
-
@app = @server.spawn_application "app_root"=>app_root, "spawn_method"=>"smart"
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_reconnect
|
24
|
-
# When using AR adapter, we're not responsible to reconnect, and we're going
|
25
|
-
# to get the same "connect" (AR connection handler) either way.
|
26
|
-
# return if defined?(Vanity::Adapters::ActiveRecordAdapter) && Vanity::Adapters::ActiveRecordAdapter === Vanity.playground.connection
|
27
|
-
|
28
|
-
sleep 0.1
|
29
|
-
case @app.listen_socket_type
|
30
|
-
when "tcp" ; socket = TCPSocket.new(*@app.listen_socket_name.split(":"))
|
31
|
-
when "unix"; socket = UNIXSocket.new(@app.listen_socket_name)
|
32
|
-
else fail
|
33
|
-
end
|
34
|
-
channel = PhusionPassenger::MessageChannel.new(socket)
|
35
|
-
request = {"REQUEST_PATH"=>"/", "REQUEST_METHOD"=>"GET", "QUERY_STRING"=>" "}
|
36
|
-
channel.write_scalar request.to_a.join("\0")
|
37
|
-
response = socket.read.split("\r\n\r\n").last
|
38
|
-
socket.close
|
39
|
-
conn, obj_id = response.split("\n")
|
40
|
-
assert_equal @original.to_s, conn
|
41
|
-
assert_not_equal @original.object_id.to_s, obj_id
|
42
|
-
end
|
43
|
-
|
44
|
-
def teardown
|
45
|
-
super
|
46
|
-
@server.cleanup
|
47
|
-
@server.stop
|
48
|
-
Process.kill('SIGKILL', @app.pid.to_i) # Just in case...KIDS, GET OUT OF THE POOL!
|
49
|
-
File.unlink "test/myapp/config/vanity.yml"
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|