vanity 1.4.0 → 1.5.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.
@@ -2724,3 +2724,268 @@ Completed in 5ms (View: 1 | 200 OK [http://:? ]
2724
2724
  Processing MainController#index (for at 2010-08-06 00:13:59) [GET]
2725
2725
  Parameters: {" "=>nil}
2726
2726
  Completed in 7ms (View: 2 | 200 OK [http://:? ]
2727
+
2728
+
2729
+ Processing MainController#index (for at 2010-09-03 11:30:25) [GET]
2730
+ Parameters: {" "=>nil}
2731
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2732
+
2733
+
2734
+ Processing MainController#index (for at 2010-09-03 11:31:47) [GET]
2735
+ Parameters: {" "=>nil}
2736
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2737
+
2738
+
2739
+ Processing MainController#index (for at 2010-09-03 11:32:33) [GET]
2740
+ Parameters: {" "=>nil}
2741
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2742
+
2743
+
2744
+ Processing MainController#index (for at 2010-09-03 11:33:37) [GET]
2745
+ Parameters: {" "=>nil}
2746
+ Completed in 2ms (View: 0 | 200 OK [http://:? ]
2747
+
2748
+
2749
+ Processing MainController#index (for at 2010-09-03 11:34:32) [GET]
2750
+ Parameters: {" "=>nil}
2751
+ Completed in 2ms (View: 0 | 200 OK [http://:? ]
2752
+
2753
+
2754
+ Processing MainController#index (for at 2010-09-03 11:36:41) [GET]
2755
+ Parameters: {" "=>nil}
2756
+ Completed in 5ms (View: 1 | 200 OK [http://:? ]
2757
+
2758
+
2759
+ Processing MainController#index (for at 2010-09-03 11:37:23) [GET]
2760
+ Parameters: {" "=>nil}
2761
+ Completed in 6ms (View: 1 | 200 OK [http://:? ]
2762
+
2763
+
2764
+ Processing MainController#index (for at 2010-09-03 12:05:18) [GET]
2765
+ Parameters: {" "=>nil}
2766
+ Completed in 4ms (View: 1 | 200 OK [http://:? ]
2767
+
2768
+
2769
+ Processing MainController#index (for at 2010-09-03 12:07:38) [GET]
2770
+ Parameters: {" "=>nil}
2771
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2772
+
2773
+
2774
+ Processing MainController#index (for at 2010-09-03 12:08:15) [GET]
2775
+ Parameters: {" "=>nil}
2776
+ Completed in 180ms (View: 0 | 200 OK [http://:? ]
2777
+
2778
+
2779
+ Processing MainController#index (for at 2010-09-22 15:36:26) [GET]
2780
+ Parameters: {" "=>nil}
2781
+ Completed in 281ms (View: 0 | 200 OK [http://:? ]
2782
+
2783
+
2784
+ Processing MainController#index (for at 2010-09-22 15:39:12) [GET]
2785
+ Parameters: {" "=>nil}
2786
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2787
+
2788
+
2789
+ Processing MainController#index (for at 2010-09-22 15:45:11) [GET]
2790
+ Parameters: {" "=>nil}
2791
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2792
+
2793
+
2794
+ Processing MainController#index (for at 2010-09-22 15:46:10) [GET]
2795
+ Parameters: {" "=>nil}
2796
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2797
+
2798
+
2799
+ Processing MainController#index (for at 2010-09-22 15:46:52) [GET]
2800
+ Parameters: {" "=>nil}
2801
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2802
+
2803
+
2804
+ Processing MainController#index (for at 2010-09-22 15:50:10) [GET]
2805
+ Parameters: {" "=>nil}
2806
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2807
+
2808
+
2809
+ Processing MainController#index (for at 2010-09-22 15:50:43) [GET]
2810
+ Parameters: {" "=>nil}
2811
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2812
+
2813
+
2814
+ Processing MainController#index (for at 2010-09-22 15:51:12) [GET]
2815
+ Parameters: {" "=>nil}
2816
+ Completed in 6ms (View: 1 | 200 OK [http://:? ]
2817
+
2818
+
2819
+ Processing MainController#index (for at 2010-09-22 15:51:50) [GET]
2820
+ Parameters: {" "=>nil}
2821
+ Completed in 5ms (View: 1 | 200 OK [http://:? ]
2822
+
2823
+
2824
+ Processing MainController#index (for at 2010-09-22 16:04:39) [GET]
2825
+ Parameters: {" "=>nil}
2826
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2827
+
2828
+
2829
+ Processing MainController#index (for at 2010-09-22 16:05:17) [GET]
2830
+ Parameters: {" "=>nil}
2831
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2832
+
2833
+
2834
+ Processing MainController#index (for at 2010-09-22 16:07:13) [GET]
2835
+ Parameters: {" "=>nil}
2836
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2837
+
2838
+
2839
+ Processing MainController#index (for at 2010-09-22 16:07:46) [GET]
2840
+ Parameters: {" "=>nil}
2841
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2842
+
2843
+
2844
+ Processing MainController#index (for at 2010-09-22 16:08:15) [GET]
2845
+ Parameters: {" "=>nil}
2846
+ Completed in 5ms (View: 1 | 200 OK [http://:? ]
2847
+
2848
+
2849
+ Processing MainController#index (for at 2010-09-22 16:08:54) [GET]
2850
+ Parameters: {" "=>nil}
2851
+ Completed in 6ms (View: 1 | 200 OK [http://:? ]
2852
+
2853
+
2854
+ Processing MainController#index (for at 2010-09-22 16:14:08) [GET]
2855
+ Parameters: {" "=>nil}
2856
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2857
+
2858
+
2859
+ Processing MainController#index (for at 2010-09-22 16:14:44) [GET]
2860
+ Parameters: {" "=>nil}
2861
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2862
+
2863
+
2864
+ Processing MainController#index (for at 2010-09-22 16:15:13) [GET]
2865
+ Parameters: {" "=>nil}
2866
+ Completed in 5ms (View: 1 | 200 OK [http://:? ]
2867
+
2868
+
2869
+ Processing MainController#index (for at 2010-09-22 16:15:52) [GET]
2870
+ Parameters: {" "=>nil}
2871
+ Completed in 6ms (View: 1 | 200 OK [http://:? ]
2872
+
2873
+
2874
+ Processing MainController#index (for at 2010-09-23 22:43:00) [GET]
2875
+ Parameters: {" "=>nil}
2876
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2877
+
2878
+
2879
+ Processing MainController#index (for at 2010-09-23 22:43:43) [GET]
2880
+ Parameters: {" "=>nil}
2881
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2882
+
2883
+
2884
+ Processing MainController#index (for at 2010-09-23 22:44:15) [GET]
2885
+ Parameters: {" "=>nil}
2886
+ Completed in 8ms (View: 3 | 200 OK [http://:? ]
2887
+
2888
+
2889
+ Processing MainController#index (for at 2010-09-23 22:44:58) [GET]
2890
+ Parameters: {" "=>nil}
2891
+ Completed in 6ms (View: 1 | 200 OK [http://:? ]
2892
+
2893
+
2894
+ Processing MainController#index (for at 2010-10-06 20:29:58) [GET]
2895
+ Parameters: {" "=>nil}
2896
+ Completed in 3ms (View: 0 | 200 OK [http://:? ]
2897
+
2898
+
2899
+ Processing MainController#index (for at 2010-10-06 20:59:06) [GET]
2900
+ Parameters: {" "=>nil}
2901
+ Completed in 2ms (View: 0 | 200 OK [http://:? ]
2902
+
2903
+
2904
+ Processing MainController#index (for at 2010-10-06 21:00:04) [GET]
2905
+ Parameters: {" "=>nil}
2906
+ Completed in 2ms (View: 0 | 200 OK [http://:? ]
2907
+
2908
+
2909
+ Processing MainController#index (for at 2010-10-12 19:58:19) [GET]
2910
+ Parameters: {" "=>nil}
2911
+ Completed in 307ms (View: 0 | 200 OK [http://:? ]
2912
+
2913
+
2914
+ Processing MainController#index (for at 2010-10-12 19:58:58) [GET]
2915
+ Parameters: {" "=>nil}
2916
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2917
+
2918
+
2919
+ Processing MainController#index (for at 2010-10-12 19:59:40) [GET]
2920
+ Parameters: {" "=>nil}
2921
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2922
+
2923
+
2924
+ Processing MainController#index (for at 2010-10-12 20:00:11) [GET]
2925
+ Parameters: {" "=>nil}
2926
+ Completed in 6ms (View: 2 | 200 OK [http://:? ]
2927
+
2928
+
2929
+ Processing MainController#index (for at 2010-10-12 20:00:52) [GET]
2930
+ Parameters: {" "=>nil}
2931
+ Completed in 5ms (View: 1 | 200 OK [http://:? ]
2932
+
2933
+
2934
+ Processing MainController#index (for at 2010-10-12 22:41:13) [GET]
2935
+ Parameters: {" "=>nil}
2936
+ Completed in 4ms (View: 2 | 200 OK [http://:? ]
2937
+
2938
+
2939
+ Processing MainController#index (for at 2010-10-12 22:41:47) [GET]
2940
+ Parameters: {" "=>nil}
2941
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2942
+
2943
+
2944
+ Processing MainController#index (for at 2010-10-12 22:42:16) [GET]
2945
+ Parameters: {" "=>nil}
2946
+ Completed in 5ms (View: 1 | 200 OK [http://:? ]
2947
+
2948
+
2949
+ Processing MainController#index (for at 2010-10-12 22:42:56) [GET]
2950
+ Parameters: {" "=>nil}
2951
+ Completed in 5ms (View: 1 | 200 OK [http://:? ]
2952
+
2953
+
2954
+ Processing MainController#index (for at 2010-10-12 22:52:58) [GET]
2955
+ Parameters: {" "=>nil}
2956
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2957
+
2958
+
2959
+ Processing MainController#index (for at 2010-10-12 22:53:32) [GET]
2960
+ Parameters: {" "=>nil}
2961
+ Completed in 4ms (View: 1 | 200 OK [http://:? ]
2962
+
2963
+
2964
+ Processing MainController#index (for at 2010-10-12 22:54:02) [GET]
2965
+ Parameters: {" "=>nil}
2966
+ Completed in 6ms (View: 1 | 200 OK [http://:? ]
2967
+
2968
+
2969
+ Processing MainController#index (for at 2010-10-12 22:54:41) [GET]
2970
+ Parameters: {" "=>nil}
2971
+ Completed in 5ms (View: 1 | 200 OK [http://:? ]
2972
+
2973
+
2974
+ Processing MainController#index (for at 2010-10-12 22:55:32) [GET]
2975
+ Parameters: {" "=>nil}
2976
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2977
+
2978
+
2979
+ Processing MainController#index (for at 2010-10-12 22:56:06) [GET]
2980
+ Parameters: {" "=>nil}
2981
+ Completed in 3ms (View: 1 | 200 OK [http://:? ]
2982
+
2983
+
2984
+ Processing MainController#index (for at 2010-10-12 22:56:34) [GET]
2985
+ Parameters: {" "=>nil}
2986
+ Completed in 5ms (View: 1 | 200 OK [http://:? ]
2987
+
2988
+
2989
+ Processing MainController#index (for at 2010-10-12 22:57:16) [GET]
2990
+ Parameters: {" "=>nil}
2991
+ Completed in 6ms (View: 1 | 200 OK [http://:? ]
data/test/rails_test.rb CHANGED
@@ -193,6 +193,24 @@ $stdout << (Vanity.playground.connection rescue $!.message)
193
193
  File.unlink "tmp/config/vanity.yml"
194
194
  end
195
195
 
196
+ def test_connection_from_yaml_with_erb
197
+ FileUtils.mkpath "tmp/config"
198
+ ENV["RAILS_ENV"] = "production"
199
+ # Pass storage URL through environment like heroku does
200
+ ENV["REDIS_URL"] = "redis://somehost:6379/15"
201
+ File.open("tmp/config/vanity.yml", "w") do |io|
202
+ io.write <<-YML
203
+ production: <%= ENV['REDIS_URL'] %>
204
+ YML
205
+ end
206
+ assert_equal "redis://somehost:6379/15", load_rails(<<-RB)
207
+ initializer.after_initialize
208
+ $stdout << Vanity.playground.connection
209
+ RB
210
+ ensure
211
+ File.unlink "tmp/config/vanity.yml"
212
+ end
213
+
196
214
  def test_connection_from_redis_yml
197
215
  FileUtils.mkpath "tmp/config"
198
216
  yml = File.open("tmp/config/redis.yml", "w")
@@ -206,20 +224,36 @@ $stdout << Vanity.playground.connection
206
224
  File.unlink yml.path
207
225
  end
208
226
 
209
- def test_collection_true_in_production
227
+ def test_collection_true_in_production_by_default
210
228
  assert_equal "true", load_rails(<<-RB, "production")
211
229
  initializer.after_initialize
212
230
  $stdout << Vanity.playground.collecting?
213
231
  RB
214
232
  end
215
233
 
216
- def test_collection_false_in_development
234
+ def test_collection_false_in_production_when_configured
235
+ assert_equal "false", load_rails(<<-RB, "production")
236
+ Vanity.playground.collecting = false
237
+ initializer.after_initialize
238
+ $stdout << Vanity.playground.collecting?
239
+ RB
240
+ end
241
+
242
+ def test_collection_false_in_development_by_default
217
243
  assert_equal "false", load_rails(<<-RB, "development")
218
244
  initializer.after_initialize
219
245
  $stdout << Vanity.playground.collecting?
220
246
  RB
221
247
  end
222
248
 
249
+ def test_collection_true_in_development_when_configured
250
+ assert_equal "true", load_rails(<<-RB, "development")
251
+ Vanity.playground.collecting = true
252
+ initializer.after_initialize
253
+ $stdout << Vanity.playground.collecting?
254
+ RB
255
+ end
256
+
223
257
  def test_collection_false_after_test!
224
258
  assert_equal "false", load_rails(<<-RB, "production")
225
259
  initializer.after_initialize
data/test/test_helper.rb CHANGED
@@ -45,8 +45,11 @@ class Test::Unit::TestCase
45
45
  # We go destructive on the database at the end of each run, so make sure we
46
46
  # don't use databases you care about. For Redis, we pick database 15
47
47
  # (default is 0).
48
- spec = { "redis"=>"redis://localhost/15", "mongodb"=>"mongo://localhost/vanity-test",
49
- "mock"=>"mock:/" }[adapter]
48
+ spec = {
49
+ "redis"=>"redis://localhost/15",
50
+ "mongodb"=>"mongodb://localhost/vanity-test",
51
+ "mock"=>"mock:/"
52
+ }[adapter]
50
53
  raise "No support yet for #{adapter}" unless spec
51
54
  Vanity.playground = Vanity::Playground.new(:logger=>$logger, :load_path=>"tmp/experiments")
52
55
  Vanity.playground.establish_connection spec
@@ -84,7 +87,7 @@ class Test::Unit::TestCase
84
87
  Vanity.playground.collecting = false
85
88
  Vanity.playground.stubs(:connection).returns(stub(:flushdb=>nil))
86
89
  end
87
-
90
+
88
91
  def teardown
89
92
  Vanity.context = nil
90
93
  FileUtils.rm_rf "tmp"
@@ -101,32 +104,6 @@ end
101
104
 
102
105
  ActiveRecord::Base.logger = $logger
103
106
  ActiveRecord::Base.establish_connection :adapter=>"sqlite3", :database=>File.expand_path("database.sqlite")
104
- # Call this to define aggregate functions not available in SQlite.
105
- class ActiveRecord::Base
106
- def self.aggregates
107
- connection.raw_connection.create_aggregate("minimum", 1) do
108
- step do |func, value|
109
- func[:minimum] = value.to_i unless func[:minimum] && func[:minimum].to_i < value.to_i
110
- end
111
- finalize { |func| func.result = func[:minimum] }
112
- end
113
-
114
- connection.raw_connection.create_aggregate("maximum", 1) do
115
- step do |func, value|
116
- func[:maximum] = value.to_i unless func[:maximum] && func[:maximum].to_i > value.to_i
117
- end
118
- finalize { |func| func.result = func[:maximum] }
119
- end
120
-
121
- connection.raw_connection.create_aggregate("average", 1) do
122
- step do |func, value|
123
- func[:total] = func[:total].to_i + value.to_i
124
- func[:count] = func[:count].to_i + 1
125
- end
126
- finalize { |func| func.result = func[:total].to_i / func[:count].to_i }
127
- end
128
- end
129
- end
130
107
 
131
108
 
132
109
  class Array
@@ -134,7 +111,7 @@ class Array
134
111
  unless method_defined?(:shuffle)
135
112
  def shuffle
136
113
  copy = clone
137
- Array.new(size) { copy.delete_at(Kernel.rand(copy.size)) }
114
+ Array.new(size) { copy.delete_at(Kernel.rand(copy.size)) }
138
115
  end
139
116
  end
140
117
  end
@@ -145,7 +122,7 @@ def context(*args, &block)
145
122
  return super unless (name = args.first) && block
146
123
  parent = Class === self ? self : (defined?(ActiveSupport::TestCase) ? ActiveSupport::TestCase : Test::Unit::TestCase)
147
124
  klass = Class.new(parent) do
148
- def self.test(name, &block)
125
+ def self.test(name, &block)
149
126
  define_method("test_#{name.gsub(/\W/,'_')}", &block) if block
150
127
  end
151
128
  def self.xtest(*args) end
data/vanity.gemspec CHANGED
@@ -1,6 +1,9 @@
1
+ $: << File.dirname(__FILE__) + "/lib"
2
+ require "vanity/version"
3
+
1
4
  Gem::Specification.new do |spec|
2
5
  spec.name = "vanity"
3
- spec.version = "1.4.0"
6
+ spec.version = Vanity::VERSION
4
7
  spec.author = "Assaf Arkin"
5
8
  spec.email = "assaf@labnotes.org"
6
9
  spec.homepage = "http://vanity.labnotes.org"
@@ -8,7 +11,7 @@ Gem::Specification.new do |spec|
8
11
  spec.description = "Mirror, mirror on the wall ..."
9
12
  spec.post_install_message = "To get started run vanity --help"
10
13
 
11
- spec.files = Dir["{bin,lib,vendor,test}/**/*", "CHANGELOG", "MIT-LICENSE", "README.rdoc", "Rakefile", "Gemfile", "vanity.gemspec"]
14
+ spec.files = Dir["{bin,lib,vendor,test}/**/*", "CHANGELOG", "MIT-LICENSE", "README.rdoc", "Rakefile", "Gemfile", "*.gemspec"]
12
15
  spec.executable = "vanity"
13
16
 
14
17
  spec.has_rdoc = true
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vanity
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
5
- prerelease: false
4
+ hash: 31098233
5
+ prerelease: true
6
6
  segments:
7
7
  - 1
8
- - 4
8
+ - 5
9
9
  - 0
10
- version: 1.4.0
10
+ - beta
11
+ version: 1.5.0.beta
11
12
  platform: ruby
12
13
  authors:
13
14
  - Assaf Arkin
@@ -15,7 +16,7 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2010-08-06 00:00:00 -07:00
19
+ date: 2010-10-12 00:00:00 -07:00
19
20
  default_executable:
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
@@ -60,8 +61,9 @@ extra_rdoc_files:
60
61
  files:
61
62
  - bin/vanity
62
63
  - lib/vanity/adapters/abstract_adapter.rb
64
+ - lib/vanity/adapters/active_record_adapter.rb
63
65
  - lib/vanity/adapters/mock_adapter.rb
64
- - lib/vanity/adapters/mongo_adapter.rb
66
+ - lib/vanity/adapters/mongodb_adapter.rb
65
67
  - lib/vanity/adapters/redis_adapter.rb
66
68
  - lib/vanity/backport.rb
67
69
  - lib/vanity/commands/list.rb
@@ -86,6 +88,7 @@ files:
86
88
  - lib/vanity/templates/jquery.min.js
87
89
  - lib/vanity/templates/vanity.css
88
90
  - lib/vanity/templates/vanity.js
91
+ - lib/vanity/version.rb
89
92
  - lib/vanity.rb
90
93
  - test/experiment/ab_test.rb
91
94
  - test/experiment/base_test.rb
@@ -131,7 +134,7 @@ licenses: []
131
134
  post_install_message: To get started run vanity --help
132
135
  rdoc_options:
133
136
  - --title
134
- - Vanity 1.4.0
137
+ - Vanity 1.5.0.beta
135
138
  - --main
136
139
  - README.rdoc
137
140
  - --webcvs
@@ -152,12 +155,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
152
155
  required_rubygems_version: !ruby/object:Gem::Requirement
153
156
  none: false
154
157
  requirements:
155
- - - ">="
158
+ - - ">"
156
159
  - !ruby/object:Gem::Version
157
- hash: 3
160
+ hash: 25
158
161
  segments:
159
- - 0
160
- version: "0"
162
+ - 1
163
+ - 3
164
+ - 1
165
+ version: 1.3.1
161
166
  requirements: []
162
167
 
163
168
  rubyforge_project: