rawgento_models 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ff2f168c82a8197f22fec68ca351f50337887f99
4
+ data.tar.gz: 7a685965dcaf66073acae23c7ebcf6ddc49c1e2a
5
+ SHA512:
6
+ metadata.gz: d78c449e3564adbeb7704c41c6c1314a4cfa1c1ea959948429cffdba4ec0a3cda8e1d08d371a64211de31eaf4652774bf420ac527b4b9264e42c0ca8dfc2f512
7
+ data.tar.gz: f17fc6087f8de9ae6c3b1538115a7dcc3cd8f518c9e750a52527ef8f8e3e7937c599a33cdb45cfbc2fef384d2a6fbb8dbac73ba9f0d2d3c06bb2a34cce9d81e7
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at felix.wolfsteller@gmail.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rawgento_models.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # RawgentoModels
2
+
3
+ Models to deal with Magento shop data of a specific shop instance.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'rawgento_models'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install rawgento_models
20
+
21
+ ## Usage
22
+
23
+ 1. Require this gem in your application.
24
+
25
+ # yourapp.gemspec
26
+ require 'rawgento_models'
27
+
28
+ $ bundle install
29
+
30
+ # Rakefile
31
+ RawgentoModels.include_tasks
32
+
33
+ 2. Setup your databse
34
+
35
+ # db/config.yml
36
+ host: ...
37
+
38
+ # TODO this does not yet work
39
+ rake db:migrate
40
+
41
+ 3. Use Models from your application
42
+
43
+ # yourapp.rb
44
+ require 'rawgento_models'
45
+ Stock.all
46
+
47
+ ## Development
48
+
49
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec rawgento_models` to use the gem in this directory, ignoring other installed copies of this gem.
50
+
51
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
52
+
53
+ ## Contributing
54
+
55
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rawgento_models. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
56
+
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'active_record_migrations'
4
+
5
+ ActiveRecordMigrations.load_tasks
6
+
7
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rawgento_models"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/db/config.yml ADDED
@@ -0,0 +1,12 @@
1
+ default: &default
2
+ adapter: sqlite3
3
+ database: db/rawgento.db
4
+ encoding: utf8
5
+ pool: 5
6
+ timeout: 5000
7
+
8
+ development:
9
+ <<: *default
10
+ test:
11
+ <<: *default
12
+ database: db/rawgento_test.db
@@ -0,0 +1,30 @@
1
+ class CreateBase < ActiveRecord::Migration
2
+ def change
3
+ create_table :local_products do |p|
4
+ p.string :name
5
+ p.string :supplier
6
+ p.integer :product_id
7
+ p.datetime "created_at", null: false
8
+ p.datetime "updated_at", null: false
9
+ end
10
+ add_index :local_products, :product_id, unique: true
11
+
12
+ create_table :remote_products do |p|
13
+ p.string :name
14
+ p.string :supplier
15
+ p.references :local_product, index: true
16
+ p.integer :product_id
17
+ p.datetime "created_at", null: false
18
+ p.datetime "updated_at", null: false
19
+ end
20
+
21
+ create_table :stock_items do |p|
22
+ p.references :local_product
23
+ p.integer :qty
24
+ p.datetime :date
25
+ p.datetime "created_at", null: false
26
+ p.datetime "updated_at", null: false
27
+ end
28
+ add_index :stock_items, :local_product_id
29
+ end
30
+ end
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rawgento_models"
@@ -0,0 +1,35 @@
1
+ require 'active_record'
2
+ require 'active_record_migrations'
3
+
4
+ require "rawgento_models/version"
5
+ require "rawgento_models/stock_item"
6
+ require "rawgento_models/local_product"
7
+ require "rawgento_models/remote_product"
8
+
9
+ require 'yaml'
10
+ require 'ostruct'
11
+
12
+ module RawgentoModels
13
+ # When required, provide migrations.
14
+ MIGRATION_PATH = File.expand_path(File.join __dir__, '..', 'db', 'migrate')
15
+ ActiveRecordMigrations.configure {|c| c.migrations_paths = [MIGRATION_PATH] }
16
+
17
+ # Reads config and wires up AR
18
+ def self.establish_connection
19
+ config = OpenStruct.new YAML.load_file("db/config.yml")
20
+ ActiveRecord::Base.establish_connection(config.default)
21
+ #ActiveRecord::Base.establish_connection({
22
+ # :adapter => 'mysql2',
23
+ # :host => 'localhost',
24
+ # :username => 'dbuser',
25
+ # :password => '',
26
+ # :database => 'your_database',
27
+ #})
28
+ end
29
+
30
+ def self.load_tasks
31
+ #load 'active_record/railties/databases.rake'
32
+ ActiveRecordMigrations.load_tasks
33
+ #load "rawgento_models.rake"
34
+ end
35
+ end
@@ -0,0 +1,6 @@
1
+ module RawgentoModels
2
+ class LocalProduct < ActiveRecord::Base
3
+ has_one :remote_product
4
+ has_many :stock_items
5
+ end
6
+ end
@@ -0,0 +1,4 @@
1
+ module RawgentoModels
2
+ class Order < ActiveRecord::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module RawgentoModels
2
+ class RemoteProduct < ActiveRecord::Base
3
+ belongs_to :local_product
4
+ end
5
+ end
6
+
@@ -0,0 +1,5 @@
1
+ module RawgentoModels
2
+ class StockItem < ActiveRecord::Base
3
+ belongs_to :local_product
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module RawgentoModels
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rawgento_models/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rawgento_models"
8
+ spec.version = RawgentoModels::VERSION
9
+ spec.authors = ["Felix Wolfsteller"]
10
+ spec.email = ["felix.wolfsteller@gmail.com"]
11
+
12
+ spec.summary = %q{ActiveRecord Models to use with specific Magento shops}
13
+ spec.homepage = ""
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.bindir = "exe"
17
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency 'activerecord'
21
+ spec.add_dependency 'active_record_migrations'
22
+ spec.add_dependency 'sqlite3'
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.11"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ end
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rawgento_models
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Felix Wolfsteller
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-01-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activerecord
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: active_record_migrations
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sqlite3
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.11'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.11'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ description:
84
+ email:
85
+ - felix.wolfsteller@gmail.com
86
+ executables:
87
+ - rawgento_models
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - CODE_OF_CONDUCT.md
93
+ - Gemfile
94
+ - README.md
95
+ - Rakefile
96
+ - bin/console
97
+ - bin/setup
98
+ - db/config.yml
99
+ - db/migrate/201601171700_create_base.rb
100
+ - exe/rawgento_models
101
+ - lib/rawgento_models.rb
102
+ - lib/rawgento_models/local_product.rb
103
+ - lib/rawgento_models/order.rb
104
+ - lib/rawgento_models/remote_product.rb
105
+ - lib/rawgento_models/stock_item.rb
106
+ - lib/rawgento_models/version.rb
107
+ - rawgento_models.gemspec
108
+ homepage: ''
109
+ licenses: []
110
+ metadata: {}
111
+ post_install_message:
112
+ rdoc_options: []
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubyforge_project:
127
+ rubygems_version: 2.5.1
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: ActiveRecord Models to use with specific Magento shops
131
+ test_files: []