g5_sibling_deployer_engine 0.2.6 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/.gitignore +9 -18
- data/.travis.yml +2 -3
- data/Gemfile +12 -2
- data/README.md +1 -2
- data/Rakefile +32 -2
- data/app/models/sibling/deploy.rb +2 -4
- data/app/models/sibling/instruction.rb +1 -3
- data/app/models/sibling.rb +1 -3
- data/app/views/siblings/deploys/index.html.erb +30 -11
- data/app/views/siblings/index.html.erb +29 -12
- data/app/views/siblings/instructions/index.html.erb +24 -9
- data/g5_sibling_deployer_engine.gemspec +5 -6
- data/lib/g5_sibling_deployer_engine/version.rb +1 -1
- data/lib/g5_sibling_deployer_engine.rb +0 -1
- data/spec/dummy/README.rdoc +15 -248
- data/spec/dummy/Rakefile +0 -1
- data/spec/dummy/app/{mailers/.gitkeep → assets/images/.keep} +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +3 -5
- data/spec/dummy/app/controllers/application_controller.rb +3 -1
- data/spec/dummy/app/{models/.gitkeep → controllers/concerns/.keep} +0 -0
- data/spec/dummy/{lib/assets/.gitkeep → app/mailers/.keep} +0 -0
- data/spec/dummy/{log/.gitkeep → app/models/.keep} +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +2 -2
- data/spec/dummy/config/application.rb +2 -44
- data/spec/dummy/config/boot.rb +4 -9
- data/spec/dummy/config/environment.rb +2 -2
- data/spec/dummy/config/environments/development.rb +11 -19
- data/spec/dummy/config/environments/production.rb +40 -27
- data/spec/dummy/config/environments/test.rb +13 -14
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +6 -5
- data/spec/dummy/config/initializers/secret_token.rb +7 -2
- data/spec/dummy/config/initializers/session_store.rb +0 -5
- data/spec/dummy/config/initializers/wrap_parameters.rb +6 -6
- data/spec/dummy/config/locales/en.yml +20 -2
- data/spec/dummy/config/routes.rb +22 -24
- data/spec/dummy/config.ru +1 -1
- 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/public/404.html +43 -11
- data/spec/dummy/public/422.html +43 -11
- data/spec/dummy/public/500.html +43 -11
- data/spec/models/sibling/instruction_spec.rb +2 -0
- data/spec/models/sibling_spec.rb +1 -0
- data/spec/spec_helper.rb +6 -7
- data/spec/workers/sibling_deployer_spec.rb +1 -1
- metadata +56 -65
- data/config/initializers/table_cloth.rb +0 -3
- data/spec/dummy/script/rails +0 -6
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
NWY5NDE0ZDYyZDQzMzFhNGE3ZWRmY2JlNWRiYmM2MzMwZDFiMzUyMWQ1MDYz
|
10
|
-
YTJjZWEyMDY2NjExOTBjMDhmODg0NjUxYjQ5ZWVlZjQxZTk0ZDg3YjJlNjZi
|
11
|
-
MjZjNTU0NDhlYjRlMzkyY2M4ZjQ1NzAyZmYzMDQxN2RiZmMzNWU=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NjUyMGIzODAyYjA3OWY5MjA1MDFhY2E3YmUyMjY5NDAyZTdkYWJmNjFhNzFi
|
14
|
-
NzIzNWNlOTIyMjE3MDg2M2MwMDVlMjYxNDI5YjhjNzc2M2FiMmNmOGY4ODgz
|
15
|
-
Njc2NDMwYzY2MjVlZTM3MWJlZjA4NTYzNjZlYWUxYzhlYTI2NDU=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d83ad1287ed9ff50ce0cc2172afff1f7f238d9dc
|
4
|
+
data.tar.gz: 2dd66c03e5aa0e98cce199e9fec434396436b7e4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 85726997938a708c8d7638fdfc29cbe3632dee50237d57cfacc63cb54ed7c1ec79d5816e309b17ed33197af7245cfb0de9a856966f35b6567f6d4d44afe49633
|
7
|
+
data.tar.gz: 7b781499db83a5c5525addcb9d3a6a5c24bb3711a2dc749739dabff72b3fd385b5edf80ac1097f003716de4cedf473f1cec479f75dc05d027a0c8a87df2f1843
|
data/.gitignore
CHANGED
@@ -1,19 +1,10 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
1
|
Gemfile.lock
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
spec/
|
15
|
-
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
18
|
-
|
19
|
-
spec/dummy/log/*
|
2
|
+
.bundle/
|
3
|
+
log/*.log
|
4
|
+
pkg/
|
5
|
+
spec/dummy/db/*.sqlite3
|
6
|
+
spec/dummy/db/*.sqlite3-journal
|
7
|
+
spec/dummy/log/*.log
|
8
|
+
spec/dummy/tmp/
|
9
|
+
spec/dummy/.sass-cache
|
10
|
+
coverage/
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,6 +1,16 @@
|
|
1
|
-
source
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
|
-
#
|
3
|
+
# Declare your gem's dependencies in g5_sibling_deployer_engine.gemspec.
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
+
# development dependencies will be added by default to the :development group.
|
4
6
|
gemspec
|
5
7
|
|
8
|
+
# Declare any dependencies that are still in development here instead of in
|
9
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
10
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
11
|
+
# your gem to rubygems.org.
|
12
|
+
|
13
|
+
# To use debugger
|
14
|
+
# gem 'debugger'
|
15
|
+
|
6
16
|
gem "codeclimate-test-reporter", group: :test, require: nil
|
data/README.md
CHANGED
@@ -8,13 +8,12 @@ Provides models, views, controllers, routes, and rake tasks for deploying Siblin
|
|
8
8
|
|
9
9
|
## Current Version
|
10
10
|
|
11
|
-
0.2
|
11
|
+
0.3.2
|
12
12
|
|
13
13
|
|
14
14
|
## Requirements
|
15
15
|
|
16
16
|
* ["rails"](http://rubygems.org/gems/rails)
|
17
|
-
* ["table_cloth"](http://rubygems.org/gems/table_cloth)
|
18
17
|
* ["state_machine"](http://rubygems.org/gems/state_machine)
|
19
18
|
* ["heroku_resque_autoscaler"](http://rubygems.org/gems/heroku_resque_autoscaler)
|
20
19
|
* ["github_heroku_deployer"](http://rubygems.org/gems/github_heroku_deployer)
|
data/Rakefile
CHANGED
@@ -1,2 +1,32 @@
|
|
1
|
-
|
2
|
-
require
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'G5SiblingDeployerEngine'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
Bundler::GemHelper.install_tasks
|
21
|
+
|
22
|
+
require 'rake/testtask'
|
23
|
+
|
24
|
+
Rake::TestTask.new(:test) do |t|
|
25
|
+
t.libs << 'lib'
|
26
|
+
t.libs << 'test'
|
27
|
+
t.pattern = 'test/**/*_test.rb'
|
28
|
+
t.verbose = false
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
task default: :test
|
@@ -1,6 +1,4 @@
|
|
1
1
|
class Sibling::Deploy < ActiveRecord::Base
|
2
|
-
attr_accessible :sibling_id, :instruction_id, :manual, :state
|
3
|
-
attr_accessible :git_repo, :heroku_repo, :heroku_app_name
|
4
2
|
|
5
3
|
belongs_to :sibling
|
6
4
|
belongs_to :instruction
|
@@ -28,8 +26,8 @@ class Sibling::Deploy < ActiveRecord::Base
|
|
28
26
|
end
|
29
27
|
end
|
30
28
|
|
31
|
-
scope :manual, where(manual: true)
|
32
|
-
scope :automatic, where(manual: false)
|
29
|
+
scope :manual, -> { where(manual: true) }
|
30
|
+
scope :automatic, -> { where(manual: false) }
|
33
31
|
|
34
32
|
def deploy
|
35
33
|
start!
|
@@ -2,8 +2,6 @@ require 'open-uri'
|
|
2
2
|
|
3
3
|
class Sibling::Instruction < ActiveRecord::Base
|
4
4
|
|
5
|
-
attr_accessible :uid, :name, :published_at
|
6
|
-
|
7
5
|
has_many :deploys
|
8
6
|
has_many :siblings, through: :deploys
|
9
7
|
|
@@ -44,7 +42,7 @@ class Sibling::Instruction < ActiveRecord::Base
|
|
44
42
|
end
|
45
43
|
|
46
44
|
def find_or_create_from_hentry(hentry)
|
47
|
-
|
45
|
+
find_or_create_by(uid: hentry.uid.to_s) do |instruction|
|
48
46
|
hcard = instruction(hentry)
|
49
47
|
instruction.name = hcard.name.to_s
|
50
48
|
instruction.published_at = hentry.updated.value
|
data/app/models/sibling.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
class Sibling < ActiveRecord::Base
|
2
|
-
attr_accessible :uid, :name, :git_repo, :heroku_repo, :heroku_app_name
|
3
|
-
|
4
2
|
has_many :deploys
|
5
3
|
has_many :instructions, through: :deploys
|
6
4
|
|
@@ -31,7 +29,7 @@ class Sibling < ActiveRecord::Base
|
|
31
29
|
end
|
32
30
|
|
33
31
|
def find_or_create_from_hcard(hcard)
|
34
|
-
|
32
|
+
find_or_create_by(uid: hcard.uid.to_s) do |sibling|
|
35
33
|
sibling.name = hcard.name.to_s
|
36
34
|
sibling.git_repo = hcard.g5_git_repo.to_s
|
37
35
|
sibling.heroku_repo = hcard.g5_heroku_repo.to_s
|
@@ -2,14 +2,33 @@
|
|
2
2
|
|
3
3
|
<%= render partial: "siblings/nav", locals: { page: :deploys } %>
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
5
|
+
<table class="table table-striped">
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<td>Id</td>
|
9
|
+
<td>Created at</td>
|
10
|
+
<td>Heroku app name</td>
|
11
|
+
<td>State</td>
|
12
|
+
<td>Git repo</td>
|
13
|
+
<td>Heroku Repo</td>
|
14
|
+
<td>Sibling id</td>
|
15
|
+
<td>Instruction id</td>
|
16
|
+
<td>Manual</td>
|
17
|
+
</tr>
|
18
|
+
</thead>
|
19
|
+
<tbody>
|
20
|
+
<% @siblings_deploys.each do |t| %>
|
21
|
+
<tr>
|
22
|
+
<td>t.id</td>
|
23
|
+
<td>t.created_at</td>
|
24
|
+
<td>t.heroku_app_name</td>
|
25
|
+
<td>t.state</td>
|
26
|
+
<td>t.git_repo</td>
|
27
|
+
<td>t.heroku_repo</td>
|
28
|
+
<td>t.sibling_id</td>
|
29
|
+
<td>t.instruction_id</td>
|
30
|
+
<td>t.manual</td>
|
31
|
+
</tr>
|
32
|
+
<% end %>
|
33
|
+
</tbody>
|
34
|
+
</table>
|
@@ -2,15 +2,32 @@
|
|
2
2
|
|
3
3
|
<%= render partial: "nav", locals: { page: :siblings } %>
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
5
|
+
<table class="table table-striped">
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<td>Id</td>
|
9
|
+
<td>Name</td>
|
10
|
+
<td>Heroku app name</td>
|
11
|
+
<td>Git repo</td>
|
12
|
+
<td>Heroku repo</td>
|
13
|
+
<td>Actions</td>
|
14
|
+
</tr>
|
15
|
+
</thead>
|
16
|
+
<tbody>
|
17
|
+
<% @siblings.each do |t| %>
|
18
|
+
<tr>
|
19
|
+
<td>t.id</td>
|
20
|
+
<td>t.name</td>
|
21
|
+
<td>t.heroku_app_name</td>
|
22
|
+
<td>t.git_repo</td>
|
23
|
+
<td>t.heroku_repo</td>
|
24
|
+
<td>
|
25
|
+
<%= link_to 'UID', t.uid, class: "btn" %>
|
26
|
+
<% unless t.main_app? %>
|
27
|
+
<%= link_to "Deploy", deploy_sibling_path(t), class: "btn", method: post %>
|
28
|
+
<% end %>
|
29
|
+
</td>
|
30
|
+
</tr>
|
31
|
+
<% end %>
|
32
|
+
</tbody>
|
33
|
+
</table>
|
@@ -2,12 +2,27 @@
|
|
2
2
|
|
3
3
|
<%= render partial: "siblings/nav", locals: { page: :instructions } %>
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
5
|
+
<table class="table table-striped">
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<td>Id</td>
|
9
|
+
<td>Name</td>
|
10
|
+
<td>Published at</td>
|
11
|
+
<td>Created at</td>
|
12
|
+
<td>Actions</td>
|
13
|
+
</tr>
|
14
|
+
</thead>
|
15
|
+
<tbody>
|
16
|
+
<% @siblings_instructions.each do |t| %>
|
17
|
+
<tr>
|
18
|
+
<td>t.id</td>
|
19
|
+
<td>t.name</td>
|
20
|
+
<td>t.published_at</td>
|
21
|
+
<td>t.created_at</td>
|
22
|
+
<td>
|
23
|
+
<%= link_to 'UID', t.uid, class: "btn" %>
|
24
|
+
</td>
|
25
|
+
</tr>
|
26
|
+
<% end %>
|
27
|
+
</tbody>
|
28
|
+
</table>
|
@@ -18,17 +18,16 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
|
21
|
-
gem.add_dependency "rails", "~>
|
22
|
-
gem.add_dependency "
|
23
|
-
gem.add_dependency "state_machine", "~> 1.1.2"
|
21
|
+
gem.add_dependency "rails", "~> 4.0.3"
|
22
|
+
gem.add_dependency "state_machine", "~> 1.2.0"
|
24
23
|
gem.add_dependency "heroku_resque_autoscaler", "~> 0.1.0"
|
25
24
|
gem.add_dependency "microformats2", "~> 2.0.0"
|
26
25
|
gem.add_dependency "github_heroku_deployer", "~> 0.2.0"
|
27
26
|
|
28
27
|
gem.add_development_dependency "sqlite3", "~> 1.3.6"
|
29
|
-
gem.add_development_dependency "simplecov", "~> 0.
|
30
|
-
gem.add_development_dependency "rspec-rails", "~> 2.
|
31
|
-
gem.add_development_dependency "guard-rspec", "~> 2.
|
28
|
+
gem.add_development_dependency "simplecov", "~> 0.8.2"
|
29
|
+
gem.add_development_dependency "rspec-rails", "~> 2.14.1"
|
30
|
+
gem.add_development_dependency "guard-rspec", "~> 4.2.8"
|
32
31
|
gem.add_development_dependency "spork", "~> 0.9.2"
|
33
32
|
gem.add_development_dependency "rb-fsevent", "~> 0.9.2"
|
34
33
|
end
|
data/spec/dummy/README.rdoc
CHANGED
@@ -1,261 +1,28 @@
|
|
1
|
-
==
|
1
|
+
== README
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
5
|
|
6
|
-
|
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.
|
6
|
+
Things you may want to cover:
|
13
7
|
|
14
|
-
|
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.
|
8
|
+
* Ruby version
|
19
9
|
|
20
|
-
|
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.
|
10
|
+
* System dependencies
|
27
11
|
|
12
|
+
* Configuration
|
28
13
|
|
29
|
-
|
14
|
+
* Database creation
|
30
15
|
|
31
|
-
|
32
|
-
<tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
|
16
|
+
* Database initialization
|
33
17
|
|
34
|
-
|
35
|
-
<tt>cd myapp; rails server</tt> (run with --help for options)
|
18
|
+
* How to run the test suite
|
36
19
|
|
37
|
-
|
38
|
-
"Welcome aboard: You're riding Ruby on Rails!"
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
39
21
|
|
40
|
-
|
41
|
-
the following resources handy:
|
22
|
+
* Deployment instructions
|
42
23
|
|
43
|
-
*
|
44
|
-
* Ruby on Rails Tutorial Book: http://www.railstutorial.org/
|
24
|
+
* ...
|
45
25
|
|
46
26
|
|
47
|
-
|
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
|
-
| `-- tasks
|
177
|
-
|-- log
|
178
|
-
|-- public
|
179
|
-
|-- script
|
180
|
-
|-- test
|
181
|
-
| |-- fixtures
|
182
|
-
| |-- functional
|
183
|
-
| |-- integration
|
184
|
-
| |-- performance
|
185
|
-
| `-- unit
|
186
|
-
|-- tmp
|
187
|
-
| |-- cache
|
188
|
-
| |-- pids
|
189
|
-
| |-- sessions
|
190
|
-
| `-- sockets
|
191
|
-
`-- vendor
|
192
|
-
|-- assets
|
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.
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|