import 0.0.1 → 0.0.2

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.
Files changed (65) hide show
  1. data/.gitignore +7 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +14 -0
  4. data/Gemfile.lock +160 -0
  5. data/Guardfile +21 -0
  6. data/README.rdoc +18 -2
  7. data/Rakefile +7 -10
  8. data/import.gemspec +33 -0
  9. data/lib/generators/import/install/install_generator.rb +32 -0
  10. data/lib/generators/import/install/templates/migrations/1_create_imports.rb +27 -0
  11. data/lib/import.rb +4 -0
  12. data/lib/import/no_relation.rb +42 -0
  13. data/lib/import/resource.rb +195 -0
  14. data/lib/import/version.rb +1 -1
  15. data/script/rails +4 -0
  16. data/spec/dummy/Gemfile +17 -0
  17. data/spec/dummy/Gemfile.lock +163 -0
  18. data/{test → spec}/dummy/Rakefile +0 -0
  19. data/{test → spec}/dummy/app/assets/javascripts/application.js +0 -2
  20. data/{test → spec}/dummy/app/assets/stylesheets/application.css +0 -0
  21. data/{test → spec}/dummy/app/controllers/application_controller.rb +0 -0
  22. data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
  23. data/{test/dummy/public/favicon.ico → spec/dummy/app/mailers/.gitkeep} +0 -0
  24. data/spec/dummy/app/models/.gitkeep +0 -0
  25. data/spec/dummy/app/models/importer/music/artist.rb +2 -0
  26. data/spec/dummy/app/models/music/artist.rb +20 -0
  27. data/{test → spec}/dummy/app/views/layouts/application.html.erb +0 -0
  28. data/{test → spec}/dummy/config.ru +0 -0
  29. data/{test → spec}/dummy/config/application.rb +10 -1
  30. data/{test → spec}/dummy/config/boot.rb +0 -0
  31. data/spec/dummy/config/database.example.yml +42 -0
  32. data/spec/dummy/config/database.yml +42 -0
  33. data/{test → spec}/dummy/config/environment.rb +0 -0
  34. data/{test → spec}/dummy/config/environments/development.rb +0 -0
  35. data/{test → spec}/dummy/config/environments/production.rb +0 -0
  36. data/{test → spec}/dummy/config/environments/test.rb +0 -0
  37. data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
  38. data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
  39. data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -0
  40. data/{test → spec}/dummy/config/initializers/secret_token.rb +1 -1
  41. data/{test → spec}/dummy/config/initializers/session_store.rb +0 -0
  42. data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +0 -0
  43. data/{test → spec}/dummy/config/locales/en.yml +0 -0
  44. data/spec/dummy/config/routes.rb +2 -0
  45. data/spec/dummy/db/migrate/20110925192802_create_imports.rb +27 -0
  46. data/spec/dummy/db/migrate/20110925204213_create_music_artists.rb +15 -0
  47. data/spec/dummy/db/schema.rb +44 -0
  48. data/spec/dummy/db/schema.txt +20 -0
  49. data/spec/dummy/lib/assets/.gitkeep +0 -0
  50. data/spec/dummy/log/.gitkeep +0 -0
  51. data/spec/dummy/log/development.log +263 -0
  52. data/spec/dummy/log/test.log +38 -0
  53. data/{test → spec}/dummy/public/404.html +0 -0
  54. data/{test → spec}/dummy/public/422.html +0 -0
  55. data/{test → spec}/dummy/public/500.html +0 -0
  56. data/spec/dummy/public/favicon.ico +0 -0
  57. data/{test → spec}/dummy/script/rails +0 -0
  58. data/spec/dummy/tmp/pids/server.pid +1 -0
  59. data/spec/models/no_relation_spec.rb +13 -0
  60. data/spec/spec_helper.rb +31 -0
  61. metadata +170 -72
  62. data/test/dummy/config/database.yml +0 -25
  63. data/test/dummy/config/routes.rb +0 -58
  64. data/test/import_test.rb +0 -7
  65. data/test/test_helper.rb +0 -10
@@ -1,3 +1,3 @@
1
1
  module Import
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ load File.expand_path('../../spec/dummy/script/rails', __FILE__)
@@ -0,0 +1,17 @@
1
+ gem "rails", "~> 3.1.0"
2
+ gem "import", :path => '../../../import'
3
+
4
+ #gem "activerecord", ">= 3.0.2"
5
+ gem "valium"
6
+ gem "state_machine"
7
+ gem "activerecord-import"
8
+
9
+ group :development, :test do
10
+ gem "rspec", "~> 2.6.0"
11
+ gem "mysql2"
12
+ gem "rspec-rails"
13
+ gem "capybara"
14
+ gem "factory_girl_rails"
15
+ gem "guard-rspec"
16
+ gem "sdoc"
17
+ end
@@ -0,0 +1,163 @@
1
+ PATH
2
+ remote: ../../../import
3
+ specs:
4
+ import (0.0.1)
5
+ activerecord-import
6
+ rails (~> 3.1.0)
7
+ state_machine
8
+ valium
9
+
10
+ GEM
11
+ specs:
12
+ actionmailer (3.1.0)
13
+ actionpack (= 3.1.0)
14
+ mail (~> 2.3.0)
15
+ actionpack (3.1.0)
16
+ activemodel (= 3.1.0)
17
+ activesupport (= 3.1.0)
18
+ builder (~> 3.0.0)
19
+ erubis (~> 2.7.0)
20
+ i18n (~> 0.6)
21
+ rack (~> 1.3.2)
22
+ rack-cache (~> 1.0.3)
23
+ rack-mount (~> 0.8.2)
24
+ rack-test (~> 0.6.1)
25
+ sprockets (~> 2.0.0)
26
+ activemodel (3.1.0)
27
+ activesupport (= 3.1.0)
28
+ bcrypt-ruby (~> 3.0.0)
29
+ builder (~> 3.0.0)
30
+ i18n (~> 0.6)
31
+ activerecord (3.1.0)
32
+ activemodel (= 3.1.0)
33
+ activesupport (= 3.1.0)
34
+ arel (~> 2.2.1)
35
+ tzinfo (~> 0.3.29)
36
+ activerecord-import (0.2.8)
37
+ activerecord (~> 3.0pre)
38
+ activerecord (~> 3.0pre)
39
+ activeresource (3.1.0)
40
+ activemodel (= 3.1.0)
41
+ activesupport (= 3.1.0)
42
+ activesupport (3.1.0)
43
+ multi_json (~> 1.0)
44
+ arel (2.2.1)
45
+ bcrypt-ruby (3.0.1)
46
+ builder (3.0.0)
47
+ capybara (1.1.1)
48
+ mime-types (>= 1.16)
49
+ nokogiri (>= 1.3.3)
50
+ rack (>= 1.0.0)
51
+ rack-test (>= 0.5.4)
52
+ selenium-webdriver (~> 2.0)
53
+ xpath (~> 0.1.4)
54
+ childprocess (0.2.2)
55
+ ffi (~> 1.0.6)
56
+ diff-lcs (1.1.3)
57
+ erubis (2.7.0)
58
+ factory_girl (2.1.2)
59
+ activesupport
60
+ factory_girl_rails (1.2.0)
61
+ factory_girl (~> 2.1.0)
62
+ railties (>= 3.0.0)
63
+ ffi (1.0.9)
64
+ guard (0.7.0)
65
+ thor (~> 0.14.6)
66
+ guard-rspec (0.4.5)
67
+ guard (>= 0.4.0)
68
+ hike (1.2.1)
69
+ i18n (0.6.0)
70
+ json (1.6.1)
71
+ json_pure (1.6.1)
72
+ mail (2.3.0)
73
+ i18n (>= 0.4.0)
74
+ mime-types (~> 1.16)
75
+ treetop (~> 1.4.8)
76
+ mime-types (1.16)
77
+ multi_json (1.0.3)
78
+ mysql2 (0.3.7)
79
+ nokogiri (1.5.0)
80
+ polyglot (0.3.2)
81
+ rack (1.3.3)
82
+ rack-cache (1.0.3)
83
+ rack (>= 0.4)
84
+ rack-mount (0.8.3)
85
+ rack (>= 1.0.0)
86
+ rack-ssl (1.3.2)
87
+ rack
88
+ rack-test (0.6.1)
89
+ rack (>= 1.0)
90
+ rails (3.1.0)
91
+ actionmailer (= 3.1.0)
92
+ actionpack (= 3.1.0)
93
+ activerecord (= 3.1.0)
94
+ activeresource (= 3.1.0)
95
+ activesupport (= 3.1.0)
96
+ bundler (~> 1.0)
97
+ railties (= 3.1.0)
98
+ railties (3.1.0)
99
+ actionpack (= 3.1.0)
100
+ activesupport (= 3.1.0)
101
+ rack-ssl (~> 1.3.2)
102
+ rake (>= 0.8.7)
103
+ rdoc (~> 3.4)
104
+ thor (~> 0.14.6)
105
+ rake (0.9.2)
106
+ rdoc (3.9.4)
107
+ rspec (2.6.0)
108
+ rspec-core (~> 2.6.0)
109
+ rspec-expectations (~> 2.6.0)
110
+ rspec-mocks (~> 2.6.0)
111
+ rspec-core (2.6.4)
112
+ rspec-expectations (2.6.0)
113
+ diff-lcs (~> 1.1.2)
114
+ rspec-mocks (2.6.0)
115
+ rspec-rails (2.6.1)
116
+ actionpack (~> 3.0)
117
+ activesupport (~> 3.0)
118
+ railties (~> 3.0)
119
+ rspec (~> 2.6.0)
120
+ rubyzip (0.9.4)
121
+ sanitize (2.0.3)
122
+ nokogiri (< 1.6, >= 1.4.4)
123
+ sdoc (0.3.11)
124
+ json (>= 1.1.3)
125
+ rdoc (~> 3)
126
+ sanitize (~> 2)
127
+ selenium-webdriver (2.7.0)
128
+ childprocess (>= 0.2.1)
129
+ ffi (>= 1.0.7)
130
+ json_pure
131
+ rubyzip
132
+ sprockets (2.0.0)
133
+ hike (~> 1.2)
134
+ rack (~> 1.0)
135
+ tilt (!= 1.3.0, ~> 1.1)
136
+ state_machine (1.0.2)
137
+ thor (0.14.6)
138
+ tilt (1.3.3)
139
+ treetop (1.4.10)
140
+ polyglot
141
+ polyglot (>= 0.3.1)
142
+ tzinfo (0.3.29)
143
+ valium (0.4.0)
144
+ activerecord (>= 3.0.2)
145
+ xpath (0.1.4)
146
+ nokogiri (~> 1.3)
147
+
148
+ PLATFORMS
149
+ ruby
150
+
151
+ DEPENDENCIES
152
+ activerecord-import
153
+ capybara
154
+ factory_girl_rails
155
+ guard-rspec
156
+ import!
157
+ mysql2
158
+ rails (~> 3.1.0)
159
+ rspec (~> 2.6.0)
160
+ rspec-rails
161
+ sdoc
162
+ state_machine
163
+ valium
File without changes
@@ -4,6 +4,4 @@
4
4
  // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
5
  // the compiled file.
6
6
  //
7
- //= require jquery
8
- //= require jquery_ujs
9
7
  //= require_tree .
File without changes
@@ -0,0 +1,2 @@
1
+ class Importer::Music::Artist < Import::NoRelation
2
+ end
@@ -0,0 +1,20 @@
1
+ class Music::Artist < ActiveRecord::Base
2
+ set_table_name 'music_artists'
3
+
4
+ validates :name, :presence => true
5
+ validates_uniqueness_of :name, :case_sensitive => false
6
+
7
+ attr_accessible :name, :tag_list, :author_id
8
+
9
+ # TODO: Move to Import::NoRelation
10
+ def self.find_existing_entries(criteria, values)
11
+ class_eval <<-EOV
12
+ find_by_sql(
13
+ [
14
+ "SELECT music_artists.id AS id, music_artists.name AS name FROM music_artists WHERE #{criteria}",
15
+ "#{values.join('", "')}"
16
+ ]
17
+ ).map{|a| [a.id, a.name]}
18
+ EOV
19
+ end
20
+ end
File without changes
@@ -1,6 +1,15 @@
1
1
  require File.expand_path('../boot', __FILE__)
2
2
 
3
- require 'rails/all'
3
+ # Pick the frameworks you want:
4
+ require "active_record/railtie"
5
+ require 'active_record'
6
+ require 'activerecord-import'
7
+ require "action_controller/railtie"
8
+ require "action_mailer/railtie"
9
+ require "active_resource/railtie"
10
+ require "sprockets/railtie"
11
+
12
+ # require "rails/test_unit/railtie"
4
13
 
5
14
  Bundler.require
6
15
  require "import"
File without changes
@@ -0,0 +1,42 @@
1
+ # MySQL. Versions 4.1 and 5.0 are recommended.
2
+ #
3
+ # Install the MYSQL driver
4
+ # gem install mysql2
5
+ #
6
+ # Ensure the MySQL gem is defined in your Gemfile
7
+ # gem 'mysql2'
8
+ #
9
+ # And be sure to use new-style password hashing:
10
+ # http://dev.mysql.com/doc/refman/5.0/en/old-client.html
11
+ development:
12
+ adapter: mysql2
13
+ encoding: utf8
14
+ reconnect: false
15
+ database: dummy_import_development
16
+ pool: 5
17
+ username: root
18
+ password:
19
+ socket: /var/run/mysqld/mysqld.sock
20
+
21
+ # Warning: The database defined as "test" will be erased and
22
+ # re-generated from your development database when you run "rake".
23
+ # Do not set this db to the same as development or production.
24
+ test:
25
+ adapter: mysql2
26
+ encoding: utf8
27
+ reconnect: false
28
+ database: dummy_import_test
29
+ pool: 5
30
+ username: root
31
+ password:
32
+ socket: /var/run/mysqld/mysqld.sock
33
+
34
+ production:
35
+ adapter: mysql2
36
+ encoding: utf8
37
+ reconnect: false
38
+ database: dummy_import_production
39
+ pool: 5
40
+ username: root
41
+ password:
42
+ socket: /var/run/mysqld/mysqld.sock
@@ -0,0 +1,42 @@
1
+ # MySQL. Versions 4.1 and 5.0 are recommended.
2
+ #
3
+ # Install the MYSQL driver
4
+ # gem install mysql2
5
+ #
6
+ # Ensure the MySQL gem is defined in your Gemfile
7
+ # gem 'mysql2'
8
+ #
9
+ # And be sure to use new-style password hashing:
10
+ # http://dev.mysql.com/doc/refman/5.0/en/old-client.html
11
+ development:
12
+ adapter: mysql2
13
+ encoding: utf8
14
+ reconnect: false
15
+ database: dummy_import_development
16
+ pool: 5
17
+ username: root
18
+ password: zero2005
19
+ socket: /var/run/mysqld/mysqld.sock
20
+
21
+ # Warning: The database defined as "test" will be erased and
22
+ # re-generated from your development database when you run "rake".
23
+ # Do not set this db to the same as development or production.
24
+ test:
25
+ adapter: mysql2
26
+ encoding: utf8
27
+ reconnect: false
28
+ database: dummy_import_test
29
+ pool: 5
30
+ username: root
31
+ password: zero2005
32
+ socket: /var/run/mysqld/mysqld.sock
33
+
34
+ production:
35
+ adapter: mysql2
36
+ encoding: utf8
37
+ reconnect: false
38
+ database: dummy_import_production
39
+ pool: 5
40
+ username: root
41
+ password: zero2005
42
+ socket: /var/run/mysqld/mysqld.sock
@@ -4,4 +4,4 @@
4
4
  # If you change this key, all old signed cookies will become invalid!
5
5
  # Make sure the secret is at least 30 characters and all random,
6
6
  # no regular words or you'll be exposed to dictionary attacks.
7
- Dummy::Application.config.secret_token = 'e0dd255d85967e984ab998341384bdca335f04851cd915470760488e5357984229699580968424f0ae2494496718180ee19d83c80116036a3b2d99dfe03c9be9'
7
+ Dummy::Application.config.secret_token = '2af5f1bbb621295850b06a0c2b4e03864f26d6af824c80a40619b3d751f030098122d909e627684447de0cb1c58c8ed6524f1181f2c7b2d3882f019c147114d8'
@@ -0,0 +1,2 @@
1
+ Dummy::Application.routes.draw do
2
+ end
@@ -0,0 +1,27 @@
1
+ class CreateImports < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :imports do |t|
4
+ t.string :type
5
+ t.text :input
6
+ t.text :parameters
7
+ t.string :email
8
+ t.integer :author_id
9
+ t.string :parent_type
10
+ t.integer :parent_id
11
+ t.text :exception
12
+ t.string :state
13
+ t.timestamps
14
+ end
15
+
16
+ change_table :imports do |t|
17
+ t.index :type
18
+ t.index :author_id
19
+ t.index [:parent_type, :parent_id]
20
+ t.index :state
21
+ end
22
+ end
23
+
24
+ def self.down
25
+ drop_table :imports
26
+ end
27
+ end
@@ -0,0 +1,15 @@
1
+ class CreateMusicArtists < ActiveRecord::Migration
2
+ def up
3
+ create_table :music_artists do |t|
4
+ t.string :name
5
+ t.text :tag_list
6
+ t.integer :author_id
7
+ t.string :state
8
+ t.timestamps
9
+ end
10
+ end
11
+
12
+ def down
13
+ drop_table :music_artists
14
+ end
15
+ end
@@ -0,0 +1,44 @@
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 => 20110925204213) do
15
+
16
+ create_table "imports", :force => true do |t|
17
+ t.string "type"
18
+ t.text "input"
19
+ t.text "parameters"
20
+ t.string "email"
21
+ t.integer "author_id"
22
+ t.string "parent_type"
23
+ t.integer "parent_id"
24
+ t.text "exception"
25
+ t.string "state"
26
+ t.datetime "created_at"
27
+ t.datetime "updated_at"
28
+ end
29
+
30
+ add_index "imports", ["author_id"], :name => "index_imports_on_author_id"
31
+ add_index "imports", ["parent_type", "parent_id"], :name => "index_imports_on_parent_type_and_parent_id"
32
+ add_index "imports", ["state"], :name => "index_imports_on_state"
33
+ add_index "imports", ["type"], :name => "index_imports_on_type"
34
+
35
+ create_table "music_artists", :force => true do |t|
36
+ t.string "name"
37
+ t.text "tag_list"
38
+ t.integer "author_id"
39
+ t.string "state"
40
+ t.datetime "created_at"
41
+ t.datetime "updated_at"
42
+ end
43
+
44
+ end