wcc-base 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +34 -0
- data/Rakefile +1 -0
- data/lib/tasks/db/mysql.rake +29 -0
- data/lib/tasks/db/psql.rake +42 -0
- data/lib/tasks/db.rake +29 -0
- data/lib/wcc/rails/railties.rb +13 -0
- data/lib/wcc/rails.rb +2 -0
- data/lib/wcc/version.rb +3 -0
- data/lib/wcc.rb +6 -0
- data/wcc-base.gemspec +23 -0
- metadata +94 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 114acf79a911eff1823b7c97df2be1cbaa9f2ef5
|
4
|
+
data.tar.gz: 1a64dd498da26937836580bc37d429a9cf9de70e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 10675d943646e1f201579c9859c87fd0fa6ad07934aefe9e3887e2280a8a794eac9e29b1b3a4ab9754bcf53fe0cecdf3532709a339e571a437fecdea566eb363
|
7
|
+
data.tar.gz: 394a8ad6a312262a9200f925409cbcac6a3a5f12fd9a5ddcd13e9d874da0f721441947901d6b4c0082eab00ab36bf54789d7b7f02af058b9dbf87afddbe4efbf
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Watermark Community Church
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# WCC
|
2
|
+
|
3
|
+
This gem holds the base namespace and default configuration for
|
4
|
+
Watermark Community Church's Ruby development. This is kind of the
|
5
|
+
general repository for common code between different apps. As components
|
6
|
+
begin to emerge in this code base they should be extracted into a
|
7
|
+
separate gem. This should be a breeding ground for new gems.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
gem 'wcc'
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install wcc
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
No specific usage instructions. Check out one of the apps to see
|
26
|
+
example usages.
|
27
|
+
|
28
|
+
## Contributing
|
29
|
+
|
30
|
+
1. Fork it
|
31
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
32
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
33
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
34
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
namespace :db do
|
2
|
+
|
3
|
+
desc 'Dump the database to the specified file'
|
4
|
+
task :dump, :file do |t, args|
|
5
|
+
raise "file argument required" unless args[:file]
|
6
|
+
db_config = WCC::RakeHelpers.db_config
|
7
|
+
command = [
|
8
|
+
"mysqldump",
|
9
|
+
"--user=#{db_config['username']}",
|
10
|
+
"--password=#{db_config['password']}",
|
11
|
+
"#{db_config['database']}",
|
12
|
+
"> #{args[:file]}"
|
13
|
+
]
|
14
|
+
WCC::RakeHelpers.db_cmd_with_password(command)
|
15
|
+
end
|
16
|
+
|
17
|
+
desc 'Restore the datbase from the specified file'
|
18
|
+
task :restore, :file do |t, args|
|
19
|
+
raise "file argument required" unless File.exists?(args[:file])
|
20
|
+
db_config = WCC::RakeHelpers.db_config
|
21
|
+
command = [
|
22
|
+
"cat #{args[:file]} | mysql --user=#{db_config['username']} --password=#{db_config['password']}",
|
23
|
+
db_config['database'],
|
24
|
+
].join(" ")
|
25
|
+
`#{command}`
|
26
|
+
end
|
27
|
+
|
28
|
+
end if WCC::RakeHelpers.mysql?
|
29
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
namespace :db do
|
2
|
+
|
3
|
+
desc 'Drop connections to the pg database'
|
4
|
+
task :drop_pg_connections => :environment do
|
5
|
+
ActiveRecord::Base.connection.execute %{
|
6
|
+
SELECT
|
7
|
+
pg_terminate_backend(pid)
|
8
|
+
FROM
|
9
|
+
pg_stat_activity
|
10
|
+
WHERE -- don't kill my own connection!
|
11
|
+
datname = '#{WCC::RakeHelpers.db_config['database']}' AND
|
12
|
+
pid <> pg_backend_pid();
|
13
|
+
}
|
14
|
+
end
|
15
|
+
Rake::Task['db:drop'].enhance ['db:drop_pg_connections']
|
16
|
+
|
17
|
+
desc 'Dump the pg database to the specified file'
|
18
|
+
task :dump, :file do |t, args|
|
19
|
+
raise "file argument required" unless args[:file]
|
20
|
+
db_config = WCC::RakeHelpers.db_config
|
21
|
+
command = [
|
22
|
+
"pg_dump",
|
23
|
+
"--username=#{db_config['username']}",
|
24
|
+
"--host=#{db_config['host']}",
|
25
|
+
"#{db_config['database']}",
|
26
|
+
"> #{args[:file]}"
|
27
|
+
]
|
28
|
+
WCC::RakeHelpers.db_cmd_with_password(command, db_config['password'])
|
29
|
+
end
|
30
|
+
|
31
|
+
desc 'Restore the pg datbase from the specified file'
|
32
|
+
task :restore, :file do |t, args|
|
33
|
+
raise "file argument required" unless File.exists?(args[:file])
|
34
|
+
command = [
|
35
|
+
"cat #{args[:file]} | psql",
|
36
|
+
WCC::RakeHelpers.db_config['database'],
|
37
|
+
].join(" ")
|
38
|
+
`#{command}`
|
39
|
+
end
|
40
|
+
|
41
|
+
end if WCC::RakeHelpers.postgresql?
|
42
|
+
|
data/lib/tasks/db.rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
module WCC
|
2
|
+
module RakeHelpers
|
3
|
+
|
4
|
+
def self.db_config
|
5
|
+
@config ||= YAML.load_file("config/database.yml")[ENV['RAILS_ENV'] || 'development'] || {}
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.db_cmd_with_password(cmd, pw)
|
9
|
+
`PGPASSWORD="#{pw}" #{cmd.join(" ")}`
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.postgresql?
|
13
|
+
db_config["adapter"] == "postgresql"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.mysql?
|
17
|
+
db_config["adapter"] == "mysql"
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
namespace :db do
|
24
|
+
|
25
|
+
desc "Drops, creates, migrates, seeds dev DB and prepares test DB"
|
26
|
+
task :rebuild => ["db:drop", "db:create", "db:migrate", "db:seed", "db:test:prepare"]
|
27
|
+
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class WCC::Railties < Rails::Railtie
|
2
|
+
initializer 'wcc.configure_rails_init' do
|
3
|
+
ActiveSupport::Inflector.inflections(:en) do |inflect|
|
4
|
+
inflect.acronym 'WCC'
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
rake_tasks do
|
9
|
+
Dir.glob(File.join(WCC::BASE_GEM_LIB_PATH, "tasks", "**", "*.rake")).sort.each do |rake|
|
10
|
+
load rake
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/wcc/rails.rb
ADDED
data/lib/wcc/version.rb
ADDED
data/lib/wcc.rb
ADDED
data/wcc-base.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'wcc/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "wcc-base"
|
8
|
+
spec.version = WCC::VERSION
|
9
|
+
spec.authors = ["Watermark Community Church"]
|
10
|
+
spec.email = ["dev@watermark.org"]
|
11
|
+
spec.description = %q{Repository for generic common code in Watermark Community Church applications}
|
12
|
+
spec.summary = File.readlines("README.md").join
|
13
|
+
spec.homepage = "https://github.com/watermarkchurch/wcc"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: wcc-base
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Watermark Community Church
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Repository for generic common code in Watermark Community Church applications
|
42
|
+
email:
|
43
|
+
- dev@watermark.org
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- lib/tasks/db.rake
|
54
|
+
- lib/tasks/db/mysql.rake
|
55
|
+
- lib/tasks/db/psql.rake
|
56
|
+
- lib/wcc.rb
|
57
|
+
- lib/wcc/rails.rb
|
58
|
+
- lib/wcc/rails/railties.rb
|
59
|
+
- lib/wcc/version.rb
|
60
|
+
- wcc-base.gemspec
|
61
|
+
homepage: https://github.com/watermarkchurch/wcc
|
62
|
+
licenses:
|
63
|
+
- MIT
|
64
|
+
metadata: {}
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 2.2.2
|
82
|
+
signing_key:
|
83
|
+
specification_version: 4
|
84
|
+
summary: "# WCC This gem holds the base namespace and default configuration for Watermark
|
85
|
+
Community Church's Ruby development. This is kind of the general repository for
|
86
|
+
common code between different apps. As components begin to emerge in this code base
|
87
|
+
they should be extracted into a separate gem. This should be a breeding ground for
|
88
|
+
new gems. ## Installation Add this line to your application's Gemfile: gem 'wcc'
|
89
|
+
\ And then execute: $ bundle Or install it yourself as: $ gem install wcc ##
|
90
|
+
Usage No specific usage instructions. Check out one of the apps to see example
|
91
|
+
usages. ## Contributing 1. Fork it 2. Create your feature branch (`git checkout
|
92
|
+
-b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`)
|
93
|
+
4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request"
|
94
|
+
test_files: []
|