Skip to content

Commit 9ccd38f

Browse files
author
Olvap
committed
initial commit
0 parents  commit 9ccd38f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+821
-0
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.bundle/
2+
log/*.log
3+
pkg/
4+
test/dummy/db/*.sqlite3
5+
test/dummy/log/*.log
6+
test/dummy/tmp/

Gemfile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
source "http://rubygems.org"
2+
3+
# Declare your gem's dependencies in locked.gemspec.
4+
# Bundler will treat runtime dependencies like base dependencies, and
5+
# development dependencies will be added by default to the :development group.
6+
gemspec
7+
8+
# jquery-rails is used by the dummy application
9+
gem "jquery-rails"
10+
11+
# Declare any dependencies that are still in development here instead of in
12+
# your gemspec. These might include edge Rails or gems from your path or
13+
# Git. Remember to move these dependencies to your gemspec before releasing
14+
# your gem to rubygems.org.
15+
16+
# To use debugger
17+
# gem 'ruby-debug19', :require => 'ruby-debug'

Gemfile.lock

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
PATH
2+
remote: .
3+
specs:
4+
locked (0.0.1)
5+
rails (~> 3.1.1)
6+
7+
GEM
8+
remote: http://rubygems.org/
9+
specs:
10+
actionmailer (3.1.3)
11+
actionpack (= 3.1.3)
12+
mail (~> 2.3.0)
13+
actionpack (3.1.3)
14+
activemodel (= 3.1.3)
15+
activesupport (= 3.1.3)
16+
builder (~> 3.0.0)
17+
erubis (~> 2.7.0)
18+
i18n (~> 0.6)
19+
rack (~> 1.3.5)
20+
rack-cache (~> 1.1)
21+
rack-mount (~> 0.8.2)
22+
rack-test (~> 0.6.1)
23+
sprockets (~> 2.0.3)
24+
activemodel (3.1.3)
25+
activesupport (= 3.1.3)
26+
builder (~> 3.0.0)
27+
i18n (~> 0.6)
28+
activerecord (3.1.3)
29+
activemodel (= 3.1.3)
30+
activesupport (= 3.1.3)
31+
arel (~> 2.2.1)
32+
tzinfo (~> 0.3.29)
33+
activeresource (3.1.3)
34+
activemodel (= 3.1.3)
35+
activesupport (= 3.1.3)
36+
activesupport (3.1.3)
37+
multi_json (~> 1.0)
38+
arel (2.2.1)
39+
builder (3.0.0)
40+
erubis (2.7.0)
41+
hike (1.2.1)
42+
i18n (0.6.0)
43+
jquery-rails (1.0.19)
44+
railties (~> 3.0)
45+
thor (~> 0.14)
46+
json (1.6.3)
47+
mail (2.3.0)
48+
i18n (>= 0.4.0)
49+
mime-types (~> 1.16)
50+
treetop (~> 1.4.8)
51+
mime-types (1.17.2)
52+
multi_json (1.0.4)
53+
polyglot (0.3.3)
54+
rack (1.3.5)
55+
rack-cache (1.1)
56+
rack (>= 0.4)
57+
rack-mount (0.8.3)
58+
rack (>= 1.0.0)
59+
rack-ssl (1.3.2)
60+
rack
61+
rack-test (0.6.1)
62+
rack (>= 1.0)
63+
rails (3.1.3)
64+
actionmailer (= 3.1.3)
65+
actionpack (= 3.1.3)
66+
activerecord (= 3.1.3)
67+
activeresource (= 3.1.3)
68+
activesupport (= 3.1.3)
69+
bundler (~> 1.0)
70+
railties (= 3.1.3)
71+
railties (3.1.3)
72+
actionpack (= 3.1.3)
73+
activesupport (= 3.1.3)
74+
rack-ssl (~> 1.3.2)
75+
rake (>= 0.8.7)
76+
rdoc (~> 3.4)
77+
thor (~> 0.14.6)
78+
rake (0.9.2.2)
79+
rdoc (3.11)
80+
json (~> 1.4)
81+
sprockets (2.0.3)
82+
hike (~> 1.2)
83+
rack (~> 1.0)
84+
tilt (~> 1.1, != 1.3.0)
85+
sqlite3 (1.3.5)
86+
thor (0.14.6)
87+
tilt (1.3.3)
88+
treetop (1.4.10)
89+
polyglot
90+
polyglot (>= 0.3.1)
91+
tzinfo (0.3.31)
92+
93+
PLATFORMS
94+
ruby
95+
96+
DEPENDENCIES
97+
jquery-rails
98+
locked!
99+
sqlite3

MIT-LICENSE

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright 2011 YOURNAME
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.

README.rdoc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
= Locked
2+
3+
This project rocks and uses MIT-LICENSE.

Rakefile

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env rake
2+
begin
3+
require 'bundler/setup'
4+
rescue LoadError
5+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6+
end
7+
begin
8+
require 'rdoc/task'
9+
rescue LoadError
10+
require 'rdoc/rdoc'
11+
require 'rake/rdoctask'
12+
RDoc::Task = Rake::RDocTask
13+
end
14+
15+
RDoc::Task.new(:rdoc) do |rdoc|
16+
rdoc.rdoc_dir = 'rdoc'
17+
rdoc.title = 'Locked'
18+
rdoc.options << '--line-numbers'
19+
rdoc.rdoc_files.include('README.rdoc')
20+
rdoc.rdoc_files.include('lib/**/*.rb')
21+
end
22+
23+
24+
25+
Bundler::GemHelper.install_tasks
26+
27+
require 'rake/testtask'
28+
29+
Rake::TestTask.new(:test) do |t|
30+
t.libs << 'lib'
31+
t.libs << 'test'
32+
t.pattern = 'test/**/*_test.rb'
33+
t.verbose = false
34+
end
35+
36+
37+
task :default => :test

