annotator 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. data/README.rdoc +9 -2
  2. data/lib/annotator.rb +60 -7
  3. data/lib/annotator/version.rb +1 -1
  4. data/test/annotator_test.rb +56 -2
  5. data/test/assets/boo_annotated.rb +8 -0
  6. data/test/assets/foo_annotated.rb +9 -0
  7. data/test/assets/foo_annotated_bad_column.rb +11 -0
  8. data/test/assets/foo_annotated_bad_column_nodoc.rb +11 -0
  9. data/test/assets/foo_annotated_column_fixed.rb +11 -0
  10. data/test/assets/foo_annotated_with_comments.rb +11 -0
  11. data/test/assets/paper_annotated.rb +16 -0
  12. data/test/assets/user_annotated.rb +34 -0
  13. data/test/dummy/app/models/boo.rb +3 -0
  14. data/test/dummy/app/models/nomodel.rb +3 -0
  15. data/test/dummy/app/models/paper.rb +8 -0
  16. data/test/dummy/app/models/user.rb +11 -0
  17. data/test/dummy/db/development.sqlite3 +0 -0
  18. data/test/dummy/db/migrate/20120219112425_create_foos.rb +1 -1
  19. data/test/dummy/db/migrate/20120527020350_devise_create_users.rb +49 -0
  20. data/test/dummy/db/migrate/20120527023350_create_papers.rb +8 -0
  21. data/test/dummy/db/migrate/20120527023417_add_attachment_avatar_to_papers.rb +15 -0
  22. data/test/dummy/db/migrate/20120527025142_create_boos.rb +8 -0
  23. data/test/dummy/db/schema.rb +54 -0
  24. data/test/dummy/log/development.log +73 -0
  25. data/test/dummy/log/test.log +2 -0
  26. data/test/dummy/test/fixtures/boos.yml +11 -0
  27. data/test/dummy/test/fixtures/papers.yml +11 -0
  28. data/test/dummy/test/fixtures/users.yml +11 -0
  29. data/test/dummy/test/unit/boo_test.rb +7 -0
  30. data/test/dummy/test/unit/paper_test.rb +7 -0
  31. data/test/dummy/test/unit/user_test.rb +7 -0
  32. data/test/test_helper.rb +10 -1
  33. metadata +68 -8
@@ -20,7 +20,9 @@ voila!
20
20
 
21
21
  Let's say you have a Foo model:
22
22
 
23
- class Foo < ActiveRecord::Base
23
+ # My Foo model, it's awesome
24
+
25
+ class Foo < ActiveRecord::Base
24
26
 
25
27
  Make sure your working tree is clean (it's suggested tu put annotations in separate commits so you can easily review changes done by annotator before commiting and you can always easily revert them all) and run:
26
28
 
@@ -59,10 +61,15 @@ Of course similar thing happens when you remove column or change it's type.
59
61
  * if you don't want it to update anything, put "Attributes(nodoc):" instead
60
62
  * for some fields like title above you can just skip description including dash sometimes name is just obvious enough
61
63
  * multiline comments are ok
64
+ * generating initial descriptions it understands things like
65
+ ** belongs_to association columns
66
+ ** devise columns
67
+ ** paperclip colums
68
+
69
+ Contributions are very much welcome.
62
70
 
63
71
  == Todos
64
72
 
65
- * tests :)
66
73
  * it could be written a bit cleaner
67
74
  * since name does not have "model" in it, we could possibly use "rake routes" to annotate controller actions, not sure if it's worth it
68
75
 
@@ -7,14 +7,15 @@ module Annotator
7
7
  [filename, klass]
8
8
  end.sort_by {|x| x.last.to_s}
9
9
 
10
- i = 0
10
+
11
11
  models.each do |filename, model|
12
+ next unless model.ancestors.include? ActiveRecord::Base
12
13
  begin
13
14
  file = File.read(filename)
14
15
  lines = file.split("\n")
15
16
  out = ''
16
17
  ia = false # inside attributes block
17
- after_block = false
18
+ after_block = false # we are already after comments block
18
19
  changed = false
19
20
  skip_file = false
20
21
  attrs_arr = []
@@ -60,7 +61,7 @@ module Annotator
60
61
  File.open(filename,'w') { |f| f.write(out) } if out.strip != file.strip && !skip_file
61
62
 
62
63
  rescue Exception => e
63
- puts "FAILURE while trying to update model #{model}:\n #{e.to_str}"
64
+ puts "FAILURE while trying to update model #{model}:\n #{e}"
64
65
  end
