appstats 0.0.1 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm 1.8.7-p248@appstats --create
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in appstats.gemspec
4
+ gemspec
@@ -0,0 +1,96 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ appstats (0.0.4)
5
+ rails
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ ZenTest (4.4.2)
11
+ abstract (1.0.0)
12
+ actionmailer (3.0.3)
13
+ actionpack (= 3.0.3)
14
+ mail (~> 2.2.9)
15
+ actionpack (3.0.3)
16
+ activemodel (= 3.0.3)
17
+ activesupport (= 3.0.3)
18
+ builder (~> 2.1.2)
19
+ erubis (~> 2.6.6)
20
+ i18n (~> 0.4)
21
+ rack (~> 1.2.1)
22
+ rack-mount (~> 0.6.13)
23
+ rack-test (~> 0.5.6)
24
+ tzinfo (~> 0.3.23)
25
+ activemodel (3.0.3)
26
+ activesupport (= 3.0.3)
27
+ builder (~> 2.1.2)
28
+ i18n (~> 0.4)
29
+ activerecord (3.0.3)
30
+ activemodel (= 3.0.3)
31
+ activesupport (= 3.0.3)
32
+ arel (~> 2.0.2)
33
+ tzinfo (~> 0.3.23)
34
+ activeresource (3.0.3)
35
+ activemodel (= 3.0.3)
36
+ activesupport (= 3.0.3)
37
+ activesupport (3.0.3)
38
+ arel (2.0.6)
39
+ builder (2.1.2)
40
+ diff-lcs (1.1.2)
41
+ erubis (2.6.6)
42
+ abstract (>= 1.0.0)
43
+ i18n (0.5.0)
44
+ mail (2.2.14)
45
+ activesupport (>= 2.3.6)
46
+ i18n (>= 0.4.0)
47
+ mime-types (~> 1.16)
48
+ treetop (~> 1.4.8)
49
+ mime-types (1.16)
50
+ mysql (2.8.1)
51
+ polyglot (0.3.1)
52
+ rack (1.2.1)
53
+ rack-mount (0.6.13)
54
+ rack (>= 1.0.0)
55
+ rack-test (0.5.7)
56
+ rack (>= 1.0)
57
+ rails (3.0.3)
58
+ actionmailer (= 3.0.3)
59
+ actionpack (= 3.0.3)
60
+ activerecord (= 3.0.3)
61
+ activeresource (= 3.0.3)
62
+ activesupport (= 3.0.3)
63
+ bundler (~> 1.0)
64
+ railties (= 3.0.3)
65
+ railties (3.0.3)
66
+ actionpack (= 3.0.3)
67
+ activesupport (= 3.0.3)
68
+ rake (>= 0.8.7)
69
+ thor (~> 0.14.4)
70
+ rake (0.8.7)
71
+ rspec (2.4.0)
72
+ rspec-core (~> 2.4.0)
73
+ rspec-expectations (~> 2.4.0)
74
+ rspec-mocks (~> 2.4.0)
75
+ rspec-core (2.4.0)
76
+ rspec-expectations (2.4.0)
77
+ diff-lcs (~> 1.1.2)
78
+ rspec-mocks (2.4.0)
79
+ standalone_migrations (0.3.0)
80
+ activerecord
81
+ rake
82
+ thor (0.14.6)
83
+ treetop (1.4.9)
84
+ polyglot (>= 0.3.1)
85
+ tzinfo (0.3.23)
86
+
87
+ PLATFORMS
88
+ ruby
89
+
90
+ DEPENDENCIES
91
+ ZenTest
92
+ appstats!
93
+ mysql
94
+ rails
95
+ rspec
96
+ standalone_migrations
@@ -2,3 +2,6 @@
2
2
 
3
3
  * 1 major enhancement:
4
4
  * Initial release
