status_quo 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in status_quo.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,34 @@
1
+
2
+ # StatusQuo
3
+ #
4
+ # The f*cking simple status management solution
5
+ #
6
+ # Usage:
7
+ # status :foo, :bar, :baz
8
+ #
9
+ # Ok! Now you got:
10
+ # Klass.foo, Klass.bar & Klass.baz
11
+ # inst.foo?, inst.bar? & inst.baz?
12
+ # inst.foo!, inst.bar! & inst.baz!
13
+
14
+ module StatusQuo
15
+ def self.included(klass)
16
+ klass.extend ClassMethods
17
+ end
18
+ module ClassMethods
19
+ def status *statuses
20
+ for status in statuses
21
+ scope status, where('status = ?', status)
22
+ class_eval %(
23
+ def #{status}?
24
+ self.status == '#{status}'
25
+ end
26
+ def #{status}!
27
+ update_attribute :status, '#{status}'
28
+ end
29
+ )
30
+ end
31
+ end
32
+ end
33
+ end
34
+ ActiveRecord::Base.send(:include, StatusQuo) if defined?(ActiveRecord)
@@ -0,0 +1,3 @@
1
+ module StatusQuo
2
+ VERSION = "0.0.1"
3
+ end
data/lib/status_quo.rb ADDED
@@ -0,0 +1,12 @@
1
+ require 'rails'
2
+ require 'rails/generators'
3
+ require 'rails/generators/migration'
4
+
5
+ class StatusDistance < Rails::Railtie
6
+
7
+ initializer 'activerecord-postgres-hstore' do
8
+ ActiveSupport.on_load :active_record do
9
+ require "status_quo/status_quo"
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "status_quo/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "status_quo"
7
+ s.version = StatusQuo::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Juan Maiz"]
10
+ s.email = ["juanmaiz@gmail.com"]
11
+ s.homepage = ""
12
+ s.summary = %q{The really f*cking simple solution for status}
13
+ s.description = %q{No CONSTANTS. No numbers. No stupid state machines. F*cking simple stuff.}
14
+
15
+ s.rubyforge_project = "status_quo"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+ end
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: status_quo
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Juan Maiz
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-05-13 00:00:00 -03:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: No CONSTANTS. No numbers. No stupid state machines. F*cking simple stuff.
23
+ email:
24
+ - juanmaiz@gmail.com
25
+ executables: []
26
+
27
+ extensions: []
28
+
29
+ extra_rdoc_files: []
30
+
31
+ files:
32
+ - .gitignore
33
+ - Gemfile
34
+ - Rakefile
35
+ - lib/status_quo.rb
36
+ - lib/status_quo/status_quo.rb
37
+ - lib/status_quo/version.rb
38
+ - status_quo.gemspec
39
+ has_rdoc: true
40
+ homepage: ""
41
+ licenses: []
42
+
43
+ post_install_message:
44
+ rdoc_options: []
45
+
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ hash: 3
54
+ segments:
55
+ - 0
56
+ version: "0"
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ hash: 3
63
+ segments:
64
+ - 0
65
+ version: "0"
66
+ requirements: []
67
+
68
+ rubyforge_project: status_quo
69
+ rubygems_version: 1.3.7
70
+ signing_key:
71
+ specification_version: 3
72
+ summary: The really f*cking simple solution for status
73
+ test_files: []
74
+