cadenero 0.0.1 → 0.0.2.a
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.
- data/MIT-LICENSE +2 -2
- data/README.md +3 -0
- data/app/models/cadenero/v1/account.rb +1 -1
- data/db/migrate/20130612061604_create_cadenero_v1_accounts.rb +2 -0
- data/db/seeds.rb +2 -0
- data/lib/cadenero/version.rb +2 -2
- data/lib/generators/cadenero/install/templates/initializer.rb +16 -0
- data/lib/generators/cadenero/install_generator.rb +143 -0
- data/spec/controllers/cadenero/v1/accounts_controller_spec.rb +25 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +2 -0
- data/spec/dummy/config/application.rb +63 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +14 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +39 -0
- data/spec/dummy/config/environments/production.rb +69 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/cadenero.rb +0 -0
- data/spec/dummy/config/initializers/secret_token.rb +19 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +13 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/schema.rb +45 -0
- data/spec/dummy/log/development.log +94 -0
- data/spec/dummy/log/test.log +8934 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/spec/spec_helper.rb +38 -0
- data/spec/dummy/tmp/ember-rails/ember-data.js +8886 -0
- data/spec/dummy/tmp/ember-rails/ember.js +29953 -0
- data/spec/features/accounts/sign_up_spec.rb +32 -0
- data/spec/features/cadenero/account_spec.rb +24 -0
- data/spec/features/users/sign_in_spec.rb +63 -0
- data/spec/features/users/sign_up_spec.rb +26 -0
- data/spec/generators/install_generator_spec.rb +56 -0
- data/spec/models/cadenero/account_spec.rb +7 -0
- data/spec/models/cadenero/member_spec.rb +7 -0
- data/spec/models/cadenero/user_spec.rb +7 -0
- data/spec/spec_helper.rb +77 -0
- data/spec/support/factories/account_factory.rb +15 -0
- data/spec/support/factories/user_factory.rb +6 -0
- data/spec/support/generator_macros.rb +29 -0
- data/spec/support/subdomain_helpers.rb +8 -0
- metadata +93 -9
- data/db/migrate/20130612093908_add_authentication_token_to_accounts.rb +0 -6
data/MIT-LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright 2013
|
1
|
+
Copyright 2013 Manuel Vidaurre @mvidaurre AgilTec Soluciones
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
@@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
17
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
18
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
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.
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -38,6 +38,9 @@ v1_user_sign_up POST /v1/sign_up(.:format) cadenero/v1/account/users#create
|
|
38
38
|
- [ ] Documatation for all the code
|
39
39
|
- [ ] Examples of use and demo
|
40
40
|
|
41
|
+
### Versions
|
42
|
+
**Cadenero** use [Semantic Versioning 2.0.0](http://semver.org/) the current version is: 0.0.2-alpha meaning MAJOR.MINOR.PATCH format
|
43
|
+
|
41
44
|
### Bug reports
|
42
45
|
|
43
46
|
If you discover a problem with **Cadenero**, we would like to know about it. However, we ask that you please review these guidelines before submitting a bug report:
|
@@ -5,7 +5,7 @@ module Cadenero::V1
|
|
5
5
|
has_many :users, :through => :members
|
6
6
|
|
7
7
|
accepts_nested_attributes_for :owner
|
8
|
-
attr_accessible :name, :subdomain, :owner_attributes
|
8
|
+
attr_accessible :name, :subdomain, :owner_attributes, :owner
|
9
9
|
validates :subdomain, :presence => true, :uniqueness => true
|
10
10
|
|
11
11
|
# Creates an accout and assign the provided [Cadenero::User] as owner to the account
|
@@ -3,10 +3,12 @@ class CreateCadeneroV1Accounts < ActiveRecord::Migration
|
|
3
3
|
create_table :cadenero_accounts do |t|
|
4
4
|
t.string :name
|
5
5
|
t.string :subdomain
|
6
|
+
t.string :authentication_token
|
6
7
|
t.references :owner
|
7
8
|
|
8
9
|
t.timestamps
|
9
10
|
end
|
10
11
|
add_index :cadenero_accounts, :owner_id
|
12
|
+
add_index :cadenero_accounts, :authentication_token
|
11
13
|
end
|
12
14
|
end
|
data/db/seeds.rb
ADDED
data/lib/cadenero/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Cadenero
|
2
|
-
VERSION = "0.0.
|
3
|
-
end
|
2
|
+
VERSION = "0.0.2.a"
|
3
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Cadenero.user_class = "<%= user_class %>"
|
2
|
+
Cadenero.email_from_address = "please-change-me@example.com"
|
3
|
+
# If you do not want to use gravatar for avatars then specify the method to use here:
|
4
|
+
# Cadenero.avatar_user_method = :custom_avatar_url
|
5
|
+
#Cadenero.per_page = <%= Cadenero.per_page.inspect %>
|
6
|
+
|
7
|
+
|
8
|
+
# Rails.application.config.to_prepare do
|
9
|
+
# If you want to change the layout that Cadenero uses, uncomment and customize the next line:
|
10
|
+
# Cadenero::ApplicationController.layout "forem"
|
11
|
+
#
|
12
|
+
# If you want to add your own cancan Abilities to Cadenero, uncomment and customize the next line:
|
13
|
+
# Cadenero::Ability.register_ability(Ability)
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# By default, these lines will use the layout located at app/views/layouts/forem.html.erb in your application.
|
@@ -0,0 +1,143 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
module Cadenero
|
3
|
+
module Generators
|
4
|
+
class InstallGenerator < Rails::Generators::Base
|
5
|
+
class_option "user-class", :type => :string
|
6
|
+
class_option "no-migrate", :type => :boolean
|
7
|
+
class_option "current-user-helper", :type => :string
|
8
|
+
|
9
|
+
source_root File.expand_path("../install/templates", __FILE__)
|
10
|
+
desc "Used to install Cadenero"
|
11
|
+
|
12
|
+
def install_migrations
|
13
|
+
puts "Copying over Cadenero migrations..."
|
14
|
+
Dir.chdir(Rails.root) do
|
15
|
+
`rake cadenero:install:migrations`
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def determine_user_class
|
20
|
+
@user_class = options["user-class"].presence ||
|
21
|
+
ask("What is your user class called? [User]").presence ||
|
22
|
+
'User'
|
23
|
+
end
|
24
|
+
|
25
|
+
def determine_current_user_helper
|
26
|
+
current_user_helper = options["current-user-helper"].presence ||
|
27
|
+
ask("What is the current_user helper called in your app? [current_user]").presence ||
|
28
|
+
:current_user
|
29
|
+
|
30
|
+
puts "Defining cadenero_user method inside ApplicationController..."
|
31
|
+
|
32
|
+
cadenero_user_method = %Q{
|
33
|
+
def cadenero_user
|
34
|
+
#{current_user_helper}
|
35
|
+
end
|
36
|
+
helper_method :cadenero_user
|
37
|
+
|
38
|
+
}
|
39
|
+
|
40
|
+
inject_into_file("#{Rails.root}/app/controllers/application_controller.rb",
|
41
|
+
cadenero_user_method,
|
42
|
+
:after => "ActionController::API\n")
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
def add_cadenero_initializer
|
47
|
+
path = "#{Rails.root}/config/initializers/cadenero.rb"
|
48
|
+
if File.exists?(path)
|
49
|
+
puts "Skipping config/initializers/cadenero.rb creation, as file already exists!"
|
50
|
+
else
|
51
|
+
puts "Adding cadenero initializer (config/initializers/cadenero.rb)..."
|
52
|
+
template "initializer.rb", path
|
53
|
+
require path # Load the configuration per issue #415
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def run_migrations
|
58
|
+
unless options["no-migrate"]
|
59
|
+
puts "Running rake db:migrate"
|
60
|
+
`rake db:migrate`
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def seed_database
|
65
|
+
load "#{Rails.root}/config/initializers/cadenero.rb"
|
66
|
+
unless options["no-migrate"]
|
67
|
+
puts "Creating default cadenero account and owner"
|
68
|
+
Cadenero::Engine.load_seed
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def mount_engine
|
73
|
+
puts "Mounting Cadenero::Engine at \"/\" in config/routes.rb..."
|
74
|
+
insert_into_file("#{Rails.root}/config/routes.rb", :after => /routes.draw.do\n/) do
|
75
|
+
%Q{
|
76
|
+
# This line mounts Cadenero's routes at / by default.
|
77
|
+
# This means, any requests to the / URL of your application will go to Cadenero::V1:Account::DashboardController#index.
|
78
|
+
# If you would like to change where this extension is mounted, simply change the :at option to something different
|
79
|
+
# but that is discourage, the idea is to protect the whole site
|
80
|
+
}
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def finished
|
85
|
+
output = "\n\n" + ("*" * 53)
|
86
|
+
output += %Q{\nDone! Cadenero has been successfully installed. Yaaaaay! He will keep the intoxicated JSON's out
|
87
|
+
|
88
|
+
Here's what happened:\n\n}
|
89
|
+
|
90
|
+
output += step("Cadenero's migrations were copied over into db/migrate.\n")
|
91
|
+
output += step("We created a new migration called AddCadeneroAdminToTable.
|
92
|
+
This creates a new field called \"cadenero_admin\" on your #{user_class} model's table.\n")
|
93
|
+
output += step("A new method called `cadenero_user` was inserted into your ApplicationController.
|
94
|
+
This lets Cadenero know what the current user of your application is.\n")
|
95
|
+
output += step("A new file was created at config/initializers/cadenero.rb
|
96
|
+
This is where you put Cadenero's configuration settings.\n")
|
97
|
+
|
98
|
+
unless options["no-migrate"]
|
99
|
+
output += step("`rake db:migrate` was run, running all the migrations against your database.\n")
|
100
|
+
output += step("Seed forum and topic were loaded into your database.\n")
|
101
|
+
end
|
102
|
+
output += step("The engine was mounted in your config/routes.rb file using this line:
|
103
|
+
|
104
|
+
mount Cadenero::Engine, :at => \"/\"
|
105
|
+
|
106
|
+
If you want to change where the forums are located, just change the \"/forums\" path at the end of this line to whatever you want.")
|
107
|
+
output += %Q{\nAnd finally:
|
108
|
+
|
109
|
+
#{step("We told you that Cadenero has been successfully installed and walked you through the steps.")}}
|
110
|
+
unless defined?(Devise)
|
111
|
+
output += %Q{We have detected you're not using Devise (which is OK with us, really!), so there's one extra step you'll need to do.
|
112
|
+
|
113
|
+
You'll need to define a "sign_in_path" method for Cadenero to use that points to the sign in path for your application. You can set Cadenero.sign_in_path to a String inside config/initializers/cadenero.rb to do this, or you can define it in your config/routes.rb file with a line like this:
|
114
|
+
|
115
|
+
get '/users/sign_in', :to => "users#sign_in"
|
116
|
+
|
117
|
+
Either way, Cadenero needs one of these two things in order to work properly. Please define them!}
|
118
|
+
end
|
119
|
+
output += "\nIf you have any questions, comments or issues, please post them on our issues page: http://github.com/AgilTec/cadenero/issues.\n\n"
|
120
|
+
output += "Thanks for using Cadenero!"
|
121
|
+
puts output
|
122
|
+
end
|
123
|
+
|
124
|
+
private
|
125
|
+
|
126
|
+
def step(words)
|
127
|
+
@step ||= 0
|
128
|
+
@step += 1
|
129
|
+
"#{@step}) #{words}\n"
|
130
|
+
end
|
131
|
+
|
132
|
+
def user_class
|
133
|
+
@user_class
|
134
|
+
end
|
135
|
+
|
136
|
+
def next_migration_number
|
137
|
+
last_migration = Dir[Rails.root + "db/migrate/*.rb"].sort.last.split("/").last
|
138
|
+
current_migration_number = /^(\d+)_/.match(last_migration)[1]
|
139
|
+
current_migration_number.to_i + 1
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Cadenero
|
4
|
+
describe V1::AccountsController do
|
5
|
+
context "creates the account's schema" do
|
6
|
+
|
7
|
+
let!(:account) { stub_model(Cadenero::V1::Account) }
|
8
|
+
|
9
|
+
before do
|
10
|
+
Cadenero::V1::Account.should_receive(:create_with_owner).and_return(account)
|
11
|
+
account.stub :valid? => true
|
12
|
+
controller.stub(:force_authentication!)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should create a schema and ensure a token is returned for the account on successful creation" do
|
16
|
+
account.should_receive(:create_schema)
|
17
|
+
account.should_receive(:ensure_authentication_token!)
|
18
|
+
post :create, account: { name: "First Account", subdomain: "first" }, use_route: :cadenero
|
19
|
+
expect(account.authentication_token).not_to eq nil
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1,261 @@
|
|
1
|
+
== Welcome to Rails
|
2
|
+
|
3
|
+
Rails is a web-application framework that includes everything needed to create
|
4
|
+
database-backed web applications according to the Model-View-Control pattern.
|
5
|
+
|
6
|
+
This pattern splits the view (also called the presentation) into "dumb"
|
7
|
+
templates that are primarily responsible for inserting pre-built data in between
|
8
|
+
HTML tags. The model contains the "smart" domain objects (such as Account,
|
9
|
+
Product, Person, Post) that holds all the business logic and knows how to
|
10
|
+
persist themselves to a database. The controller handles the incoming requests
|
11
|
+
(such as Save New Account, Update Product, Show Post) by manipulating the model
|
12
|
+
and directing data to the view.
|
13
|
+
|
14
|
+
In Rails, the model is handled by what's called an object-relational mapping
|
15
|
+
layer entitled Active Record. This layer allows you to present the data from
|
16
|
+
database rows as objects and embellish these data objects with business logic
|
17
|
+
methods. You can read more about Active Record in
|
18
|
+
link:files/vendor/rails/activerecord/README.html.
|
19
|
+
|
20
|
+
The controller and view are handled by the Action Pack, which handles both
|
21
|
+
layers by its two parts: Action View and Action Controller. These two layers
|
22
|
+
are bundled in a single package due to their heavy interdependence. This is
|
23
|
+
unlike the relationship between the Active Record and Action Pack that is much
|
24
|
+
more separate. Each of these packages can be used independently outside of
|
25
|
+
Rails. You can read more about Action Pack in
|
26
|
+
link:files/vendor/rails/actionpack/README.html.
|
27
|
+
|
28
|
+
|
29
|
+
== Getting Started
|
30
|
+
|
31
|
+
1. At the command prompt, create a new Rails application:
|
32
|
+
<tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
|
33
|
+
|
34
|
+
2. Change directory to <tt>myapp</tt> and start the web server:
|
35
|
+
<tt>cd myapp; rails server</tt> (run with --help for options)
|
36
|
+
|
37
|
+
3. Go to http://localhost:3000/ and you'll see:
|
38
|
+
"Welcome aboard: You're riding Ruby on Rails!"
|
39
|
+
|
40
|
+
4. Follow the guidelines to start developing your application. You can find
|
41
|
+
the following resources handy:
|
42
|
+
|
43
|
+
* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
|
44
|
+
* Ruby on Rails Tutorial Book: http://www.railstutorial.org/
|
45
|
+
|
46
|
+
|
47
|
+
== Debugging Rails
|
48
|
+
|
49
|
+
Sometimes your application goes wrong. Fortunately there are a lot of tools that
|
50
|
+
will help you debug it and get it back on the rails.
|
51
|
+
|
52
|
+
First area to check is the application log files. Have "tail -f" commands
|
53
|
+
running on the server.log and development.log. Rails will automatically display
|
54
|
+
debugging and runtime information to these files. Debugging info will also be
|
55
|
+
shown in the browser on requests from 127.0.0.1.
|
56
|
+
|
57
|
+
You can also log your own messages directly into the log file from your code
|
58
|
+
using the Ruby logger class from inside your controllers. Example:
|
59
|
+
|
60
|
+
class WeblogController < ActionController::Base
|
61
|
+
def destroy
|
62
|
+
@weblog = Weblog.find(params[:id])
|
63
|
+
@weblog.destroy
|
64
|
+
logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
The result will be a message in your log file along the lines of:
|
69
|
+
|
70
|
+
Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
|
71
|
+
|
72
|
+
More information on how to use the logger is at http://www.ruby-doc.org/core/
|
73
|
+
|
74
|
+
Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
|
75
|
+
several books available online as well:
|
76
|
+
|
77
|
+
* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
|
78
|
+
* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
|
79
|
+
|
80
|
+
These two books will bring you up to speed on the Ruby language and also on
|
81
|
+
programming in general.
|
82
|
+
|
83
|
+
|
84
|
+
== Debugger
|
85
|
+
|
86
|
+
Debugger support is available through the debugger command when you start your
|
87
|
+
Mongrel or WEBrick server with --debugger. This means that you can break out of
|
88
|
+
execution at any point in the code, investigate and change the model, and then,
|
89
|
+
resume execution! You need to install ruby-debug to run the server in debugging
|
90
|
+
mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
|
91
|
+
|
92
|
+
class WeblogController < ActionController::Base
|
93
|
+
def index
|
94
|
+
@posts = Post.all
|
95
|
+
debugger
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
So the controller will accept the action, run the first line, then present you
|
100
|
+
with a IRB prompt in the server window. Here you can do things like:
|
101
|
+
|
102
|
+
>> @posts.inspect
|
103
|
+
=> "[#<Post:0x14a6be8
|
104
|
+
@attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
|
105
|
+
#<Post:0x14a6620
|
106
|
+
@attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
|
107
|
+
>> @posts.first.title = "hello from a debugger"
|
108
|
+
=> "hello from a debugger"
|
109
|
+
|
110
|
+
...and even better, you can examine how your runtime objects actually work:
|
111
|
+
|
112
|
+
>> f = @posts.first
|
113
|
+
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
|
114
|
+
>> f.
|
115
|
+
Display all 152 possibilities? (y or n)
|
116
|
+
|
117
|
+
Finally, when you're ready to resume execution, you can enter "cont".
|
118
|
+
|
119
|
+
|
120
|
+
== Console
|
121
|
+
|
122
|
+
The console is a Ruby shell, which allows you to interact with your
|
123
|
+
application's domain model. Here you'll have all parts of the application
|
124
|
+
configured, just like it is when the application is running. You can inspect
|
125
|
+
domain models, change values, and save to the database. Starting the script
|
126
|
+
without arguments will launch it in the development environment.
|
127
|
+
|
128
|
+
To start the console, run <tt>rails console</tt> from the application
|
129
|
+
directory.
|
130
|
+
|
131
|
+
Options:
|
132
|
+
|
133
|
+
* Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
|
134
|
+
made to the database.
|
135
|
+
* Passing an environment name as an argument will load the corresponding
|
136
|
+
environment. Example: <tt>rails console production</tt>.
|
137
|
+
|
138
|
+
To reload your controllers and models after launching the console run
|
139
|
+
<tt>reload!</tt>
|
140
|
+
|
141
|
+
More information about irb can be found at:
|
142
|
+
link:http://www.rubycentral.org/pickaxe/irb.html
|
143
|
+
|
144
|
+
|
145
|
+
== dbconsole
|
146
|
+
|
147
|
+
You can go to the command line of your database directly through <tt>rails
|
148
|
+
dbconsole</tt>. You would be connected to the database with the credentials
|
149
|
+
defined in database.yml. Starting the script without arguments will connect you
|
150
|
+
to the development database. Passing an argument will connect you to a different
|
151
|
+
database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
|
152
|
+
PostgreSQL and SQLite 3.
|
153
|
+
|
154
|
+
== Description of Contents
|
155
|
+
|
156
|
+
The default directory structure of a generated Ruby on Rails application:
|
157
|
+
|
158
|
+
|-- app
|
159
|
+
| |-- assets
|
160
|
+
| | |-- images
|
161
|
+
| | |-- javascripts
|
162
|
+
| | `-- stylesheets
|
163
|
+
| |-- controllers
|
164
|
+
| |-- helpers
|
165
|
+
| |-- mailers
|
166
|
+
| |-- models
|
167
|
+
| `-- views
|
168
|
+
| `-- layouts
|
169
|
+
|-- config
|
170
|
+
| |-- environments
|
171
|
+
| |-- initializers
|
172
|
+
| `-- locales
|
173
|
+
|-- db
|
174
|
+
|-- doc
|
175
|
+
|-- lib
|
176
|
+
| |-- assets
|
177
|
+
| `-- tasks
|
178
|
+
|-- log
|
179
|
+
|-- public
|
180
|
+
|-- script
|
181
|
+
|-- test
|
182
|
+
| |-- fixtures
|
183
|
+
| |-- functional
|
184
|
+
| |-- integration
|
185
|
+
| |-- performance
|
186
|
+
| `-- unit
|
187
|
+
|-- tmp
|
188
|
+
| `-- cache
|
189
|
+
| `-- assets
|
190
|
+
`-- vendor
|
191
|
+
|-- assets
|
192
|
+
| |-- javascripts
|
193
|
+
| `-- stylesheets
|
194
|
+
`-- plugins
|
195
|
+
|
196
|
+
app
|
197
|
+
Holds all the code that's specific to this particular application.
|
198
|
+
|
199
|
+
app/assets
|
200
|
+
Contains subdirectories for images, stylesheets, and JavaScript files.
|
201
|
+
|
202
|
+
app/controllers
|
203
|
+
Holds controllers that should be named like weblogs_controller.rb for
|
204
|
+
automated URL mapping. All controllers should descend from
|
205
|
+
ApplicationController which itself descends from ActionController::Base.
|
206
|
+
|
207
|
+
app/models
|
208
|
+
Holds models that should be named like post.rb. Models descend from
|
209
|
+
ActiveRecord::Base by default.
|
210
|
+
|
211
|
+
app/views
|
212
|
+
Holds the template files for the view that should be named like
|
213
|
+
weblogs/index.html.erb for the WeblogsController#index action. All views use
|
214
|
+
eRuby syntax by default.
|
215
|
+
|
216
|
+
app/views/layouts
|
217
|
+
Holds the template files for layouts to be used with views. This models the
|
218
|
+
common header/footer method of wrapping views. In your views, define a layout
|
219
|
+
using the <tt>layout :default</tt> and create a file named default.html.erb.
|
220
|
+
Inside default.html.erb, call <% yield %> to render the view using this
|
221
|
+
layout.
|
222
|
+
|
223
|
+
app/helpers
|
224
|
+
Holds view helpers that should be named like weblogs_helper.rb. These are
|
225
|
+
generated for you automatically when using generators for controllers.
|
226
|
+
Helpers can be used to wrap functionality for your views into methods.
|
227
|
+
|
228
|
+
config
|
229
|
+
Configuration files for the Rails environment, the routing map, the database,
|
230
|
+
and other dependencies.
|
231
|
+
|
232
|
+
db
|
233
|
+
Contains the database schema in schema.rb. db/migrate contains all the
|
234
|
+
sequence of Migrations for your schema.
|
235
|
+
|
236
|
+
doc
|
237
|
+
This directory is where your application documentation will be stored when
|
238
|
+
generated using <tt>rake doc:app</tt>
|
239
|
+
|
240
|
+
lib
|
241
|
+
Application specific libraries. Basically, any kind of custom code that
|
242
|
+
doesn't belong under controllers, models, or helpers. This directory is in
|
243
|
+
the load path.
|
244
|
+
|
245
|
+
public
|
246
|
+
The directory available for the web server. Also contains the dispatchers and the
|
247
|
+
default HTML files. This should be set as the DOCUMENT_ROOT of your web
|
248
|
+
server.
|
249
|
+
|
250
|
+
script
|
251
|
+
Helper scripts for automation and generation.
|
252
|
+
|
253
|
+
test
|
254
|
+
Unit and functional tests along with fixtures. When using the rails generate
|
255
|
+
command, template test files will be generated for you and placed in this
|
256
|
+
directory.
|
257
|
+
|
258
|
+
vendor
|
259
|
+
External libraries that the application depends on. Also includes the plugins
|
260
|
+
subdirectory. If the app has frozen rails, those gems also go here, under
|
261
|
+
vendor/rails/. This directory is in the load path.
|
data/spec/dummy/Rakefile
ADDED
@@ -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
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
require "cadenero"
|
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 escaping HTML in JSON.
|
39
|
+
config.active_support.escape_html_entities_in_json = true
|
40
|
+
|
41
|
+
# Use SQL instead of Active Record's schema dumper when creating the database.
|
42
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
43
|
+
# like if you have constraints or database-specific column types
|
44
|
+
# config.active_record.schema_format = :sql
|
45
|
+
|
46
|
+
# Enforce whitelist mode for mass assignment.
|
47
|
+
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
48
|
+
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
49
|
+
# parameters by using an attr_accessible or attr_protected declaration.
|
50
|
+
config.active_record.whitelist_attributes = true
|
51
|
+
|
52
|
+
# Enable the asset pipeline
|
53
|
+
config.assets.enabled = true
|
54
|
+
|
55
|
+
# Version of your assets, change this if you want to expire all your assets
|
56
|
+
config.assets.version = '1.0'
|
57
|
+
|
58
|
+
config.generators do |g|
|
59
|
+
g.test_framework :rspec
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
@@ -0,0 +1,14 @@
|
|
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
|
+
development:
|
7
|
+
adapter: postgresql
|
8
|
+
database: cadenero_development
|
9
|
+
min_messages: warning
|
10
|
+
|
11
|
+
test:
|
12
|
+
adapter: postgresql
|
13
|
+
database: cadenero_test
|
14
|
+
min_messages: warning
|
@@ -0,0 +1,39 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
config.ember.variant = :development
|
10
|
+
|
11
|
+
# Log error messages when you accidentally call methods on nil.
|
12
|
+
config.whiny_nils = true
|
13
|
+
|
14
|
+
# Show full error reports and disable caching
|
15
|
+
config.consider_all_requests_local = true
|
16
|
+
config.action_controller.perform_caching = false
|
17
|
+
|
18
|
+
# Don't care if the mailer can't send
|
19
|
+
# config.action_mailer.raise_delivery_errors = false
|
20
|
+
|
21
|
+
# Print deprecation notices to the Rails logger
|
22
|
+
config.active_support.deprecation = :log
|
23
|
+
|
24
|
+
# Only use best-standards-support built into browsers
|
25
|
+
config.action_dispatch.best_standards_support = :builtin
|
26
|
+
|
27
|
+
# Raise exception on mass assignment protection for Active Record models
|
28
|
+
config.active_record.mass_assignment_sanitizer = :strict
|
29
|
+
|
30
|
+
# Log the query plan for queries taking more than this (works
|
31
|
+
# with SQLite, MySQL, and PostgreSQL)
|
32
|
+
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
33
|
+
|
34
|
+
# Do not compress assets
|
35
|
+
config.assets.compress = false
|
36
|
+
|
37
|
+
# Expands the lines which load the assets
|
38
|
+
config.assets.debug = true
|
39
|
+
end
|