5
+ * Followed http://drnicwilliams.com/2006/10/11/generating-new-gems/
6
+ >> rake package
7
+ >> gem push pkg/appstats-0.0.1.gem
data/Rakefile CHANGED
@@ -1,26 +1,21 @@
1
- require 'rubygems'
2
- gem 'hoe', '>= 2.1.0'
3
- require 'hoe'
4
- require 'fileutils'
5
- require './lib/appstats'
6
-
7
- Hoe.plugin :newgem
8
- # Hoe.plugin :website
9
- # Hoe.plugin :cucumberfeatures
10
-
11
- # Generate all the Rake tasks
12
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
13
- $hoe = Hoe.spec 'appstats' do
14
- self.developer 'Andrew Forward', 'aforward@gmail.com'
15
- self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
16
- self.rubyforge_name = self.name # TODO this is default value
17
- # self.extra_deps = [['activesupport','>= 2.0.2']]
18
-
19
- end
20
-
21
- require 'newgem/tasks'
22
- Dir['tasks/**/*.rake'].each { |t| load t }
23
-
24
- # TODO - want other tests/tasks run by default? Add them to the list
25
- # remove_task :default
26
- # task :default => [:spec, :features]
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'tasks/standalone_migrations'
5
+ require 'appstats/tasks'
6
+
7
+ begin
8
+ AppstatsTasks.new
9
+
10
+ MigratorTasks.new do |t|
11
+ t.migrations = "db/migrations"
12
+ t.config = "db/config.yml"
13
+ t.schema = "db/schema.rb"
14
+ t.env = "DB"
15
+ t.default_env = "development"
16
+ t.verbose = true
17
+ t.log_level = Logger::ERROR
18
+ end
19
+ rescue LoadError => e
20
+ puts "gem install standalone_migrations to get db:migrate:* tasks! (Error: #{e})"
21
+ end
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "appstats/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "appstats"
7
+ s.version = Appstats::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Andrew Forward"]
10
+ s.email = ["aforward@gmail.com"]
11
+ s.homepage = "http://github.com/aforward/appstats"
12
+ s.summary = %q{Provide usage statistics about how your application is being used}
13
+ s.description = %q{Provide usage statistics about how your application is being used}
14
+
15
+ s.add_dependency('rails')
16
+
17
+ s.add_development_dependency('rspec')
18
+ s.add_development_dependency('ZenTest')
19
+ s.add_development_dependency('standalone_migrations')
20
+ s.add_development_dependency('mysql')
21
+
22
+ # only on a mac machine
23
+ # s.add_development_dependency('autotest-fsevent')
24
+
25
+
26
+ s.files = `git ls-files`.split("\n")
27
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
28
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
29
+ s.require_paths = ["lib"]
30
+ end
@@ -0,0 +1,2 @@
1
+ #Autotest.add_discovery { "rails" }
2
+ Autotest.add_discovery { "rspec2" }
@@ -0,0 +1,17 @@
1
+ development:
2
+ adapter: mysql
3
+ database: appstats_development
4
+ username: root
5
+ password:
6
+ host: localhost
7
+ encoding: utf8
8
+ cache:
9
+ adapter: memcached
10
+ servers: localhost
11
+ test:
12
+ adapter: mysql
13
+ database: appstats_test
14
+ username: root
15
+ password:
16
+ host: localhost
17
+ encoding: utf8
@@ -0,0 +1,14 @@
1
+ class CreateAppstatsEntries < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :appstats_entries do |t|
4
+ t.string :entry_type
5
+ t.string :name, :null => false
6
+ t.string :description
7
+ t.timestamps
8
+ end
9
+ end
10
+
11
+ def self.down
12
+ drop_table :appstats_entries
13
+ end
14
+ end
@@ -0,0 +1,23 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your
6
+ # database schema. If you need to create the application database on another
7
+ # system, you should be using db:schema:load, not running all the migrations
8
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
10
+ #
11
+ # It's strongly recommended to check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(:version => 20110105221941) do
14
+
15
+ create_table "appstats_entries", :force => true do |t|
16
+ t.string "entry_type"
17
+ t.string "name", :null => false
18
+ t.string "description"
19
+ t.datetime "created_at"
20
+ t.datetime "updated_at"
21
+ end
22
+
23
+ end
@@ -1,6 +1,8 @@
1
- $:.unshift(File.dirname(__FILE__)) unless
2
- $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
1
+ require 'rubygems'
2
+ require 'active_record'
3
+ require "#{File.dirname(__FILE__)}/appstats/appstats_entry"
4
+ require "#{File.dirname(__FILE__)}/appstats/tasks"
3
5
 
4
6
  module Appstats
