heartwood 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +28 -0
- data/.ruby-version +1 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +4 -0
- data/Rakefile +20 -0
- data/app/controllers/cambium/base_controller.rb +3 -0
- data/app/models/concerns/idx.rb +28 -0
- data/app/models/concerns/image_cropper.rb +24 -0
- data/app/models/concerns/publishable.rb +57 -0
- data/app/models/concerns/slug.rb +56 -0
- data/app/models/concerns/tags.rb +33 -0
- data/bin/rails +12 -0
- data/config/routes.rb +2 -0
- data/heartwood.gemspec +43 -0
- data/lib/generators/cambium/app_generator.rb +205 -0
- data/lib/generators/cambium/controller_generator.rb +81 -0
- data/lib/generators/cambium/gemfile_generator.rb +36 -0
- data/lib/generators/cambium/install_generator.rb +19 -0
- data/lib/generators/cambium/user_generator.rb +40 -0
- data/lib/generators/helpers/_autoloader.rb +12 -0
- data/lib/generators/helpers/generators_helper.rb +235 -0
- data/lib/generators/templates/Gemfile.erb +78 -0
- data/lib/generators/templates/app/assets/javascripts/application.js.coffee +24 -0
- data/lib/generators/templates/app/assets/javascripts/routers/router.js.coffee +23 -0
- data/lib/generators/templates/app/assets/javascripts/templates/.keep +0 -0
- data/lib/generators/templates/app/assets/javascripts/views/default_helpers.js.coffee +16 -0
- data/lib/generators/templates/app/assets/stylesheets/admin/admin.scss +3 -0
- data/lib/generators/templates/app/assets/stylesheets/application.scss +9 -0
- data/lib/generators/templates/app/controllers/admin/controller.rb.erb +2 -0
- data/lib/generators/templates/app/controllers/application_controller.rb +11 -0
- data/lib/generators/templates/app/models/user.rb +14 -0
- data/lib/generators/templates/app/views/application/_status.html.erb +3 -0
- data/lib/generators/templates/app/views/home/index.html.erb +7 -0
- data/lib/generators/templates/app/views/layouts/application.html.erb +24 -0
- data/lib/generators/templates/config/application.rb +17 -0
- data/lib/generators/templates/config/initializers/_hash.rb +23 -0
- data/lib/generators/templates/config/initializers/_settings.rb +18 -0
- data/lib/generators/templates/config/initializers/assets.rb +3 -0
- data/lib/generators/templates/config/initializers/heartwood.rb +25 -0
- data/lib/generators/templates/config/private.yml +16 -0
- data/lib/generators/templates/config/routes.rb +54 -0
- data/lib/generators/templates/config/settings.yml +16 -0
- data/lib/generators/templates/db/seeds.rb +25 -0
- data/lib/generators/templates/gitignore +30 -0
- data/lib/heartwood/configuration.rb +29 -0
- data/lib/heartwood/engine.rb +28 -0
- data/lib/heartwood/support/array.rb +9 -0
- data/lib/heartwood/support/false_class.rb +9 -0
- data/lib/heartwood/support/fixnum.rb +13 -0
- data/lib/heartwood/support/float.rb +5 -0
- data/lib/heartwood/support/hash.rb +22 -0
- data/lib/heartwood/support/nil_class.rb +19 -0
- data/lib/heartwood/support/string.rb +28 -0
- data/lib/heartwood/support/true_class.rb +9 -0
- data/lib/heartwood/version.rb +3 -0
- data/lib/heartwood.rb +11 -0
- data/lib/help/heartwood_prereqs.txt +13 -0
- data/lib/help/pg_search_post_install.txt +13 -0
- data/lib/tasks/db.rake +22 -0
- data/lib/tasks/rename.rake +28 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config/application.rb +32 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/heartwood_development.sqlite3 +0 -0
- data/spec/dummy/db/heartwood_test.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +15 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/log/development.log +78 -0
- data/spec/dummy/log/test.log +3050 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/1i/1ii3yPGPbB0S_BkYiwVDC7qlKvhKF5P0zr7QiaTpgV4.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/5L/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/7k/7kqdQ5LCh-fs6HP4CUqWvk9w7HRuj6ZT_zkC-hUUMHU.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/8M/8Mpbgok-UsQPhrJQKqd6hVtQogD8YuU6GMn-2KVhC3E.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Au/AuOTcA4Uen3sMQjy8Mi6nooP_8gMgvlFsjqr8mHpMIs.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/FG/FGeBOdRSmza-XfWb8ERFQydMrExKmdlz2_eksYO3y4Q.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/MB/MBqa7cQSBGYszhtbC7r7yiDA0gjwriFrAaNiQnMbfFw.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ML/MLT6NKtdybeBwpm6H1d7XzkomTyZnMge5E8EEQkhtrc.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/OI/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/R2/R2IjUuzOFtsZdvjOQOrasVwjaCegvj-lE6jkTQFL9xs.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/WB/WB2XiMJ4O7--cvm29FJ4zeUyMpU15sqdYtfduF0YeT0.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/YT/YTDOaZ9qOx03chcaLrJy-Ch0Rtn4Nik102vwxZ2a-k8.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/aB/aBAdNO31MRRIPsReAdfHmtSFswygiBIFctx6fBhTTdc.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/fK/fKCgrNQR1G7Gf6VTItx7NTaKXquuw-ufNT5nGlxvBV4.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/hZ/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/hr/hrKDaC8EYPX0veGxFTXgYt7IynAdYyeBjYjzcPazQkk.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/i4/i4-E3GFC6rOjx1w5H9W14IbdPm4ouzkqixHmsK27kmo.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/jE/jEmEy4r1QfD5kzXcHSPcAaAgBwet1M0ZIWQuzyT9TXw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/l7/l7FREFh3W4tfuo0mF7DdkXKth9VT4R2hiiiq0KS4xpI.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/o8/o8getMbwHiM68k4uUk4shsyjKnDbV_hmifAWyvO-E50.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/pE/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/wA/wAjBFweHcRdsYa4zx9mayhvC0RDVqaI5gM0LcoCv7a4.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xW/xWmlGxKNxc1ViyjTyokcbCu6WjNIGDIqPVPXsBwdveA.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zP/zPn9M5I_yf8ko0-lpbDwTWjG6wpRvXkA77hDUPzAFZ8.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zd/zd90ZPTG89ScoQQ_PzPAAe2669wzpdyZuzn7qmr9e3s.cache +0 -0
- data/spec/lib/support/array_spec.rb +14 -0
- data/spec/lib/support/false_class_spec.rb +17 -0
- data/spec/lib/support/fixnum_spec.rb +23 -0
- data/spec/lib/support/float_spec.rb +18 -0
- data/spec/lib/support/hash_spec.rb +21 -0
- data/spec/lib/support/nil_class_spec.rb +23 -0
- data/spec/lib/support/string_spec.rb +44 -0
- data/spec/lib/support/true_class_spec.rb +17 -0
- data/spec/rails_helper.rb +183 -0
- data/spec/spec_helper.rb +99 -0
- data/vendor/assets/javascripts/backbone.js +1920 -0
- data/vendor/assets/javascripts/modernizr.js +4 -0
- data/vendor/assets/javascripts/underscore.js +1548 -0
- data/vendor/assets/stylesheets/normalize.scss +406 -0
- metadata +425 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
|
3
|
+
# --- Heartwood's Routes ---
|
4
|
+
#
|
5
|
+
# The following are Heartwood's default routes. Feel free to
|
6
|
+
# customize (or delete) these to fit your needs.
|
7
|
+
#
|
8
|
+
# ------------------------------------------ Users (Devise)
|
9
|
+
#
|
10
|
+
# Learn more about Devise at https://github.com/plataformatec/devise
|
11
|
+
#
|
12
|
+
devise_for :users, :skip => [:sessions, :registrations]
|
13
|
+
devise_scope :user do
|
14
|
+
get '/login' => 'devise/sessions#new', :as => :new_user_session
|
15
|
+
post '/login' => 'devise/sessions#create', :as => :user_session
|
16
|
+
get '/logout' => 'devise/sessions#destroy', :as => :destroy_user_session
|
17
|
+
end
|
18
|
+
#
|
19
|
+
# ------------------------------------------ Admin
|
20
|
+
#
|
21
|
+
# Heartwood already namespaces all its own routes, so it's
|
22
|
+
# best to just mount it at the root. This is the base
|
23
|
+
# setup if you are using Heartwood's CMS
|
24
|
+
#
|
25
|
+
mount Heartwood::Engine => '/'
|
26
|
+
#
|
27
|
+
# ------------------------------------------ JSON
|
28
|
+
#
|
29
|
+
# If you plan to use any public json routes, it's good to
|
30
|
+
# nest them in their own scope. We use a scope instead of
|
31
|
+
# a namespace because a controller action can have routes
|
32
|
+
# to it in different formats, so namespacing is
|
33
|
+
# unecessary.
|
34
|
+
#
|
35
|
+
# scope 'json' do
|
36
|
+
# 'users' => 'users#index'
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
# ------------------------------------------ Public
|
40
|
+
#
|
41
|
+
# After we define all namespaced routes, we can move on to
|
42
|
+
# those routes that are not namespaced.
|
43
|
+
#
|
44
|
+
# resources :users
|
45
|
+
#
|
46
|
+
# ------------------------------------------ Home Page
|
47
|
+
#
|
48
|
+
# This is your application's home page. Feel free to
|
49
|
+
# delete the home controller and change this if you want a
|
50
|
+
# different home page.
|
51
|
+
#
|
52
|
+
root :to => 'home#index'
|
53
|
+
|
54
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#
|
2
|
+
# This file is for storing NON-SENSITIVE settings.
|
3
|
+
#
|
4
|
+
# Values here are accessible through a recursive `Settings`
|
5
|
+
# OpenStruct. For example, you can access "ABC123" using the
|
6
|
+
# example below through Setting.say.hello
|
7
|
+
#
|
8
|
+
development: &default
|
9
|
+
say:
|
10
|
+
hello: "Hello"
|
11
|
+
|
12
|
+
test:
|
13
|
+
<<: *default
|
14
|
+
|
15
|
+
production:
|
16
|
+
<<: *default
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'csv'
|
2
|
+
Dir.glob("#{Rails.root}/app/models/*.rb").each { |file| require file }
|
3
|
+
|
4
|
+
ActiveRecord::Base.descendants.each do |model|
|
5
|
+
filename = "#{Rails.root}/db/csv/#{model.to_s.tableize}.csv"
|
6
|
+
if File.exist?(filename)
|
7
|
+
CSV.foreach(filename, :headers => true) do |row|
|
8
|
+
attrs = {}
|
9
|
+
row.to_hash.each do |k,v|
|
10
|
+
if k =~ /.*\:file/
|
11
|
+
unless v.blank?
|
12
|
+
attrs[k.split(':')[0]] = File.open("#{Rails.root}/lib/assets/seeds/#{v}")
|
13
|
+
end
|
14
|
+
else
|
15
|
+
attrs[k] = v
|
16
|
+
end
|
17
|
+
end
|
18
|
+
item = model.create!(attrs.to_hash.symbolize_keys)
|
19
|
+
puts "CREATED #{model.to_s.upcase} >> #{model.to_s} ##{item.id}"
|
20
|
+
end
|
21
|
+
if ActiveRecord::Base.connection.adapter_name == 'PostgreSQL'
|
22
|
+
ActiveRecord::Base.connection.reset_pk_sequence!(model.to_s.tableize)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
6
|
+
|
7
|
+
# Ignore bundler config.
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
# Ignore the default SQLite database.
|
11
|
+
/db/*.sqlite3
|
12
|
+
/db/*.sqlite3-journal
|
13
|
+
|
14
|
+
# Ignore all logfiles and tempfiles.
|
15
|
+
/log/*.log
|
16
|
+
/tmp
|
17
|
+
sass-cache
|
18
|
+
esproj
|
19
|
+
|
20
|
+
# Sensitive Data
|
21
|
+
config/database.yml
|
22
|
+
config/private.yml
|
23
|
+
|
24
|
+
# Public Uploads
|
25
|
+
public/uploads/
|
26
|
+
public/files/
|
27
|
+
public/media/
|
28
|
+
|
29
|
+
# Stupid Files
|
30
|
+
*.DS_Store
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Heartwood
|
2
|
+
class Configuration
|
3
|
+
|
4
|
+
attr_accessor :app_title,
|
5
|
+
:cache_pages,
|
6
|
+
:development_url,
|
7
|
+
:production_url
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@app_title = 'Heartwood'
|
11
|
+
@cache_pages = false
|
12
|
+
@development_url = 'localhost:3000'
|
13
|
+
@production_url = 'example.com'
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.configuration
|
19
|
+
@configuration ||= Configuration.new
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.configuration=(config)
|
23
|
+
@configuration = config
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.configure
|
27
|
+
yield configuration
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'rails'
|
2
|
+
|
3
|
+
module Heartwood
|
4
|
+
class Engine < ::Rails::Engine
|
5
|
+
|
6
|
+
isolate_namespace Heartwood
|
7
|
+
|
8
|
+
config.generators do |g|
|
9
|
+
g.test_framework :rspec, :fixture => false
|
10
|
+
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
|
11
|
+
g.assets false
|
12
|
+
g.helper false
|
13
|
+
end
|
14
|
+
|
15
|
+
initializer :append_migrations do |app|
|
16
|
+
unless app.root.to_s.match root.to_s
|
17
|
+
config.paths["db/migrate"].expanded.each do |expanded_path|
|
18
|
+
app.config.paths["db/migrate"] << expanded_path
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def root
|
24
|
+
@root ||= Gem::Specification.find_by_name('heartwood').gem_dir.to_s
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class Hash
|
2
|
+
|
3
|
+
def to_ostruct
|
4
|
+
convert_to_ostruct_recursive(self)
|
5
|
+
end
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
def convert_to_ostruct_recursive(result)
|
10
|
+
if result.is_a? Hash
|
11
|
+
result = result.dup.symbolize_keys
|
12
|
+
result.each do |key, val|
|
13
|
+
result[key] = convert_to_ostruct_recursive(val)
|
14
|
+
end
|
15
|
+
result = OpenStruct.new(result)
|
16
|
+
elsif result.is_a? Array
|
17
|
+
result = result.map { |r| convert_to_ostruct_recursive(r) }
|
18
|
+
end
|
19
|
+
result
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class String
|
2
|
+
def to_bool
|
3
|
+
return true if self == true || self =~ (/^(true|t|yes|y|1)$/i)
|
4
|
+
return false if self == false || self.blank? || self =~ (/^(false|f|no|n|0)$/i)
|
5
|
+
raise ArgumentError.new("invalid value for Boolean: \"#{self}\"")
|
6
|
+
end
|
7
|
+
|
8
|
+
def possessive
|
9
|
+
self + ('s' == self[-1, 1] ? "'" : "'s")
|
10
|
+
end
|
11
|
+
|
12
|
+
def paragraphs
|
13
|
+
pattern = /\n/
|
14
|
+
split(pattern).map(&:strip).reject(&:blank?)
|
15
|
+
end
|
16
|
+
|
17
|
+
def sentences
|
18
|
+
pattern = /[\.\?\!]/
|
19
|
+
punctuation = scan(pattern)
|
20
|
+
sentences = split(pattern).map(&:strip).reject(&:blank?)
|
21
|
+
return sentences if punctuation.blank?
|
22
|
+
sentences.each_with_index do |txt, idx|
|
23
|
+
next if punctuation[idx].blank?
|
24
|
+
sentences[idx] += punctuation[idx]
|
25
|
+
end
|
26
|
+
sentences
|
27
|
+
end
|
28
|
+
end
|
data/lib/heartwood.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'heartwood/version'
|
2
|
+
require 'heartwood/configuration'
|
3
|
+
|
4
|
+
support_files = "#{File.expand_path('../heartwood/support', __FILE__)}/*.rb"
|
5
|
+
Dir.glob(support_files).each do |file|
|
6
|
+
require "heartwood/support/#{File.basename(file)}"
|
7
|
+
end
|
8
|
+
|
9
|
+
module Heartwood
|
10
|
+
require 'heartwood/engine' if defined?(Rails)
|
11
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
==================== WARNING! ====================
|
3
|
+
|
4
|
+
No config file found. Please run:
|
5
|
+
|
6
|
+
rails g heartwood:install
|
7
|
+
|
8
|
+
Before running this generator. If you wish to
|
9
|
+
skip this config check, you can run:
|
10
|
+
|
11
|
+
rails g heartwood:install --no-config-check
|
12
|
+
|
13
|
+
==================================================
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
==================== PG SEARCH ====================
|
3
|
+
|
4
|
+
Add the following to each model that you would like
|
5
|
+
to be searchable:
|
6
|
+
|
7
|
+
include PgSearch
|
8
|
+
multisearchable :against => [:title, :author]
|
9
|
+
|
10
|
+
where :title and :author are the attributes you
|
11
|
+
wish to be searched
|
12
|
+
|
13
|
+
==================================================
|
data/lib/tasks/db.rake
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
namespace :db do
|
2
|
+
|
3
|
+
namespace :seed do
|
4
|
+
|
5
|
+
desc "Create CSV files from models"
|
6
|
+
task :create_files => :environment do
|
7
|
+
Dir.glob("#{Rails.root}/app/models/*.rb").each { |file| require file }
|
8
|
+
dir = "#{Rails.root}/db/csv"
|
9
|
+
FileUtils.mkdir(dir) unless File.exists?(dir)
|
10
|
+
ActiveRecord::Base.descendants.each do |model|
|
11
|
+
unless File.exists?("#{dir}/#{model.to_s.tableize}.csv")
|
12
|
+
File.open("#{dir}/#{model.to_s.tableize}.csv", 'w+') do |f|
|
13
|
+
f.write(model.columns.collect(&:name).join(','))
|
14
|
+
end
|
15
|
+
puts "CREATED FILE >> #{model.to_s.tableize}.csv"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
namespace :rename do
|
2
|
+
|
3
|
+
desc 'Rename Rails App'
|
4
|
+
task :app, [:new_name] do |t, args|
|
5
|
+
filenames = [
|
6
|
+
'Rakefile',
|
7
|
+
'app/views/layouts/admin.html.erb',
|
8
|
+
'app/views/layouts/application.html.erb',
|
9
|
+
'app/views/layouts/devise.html.erb',
|
10
|
+
'config/application.rb',
|
11
|
+
'config/environment.rb',
|
12
|
+
'config/routes.rb',
|
13
|
+
'config/environments/development.rb',
|
14
|
+
'config/environments/test.rb',
|
15
|
+
'config/environments/production.rb',
|
16
|
+
'config/initializers/secret_token.rb',
|
17
|
+
'config/initializers/session_store.rb',
|
18
|
+
]
|
19
|
+
filenames.each do |filename|
|
20
|
+
text = File.read(filename)
|
21
|
+
File.open(filename, "w") do |file|
|
22
|
+
file << text.gsub(/Roots/, args[:new_name])
|
23
|
+
end
|
24
|
+
puts "CHECKED FILE >> #{filename}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/spec/dummy/Rakefile
ADDED
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/spec/dummy/bin/rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
+
|
7
|
+
Dir.chdir APP_ROOT do
|
8
|
+
# This script is a starting point to setup your application.
|
9
|
+
# Add necessary setup steps to this file:
|
10
|
+
|
11
|
+
puts "== Installing dependencies =="
|
12
|
+
system "gem install bundler --conservative"
|
13
|
+
system "bundle check || bundle install"
|
14
|
+
|
15
|
+
# puts "\n== Copying sample files =="
|
16
|
+
# unless File.exist?("config/database.yml")
|
17
|
+
# system "cp config/database.yml.sample config/database.yml"
|
18
|
+
# end
|
19
|
+
|
20
|
+
puts "\n== Preparing database =="
|
21
|
+
system "bin/rake db:setup"
|
22
|
+
|
23
|
+
puts "\n== Removing old logs and tempfiles =="
|
24
|
+
system "rm -f log/*"
|
25
|
+
system "rm -rf tmp/cache"
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system "touch tmp/restart.txt"
|
29
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
# Pick the frameworks you want:
|
4
|
+
require "active_record/railtie"
|
5
|
+
require "action_controller/railtie"
|
6
|
+
require "action_mailer/railtie"
|
7
|
+
require "action_view/railtie"
|
8
|
+
require "sprockets/railtie"
|
9
|
+
# require "rails/test_unit/railtie"
|
10
|
+
|
11
|
+
Bundler.require(*Rails.groups)
|
12
|
+
require "heartwood"
|
13
|
+
|
14
|
+
module Dummy
|
15
|
+
class Application < Rails::Application
|
16
|
+
# Settings in config/environments/* take precedence over those specified here.
|
17
|
+
# Application configuration should go into files in config/initializers
|
18
|
+
# -- all .rb files in that directory are automatically loaded.
|
19
|
+
|
20
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
21
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
22
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
23
|
+
|
24
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
25
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
26
|
+
# config.i18n.default_locale = :de
|
27
|
+
|
28
|
+
# Do not swallow errors in after_commit/after_rollback callbacks.
|
29
|
+
config.active_record.raise_in_transactional_callbacks = true
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem 'sqlite3'
|
6
|
+
#
|
7
|
+
default: &default
|
8
|
+
adapter: sqlite3
|
9
|
+
pool: 5
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
development:
|
13
|
+
<<: *default
|
14
|
+
database: db/heartwood_development.sqlite3
|
15
|
+
|
16
|
+
# Warning: The database defined as "test" will be erased and
|
17
|
+
# re-generated from your development database when you run "rake".
|
18
|
+
# Do not set this db to the same as development or production.
|
19
|
+
test:
|
20
|
+
<<: *default
|
21
|
+
database: db/heartwood_test.sqlite3
|
22
|
+
|
23
|
+
production:
|
24
|
+
<<: *default
|
25
|
+
database: db/heartwood_production.sqlite3
|