init.rb

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require 'locked'

lib/locked.rb

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
require "locked/core_ext"
2+
require 'locked/acts_as_locked'
3+
4+
module Locked
5+
end

lib/locked/acts_as_locked.rb

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
module Locked
2+
module ActsAsLocked
3+
extend ActiveSupport::Concern
4+
5+
included do
6+
end
7+
8+
module ClassMethods
9+
def acts_as_locked(options = {})
10+
# your code will go here
11+
end
12+
end
13+
14+
def lockable?
15+
true
16+
end
17+
18+
def lock!
19+
self.locked = Date.today
20+
end
21+
22+
def unlock!
23+
self.locked = nil
24+
end
25+
26+
27+
end
28+
end
29+
30+
ActiveRecord::Base.send :include, Locked::ActsAsLocked

lib/locked/core_ext.rb

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
String.class_eval do
2+
def to_squawk
3+
"squawk! #{self}".strip
4+
end
5+
end

lib/locked/version.rb

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module Locked
2+
VERSION = "0.0.1"
3+
end

lib/tasks/locked_tasks.rake

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# desc "Explaining what the task does"
2+
# task :locked do
3+
# # Task goes here
4+
# end

locked.gemspec

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
$:.push File.expand_path("../lib", __FILE__)
2+
3+
# Maintain your gem's version:
4+
require "locked/version"
5+
6+
# Describe your gem and declare its dependencies:
7+
Gem::Specification.new do |s|
8+
s.name = "locked"
9+
s.version = Locked::VERSION
10+
s.authors = ["TODO: Your name"]
11+
s.email = ["TODO: Your email"]
12+
s.homepage = "TODO"
13+
s.summary = "TODO: Summary of Locked."
14+
s.description = "TODO: Description of Locked."
15+
16+
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
17+
s.test_files = Dir["test/**/*"]
18+
19+
s.add_dependency "rails", "~> 3.1.1"
20+
21+
s.add_development_dependency "sqlite3"
22+
end

