product_rails 0.1.0

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: a68156a7d55e6f59e60135ddd2c59f18f8b4f102
4
+ data.tar.gz: c4482c0c7083ed0f9806d52f2ccf80f267cfad77
5
+ SHA512:
6
+ metadata.gz: 20a3572e76899f49771f220365f7552d1ff33dfa22cd794cc0084699b61c2bcf3304e4601b1c6b6bdd620128a895ef807cc4600aa5bdc091a3fffe4950763175
7
+ data.tar.gz: c7a80a3d5f2cc15f4a69fc83095001b006bb5df909df702689eb0d6203c76ed58702a388c10f67fb1d918e53ed36490ecbc28d9a45cace8d2c46796ddc814069
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2015 Orgânica Digital
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/Rakefile ADDED
@@ -0,0 +1,26 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'ProductRails'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../spec/test_app/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ Bundler::GemHelper.install_tasks
26
+
@@ -0,0 +1,17 @@
1
+ require "friendly_id"
2
+ class Product < ActiveRecord::Base
3
+
4
+ extend FriendlyId
5
+
6
+ validates :sku, :name, :description, :unity, :stock, :min_stock, :wheight, presence: true
7
+ validates :sku, uniqueness: true
8
+ validates :stock, :min_stock, numericality: {only_integer: true}
9
+ validates :price, :tax, :wheight, numericality: {greater_than_or_equal_to: 0}
10
+
11
+ friendly_id :slug_candidates, use: [:slugged, :finders]
12
+
13
+ def slug_candidates
14
+ [[:name, :sku]]
15
+ end
16
+
17
+ end
@@ -0,0 +1,18 @@
1
+ pt-BR:
2
+ activerecord:
3
+ models:
4
+ product:
5
+ one: Produto
6
+ other: Produtos
7
+ attributes:
8
+ product:
9
+ sku: Código
10
+ name: Nome
11
+ description: Descrição
12
+ unity: Unidade
13
+ tax: Taxa
14
+ stock: Estoque
15
+ min_stock: Estoque Mínimo
16
+ wheight: Peso
17
+ enabled: Habilitado?
18
+ price: Preço
@@ -0,0 +1,18 @@
1
+ class CreateProducts < ActiveRecord::Migration
2
+ def change
3
+ create_table :products do |t|
4
+ t.string :slug, null: false, unique: true, index: true
5
+ t.string :sku, null: false, unique: true, index: true
6
+ t.string :name, null: false
7
+ t.string :description, null: false
8
+ t.string :unity, null: false
9
+ t.decimal :price, default: 0, precision: 12, scale: 2
10
+ t.decimal :tax, default: 0, precision: 12, scale: 2
11
+ t.integer :stock, null: false, default: 0
12
+ t.integer :min_stock, null: false, default: 0
13
+ t.decimal :wheight, null: false, default: 0, precision: 12, scale: 3
14
+ t.boolean :enabled
15
+ t.timestamps
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,4 @@
1
+ require "product_rails/engine"
2
+
3
+ module ProductRails
4
+ end
@@ -0,0 +1,5 @@
1
+ module ProductRails
2
+ class Engine < ::Rails::Engine
3
+ engine_name :product_rails
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module ProductRails
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :product_rails do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: product_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Orgânica Digital
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: friendly_id
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 5.1.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 5.1.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: mysql2
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: A simple product representation for Rails applications.
56
+ email:
57
+ - contato@organicadigital.com.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - MIT-LICENSE
63
+ - Rakefile
64
+ - app/models/product.rb
65
+ - config/locales/pt-BR.yml
66
+ - db/migrate/20150206104816_create_products.rb
67
+ - lib/product_rails.rb
68
+ - lib/product_rails/engine.rb
69
+ - lib/product_rails/version.rb
70
+ - lib/tasks/product_rails_tasks.rake
71
+ homepage: https://github.com/organicadigital/product_rails
72
+ licenses:
73
+ - MIT
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.4.5
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: A simple product representation for Rails applications.
95
+ test_files: []