magerecord 0.1.0

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.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+ gem 'activerecord', '>= 4.0.4'
6
+ gem 'mysql2', '>= 0.3.1'
7
+
8
+
9
+ # Add dependencies to develop your gem here.
10
+ # Include everything needed to run rake, tests, features, etc.
11
+ group :development do
12
+ gem "shoulda", ">= 0"
13
+ gem "rdoc", "~> 3.12"
14
+ gem "bundler", "~> 1.0"
15
+ gem "jeweler", "~> 2.0.1"
16
+ gem "simplecov", ">= 0"
17
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,95 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activemodel (4.0.4)
5
+ activesupport (= 4.0.4)
6
+ builder (~> 3.1.0)
7
+ activerecord (4.0.4)
8
+ activemodel (= 4.0.4)
9
+ activerecord-deprecated_finders (~> 1.0.2)
10
+ activesupport (= 4.0.4)
11
+ arel (~> 4.0.0)
12
+ activerecord-deprecated_finders (1.0.3)
13
+ activesupport (4.0.4)
14
+ i18n (~> 0.6, >= 0.6.9)
15
+ minitest (~> 4.2)
16
+ multi_json (~> 1.3)
17
+ thread_safe (~> 0.1)
18
+ tzinfo (~> 0.3.37)
19
+ addressable (2.3.6)
20
+ arel (4.0.2)
21
+ atomic (1.1.16)
22
+ builder (3.1.4)
23
+ descendants_tracker (0.0.4)
24
+ thread_safe (~> 0.3, >= 0.3.1)
25
+ docile (1.1.3)
26
+ faraday (0.9.0)
27
+ multipart-post (>= 1.2, < 3)
28
+ git (1.2.6)
29
+ github_api (0.11.3)
30
+ addressable (~> 2.3)
31
+ descendants_tracker (~> 0.0.1)
32
+ faraday (~> 0.8, < 0.10)
33
+ hashie (>= 1.2)
34
+ multi_json (>= 1.7.5, < 2.0)
35
+ nokogiri (~> 1.6.0)
36
+ oauth2
37
+ hashie (2.0.5)
38
+ highline (1.6.21)
39
+ i18n (0.6.9)
40
+ jeweler (2.0.1)
41
+ builder
42
+ bundler (>= 1.0)
43
+ git (>= 1.2.5)
44
+ github_api
45
+ highline (>= 1.6.15)
46
+ nokogiri (>= 1.5.10)
47
+ rake
48
+ rdoc
49
+ json (1.8.1)
50
+ jwt (0.1.11)
51
+ multi_json (>= 1.5)
52
+ mini_portile (0.5.3)
53
+ minitest (4.7.5)
54
+ multi_json (1.9.2)
55
+ multi_xml (0.5.5)
56
+ multipart-post (2.0.0)
57
+ mysql2 (0.3.15)
58
+ nokogiri (1.6.1)
59
+ mini_portile (~> 0.5.0)
60
+ oauth2 (0.9.3)
61
+ faraday (>= 0.8, < 0.10)
62
+ jwt (~> 0.1.8)
63
+ multi_json (~> 1.3)
64
+ multi_xml (~> 0.5)
65
+ rack (~> 1.2)
66
+ rack (1.5.2)
67
+ rake (10.2.2)
68
+ rdoc (3.12.2)
69
+ json (~> 1.4)
70
+ shoulda (3.5.0)
71
+ shoulda-context (~> 1.0, >= 1.0.1)
72
+ shoulda-matchers (>= 1.4.1, < 3.0)
73
+ shoulda-context (1.2.0)
74
+ shoulda-matchers (2.5.0)
75
+ activesupport (>= 3.0.0)
76
+ simplecov (0.8.2)
77
+ docile (~> 1.1.0)
78
+ multi_json
79
+ simplecov-html (~> 0.8.0)
80
+ simplecov-html (0.8.0)
81
+ thread_safe (0.3.1)
82
+ atomic (>= 1.1.7, < 2)
83
+ tzinfo (0.3.39)
84
+
85
+ PLATFORMS
86
+ ruby
87
+
88
+ DEPENDENCIES
89
+ activerecord (>= 4.0.4)
90
+ bundler (~> 1.0)
91
+ jeweler (~> 2.0.1)
92
+ mysql2 (>= 0.3.1)
93
+ rdoc (~> 3.12)
94
+ shoulda
95
+ simplecov
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2014 Marc
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # MageRecord RubyGem
2
+
3
+ ## Introduction
4
+ Simple ActiveRecord wrapper for various Magento objects.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+ ```
10
+ gem 'magerecord'
11
+ ```
12
+ And then execute:
13
+ ```
14
+ $ bundle
15
+ ```
16
+ Or install it yourself as:
17
+ ```
18
+ $ gem install magerecord
19
+ ```
20
+
21
+ ## Basic Usage:
22
+ ```
23
+ # IMPORTANT: initialise magento mysql database connection
24
+ MageRecord::Connection.new 'localhost', 'db_name', 'username', 'password'
25
+
26
+
27
+ # get total number of orders
28
+ MageRecord::Order.count
29
+
30
+ # get latest order
31
+ order = MageRecord::Order.last
32
+
33
+ # get order items
34
+ order.items
35
+
36
+ # get associated products
37
+ order.products
38
+
39
+ # get customer's full name
40
+ order.customer.firstname + ' ' + order.customer.lastname
41
+
42
+ # get billing address
43
+ order.billing_address
44
+
45
+ # get shipping address
46
+ order.shipping_address
47
+
48
+
49
+ # get a product
50
+ product = MageRecord::Product.last
51
+
52
+ # get product name
53
+ product.name
54
+
55
+ # get list of EAV attributes for a MageRecord
56
+ #
57
+ # currently works with:
58
+ # - MageRecord::Address
59
+ # - MageRecord::Customer
60
+ # - MageRecord::Product
61
+ MageRecord::Address.eav_attributes
62
+ MageRecord::Customer.eav_attributes
63
+ MageRecord::Product.eav_attributes
64
+
65
+ # get custom product EAV attribute
66
+ # (note: these should first be defined in Magento)
67
+ product.flavor
68
+ product.size
69
+ product.color
70
+
71
+ # get product stock level
72
+ product.qty
73
+ ```
74
+
75
+ ## Contributing
76
+
77
+ 1. Fork it ( http://github.com/[my-github-username]/magerecord/fork )
78
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
79
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
80
+ 4. Push to the branch (`git push origin my-new-feature`)
81
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,51 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
17
+ gem.name = "magerecord"
18
+ gem.homepage = "http://github.com/mystix/magerecord"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Simple ActiveRecord wrapper for Magento}
21
+ gem.description = %Q{A simple ActiveRecord wrapper for various Magento models}
22
+ gem.email = "xerokill@gmail.com"
23
+ gem.authors = ["Marc"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ desc "Code coverage detail"
36
+ task :simplecov do
37
+ ENV['COVERAGE'] = "true"
38
+ Rake::Task['test'].execute
39
+ end
40
+
41
+ task :default => :test
42
+
43
+ require 'rdoc/task'
44
+ Rake::RDocTask.new do |rdoc|
45
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
46
+
47
+ rdoc.rdoc_dir = 'rdoc'
48
+ rdoc.title = "magerecord #{version}"
49
+ rdoc.rdoc_files.include('README*')
50
+ rdoc.rdoc_files.include('lib/**/*.rb')
51
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,7 @@
1
+ module MageRecord
2
+ class Address < EavRecord
3
+ self.table_name = :customer_address_entity
4
+
5
+ belongs_to :customer, foreign_key: :parent_id
6
+ end
7
+ end
@@ -0,0 +1,13 @@
1
+ module MageRecord
2
+ class Connection
3
+ def initialize(hostname, db, user, pwd)
4
+ ActiveRecord::Base.establish_connection(
5
+ adapter: 'mysql2',
6
+ host: hostname,
7
+ database: db,
8
+ username: user,
9
+ password: pwd
10
+ )
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ module MageRecord
2
+ class Customer < EavRecord
3
+ self.table_name = :customer_entity
4
+
5
+ belongs_to :store
6
+ belongs_to :website
7
+
8
+ has_many :addresses, foreign_key: :parent_id
9
+ has_many :orders
10
+ end
11
+ end
@@ -0,0 +1,78 @@
1
+ module MageRecord
2
+ class EavRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+
5
+
6
+ # return the full list of EAV attributes available for this entity type
7
+ def self.eav_attributes
8
+ conn = connection
9
+
10
+ # note: select_values returns just one value from a single db column
11
+ conn.select_values <<-RAWSQL.strip_heredoc
12
+ SELECT attribute_code
13
+ FROM eav_entity_type, eav_attribute
14
+ WHERE eav_entity_type.entity_type_code = #{conn.quote(eav_prefix)}
15
+ AND eav_attribute.entity_type_id = eav_entity_type.entity_type_id
16
+ RAWSQL
17
+ end
18
+
19
+
20
+ # returns the Magento EAV DB table prefix for this entity type
21
+ def self.eav_prefix
22
+ table_name.gsub(/_entity$/, '')
23
+ end
24
+
25
+
26
+ def method_missing(meth, *args, &block)
27
+ conn = self.class.connection
28
+ eav_prefix = self.class.eav_prefix
29
+
30
+ # note: select_values returns just one value from a single db column
31
+ eav = conn.select_values <<-RAWSQL.strip_heredoc
32
+ SELECT
33
+ CASE ea.backend_type
34
+ WHEN 'varchar' THEN entity_varchar.value
35
+ WHEN 'int' THEN (
36
+ CASE ea.frontend_input
37
+ WHEN 'select' THEN ( # if attribute is used in a <select> field
38
+ CASE
39
+ WHEN eaov.value IS NOT NULL THEN eaov.value # user-defined attribute options
40
+ ELSE entity_int.value
41
+ END
42
+ )
43
+ ELSE entity_int.value
44
+ END
45
+ )
46
+ WHEN 'text' THEN entity_text.value
47
+ WHEN 'decimal' THEN entity_decimal.value
48
+ WHEN 'datetime' THEN entity_datetime.value
49
+ ELSE ea.backend_type
50
+ END AS value
51
+ FROM #{eav_prefix}_entity AS entity
52
+
53
+ LEFT JOIN eav_attribute AS ea ON entity.entity_type_id = ea.entity_type_id
54
+ LEFT JOIN #{eav_prefix}_entity_varchar AS entity_varchar ON entity.entity_id = entity_varchar.entity_id AND ea.attribute_id = entity_varchar.attribute_id AND ea.backend_type = 'varchar'
55
+
56
+ LEFT JOIN #{eav_prefix}_entity_int AS entity_int ON entity.entity_id = entity_int.entity_id AND ea.attribute_id = entity_int.attribute_id AND ea.backend_type = 'int'
57
+ LEFT JOIN eav_attribute_option AS eao ON ea.attribute_id = eao.attribute_id AND entity_int.value = eao.option_id
58
+ LEFT JOIN eav_attribute_option_value AS eaov ON eaov.option_id = eao.option_id
59
+
60
+ LEFT JOIN #{eav_prefix}_entity_text AS entity_text ON entity.entity_id = entity_text.entity_id AND ea.attribute_id = entity_text.attribute_id AND ea.backend_type = 'text'
61
+ LEFT JOIN #{eav_prefix}_entity_decimal AS entity_decimal ON entity.entity_id = entity_decimal.entity_id AND ea.attribute_id = entity_decimal.attribute_id AND ea.backend_type = 'decimal'
62
+ LEFT JOIN #{eav_prefix}_entity_datetime AS entity_datetime ON entity.entity_id = entity_datetime.entity_id AND ea.attribute_id = entity_datetime.attribute_id AND ea.backend_type = 'datetime'
63
+
64
+ WHERE ea.attribute_code = #{conn.quote(meth)}
65
+ AND entity.entity_id = #{id}
66
+ RAWSQL
67
+
68
+ if eav.count > 0
69
+ # return value of Magento EAV attribute if available
70
+ eav.first
71
+ else
72
+ # call superclass's method_missing method
73
+ # or risk breaking Ruby's method lookup
74
+ super
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,38 @@
1
+ module MageRecord
2
+ # add custom FitLion-specific product methods
3
+ class Product < EavRecord
4
+ def uom
5
+ "#{measurement} #{unit}"
6
+ end
7
+
8
+
9
+ def full_name
10
+ if @fname.nil?
11
+ @fname = "#{name} (#{uom})"
12
+
13
+ # note: most bundles are not associated with any brand
14
+ if brand
15
+ @fname = "(#{brand}) #{@fname}"
16
+ end
17
+
18
+ # only simple/virtual products will have custom attributes
19
+ if %w{simple virtual}.include?(type_id)
20
+ # get all custom product attributes specific to attribute set
21
+ attribs = set.downcase.gsub(/^.*\((\w*)(?: only)?\)/, "\\1").split(' + ') - ['brand']
22
+
23
+ attribs.each do |attr|
24
+ @fname += " (#{send(attr)})"
25
+ end
26
+ end
27
+ end
28
+
29
+ # return cached full name
30
+ @fname
31
+ end
32
+
33
+
34
+ def is_supplement?
35
+ set.downcase.include? 'supplement'
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,16 @@
1
+ module MageRecord
2
+ class Order < ActiveRecord::Base
3
+ self.table_name = :sales_flat_order
4
+
5
+ # ignore canceled orders
6
+ default_scope { where status: [:processing, :complete] }
7
+
8
+ belongs_to :customer
9
+
10
+ has_one :billing_address, -> { where address_type: 'billing' }, class_name: :OrderAddress, foreign_key: :parent_id
11
+ has_one :shipping_address, -> { where address_type: 'shipping' }, class_name: :OrderAddress, foreign_key: :parent_id
12
+
13
+ has_many :items, class_name: :OrderItem
14
+ has_many :products, through: :items
15
+ end
16
+ end
@@ -0,0 +1,7 @@
1
+ module MageRecord
2
+ class OrderAddress < ActiveRecord::Base
3
+ self.table_name = :sales_flat_order_address
4
+
5
+ belongs_to :order, foreign_key: :parent_id
6
+ end
7
+ end
@@ -0,0 +1,21 @@
1
+ module MageRecord
2
+ # order items can be parents / children of other order items
3
+ # (only within the same order)
4
+ class OrderItem < ActiveRecord::Base
5
+ self.table_name = :sales_flat_order_item
6
+
7
+ belongs_to :order
8
+ belongs_to :parent, class_name: :OrderItem, foreign_key: :parent_item_id
9
+ belongs_to :product
10
+
11
+ # note: add an index on the column "parent_item_id" to
12
+ # *dramatically* speed up loading of child order items from the parent order item
13
+ has_many :children, class_name: :OrderItem, foreign_key: :parent_item_id
14
+
15
+
16
+ # call associated product's method
17
+ def method_missing(meth, *args, &block)
18
+ product.nil? ? super : product.send(meth)
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,38 @@
1
+ module MageRecord
2
+ class Product < EavRecord
3
+ self.table_name = :catalog_product_entity
4
+
5
+ alias_attribute :type, :type_id
6
+
7
+
8
+ belongs_to :product_attribute_set, foreign_key: :attribute_set_id
9
+
10
+ has_one :stock
11
+
12
+ has_many :items, class_name: :OrderItem
13
+ has_many :orders, through: :items
14
+
15
+
16
+ def qty
17
+ stock.qty.to_i
18
+ end
19
+
20
+
21
+ def in_stock?
22
+ stock.is_in_stock?
23
+ end
24
+
25
+
26
+ def enabled?
27
+ # note: a magento product's enabled/disabled status is stored in EAV attribute code "status"
28
+ # 1 = enabled, 2 = disabled
29
+ status.to_i == 1
30
+ end
31
+
32
+
33
+ def set
34
+ # return product's attribute set
35
+ product_attribute_set.attribute_set_name
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,13 @@
1
+ module MageRecord
2
+ # allows us to make queries like: "List all supplements"
3
+ class ProductAttributeSet < ActiveRecord::Base
4
+ self.table_name = :eav_attribute_set
5
+
6
+ default_scope { where entity_type_id: 4 }
7
+
8
+ alias_attribute :name, :attribute_set_name
9
+
10
+
11
+ has_many :products, foreign_key: :attribute_set_id
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ module MageRecord
2
+ class Stock < ActiveRecord::Base
3
+ self.table_name = :cataloginventory_stock_item
4
+
5
+ belongs_to :product
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ module MageRecord
2
+ class Store < ActiveRecord::Base # also known as Store View in Magento
3
+ self.table_name = :core_store
4
+
5
+ belongs_to :website
6
+
7
+ has_many :customers
8
+ end
9
+ end
@@ -0,0 +1,8 @@
1
+ module MageRecord
2
+ class Website < ActiveRecord::Base
3
+ self.table_name = :core_website
4
+
5
+ has_many :customers
6
+ has_many :stores
7
+ end
8
+ end
data/lib/magerecord.rb ADDED
@@ -0,0 +1,19 @@
1
+ require 'active_record'
2
+ require 'active_support/core_ext/string/strip'
3
+
4
+ # for establishing db connection
5
+ require 'magerecord/connection.rb'
6
+
7
+ # include models
8
+ require 'magerecord/eav_record'
9
+ require 'magerecord/address'
10
+ require 'magerecord/customer'
11
+ require 'magerecord/product'
12
+
13
+ require 'magerecord/website'
14
+ require 'magerecord/store'
15
+ require 'magerecord/product_attribute_set'
16
+ require 'magerecord/stock'
17
+ require 'magerecord/order'
18
+ require 'magerecord/order_item'
19
+ require 'magerecord/order_address'
@@ -0,0 +1,81 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "magerecord"
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Marc"]
12
+ s.date = "2014-04-01"
13
+ s.description = "A simple ActiveRecord wrapper for various Magento models"
14
+ s.email = "xerokill@gmail.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.md"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE.txt",
24
+ "README.md",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "lib/magerecord.rb",
28
+ "lib/magerecord/address.rb",
29
+ "lib/magerecord/connection.rb",
30
+ "lib/magerecord/customer.rb",
31
+ "lib/magerecord/eav_record.rb",
32
+ "lib/magerecord/fitlion/product.rb",
33
+ "lib/magerecord/order.rb",
34
+ "lib/magerecord/order_address.rb",
35
+ "lib/magerecord/order_item.rb",
36
+ "lib/magerecord/product.rb",
37
+ "lib/magerecord/product_attribute_set.rb",
38
+ "lib/magerecord/stock.rb",
39
+ "lib/magerecord/store.rb",
40
+ "lib/magerecord/website.rb",
41
+ "magerecord.gemspec",
42
+ "test/helper.rb",
43
+ "test/test_magerecord.rb"
44
+ ]
45
+ s.homepage = "http://github.com/mystix/magerecord"
46
+ s.licenses = ["MIT"]
47
+ s.require_paths = ["lib"]
48
+ s.rubygems_version = "1.8.23.2"
49
+ s.summary = "Simple ActiveRecord wrapper for Magento"
50
+
51
+ if s.respond_to? :specification_version then
52
+ s.specification_version = 3
53
+
54
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
55
+ s.add_runtime_dependency(%q<activerecord>, [">= 4.0.4"])
56
+ s.add_runtime_dependency(%q<mysql2>, [">= 0.3.1"])
57
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
58
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
59
+ s.add_development_dependency(%q<bundler>, ["~> 1.0"])
60
+ s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
61
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
62
+ else
63
+ s.add_dependency(%q<activerecord>, [">= 4.0.4"])
64
+ s.add_dependency(%q<mysql2>, [">= 0.3.1"])
65
+ s.add_dependency(%q<shoulda>, [">= 0"])
66
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
67
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
68
+ s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
69
+ s.add_dependency(%q<simplecov>, [">= 0"])
70
+ end
71
+ else
72
+ s.add_dependency(%q<activerecord>, [">= 4.0.4"])
73
+ s.add_dependency(%q<mysql2>, [">= 0.3.1"])
74
+ s.add_dependency(%q<shoulda>, [">= 0"])
75
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
76
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
77
+ s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
78
+ s.add_dependency(%q<simplecov>, [">= 0"])
79
+ end
80
+ end
81
+
data/test/helper.rb ADDED
@@ -0,0 +1,34 @@
1
+ require 'simplecov'
2
+
3
+ module SimpleCov::Configuration
4
+ def clean_filters
5
+ @filters = []
6
+ end
7
+ end
8
+
9
+ SimpleCov.configure do
10
+ clean_filters
11
+ load_adapter 'test_frameworks'
12
+ end
13
+
14
+ ENV["COVERAGE"] && SimpleCov.start do
15
+ add_filter "/.rvm/"
16
+ end
17
+ require 'rubygems'
18
+ require 'bundler'
19
+ begin
20
+ Bundler.setup(:default, :development)
21
+ rescue Bundler::BundlerError => e
22
+ $stderr.puts e.message
23
+ $stderr.puts "Run `bundle install` to install missing gems"
24
+ exit e.status_code
25
+ end
26
+ require 'test/unit'
27
+ require 'shoulda'
28
+
29
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
30
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
31
+ require 'magerecord'
32
+
33
+ class Test::Unit::TestCase
34
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestMagerecord < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,186 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: magerecord
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Marc
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-04-01 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activerecord
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 4.0.4
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 4.0.4
30
+ - !ruby/object:Gem::Dependency
31
+ name: mysql2
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 0.3.1
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 0.3.1
46
+ - !ruby/object:Gem::Dependency
47
+ name: shoulda
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rdoc
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '3.12'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '3.12'
78
+ - !ruby/object:Gem::Dependency
79
+ name: bundler
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: '1.0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: '1.0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: jeweler
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: 2.0.1
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 2.0.1
110
+ - !ruby/object:Gem::Dependency
111
+ name: simplecov
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ description: A simple ActiveRecord wrapper for various Magento models
127
+ email: xerokill@gmail.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files:
131
+ - LICENSE.txt
132
+ - README.md
133
+ files:
134
+ - .document
135
+ - Gemfile
136
+ - Gemfile.lock
137
+ - LICENSE.txt
138
+ - README.md
139
+ - Rakefile
140
+ - VERSION
141
+ - lib/magerecord.rb
142
+ - lib/magerecord/address.rb
143
+ - lib/magerecord/connection.rb
144
+ - lib/magerecord/customer.rb
145
+ - lib/magerecord/eav_record.rb
146
+ - lib/magerecord/fitlion/product.rb
147
+ - lib/magerecord/order.rb
148
+ - lib/magerecord/order_address.rb
149
+ - lib/magerecord/order_item.rb
150
+ - lib/magerecord/product.rb
151
+ - lib/magerecord/product_attribute_set.rb
152
+ - lib/magerecord/stock.rb
153
+ - lib/magerecord/store.rb
154
+ - lib/magerecord/website.rb
155
+ - magerecord.gemspec
156
+ - test/helper.rb
157
+ - test/test_magerecord.rb
158
+ homepage: http://github.com/mystix/magerecord
159
+ licenses:
160
+ - MIT
161
+ post_install_message:
162
+ rdoc_options: []
163
+ require_paths:
164
+ - lib
165
+ required_ruby_version: !ruby/object:Gem::Requirement
166
+ none: false
167
+ requirements:
168
+ - - ! '>='
169
+ - !ruby/object:Gem::Version
170
+ version: '0'
171
+ segments:
172
+ - 0
173
+ hash: 3307920750620264480
174
+ required_rubygems_version: !ruby/object:Gem::Requirement
175
+ none: false
176
+ requirements:
177
+ - - ! '>='
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
180
+ requirements: []
181
+ rubyforge_project:
182
+ rubygems_version: 1.8.23.2
183
+ signing_key:
184
+ specification_version: 3
185
+ summary: Simple ActiveRecord wrapper for Magento
186
+ test_files: []