Skip to content

Commit

Permalink
Blank treasury classes
Browse files Browse the repository at this point in the history
  • Loading branch information
ashalaev committed Feb 25, 2015
1 parent defde40 commit b39c386
Show file tree
Hide file tree
Showing 15 changed files with 204 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/.bundle/
/.yardoc
/Gemfile.lock
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
*.bundle
*.so
*.o
*.a
mkmf.log
/.rvmrc
/.idea/
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source 'https://gems.railsc.ru/'
source 'https://rubygems.org'

# Specify your gem's dependencies in treasury.gemspec
gemspec
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
# apress-treasury
# Treasury

Denormalized data collection system.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'treasury'
```

And then execute:

$ bundle

Or install it yourself as:

$ gem install treasury

## Contributing

1. Fork it ( https://github.com/abak-press/treasury/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
7 changes: 7 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end

require 'apress/gems/rake_tasks'
8 changes: 8 additions & 0 deletions lib/treasury.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# coding: utf-8

require 'treasury/version'
require 'treasury/engine'

module Treasury
# Your code goes here...
end
9 changes: 9 additions & 0 deletions lib/treasury/engine.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# coding: utf-8

require 'rails'

module Treasury
class Engine < ::Rails::Engine
config.autoload_paths += Dir["#{config.root}/lib"]
end
end
10 changes: 10 additions & 0 deletions lib/treasury/fields/company/base.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# coding: utf-8

module Treasury
module Fields
module Company
class Base < ::CoreDenormalization::Fields::Company::Base
end
end
end
end
10 changes: 10 additions & 0 deletions lib/treasury/fields/product/base.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# coding: utf-8

module Treasury
module Fields
module Product
class Base < ::CoreDenormalization::Fields::Product::Base
end
end
end
end
28 changes: 28 additions & 0 deletions lib/treasury/fields/translator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# coding: utf-8

module Treasury
module Fields
module Translator
extend ActiveSupport::Concern

module ClassMethods
def value_as_string(params)
init_accessor(params)
value.to_s
end

def value_as_integer(params)
value_as_string(params).to_i
end

def value_as_boolean(params)
value_as_string(params).mb_chars.downcase.to_b
end

def value_as_date(params)
value_as_string(params).to_date
end
end
end
end
end
10 changes: 10 additions & 0 deletions lib/treasury/fields/user/base.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# coding: utf-8

module Treasury
module Fields
module User
class Base < ::CoreDenormalization::Fields::User::Base
end
end
end
end
10 changes: 10 additions & 0 deletions lib/treasury/processors/company/base.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# coding: utf-8

module Treasury
module Processors
module Company
class Base < ::CoreDenormalization::Processors::Company::Base
end
end
end
end
26 changes: 26 additions & 0 deletions lib/treasury/processors/single.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# coding: utf-8

module Treasury
module Processors
module Single

protected

def storage_field
@storage_field ||= field.first_field.to_sym
end

def form_value(value)
{storage_field => value}
end

def increment_current_value(field_name = nil, by = 1)
result_row(incremented_current_value(field_name, by))
end

def decrement_current_value(field_name = nil, by = 1)
result_row(decremented_current_value(field_name, by))
end
end
end
end
10 changes: 10 additions & 0 deletions lib/treasury/processors/user/base.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# coding: utf-8

module Treasury
module Processors
module User
class Base < ::CoreDenormalization::Processors::User::Base
end
end
end
end
3 changes: 3 additions & 0 deletions lib/treasury/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Treasury
VERSION = "0.0.1"
end
25 changes: 25 additions & 0 deletions treasury.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'treasury/version'

Gem::Specification.new do |spec|
spec.name = 'treasury'
spec.version = Treasury::VERSION
spec.authors = ['Andrew N. Shalaev']
spec.email = ['[email protected]']
spec.summary = %q{Treasury - Denormalized data collection system.}
spec.description = %q{Denormalized data collection system.}
spec.homepage = ''

spec.files = `git ls-files -z`.split("\x0")
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = %w(lib)

spec.add_runtime_dependency 'rails', '>= 3.1.12', '< 4.1'

spec.add_development_dependency 'bundler', '~> 1.7'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'apress-gems', '>= 0.2'
end

0 comments on commit b39c386

Please sign in to comment.