65
66
  end
66
67
 
@@ -80,10 +81,7 @@ module Annotator
80
81
  end
81
82
  else
82
83
  puts " A #{model}##{column.name} [#{attrs_str}]"
83
- desc = "TODO: document me"
84
- desc = "primary key" if column.name == 'id'
85
- desc = "creation time" if column.name == 'created_at'
86
- desc = "last update time" if column.name == 'updated_at'
84
+ desc = initial_description model, column
87
85
  arr << [column.name, attrs_str, desc]
88
86
  end
89
87
  end
@@ -99,6 +97,61 @@ module Annotator
99
97
  arr
100
98
  end
101
99
 
100
+ def self.initial_description(model, column)
101
+ case column.name
102
+ when 'id' then return 'primary key'
103
+ when 'created_at' then return 'creation time'
104
+ when 'updated_at' then return 'last update time'
105
+ end
106
+
107
+ # TODO stop writing like it's functional lang and make class for Description ;)
108
+
109
+ # Belongs to association
110
+ model.reflect_on_all_associations.each do |reflect|
111
+ if reflect.foreign_key == column.name && reflect.macro == :belongs_to
112
+ return "belongs to #{reflect.klass}"
113
+ end
114
+ end
115
+
116
+ # Devise column names
117
+ if model.respond_to? :devise_modules
118
+ devise_columns = {
119
+ :reset_password_token => "Devise Recoverable module",
120
+ :reset_password_sent_at => "Devise Recoverable module",
121
+ :remember_created_at => "Devise Rememberable module",
122
+ :sign_in_count => "Devise Trackable module",
123
+ :current_sign_in_at => "Devise Trackable module",
124
+ :last_sign_in_at => "Devise Trackable module",
125
+ :current_sign_in_ip => "Devise Trackable module",
126
+ :last_sign_in_ip => "Devise Trackable module",
127
+ :password_salt => "Devise Encriptable module",
128
+ :confirmation_token => "Devise Confirmable module",
129
+ :confirmed_at => "Devise Confirmable module",
130
+ :confiramtion_sent_at => "Devise Confirmable module",
131
+ :unconfirmed_email => "Devise Confirmable module",
132
+ :failed_attempts => "Devise Lockable module",
133
+ :unlock_token => "Devise Locakble module",
134
+ :locked_at => "Devise Lockable module",
135
+ :authentication_token => "Devise Token authenticable module"
136
+ }
137
+ guess = devise_columns[column.name.to_sym]
138
+ return guess if guess
139
+ end
140
+
141
+ # Paperclip column names
142
+ if model.respond_to? :attachments_definitions
143
+ model.attachments_definitions.keys.each do |att|
144
+ cols = ["#{att}_file_name", "#{att}_content_type", "#{att}_file_size", "#{att}_updated_at"]
145
+ return "Paperclip for #{att}" if cols.include? column.name
146
+ end
147
+ end
148
+
149
+ # let's not add "document me" note for these obvious ones:
150
+ return '' if %w{email name title body}.include? column.name
151
+
152
+ return 'TODO: document me'
153
+ end
154
+
102
155
  def self.column_attrs(c)
103
156
  ret = c.type.to_s
104
157
  ret << ", primary" if c.primary
@@ -1,3 +1,3 @@
1
1
  module Annotator
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -1,7 +1,61 @@
1
1
  require 'test_helper'
2
+ require 'tempfile'
2
3
 
3
4
  class AnnotatorTest < ActiveSupport::TestCase
