beso 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc ADDED
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
+ # Only full ruby name is supported here, for short names use:
8
+ # echo "rvm use 1.9.2" > .rvmrc
9
+ environment_id="ruby-1.9.2-p318@beso"
10
+
11
+ # Uncomment the following lines if you want to verify rvm version per project
12
+ # rvmrc_rvm_version="1.10.3" # 1.10.1 seams as a safe start
13
+ # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
+ # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
+ # return 1
16
+ # }
17
+
18
+ # First we attempt to load the desired environment directly from the environment
19
+ # file. This is very fast and efficient compared to running through the entire
20
+ # CLI and selector. If you want feedback on which environment was used then
21
+ # insert the word 'use' after --create as this triggers verbose mode.
22
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
+ then
25
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
+ [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
27
+ \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
28
+ else
29
+ # If the environment file has not yet been created, use the RVM CLI to select.
30
+ rvm --create "$environment_id" || {
31
+ echo "Failed to create RVM environment '${environment_id}'."
32
+ return 1
33
+ }
34
+ fi
35
+
36
+ # If you use bundler, this might be useful to you:
37
+ # if [[ -s Gemfile ]] && {
38
+ # ! builtin command -v bundle >/dev/null ||
39
+ # builtin command -v bundle | grep $rvm_path/bin/bundle >/dev/null
40
+ # }
41
+ # then
42
+ # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
43
+ # gem install bundler
44
+ # fi
45
+ # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
46
+ # then
47
+ # bundle install | grep -vE '^Using|Your bundle is complete'
48
+ # fi
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Sync your historical events to KISSmetrics via CSV.
4
4
 
5
+ http://support.kissmetrics.com/integrations/csv-import/recurring-import
6
+
5
7
  ## Installation
6
8
 
7
9
  Add this line to your application's Gemfile:
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/jeremyruppel/Git/beso
3
3
  specs:
4
- beso (0.0.1)
4
+ beso (0.2.0)
5
5
  fastercsv (>= 1.5.4)
6
6
  fog (>= 1.3.1)
7
7
  rails (>= 3.0.10)
data/lib/beso/job.rb CHANGED
@@ -2,8 +2,9 @@ module Beso
2
2
  class Job
3
3
  def initialize( event, options )
4
4
  @event = event.to_sym
5
- @table = options.delete :table
6
- @since = options.delete :since
5
+ @title = options.delete( :event ) || @event.to_s.titleize
6
+ @table = options.delete( :table )
7
+ @since = options.delete( :since )
7
8
  @props = { }
8
9
  @extra = options
9
10
  end
@@ -64,7 +65,7 @@ module Beso
64
65
  [ ].tap do |row|
65
66
  row << block_or_value( @identity, model )
66
67
  row << model.send( @timestamp ).to_i
67
- row << event_title
68
+ row << @title
68
69
  end
69
70
  end
70
71
 
@@ -72,10 +73,6 @@ module Beso
72
73
  @props.values.map { |value| block_or_value( value, model ) }
73
74
  end
74
75
 
75
- def event_title
76
- @event.to_s.titleize
77
- end
78
-
79
76
  def model_class
80
77
  @table.to_s.classify.constantize
81
78
  end
data/lib/beso/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Beso
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -253,6 +253,23 @@ Identity,Timestamp,Event
253
253
  end
254
254
  end
255
255
 
256
+ describe 'custom event names' do
257
+ let!( :foo ){ User.create :name => 'Foo' }
258
+
259
+ subject { Beso::Job.new :message_sent, :table => :users, :event => 'Messages Sent Action' }
260
+
261
+ before do
262
+ subject.identity :id
263
+ subject.timestamp :created_at
264
+ end
265
+
266
+ its( :to_csv ){ should eq( <<-EOS
267
+ Identity,Timestamp,Event
268
+ #{foo.id},#{foo.updated_at.to_i},Messages Sent Action
269
+ EOS
270
+ ) }
271
+ end
272
+
256
273
  describe '#last_timestamp' do
257
274
  let!( :foo ){ User.create :name => 'Foo', :created_at => 100, :updated_at => 301 }
258
275
  let!( :bar ){ User.create :name => 'Bar', :created_at => 200, :updated_at => 200 }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -115,6 +115,7 @@ extensions: []
115
115
  extra_rdoc_files: []
116
116
  files:
117
117
  - .gitignore
118
+ - .rvmrc
118
119
  - Appraisals
119
120
  - Gemfile
120
121
  - LICENSE