5
- VERSION = '0.0.1'
6
- end
7
+ # Your code goes here...
8
+ end
@@ -0,0 +1,10 @@
1
+ class AppstatsEntry < ActiveRecord::Base
2
+
3
+ attr_accessible :entry_type, :name, :description
4
+
5
+
6
+ def to_s
7
+ "Entry [type],[name],[description]"
8
+ end
9
+
10
+ end
@@ -0,0 +1,52 @@
1
+ require 'rake'
2
+ require 'rake/tasklib'
3
+ require 'logger'
4
+
5
+ class AppstatsTasks < ::Rake::TaskLib
6
+ attr_accessor :name, :base, :vendor, :config, :schema, :env, :default_env, :verbose, :log_level
7
+ attr_reader :migrations
8
+
9
+ def initialize(name = :appstats)
10
+ @name = name
11
+ base = File.expand_path('.')
12
+ here = File.expand_path(File.dirname(File.dirname(File.dirname((__FILE__)))))
13
+ @base = base
14
+ @vendor = "#{here}/vendor"
15
+ @my_migrations = "#{here}/db/migrations"
16
+ @migrations = "#{base}/db/migrations"
17
+ @config = "#{base}/db/config.yml"
18
+ @schema = "#{base}/db/schema.rb"
19
+ @env = 'DB'
20
+ @default_env = 'development'
21
+ @verbose = true
22
+ @log_level = Logger::ERROR
23
+ yield self if block_given?
24
+ # Add to load_path every "lib/" directory in vendor
25
+ Dir["#{vendor}/**/lib"].each{|p| $LOAD_PATH << p }
26
+ define
27
+ end
28
+
29
+ # def migrations=(*value)
30
+ # @migrations = value.flatten
31
+ # end
32
+
33
+ def define
34
+ namespace :appstats do
35
+
36
+ desc "Install or upgrade"
37
+ task :install do
38
+ puts "#{File.dirname((__FILE__))}"
39
+ unless File.exists?(migrations)
40
+ puts "Creating #{migrations} directory"
41
+ mkdir migrations
42
+ end
43
+ puts "Moving migrations files from #{@my_migrations} into #{migrations}"
44
+ system "cp -R #{@my_migrations}/* #{migrations}"
45
+ end
46
+
47
+ end
48
+ end
49
+
50
+
51
+
52
+ end
@@ -0,0 +1,3 @@
1
+ module Appstats
2
+ VERSION = "0.0.4"
3
+ end
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+
3
+ describe AppstatsEntry do
4
+
5
+ describe "#initialize" do
6
+
7
+ before(:each) do
8
+ @entry = AppstatsEntry.new
9
+ end
10
+
11
+ it "should set entry_type to nil" do
12
+ @entry.entry_type.should == nil
13
+ end
14
+
15
+ it "should set name to nil" do
16
+ @entry.name.should == nil
17
+ end
18
+
19
+ it "should set description to nil" do
20
+ @entry.description.should == nil
21
+ end
22
+
23
+ it "should set on constructor" do
24
+ entry = AppstatsEntry.new(:entry_type => 'a', :name => 'b', :description => 'c')
25
+ entry.entry_type.should == 'a'
26
+ entry.name.should == 'b'
27
+ entry.description.should == 'c'
28
+ end
29
+
30
+ end
31
+
32
+ describe "#to_s" do
33
+
34
+ before(:each) do
35
+ @entry = AppstatsEntry.new
36
+ end
37
+
38
+ it "should run the test" do
39
+ @entry.to_s.should == 'Entry [type],[name],[description]'
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe "appstats" do
4
+
5
+ it "should run the test" do
6
+ 1.should == 1
7
+ end
8
+
9
+ end
@@ -0,0 +1,32 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ require 'rubygems'
3
+ require File.dirname(__FILE__) + '/../lib/appstats'
4
+
5
+ # Requires supporting ruby files with custom matchers and macros, etc,
6
+ # in spec/support/ and its subdirectories.
7
+ # Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
8
+
9
+ RSpec.configure do |config|
10
+
11
+ dbconfig = YAML::load(File.open('db/config.yml'))
12
+ ActiveRecord::Base.establish_connection(dbconfig['test'])
13
+
14
+ # == Mock Framework
15
+ #
16
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
17
+ #
18
+ # config.mock_with :mocha
19
+ # config.mock_with :flexmock
20
+ # config.mock_with :rr
21
+ config.mock_with :rspec
22
+ # config.before(:each) { Machinist.reset_before_test }
23
+
24
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
25
+ # config.fixture_path = "#{::Rails.root}/spec/fixtures"
26
+
27
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
28
+ # examples within a transaction, remove the following line or assign false
29
+ # instead of true.
30
+ # config.use_transactional_fixtures = true
31
+
32
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appstats
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
5
- prerelease: false
4
+ hash: 23
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrew Forward
@@ -19,68 +19,127 @@ date: 2011-01-05 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: rubyforge
22
+ name: rails
23
23
  prerelease: false
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- hash: 7
29
+ hash: 3
30
30
  segments:
31
- - 2
32
31
  - 0
33
- - 4
34
- version: 2.0.4
35
- type: :development
32
+ version: "0"
33
+ type: :runtime
36
34
  version_requirements: *id001
37
35
  - !ruby/object:Gem::Dependency
38
- name: hoe
36
+ name: rspec
39
37
  prerelease: false
40
38
  requirement: &id002 !ruby/object:Gem::Requirement
41
39
  none: false
42
40
  requirements:
43
41
  - - ">="
44
42
  - !ruby/object:Gem::Version
45
- hash: 19
43
+ hash: 3
46
44
  segments:
47
- - 2
48
- - 7
49
45
  - 0
50
- version: 2.7.0
46
+ version: "0"
51
47
  type: :development
52
48
  version_requirements: *id002