4
- test "truth" do
5
- assert_kind_of Module, Annotator
5
+ def setup
6
+ @output = execute("cd #{$test_app} && rake annotate")
7
+ end
8
+
9
+ test "annotating foo" do
10
+ assert_equal File.read(asset_file 'foo_annotated.rb' ), File.read(app_file 'foo.rb' )
11
+ end
12
+
13
+ test "leaving existing comments" do
14
+ FileUtils.cp asset_file('foo_annotated_with_comments.rb'), app_file('foo.rb')
15
+ assert system("cd #{$test_app} && rake annotate")
16
+ assert_equal File.read(asset_file 'foo_annotated_with_comments.rb' ), File.read(app_file 'foo.rb' )
17
+ end
18
+
19
+ test "updating column type" do
20
+ FileUtils.cp asset_file('foo_annotated_bad_column.rb'), app_file('foo.rb')
21
+ output = execute("cd #{$test_app} && rake annotate")
22
+ assert_equal File.read(asset_file 'foo_annotated_column_fixed.rb' ), File.read(app_file 'foo.rb' )
23
+ assert output.include?('M Foo#title [octopus -> string]')
24
+ assert output.include?('M Foo#created_at [foobar -> datetime, not null]')
25
+ end
26
+
27
+ test "skipping when nodoc is preesnt" do
28
+ FileUtils.cp asset_file('foo_annotated_bad_column_nodoc.rb'), app_file('foo.rb')
29
+ execute("cd #{$test_app} && rake annotate")
30
+ assert_equal File.read(asset_file 'foo_annotated_bad_column_nodoc.rb' ), File.read(app_file 'foo.rb' )
31
+ end
32
+
33
+ test "annotating devise columns" do
34
+ assert_equal File.read(asset_file 'user_annotated.rb' ), File.read(app_file 'user.rb' )
35
+ end
36
+
37
+ test "annotating paperclip columns" do
38
+ assert_equal File.read(asset_file 'paper_annotated.rb' ), File.read(app_file 'paper.rb' )
39
+ end
40
+
41
+ test "annotating belongs_to associations" do
42
+ assert_equal File.read(asset_file 'boo_annotated.rb' ), File.read(app_file 'boo.rb' )
43
+ end
44
+
45
+ def asset_file(name)
46
+ File.join(File.expand_path("../assets/", __FILE__), name)
47
+ end
48
+
49
+ def app_file(name)
50
+ File.join($test_app,'app','models',name)
51
+ end
52
+
53
+ # Check exit code while grabbing output
54
+ def execute(command)
55
+ tmp = Tempfile.new "output"
56
+ assert system("#{command} > #{tmp.path}")
57
+ output = tmp.read
58
+ tmp.unlink
59
+ output
6
60
  end
7
61
  end