test/acts_as_locked_test.rb

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
require 'test_helper'
2+
3+
class ActsAsLockedTest < Test::Unit::TestCase
4+
end

test/core_ext_test.rb

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require 'test_helper'
2+
3+
class CoreExtTest < Test::Unit::TestCase
4+
def test_to_squawk_prepends_the_word_squawk
5+
assert_equal "squawk! Hello World", "Hello World".to_squawk
6+
end
7+
end

test/dummy/Rakefile

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env rake
2+
# Add your own tasks in files placed in lib/tasks ending in .rake,
3+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4+
5+
require File.expand_path('../config/application', __FILE__)
6+
7+
Dummy::Application.load_tasks
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// This is a manifest file that'll be compiled into including all the files listed below.
2+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3+
// be included in the compiled file accessible from http://example.com/assets/application.js
4+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5+
// the compiled file.
6+
//
7+
//= require jquery
8+
//= require jquery_ujs
9+
//= require_tree .
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
* This is a manifest file that'll automatically include all the stylesheets available in this directory
3+
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4+
* the top of the compiled file, but it's generally better to create a new file per style scope.
5+
*= require_self
6+
*= require_tree .
7+
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class ApplicationController < ActionController::Base
2+
protect_from_forgery
3+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module ApplicationHelper
2+
end

test/dummy/app/mailers/.gitkeep

Whitespace-only changes.

test/dummy/app/models/.gitkeep

Whitespace-only changes.

test/dummy/app/models/hickwall.rb

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class Hickwall < ActiveRecord::Base
2+
acts_as_locked
3+
end

test/dummy/app/models/wickwall.rb

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class Wickwall < ActiveRecord::Base
2+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Dummy</title>
5+
<%= stylesheet_link_tag "application" %>
6+
<%= javascript_include_tag "application" %>
7+
<%= csrf_meta_tags %>
8+
</head>
9+
<body>
10+
11+
<%= yield %>
12+
13+
</body>
14+
</html>

test/dummy/config.ru

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# This file is used by Rack-based servers to start the application.
2+
3+
require ::File.expand_path('../config/environment', __FILE__)
4+
run Dummy::Application

test/dummy/config/application.rb

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
require File.expand_path('../boot', __FILE__)
2+
3+
require 'rails/all'
4+
5+
Bundler.require
6+
require "locked"
7+
8+
module Dummy
9+
class Application < Rails::Application
10+
# Settings in config/environments/* take precedence over those specified here.
11+
# Application configuration should go into files in config/initializers
12+
# -- all .rb files in that directory are automatically loaded.
13+
14+
# Custom directories with classes and modules you want to be autoloadable.
15+
# config.autoload_paths += %W(#{config.root}/extras)
16+
17+
# Only load the plugins named here, in the order given (default is alphabetical).
18+
# :all can be used as a placeholder for all plugins not explicitly named.
19+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
20+
21+
# Activate observers that should always be running.
22+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
23+
24+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
25+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
26+
# config.time_zone = 'Central Time (US & Canada)'
27+
28+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
29+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
30+
# config.i18n.default_locale = :de
31+
32+
# Configure the default encoding used in templates for Ruby 1.9.
33+
config.encoding = "utf-8"
34+
35+
# Configure sensitive parameters which will be filtered from the log file.
36+
config.filter_parameters += [:password]
37+
38+
# Enable the asset pipeline
39+
config.assets.enabled = true
40+
41+
# Version of your assets, change this if you want to expire all your assets
42+
config.assets.version = '1.0'
43+
end
44+
end
45+

test/dummy/config/boot.rb

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
require 'rubygems'
2+
gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3+
4+
if File.exist?(gemfile)
5+
ENV['BUNDLE_GEMFILE'] = gemfile
6+
require 'bundler'
7+
Bundler.setup
8+
end
9+
10+
$:.unshift File.expand_path('../../../../lib', __FILE__)

0 commit comments

Comments
 (0)