53
- description: Eventually this will be used as a place to log actions done within your application, and provide usage statistics about how your application is being used. It will be tailored to our needs, but you may find it useful.
49
+ - !ruby/object:Gem::Dependency
50
+ name: ZenTest
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :development
62
+ version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ name: standalone_migrations
65
+ prerelease: false
66
+ requirement: &id004 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ type: :development
76
+ version_requirements: *id004
77
+ - !ruby/object:Gem::Dependency
78
+ name: mysql
79
+ prerelease: false
80
+ requirement: &id005 !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ hash: 3
86
+ segments:
87
+ - 0
88
+ version: "0"
89
+ type: :development
90
+ version_requirements: *id005
91
+ description: Provide usage statistics about how your application is being used
54
92
  email:
55
93
  - aforward@gmail.com
56
94
  executables: []
57
95
 
58
96
  extensions: []
59
97
 
60
- extra_rdoc_files:
61
- - History.txt
62
- - Manifest.txt
63
- - PostInstall.txt
98
+ extra_rdoc_files: []
99
+
64
100
  files:
101
+ - .gitignore
102
+ - .rvmrc
103
+ - Gemfile
104
+ - Gemfile.lock
65
105
  - History.txt
66
- - Manifest.txt
67
- - PostInstall.txt
68
106
  - README.rdoc
69
107
  - Rakefile
108
+ - appstats.gemspec
109
+ - autotest/discover.rb
110
+ - db/config.yml
111
+ - db/migrations/20110105221941_create_appstats_entries.rb
112
+ - db/schema.rb
70
113
  - lib/appstats.rb
114
+ - lib/appstats/appstats_entry.rb
115
+ - lib/appstats/tasks.rb
116
+ - lib/appstats/version.rb
117
+ - pkg/appstats-0.0.1.gem
118
+ - pkg/appstats-0.0.1.tgz
119
+ - pkg/appstats-0.0.1/History.txt
120
+ - pkg/appstats-0.0.1/Manifest.txt
121
+ - pkg/appstats-0.0.1/PostInstall.txt
122
+ - pkg/appstats-0.0.1/README.rdoc
123
+ - pkg/appstats-0.0.1/Rakefile
124
+ - pkg/appstats-0.0.1/lib/appstats.rb
125
+ - pkg/appstats-0.0.1/script/console
126
+ - pkg/appstats-0.0.1/script/destroy
127
+ - pkg/appstats-0.0.1/script/generate
128
+ - pkg/appstats-0.0.1/test/test_appstats.rb
129
+ - pkg/appstats-0.0.1/test/test_helper.rb
71
130
  - script/console
72
131
  - script/destroy
73
132
  - script/generate
74
- - test/test_appstats.rb
75
- - test/test_helper.rb
133
+ - spec/appstats_entry_spec.rb
134
+ - spec/appstats_spec.rb
135
+ - spec/spec_helper.rb
76
136
  has_rdoc: true
77
137
  homepage: http://github.com/aforward/appstats
78
138
  licenses: []
79
139
 
80
- post_install_message: PostInstall.txt
81
- rdoc_options:
82
- - --main
83
- - README.rdoc
140
+ post_install_message:
141
+ rdoc_options: []
142
+
84
143
  require_paths:
85
144
  - lib
86
145
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -103,11 +162,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
162
  version: "0"
104
163
  requirements: []
105
164
 
106
- rubyforge_project: appstats
107
- rubygems_version: 1.3.7
165
+ rubyforge_project:
166
+ rubygems_version: 1.4.1
108
167
  signing_key:
109
168
  specification_version: 3
110
- summary: Eventually this will be used as a place to log actions done within your application, and provide usage statistics about how your application is being used
169
+ summary: Provide usage statistics about how your application is being used
111
170
  test_files:
112
- - test/test_appstats.rb
113
- - test/test_helper.rb
171
+ - spec/appstats_entry_spec.rb
172
+ - spec/appstats_spec.rb
173
+ - spec/spec_helper.rb
@@ -1,11 +0,0 @@
1
- History.txt
2
- Manifest.txt
3
- PostInstall.txt
4
- README.rdoc
5
- Rakefile
6
- lib/appstats.rb
7
- script/console
8
- script/destroy
9
- script/generate
10
- test/test_appstats.rb
11
- test/test_helper.rb
@@ -1,2 +0,0 @@
1
-
2
- For more information on appstats, see http://appstats.rubyforge.org
@@ -1,11 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- class TestAppstats < Test::Unit::TestCase
4
-
5
- def setup
6
- end
7
-
8
- def test_truth
9
- assert true
10
- end
11
- end
@@ -1,3 +0,0 @@
1
- require 'stringio'
2
- require 'test/unit'
3
- require File.dirname(__FILE__) + '/../lib/appstats'