@@ -0,0 +1,8 @@
1
+ # Attributes:
2
+ # * id [integer, primary, not null] - primary key
3
+ # * created_at [datetime, not null] - creation time
4
+ # * foo_id [integer] - belongs to Foo
5
+ # * updated_at [datetime, not null] - last update time
6
+ class Boo < ActiveRecord::Base
7
+ belongs_to :foo
8
+ end
@@ -0,0 +1,9 @@
1
+ # Attributes:
2
+ # * id [integer, primary, not null] - primary key
3
+ # * body [text]
4
+ # * created_at [datetime, not null] - creation time
5
+ # * random_number [integer] - TODO: document me
6
+ # * title [string]
7
+ # * updated_at [datetime, not null] - last update time
8
+ class Foo < ActiveRecord::Base
9
+ end
@@ -0,0 +1,11 @@
1
+ # Foo class is very foo
2
+ #
3
+ # Attributes:
4
+ # * id [integer, primary, not null] - primary key
5
+ # * body [text] - whatever
6
+ # * created_at [foobar] - creation time
7
+ # * random_number [integer] - We still haven't found what this actually means, WTF
8
+ # * title [octopus] - yellow
9
+ # * updated_at [datetime, not null] - last update time
10
+ class Foo < ActiveRecord::Base
11
+ end
@@ -0,0 +1,11 @@
1
+ # Foo class is very foo
2
+ #
3
+ # Attributes(nodoc):
4
+ # * id [integer, primary, not null] - primary key
5
+ # * body [text] - whatever
6
+ # * created_at [foobar] - creation time
7
+ # * random_number [integer] - We still haven't found what this actually means, WTF
8
+ # * title [octopus] - yellow
9
+ # * updated_at [datetime, not null] - last update time
10
+ class Foo < ActiveRecord::Base
11
+ end
@@ -0,0 +1,11 @@
1
+ # Foo class is very foo
2
+ #
3
+ # Attributes:
4
+ # * id [integer, primary, not null] - primary key
5
+ # * body [text] - whatever
6
+ # * created_at [datetime, not null] - creation time
7
+ # * random_number [integer] - We still haven't found what this actually means, WTF
8
+ # * title [string] - yellow
9
+ # * updated_at [datetime, not null] - last update time
10
+ class Foo < ActiveRecord::Base
11
+ end
@@ -0,0 +1,11 @@
1
+ # Foo class is very foo
2
+ #
3
+ # Attributes:
4
+ # * id [integer, primary, not null] - primary key
5
+ # * body [text] - whatever
6
+ # * created_at [datetime, not null] - creation time
7
+ # * random_number [integer] - We still haven't found what this actually means, WTF
8
+ # * title [string]
9
+ # * updated_at [datetime, not null] - last update time
10
+ class Foo < ActiveRecord::Base
11
+ end
@@ -0,0 +1,16 @@
1
+ # Attributes:
2
+ # * id [integer, primary, not null] - primary key
3
+ # * avatar_content_type [string] - Paperclip for avatar
4
+ # * avatar_file_name [string] - Paperclip for avatar
5
+ # * avatar_file_size [integer] - Paperclip for avatar
6
+ # * avatar_updated_at [datetime] - Paperclip for avatar
7
+ # * created_at [datetime, not null] - creation time
8
+ # * updated_at [datetime, not null] - last update time
9
+ class Paper < ActiveRecord::Base
10
+ # has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" }
11
+
12
+ # stub for tests
13
+ def self.attachments_definitions
14
+ {:avatar=>{:styles=>{:medium=>"300x300>", :thumb=>"100x100>"}}}
15
+ end
16
+ end
@@ -0,0 +1,34 @@
1
+ # Attributes:
2
+ # * id [integer, primary, not null] - primary key
3
+ # * authentication_token [string] - Devise Token authenticable module
4
+ # * confirmation_sent_at [datetime] - TODO: document me
5
+ # * confirmation_token [string] - Devise Confirmable module
6
+ # * confirmed_at [datetime] - Devise Confirmable module
7
+ # * created_at [datetime, not null] - creation time
8
+ # * current_sign_in_at [datetime] - Devise Trackable module
9
+ # * current_sign_in_ip [string] - Devise Trackable module
10
+ # * email [string, default=, not null]
11
+ # * encrypted_password [string, default=, not null] - TODO: document me
12
+ # * failed_attempts [integer, default=0] - Devise Lockable module
13
+ # * last_sign_in_at [datetime] - Devise Trackable module
14
+ # * last_sign_in_ip [string] - Devise Trackable module
15
+ # * locked_at [datetime] - Devise Lockable module
16
+ # * password_salt [string] - Devise Encriptable module
17
+ # * remember_created_at [datetime] - Devise Rememberable module
18
+ # * reset_password_sent_at [datetime] - Devise Recoverable module
19
+ # * reset_password_token [string] - Devise Recoverable module
20
+ # * sign_in_count [integer, default=0] - Devise Trackable module
21
+ # * unconfirmed_email [string] - Devise Confirmable module
22
+ # * unlock_token [string] - Devise Locakble module
23
+ # * updated_at [datetime, not null] - last update time
24
+ class User < ActiveRecord::Base
25
+ # Include default devise modules. Others available are:
26
+ # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
27
+ def self.devise_modules
28
+ [:database_authenticatable, :registerable,
29
+ :recoverable, :rememberable, :trackable, :validatable]
30
+ end
31
+
32
+ # Setup accessible (or protected) attributes for your model
33
+ attr_accessible :email, :password, :password_confirmation, :remember_me
34
+ end
@@ -0,0 +1,3 @@
1
+ class Boo < ActiveRecord::Base
2
+ belongs_to :foo
3
+ end
@@ -0,0 +1,3 @@
1
+ class Nomodel
2
+ # Something that's not really a database thingy
3
+ end
@@ -0,0 +1,8 @@
1
+ class Paper < ActiveRecord::Base
2
+ # has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" }
3
+
4
+ # stub for tests
5
+ def self.attachments_definitions
6
+ {:avatar=>{:styles=>{:medium=>"300x300>", :thumb=>"100x100>"}}}
7
+ end
8
+ end
@@ -0,0 +1,11 @@
1
+ class User < ActiveRecord::Base
2
+ # Include default devise modules. Others available are:
3
+ # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
4
+ def self.devise_modules
5
+ [:database_authenticatable, :registerable,
6
+ :recoverable, :rememberable, :trackable, :validatable]
7
+ end
8
+
9
+ # Setup accessible (or protected) attributes for your model
10
+ attr_accessible :email, :password, :password_confirmation, :remember_me
11
+ end
@@ -3,7 +3,7 @@ class CreateFoos < ActiveRecord::Migration
3
3
  create_table :foos do |t|
4
4
  t.text :body
5
5
  t.string :title
6
- t.interger :random_number
6
+ t.integer :random_number
7
7
  t.timestamps
8
8
  end
9
9
  end
