abtest 0.0.3 → 0.0.4
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2feb33d2ff421a52ce02c0501b1595aa3f5c0640
|
4
|
+
data.tar.gz: fc1e8b24c8ebfa81355961292ac0a7884ef4ab10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: addace6fa5603b07dcbc930e8cd78d466662fcb1053236c931587d6c089c9edbceb20cecdd069207c58719e32ef9ad7f13130a8d5f2db63af96bfcc023f32e5c
|
7
|
+
data.tar.gz: 9655689637f0c72e9c80e0353218bad317a4cdb72296c3ff02917f113a3d2ddd7d7449f1f96f0ecf25a09542fb258c47c01ae93d7f1545e470e0b13bf0420784
|
@@ -4,12 +4,22 @@ namespace :abtest do
|
|
4
4
|
name = args[:name]
|
5
5
|
puts "Experiment name is required" and return if name.nil?
|
6
6
|
|
7
|
-
# Check to see if we have a
|
8
|
-
|
7
|
+
# Check to see if we have a experiments directory
|
8
|
+
FileUtils.mkdir_p("#{Rails.root}/experiments")
|
9
9
|
|
10
|
-
#
|
11
|
-
experiment_path
|
12
|
-
|
10
|
+
# Add directories for views and assets
|
11
|
+
experiment_path = "#{Rails.root}/experiments/#{args[:name]}"
|
12
|
+
application_css_path = "#{experiment_path}/assets/stylesheets"
|
13
|
+
view_path = "#{experiment_path}/views"
|
14
|
+
FileUtils.mkdir_p(view_path)
|
15
|
+
FileUtils.mkdir_p(application_css_path)
|
16
|
+
|
17
|
+
# Add template stylesheet
|
18
|
+
css_template = File.read("#{File.dirname(__FILE__)}/templates/application.scss.erb")
|
19
|
+
renderer = ERB.new(css_template)
|
20
|
+
css_result = renderer.result(binding)
|
21
|
+
|
22
|
+
File.open("#{application_css_path}/#{name}_application.scss", 'w') {|f| f.write(css_result) }
|
13
23
|
|
14
24
|
# Create a new initializer file if it doesn't exist already
|
15
25
|
initializer_path = "#{Rails.root}/config/initializers/abtest.rb"
|
@@ -28,11 +38,11 @@ namespace :abtest do
|
|
28
38
|
|
29
39
|
desc "Delete all experiments"
|
30
40
|
task :delete_experiments => :environment do
|
31
|
-
# Remove
|
32
|
-
FileUtils.rm_rf("#{Rails.root}/
|
41
|
+
# Remove experiments directory
|
42
|
+
FileUtils.rm_rf("#{Rails.root}/experiments")
|
33
43
|
|
34
44
|
# Remove initializer
|
35
|
-
FileUtils.
|
45
|
+
FileUtils.rm_f("#{Rails.root}/config/initializers/abtest.rb")
|
36
46
|
|
37
47
|
puts "All tests removed"
|
38
48
|
end
|
@@ -1,3 +1,10 @@
|
|
1
|
+
|
2
|
+
################################################
|
3
|
+
#
|
4
|
+
# Begin configuration for <%= name %> experiment
|
5
|
+
#
|
6
|
+
################################################
|
7
|
+
|
1
8
|
<%= name %>_test = lambda { |request|
|
2
9
|
false
|
3
10
|
}
|
@@ -6,4 +13,12 @@
|
|
6
13
|
|
7
14
|
}
|
8
15
|
|
9
|
-
Abtest.register_test("<%= experiment_path %>", <%= name %>_test, <%= name %>_process)
|
16
|
+
Abtest.register_test("<%= experiment_path %>", <%= name %>_test, <%= name %>_process)
|
17
|
+
Rails.application.config.assets.paths << "<%= experiment_path %>/assets"
|
18
|
+
Rails.application.config.assets.precompile += ['<%= experiment_path %>/assets/stylesheets/<%= name %>_application.scss']
|
19
|
+
|
20
|
+
################################################
|
21
|
+
#
|
22
|
+
# End configuration for <%= name %> experiment
|
23
|
+
#
|
24
|
+
################################################
|
data/lib/abtest/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abtest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Saarinen
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- lib/abtest/railtie.rb
|
73
73
|
- lib/abtest/registry.rb
|
74
74
|
- lib/abtest/tasks/experiments.rake
|
75
|
+
- lib/abtest/tasks/templates/application.scss.erb
|
75
76
|
- lib/abtest/tasks/templates/initializer.erb
|
76
77
|
- lib/abtest/version.rb
|
77
78
|
homepage: http://www.whitepages.com
|