@@ -0,0 +1,49 @@
1
+ class DeviseCreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table(:users) do |t|
4
+ ## Database authenticatable
5
+ t.string :email, :null => false, :default => ""
6
+ t.string :encrypted_password, :null => false, :default => ""
7
+
8
+ ## Recoverable
9
+ t.string :reset_password_token
10
+ t.datetime :reset_password_sent_at
11
+
12
+ ## Rememberable
13
+ t.datetime :remember_created_at
14
+
15
+ ## Trackable
16
+ t.integer :sign_in_count, :default => 0
17
+ t.datetime :current_sign_in_at
18
+ t.datetime :last_sign_in_at
19
+ t.string :current_sign_in_ip
20
+ t.string :last_sign_in_ip
21
+
22
+ ## Encryptable
23
+ t.string :password_salt
24
+
25
+ ## Confirmable
26
+ t.string :confirmation_token
27
+ t.datetime :confirmed_at
28
+ t.datetime :confirmation_sent_at
29
+ t.string :unconfirmed_email # Only if using reconfirmable
30
+
31
+ ## Lockable
32
+ t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
33
+ t.string :unlock_token # Only if unlock strategy is :email or :both
34
+ t.datetime :locked_at
35
+
36
+ ## Token authenticatable
37
+ t.string :authentication_token
38
+
39
+
40
+ t.timestamps
41
+ end
42
+
43
+ add_index :users, :email, :unique => true
44
+ add_index :users, :reset_password_token, :unique => true
45
+ add_index :users, :confirmation_token, :unique => true
46
+ add_index :users, :unlock_token, :unique => true
47
+ add_index :users, :authentication_token, :unique => true
48
+ end
49
+ end
@@ -0,0 +1,8 @@
1
+ class CreatePapers < ActiveRecord::Migration
2
+ def change
3
+ create_table :papers do |t|
4
+
5
+ t.timestamps
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,15 @@
1
+ class AddAttachmentAvatarToPapers < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :papers, :avatar_file_name, :string
4
+ add_column :papers, :avatar_content_type, :string
5
+ add_column :papers, :avatar_file_size, :integer
6
+ add_column :papers, :avatar_updated_at, :datetime
7
+ end
8
+
9
+ def self.down
10
+ remove_column :papers, :avatar_file_name
11
+ remove_column :papers, :avatar_content_type
12
+ remove_column :papers, :avatar_file_size
13
+ remove_column :papers, :avatar_updated_at
14
+ end
15
+ end
@@ -0,0 +1,8 @@
1
+ class CreateBoos < ActiveRecord::Migration
2
+ def change
3
+ create_table :boos do |t|
4
+ t.references :foo
5
+ t.timestamps
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,54 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20120527020350) do
15
+
16
+ create_table "foos", :force => true do |t|
17
+ t.text "body"
18
+ t.string "title"
19
+ t.integer "random_number"
20
+ t.datetime "created_at", :null => false
21
+ t.datetime "updated_at", :null => false
22
+ end
23
+
24
+ create_table "users", :force => true do |t|
25
+ t.string "email", :default => "", :null => false
26
+ t.string "encrypted_password", :default => "", :null => false
27
+ t.string "reset_password_token"
28
+ t.datetime "reset_password_sent_at"
29
+ t.datetime "remember_created_at"
30
+ t.integer "sign_in_count", :default => 0
31
+ t.datetime "current_sign_in_at"
32
+ t.datetime "last_sign_in_at"
33
+ t.string "current_sign_in_ip"
34
+ t.string "last_sign_in_ip"
35
+ t.string "password_salt"
36
+ t.string "confirmation_token"
37
+ t.datetime "confirmed_at"
38
+ t.datetime "confirmation_sent_at"
39
+ t.string "unconfirmed_email"
40
+ t.integer "failed_attempts", :default => 0
41
+ t.string "unlock_token"
42
+ t.datetime "locked_at"
43
+ t.string "authentication_token"
44
+ t.datetime "created_at", :null => false
45
+ t.datetime "updated_at", :null => false
46
+ end
47
+
48
+ add_index "users", ["authentication_token"], :name => "index_users_on_authentication_token", :unique => true
49
+ add_index "users", ["confirmation_token"], :name => "index_users_on_confirmation_token", :unique => true
50
+ add_index "users", ["email"], :name => "index_users_on_email", :unique => true
51
+ add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
52
+ add_index "users", ["unlock_token"], :name => "index_users_on_unlock_token", :unique => true
53
+
54
+ end
@@ -0,0 +1,73 @@
1
+  (0.0ms) select sqlite_version(*)
2
+  (14.5ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
3
+  (0.0ms) PRAGMA index_list("schema_migrations")
4
+  (3.3ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
5
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
6
+ Migrating to CreateFoos (20120219112425)
7
+  (0.1ms) begin transaction
8
+  (0.4ms) CREATE TABLE "foos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "body" text, "title" varchar(255), "random_number" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
9
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120219112425')
10
+  (2.8ms) commit transaction
11
+  (0.2ms) select sqlite_version(*)
12
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
13
+  (0.0ms) PRAGMA index_list("foos")
14
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
15
+  (0.2ms) select sqlite_version(*)
16
+  (15.7ms) CREATE TABLE "foos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "body" text, "title" varchar(255), "random_number" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
17
+  (3.6ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
18
+  (0.0ms) PRAGMA index_list("schema_migrations")
19
+  (3.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
20
+  (0.1ms) SELECT version FROM "schema_migrations"
21
+  (4.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20120219112425')
22
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
23
+  (0.1ms) select sqlite_version(*)
24
+  (5.8ms) CREATE TABLE "foos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "body" text, "title" varchar(255), "random_number" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
25
+  (3.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
26
+  (0.0ms) PRAGMA index_list("schema_migrations")
27
+  (3.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
28
+  (0.1ms) SELECT version FROM "schema_migrations"
29
+  (3.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20120219112425')
30
+  (0.0ms) select sqlite_version(*)
31
+  (5.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
32
+  (0.0ms) PRAGMA index_list("schema_migrations")
33
+  (4.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
34
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
35
+ Migrating to CreateFoos (20120219112425)
36
+  (0.0ms) begin transaction
37
+  (0.4ms) CREATE TABLE "foos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "body" text, "title" varchar(255), "random_number" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
38
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120219112425')
39
+  (3.3ms) commit transaction
40
+ Migrating to DeviseCreateUsers (20120527020350)
41
+  (0.0ms) begin transaction
42
+  (0.3ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL, "encrypted_password" varchar(255) DEFAULT '' NOT NULL, "reset_password_token" varchar(255), "reset_password_sent_at" datetime, "remember_created_at" datetime, "sign_in_count" integer DEFAULT 0, "current_sign_in_at" datetime, "last_sign_in_at" datetime, "current_sign_in_ip" varchar(255), "last_sign_in_ip" varchar(255), "password_salt" varchar(255), "confirmation_token" varchar(255), "confirmed_at" datetime, "confirmation_sent_at" datetime, "unconfirmed_email" varchar(255), "failed_attempts" integer DEFAULT 0, "unlock_token" varchar(255), "locked_at" datetime, "authentication_token" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
43
+  (0.0ms) PRAGMA index_list("users")
44
+  (0.1ms) CREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email")
45
+  (0.0ms) PRAGMA index_list("users")
46
+  (0.0ms) PRAGMA index_info('index_users_on_email')
47
+  (0.1ms) CREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token")
48
+  (0.0ms) PRAGMA index_list("users")
49
+  (0.0ms) PRAGMA index_info('index_users_on_reset_password_token')
50
+  (0.0ms) PRAGMA index_info('index_users_on_email')
51
+  (0.1ms) CREATE UNIQUE INDEX "index_users_on_confirmation_token" ON "users" ("confirmation_token")
52
+  (0.0ms) PRAGMA index_list("users")
53
+  (0.0ms) PRAGMA index_info('index_users_on_confirmation_token')
54
+  (0.0ms) PRAGMA index_info('index_users_on_reset_password_token')
55
+  (0.0ms) PRAGMA index_info('index_users_on_email')
56
+  (0.1ms) CREATE UNIQUE INDEX "index_users_on_unlock_token" ON "users" ("unlock_token")
57
+  (0.0ms) PRAGMA index_list("users")
58
+  (0.0ms) PRAGMA index_info('index_users_on_unlock_token')
59
+  (0.0ms) PRAGMA index_info('index_users_on_confirmation_token')
60
+  (0.0ms) PRAGMA index_info('index_users_on_reset_password_token')
61
+  (0.0ms) PRAGMA index_info('index_users_on_email')
62
+  (0.1ms) CREATE UNIQUE INDEX "index_users_on_authentication_token" ON "users" ("authentication_token")
63
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120527020350')
64
+  (3.6ms) commit transaction
65
+  (0.2ms) select sqlite_version(*)
66
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
67
+  (0.0ms) PRAGMA index_list("foos")
68
+  (0.0ms) PRAGMA index_list("users")
69
+  (0.0ms) PRAGMA index_info('index_users_on_authentication_token')
70
+  (0.0ms) PRAGMA index_info('index_users_on_unlock_token')
71
+  (0.0ms) PRAGMA index_info('index_users_on_confirmation_token')
72
+  (0.0ms) PRAGMA index_info('index_users_on_reset_password_token')
73
+  (0.0ms) PRAGMA index_info('index_users_on_email')
@@ -0,0 +1,2 @@
1
+  (0.2ms) begin transaction
2
+  (0.0ms) rollback transaction
@@ -0,0 +1,11 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ # This model initially had no columns defined. If you add columns to the
4
+ # model remove the '{}' from the fixture names and add the columns immediately
5
+ # below each fixture, per the syntax in the comments below
6
+ #
7
+ one: {}
8
+ # column: value
9
+ #
10
+ two: {}
11
+ # column: value
@@ -0,0 +1,11 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ # This model initially had no columns defined. If you add columns to the
4
+ # model remove the '{}' from the fixture names and add the columns immediately
5
+ # below each fixture, per the syntax in the comments below
6
+ #
7
+ one: {}
8
+ # column: value
9
+ #
10
+ two: {}
11
+ # column: value
@@ -0,0 +1,11 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ # This model initially had no columns defined. If you add columns to the
4
+ # model remove the '{}' from the fixture names and add the columns immediately
5
+ # below each fixture, per the syntax in the comments below
6
+ #
7
+ one: {}
8
+ # column: value
9
+ #
10
+ two: {}
11
+ # column: value
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class BooTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class PaperTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class UserTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -1,7 +1,16 @@
1
+ require 'fileutils'
2
+
1
3
  # Configure Rails Environment
2
4
  ENV["RAILS_ENV"] = "test"
3
5
 
4
- require File.expand_path("../dummy/config/environment.rb", __FILE__)
6
+ $test_app = test_app_dir = File.expand_path("../../tmp/dummy", __FILE__)
7
+ FileUtils.rm_rf test_app_dir
8
+ FileUtils.mkdir_p test_app_dir
9
+ FileUtils.cp_r File.expand_path("../dummy//", __FILE__), File.expand_path(test_app_dir+"/../")
10
+ system("cd #{$test_app} && bundle exec rake db:migrate > /dev/null")
11
+
12
+
13
+ require File.expand_path("#{test_app_dir}/config/environment.rb", __FILE__)
5
14
  require "rails/test_help"
6
15
 
7
16
  Rails.backtrace_cleaner.remove_silencers!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: annotator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-02-19 00:00:00.000000000 Z
13
+ date: 2012-05-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &17912340 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,15 @@ dependencies:
22
22
  version: '3.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *17912340
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: '3.0'
26
31
  - !ruby/object:Gem::Dependency
27
32
  name: sqlite3
28
- requirement: &19057700 !ruby/object:Gem::Requirement
33
+ requirement: !ruby/object:Gem::Requirement
29
34
  none: false
30
35
  requirements:
31
36
  - - ! '>='
@@ -33,7 +38,12 @@ dependencies:
33
38
  version: '0'
34
39
  type: :development
35
40
  prerelease: false
36
- version_requirements: *19057700
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
37
47
  description: ''
38
48
  email:
39
49
  - kacper.ciesla@tech-angels.com
@@ -49,6 +59,14 @@ files:
49
59
  - Rakefile
50
60
  - README.rdoc
51
61
  - test/test_helper.rb
62
+ - test/assets/paper_annotated.rb
63
+ - test/assets/foo_annotated_bad_column.rb
64
+ - test/assets/foo_annotated_with_comments.rb
65
+ - test/assets/user_annotated.rb
66
+ - test/assets/foo_annotated_bad_column_nodoc.rb
67
+ - test/assets/boo_annotated.rb
68
+ - test/assets/foo_annotated.rb
69
+ - test/assets/foo_annotated_column_fixed.rb
52
70
  - test/annotator_test.rb
53
71
  - test/dummy/public/500.html
54
72
  - test/dummy/public/favicon.ico
@@ -71,8 +89,13 @@ files:
71
89
  - test/dummy/config/environment.rb
72
90
  - test/dummy/config/database.yml
73
91
  - test/dummy/log/development.log
92
+ - test/dummy/log/test.log
74
93
  - test/dummy/app/helpers/application_helper.rb
94
+ - test/dummy/app/models/boo.rb
95
+ - test/dummy/app/models/paper.rb
96
+ - test/dummy/app/models/user.rb
75
97
  - test/dummy/app/models/foo.rb
98
+ - test/dummy/app/models/nomodel.rb
76
99
  - test/dummy/app/views/layouts/application.html.erb
77
100
  - test/dummy/app/assets/javascripts/application.js
78
101
  - test/dummy/app/assets/stylesheets/application.css
@@ -80,10 +103,22 @@ files:
80
103
  - test/dummy/config.ru
81
104
  - test/dummy/script/rails
82
105
  - test/dummy/test/unit/foo_test.rb
106
+ - test/dummy/test/unit/user_test.rb
107
+ - test/dummy/test/unit/paper_test.rb
108
+ - test/dummy/test/unit/boo_test.rb
109
+ - test/dummy/test/fixtures/papers.yml
110
+ - test/dummy/test/fixtures/users.yml
83
111
  - test/dummy/test/fixtures/foos.yml
112
+ - test/dummy/test/fixtures/boos.yml
84
113
  - test/dummy/README.rdoc
114
+ - test/dummy/db/schema.rb
115
+ - test/dummy/db/migrate/20120527020350_devise_create_users.rb
116
+ - test/dummy/db/migrate/20120527025142_create_boos.rb
117
+ - test/dummy/db/migrate/20120527023350_create_papers.rb
118
+ - test/dummy/db/migrate/20120527023417_add_attachment_avatar_to_papers.rb
85
119
  - test/dummy/db/migrate/20120219112425_create_foos.rb
86
- homepage: ''
120
+ - test/dummy/db/development.sqlite3
121
+ homepage: https://github.com/tech-angels/annotator
87
122
  licenses: []
88
123
  post_install_message:
89
124
  rdoc_options: []
@@ -103,12 +138,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
138
  version: '0'
104
139
  requirements: []
105
140
  rubyforge_project:
106
- rubygems_version: 1.8.12
141
+ rubygems_version: 1.8.24
107
142
  signing_key:
108
143
  specification_version: 3
109
144
  summary: Annotate your models and keep your comments about fields.
110
145
  test_files:
111
146
  - test/test_helper.rb
147
+ - test/assets/paper_annotated.rb
148
+ - test/assets/foo_annotated_bad_column.rb
149
+ - test/assets/foo_annotated_with_comments.rb
150
+ - test/assets/user_annotated.rb
151
+ - test/assets/foo_annotated_bad_column_nodoc.rb
152
+ - test/assets/boo_annotated.rb
153
+ - test/assets/foo_annotated.rb
154
+ - test/assets/foo_annotated_column_fixed.rb
112
155
  - test/annotator_test.rb
113
156
  - test/dummy/public/500.html
114
157
  - test/dummy/public/favicon.ico
@@ -131,8 +174,13 @@ test_files:
131
174
  - test/dummy/config/environment.rb
132
175
  - test/dummy/config/database.yml
133
176
  - test/dummy/log/development.log
177
+ - test/dummy/log/test.log
134
178
  - test/dummy/app/helpers/application_helper.rb
179
+ - test/dummy/app/models/boo.rb
180
+ - test/dummy/app/models/paper.rb
181
+ - test/dummy/app/models/user.rb
135
182
  - test/dummy/app/models/foo.rb
183
+ - test/dummy/app/models/nomodel.rb
136
184
  - test/dummy/app/views/layouts/application.html.erb
137
185
  - test/dummy/app/assets/javascripts/application.js
138
186
  - test/dummy/app/assets/stylesheets/application.css
@@ -140,6 +188,18 @@ test_files:
140
188
  - test/dummy/config.ru
141
189
  - test/dummy/script/rails
142
190
  - test/dummy/test/unit/foo_test.rb
191
+ - test/dummy/test/unit/user_test.rb
192
+ - test/dummy/test/unit/paper_test.rb
193
+ - test/dummy/test/unit/boo_test.rb
194
+ - test/dummy/test/fixtures/papers.yml
195
+ - test/dummy/test/fixtures/users.yml
143
196
  - test/dummy/test/fixtures/foos.yml
197
+ - test/dummy/test/fixtures/boos.yml
144
198
  - test/dummy/README.rdoc
199
+ - test/dummy/db/schema.rb
200
+ - test/dummy/db/migrate/20120527020350_devise_create_users.rb
201
+ - test/dummy/db/migrate/20120527025142_create_boos.rb
202
+ - test/dummy/db/migrate/20120527023350_create_papers.rb
203
+ - test/dummy/db/migrate/20120527023417_add_attachment_avatar_to_papers.rb
145
204
  - test/dummy/db/migrate/20120219112425_create_foos.rb
205
+ - test/dummy/db/development.sqlite3