trackman 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/trackman.rb CHANGED
@@ -4,9 +4,11 @@ require 'tasks'
4
4
 
5
5
  module Trackman
6
6
  autoload :RackMiddleware, 'trackman/rack_middleware'
7
- autoload :Assets, 'trackman/assets'
7
+ autoload :Assets, 'trackman/assets'
8
8
  end
9
9
 
10
+ autoload :Debugger, 'trackman/debugger'
11
+
10
12
  if defined?(Rails)
11
13
  if ::Rails::VERSION::STRING =~ /^2\.[1-9]/
12
14
  Rails.configuration.middleware.use Trackman::RackMiddleware
@@ -21,8 +21,8 @@ module Trackman
21
21
 
22
22
  def ==(other)
23
23
  return false if other.nil?
24
- other_path = other.path.is_a?(Pathname) ? other.path : Pathname.new(other.path)
25
- other_path.to_s == path.to_s || path.realpath == other_path.realpath
24
+ other_path = other.path.is_a?(Pathname) ? other.path : Pathname.new(other.path)
25
+ other_path.to_s == path.to_s || path.cleanpath == other_path.cleanpath
26
26
  end
27
27
 
28
28
  def <=>(another)
@@ -37,13 +37,15 @@ module Trackman
37
37
  result += -1
38
38
  elsif another.is_child_of(self)
39
39
  result += 1
40
+ else
41
+ result = self.path.to_s <=> another.path.to_s
40
42
  end
41
43
 
42
44
  result
43
45
  end
44
46
 
45
47
  def is_child_of(parent)
46
- parent.is_a?(Components::CompositeAsset) && parent.assets.include?(self)
48
+ parent.assets.include? self
47
49
  end
48
50
 
49
51
  def self.all
@@ -59,6 +61,11 @@ module Trackman
59
61
  local = Asset.all
60
62
  remote = RemoteAsset.all
61
63
  diff_result = diff(local, remote)
64
+
65
+ Debugger.trace diff_result[:create]
66
+ Debugger.trace diff_result[:update]
67
+ Debugger.trace diff_result[:delete]
68
+
62
69
  ship diff_result
63
70
 
64
71
  true
@@ -1,18 +1,16 @@
1
1
  require 'rest-client'
2
2
  require 'json'
3
+ require 'uri'
3
4
 
4
5
  module Trackman
5
6
  module Assets
6
7
  class RemoteAsset < Asset
7
- @@user = ENV['TRACKMAN_USER']
8
- @@pass = ENV['TRACKMAN_PASSWORD']
9
- @@app_id = ENV['TRACKMAN_APP_ID']
10
- @@server = ENV['TRACKMAN_SERVER_URL']
8
+ @@server_url = ENV['TRACKMAN_URL']
11
9
 
12
- @@site = "https://#{@@user}:#{@@pass}@#{@@server}/heroku/resources/#{@@app_id}/assets"
10
+ @@site = "#{@@server_url}/assets"
13
11
 
14
12
  attr_reader :id
15
-
13
+
16
14
  def initialize attributes = {}
17
15
  ensure_config
18
16
  super
@@ -30,13 +28,17 @@ module Trackman
30
28
  end
31
29
 
32
30
  def self.find id
31
+ puts "For #{@@site}"
32
+ puts RestClient.get "#{@@site}"
33
+
33
34
  response = RestClient.get "#{@@site}/#{id}"
35
+
34
36
  body = Hash[JSON.parse(response).map{ |k, v| [k.to_sym, v] }]
35
37
  RemoteAsset.new(body)
36
38
  end
37
39
 
38
40
  def self.all
39
- JSON.parse(RestClient.get @@site).map{|r| Hash[r.map{ |k, v| [k.to_sym, v] }] }.map { |r| RemoteAsset.new(r) }.sort
41
+ get_attributes.map{ |r| RemoteAsset.new(r) }.sort
40
42
  end
41
43
 
42
44
  def create!
@@ -64,14 +66,12 @@ module Trackman
64
66
  false
65
67
  end
66
68
 
67
-
68
-
69
69
  private
70
70
  def ensure_config
71
- if @@user.nil? || @@pass.nil? || @@app_id.nil? || @@server.nil?
72
- config_missing = ['TRACKMAN_USER', 'TRACKMAN_PASSWORD', 'TRACKMAN_APP_ID', 'TRACKMAN_SERVER_URL'].first{|c| ENV[c].nil? }
73
- raise Errors::ConfigNotFoundError, "The config '#{config_missing}' is missing."
74
- end
71
+ raise Errors::ConfigNotFoundError, "The config TRACKMAN_URL is missing." if @@server_url.nil?
72
+ end
73
+ def self.get_attributes
74
+ JSON.parse(RestClient.get @@site).map{|r| Hash[r.map{ |k, v| [k.to_sym, v] }] }
75
75
  end
76
76
  end
77
77
  end
@@ -0,0 +1,9 @@
1
+ class Debugger
2
+ def self.debug_mode?
3
+ !ENV['TRACKMAN_DEBUG_MODE'].nil? && ENV['TRACKMAN_DEBUG_MODE'] == 'true'
4
+ end
5
+
6
+ def self.trace data
7
+ puts data if debug_mode?
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Trackman
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -6,7 +6,10 @@ namespace :trackman do
6
6
  TRACKMAN_MAINTENANCE = 'TRACKMAN_MAINTENANCE_PAGE_URL'
7
7
 
8
8
  desc "Syncs your assets with the server, this is what gets executed when you deploy to heroku."
9
- task :sync do
9
+ task :sync, :debug do |t, args|
10
+ if Debugger.debug_mode?
11
+ RestClient.log = Logger.new(STDOUT)
12
+ end
10
13
  Trackman::Assets::Asset.sync
11
14
  end
12
15
 
@@ -45,9 +45,9 @@ describe Trackman::Assets::Asset do
45
45
  end
46
46
 
47
47
  expected = [
48
- TestAsset.create(:path => 'spec/test_data/all/3.js'),
49
- TestAsset.create(:path => 'spec/test_data/all/2.gif'),
50
48
  TestAsset.create(:path => 'spec/test_data/all/1.css'),
49
+ TestAsset.create(:path => 'spec/test_data/all/2.gif'),
50
+ TestAsset.create(:path => 'spec/test_data/all/3.js'),
51
51
  TestAsset.maintenance_page,
52
52
  TestAsset.error_page
53
53
  ]
data/spec/asset_spec.rb CHANGED
@@ -46,8 +46,6 @@ describe Trackman::Assets::Asset do
46
46
  end
47
47
  end
48
48
 
49
-
50
-
51
49
  describe "#remote" do
52
50
 
53
51
  class TestAsset < Asset
@@ -96,4 +94,20 @@ describe Trackman::Assets::Asset do
96
94
  (dependent <=> dependency).should == 1
97
95
  (dependency <=> dependent).should == -1
98
96
  end
97
+
98
+ it "fixes the bug with realpath" do
99
+ class MyAsset < Asset
100
+ def validate_path?
101
+ false
102
+ end
103
+ def file_hash
104
+ 123
105
+ end
106
+ end
107
+
108
+ local = MyAsset.new(:path => 'public/test.html')
109
+ remote = MyAsset.new(:path => 'public/./test.html')
110
+
111
+ local.should == remote
112
+ end
99
113
  end
@@ -1,38 +1,28 @@
1
1
  class AppCreator
2
- def self.get_config
3
- RemoteAsset.class_variables.inject({}) do |carry, e|
4
- carry.merge!({e => RemoteAsset.send(:class_variable_get, e)})
5
- end
2
+ def self.get_config url
3
+ response = RestClient.post url, :plan => 'test', :heroku_id => 123
4
+ json = JSON.parse response
5
+
6
+ trackman_url = json['config']['TRACKMAN_URL'].gsub('https', 'http')
7
+
8
+ [[:@@server_url, trackman_url], [:@@site, "#{trackman_url}/assets"]]
6
9
  end
7
10
 
8
11
  def self.create
9
12
  user = ENV['HEROKU_USERNAME']
10
13
  pass = ENV['HEROKU_PASSWORD']
11
-
12
- server = RemoteAsset.send(:class_variable_get, :@@server)
13
- url = "http://#{user}:#{pass}@#{server}/heroku/resources"
14
+ server = ENV['TRACKMAN_SERVER_URL']
14
15
 
15
- response = RestClient.post url, :plan => 'test', :heroku_id => 123
16
- json = JSON.parse response
17
-
18
- user = json['config']['TRACKMAN_USER']
19
- pass = json['config']['TRACKMAN_PASSWORD']
20
- id = json['id']
21
- site = "http://#{user}:#{pass}@#{server}/heroku/resources/#{id}/assets"
22
-
16
+ @@config = get_config "http://#{user}:#{pass}@#{server}/heroku/resources"
23
17
 
24
- [[:@@user,user], [:@@pass, pass], [:@@app_id, id], [:@@site, site]].each do |s, v|
18
+ @@config.each do |s, v|
25
19
  RemoteAsset.send(:class_variable_set, s, v)
26
20
  end
27
-
28
- get_config
29
21
  end
30
22
 
31
23
  def self.reset
32
- @@old_config.each do |k,v|
24
+ @@config.each do |k,v|
33
25
  RemoteAsset.send(:class_variable_set, k, v)
34
26
  end
35
27
  end
36
-
37
- @@old_config = get_config
38
28
  end
@@ -21,7 +21,21 @@ class FakablePathManTester
21
21
  end
22
22
  end
23
23
  end
24
-
24
+
25
+ RemoteAsset.class_eval do
26
+ singleton_class = class << self; self; end
27
+ singleton_class.instance_eval do
28
+ alias_method :old_get_attributes, :get_attributes
29
+ define_method :get_attributes do
30
+ old_get_attributes.map do |h|
31
+ my_hash = h.dup
32
+ my_hash[:path] = prepath + h[:path] unless h[:path].start_with? prepath
33
+ my_hash
34
+ end
35
+ end
36
+ end
37
+ end
38
+
25
39
  Conventions.module_eval do
26
40
  alias :real_maintenance_path :maintenance_path
27
41
  alias :real_error_path :error_path
@@ -55,7 +69,15 @@ class FakablePathManTester
55
69
 
56
70
  remove_method :real_maintenance_path
57
71
  remove_method :real_error_path
58
- end
72
+ end
73
+
74
+ RemoteAsset.class_eval do
75
+ singleton_class = class << self; self; end
76
+ singleton_class.instance_eval do
77
+ alias_method :get_attributes, :old_get_attributes
78
+ remove_method :old_get_attributes
79
+ end
80
+ end
59
81
  end
60
82
  end
61
83
 
@@ -18,12 +18,12 @@ describe 'full path' do
18
18
  end
19
19
 
20
20
  it "replaces all images" do
21
- expected = Asset.all
22
-
23
- Asset.sync
24
- actual = RemoteAsset.all
21
+ local = Asset.all
25
22
 
26
- actual.count.should == 8
27
- actual.should == expected
23
+ Asset.sync
24
+ remote = RemoteAsset.all
25
+
26
+ remote.count.should == 8
27
+ local.each{|l| remote.should include(l) }
28
28
  end
29
29
  end
@@ -65,12 +65,13 @@ describe 'full path' do
65
65
  end
66
66
 
67
67
  it "replaces all images" do
68
- expected = Asset.all
68
+ local = Asset.all
69
69
 
70
70
  Asset.sync
71
- actual = RemoteAsset.all
72
-
73
- actual.count.should == 7
74
- actual.should == expected
71
+ remote = RemoteAsset.all
72
+
73
+ remote.count.should == 7
74
+
75
+ local.each{|l| remote.should include(l) }
75
76
  end
76
77
  end
@@ -4,16 +4,14 @@ describe Trackman::Assets::RemoteAsset do
4
4
  before :all do
5
5
  user = ENV['HEROKU_USERNAME']
6
6
  pass = ENV['HEROKU_PASSWORD']
7
- server = RemoteAsset.send(:class_variable_get, :@@server)
7
+ server = ENV['TRACKMAN_SERVER_URL']
8
8
 
9
- response = RestClient.post "https://#{user}:#{pass}@#{server}/heroku/resources", :plan => 'test', :heroku_id => 123
9
+ response = RestClient.post "http://#{user}:#{pass}@#{server}/heroku/resources", :plan => 'test', :heroku_id => 123
10
10
  json = JSON.parse response
11
-
12
- user = json['config']['TRACKMAN_USER']
13
- pass = json['config']['TRACKMAN_PASSWORD']
14
- app_id = json['id']
15
-
16
- [[:@@app_id, app_id], [:@@user, user], [:@@pass, pass], [:@@site, "https://#{user}:#{pass}@#{server}/heroku/resources/#{app_id}/assets"]].each do |s, v|
11
+ @trackman_url = json['config']['TRACKMAN_URL'].gsub('https', 'http')
12
+
13
+ @config = [[:@@server_url, @trackman_url], [:@@site, "#{@trackman_url}/assets"]]
14
+ @config.each do |s, v|
17
15
  RemoteAsset.send(:class_variable_set, s, v)
18
16
  end
19
17
  end
@@ -24,7 +22,7 @@ describe Trackman::Assets::RemoteAsset do
24
22
  end
25
23
 
26
24
  File.open('spec/test_data/y.css', 'w') {|f| f.write @old_file } unless @old_file.nil?
27
- end
25
+ end
28
26
 
29
27
  it "creates assets on the server" do
30
28
  expected = RemoteAsset.new(:path => 'spec/test_data/test2.png')
@@ -45,9 +43,9 @@ describe Trackman::Assets::RemoteAsset do
45
43
  end
46
44
 
47
45
  it "returns all assets on the server" do
48
- expected = ['spec/test_data/y.css', 'spec/test_data/a.js', '/public/503-error.html', '/public/503.html', 'spec/test_data/sample.html']
46
+ expected = ['spec/test_data/a.js', 'spec/test_data/y.css', 'public/503-error.html', 'public/503.html', 'spec/test_data/sample.html']
49
47
 
50
- assets = ['spec/test_data/y.css', 'spec/test_data/a.js', 'spec/test_data/sample.html'].map { |f| RemoteAsset.new(:path => f) }
48
+ assets = ['spec/test_data/a.js', 'spec/test_data/y.css', 'spec/test_data/sample.html'].map { |f| RemoteAsset.new(:path => f) }
51
49
 
52
50
  assets.each{|f| f.create! }
53
51
 
@@ -69,20 +67,13 @@ describe Trackman::Assets::RemoteAsset do
69
67
  end
70
68
 
71
69
  it "throws if a config is missing" do
72
- configs = {
73
- '@@server' => 'TRACKMAN_SERVER_URL',
74
- '@@user' => 'TRACKMAN_USER',
75
- '@@pass' => 'TRACKMAN_PASSWORD',
76
- '@@app_id' => 'TRACKMAN_APP_ID'
77
- }
78
70
  begin
79
- configs.each {|k,v| RemoteAsset.send(:class_variable_set, k, nil) }
80
- configs.each do |k,v|
71
+ @config.each {|k,v| RemoteAsset.send(:class_variable_set, k, nil) }
72
+ @config.each do |k,v|
81
73
  lambda { RemoteAsset.new(:path => 'spec/test_data/a.js') }.should raise_error(Trackman::Assets::Errors::ConfigNotFoundError)
82
- RemoteAsset.send(:class_variable_set, k, ENV[v])
83
74
  end
84
- ensure
85
- configs.each {|k,v| RemoteAsset.send(:class_variable_set, k, ENV[v]) }
75
+ ensure
76
+ @config.each {|k,v| RemoteAsset.send(:class_variable_set, k, v) }
86
77
  end
87
78
  end
88
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-06-03 00:00:00.000000000 Z
13
+ date: 2012-06-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rest-client
17
- requirement: &8210940 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,15 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *8210940
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
26
31
  - !ruby/object:Gem::Dependency
27
32
  name: json
28
- requirement: &8210260 !ruby/object:Gem::Requirement
33
+ requirement: !ruby/object:Gem::Requirement
29
34
  none: false
30
35
  requirements:
31
36
  - - ! '>='
@@ -33,10 +38,15 @@ dependencies:
33
38
  version: '0'
34
39
  type: :runtime
35
40
  prerelease: false
36
- version_requirements: *8210260
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
37
47
  - !ruby/object:Gem::Dependency
38
48
  name: nokogiri
39
- requirement: &8209700 !ruby/object:Gem::Requirement
49
+ requirement: !ruby/object:Gem::Requirement
40
50
  none: false
41
51
  requirements:
42
52
  - - ! '>='
@@ -44,10 +54,15 @@ dependencies:
44
54
  version: '0'
45
55
  type: :runtime
46
56
  prerelease: false
47
- version_requirements: *8209700
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
48
63
  - !ruby/object:Gem::Dependency
49
64
  name: rack
50
- requirement: &8209280 !ruby/object:Gem::Requirement
65
+ requirement: !ruby/object:Gem::Requirement
51
66
  none: false
52
67
  requirements:
53
68
  - - ! '>='
@@ -55,10 +70,15 @@ dependencies:
55
70
  version: '0'
56
71
  type: :runtime
57
72
  prerelease: false
58
- version_requirements: *8209280
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
59
79
  - !ruby/object:Gem::Dependency
60
80
  name: rspec
61
- requirement: &8208860 !ruby/object:Gem::Requirement
81
+ requirement: !ruby/object:Gem::Requirement
62
82
  none: false
63
83
  requirements:
64
84
  - - ! '>='
@@ -66,7 +86,12 @@ dependencies:
66
86
  version: '0'
67
87
  type: :development
68
88
  prerelease: false
69
- version_requirements: *8208860
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
70
95
  description: Trackman hosts your maintenances and app-down pages (503s) and lets you
71
96
  keep them in your current development environment so that you can focus on delivering
72
97
  and not configuring.
@@ -105,6 +130,7 @@ files:
105
130
  - lib/trackman/assets/errors/config_not_found_error.rb
106
131
  - lib/trackman/assets/html_asset.rb
107
132
  - lib/trackman/assets/remote_asset.rb
133
+ - lib/trackman/debugger.rb
108
134
  - lib/trackman/rack_middleware.rb
109
135
  - lib/trackman/railtie.rb
110
136
  - lib/trackman/version.rb
@@ -144,9 +170,7 @@ files:
144
170
  - spec/fixtures/rails2311/fully-loaded/public/422.html
145
171
  - spec/fixtures/rails2311/fully-loaded/public/500.html
146
172
  - spec/fixtures/rails2311/fully-loaded/public/503-error.html
147
- - spec/fixtures/rails2311/fully-loaded/public/503-error.html~
148
173
  - spec/fixtures/rails2311/fully-loaded/public/503.html
149
- - spec/fixtures/rails2311/fully-loaded/public/503.html~
150
174
  - spec/fixtures/rails2311/fully-loaded/public/favicon.ico
151
175
  - spec/fixtures/rails2311/fully-loaded/public/images/rails.png
152
176
  - spec/fixtures/rails2311/fully-loaded/public/index.html
@@ -405,7 +429,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
405
429
  version: '0'
406
430
  requirements: []
407
431
  rubyforge_project:
408
- rubygems_version: 1.8.10
432
+ rubygems_version: 1.8.24
409
433
  signing_key:
410
434
  specification_version: 3
411
435
  summary: Client version of the Trackman addon on Heroku
@@ -1,24 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>HAPPY PATH FIXTURE</title>
5
-
6
- <link rel="stylesheet" type="text/css" href="stylesheets/some-other-css.css" />
7
-
8
- <style>
9
- @import url('stylesheets/application.css');
10
-
11
- p {
12
- color:#09F;
13
- text-indent: 20px;
14
- }
15
- </style>
16
-
17
- </head>
18
- <body>
19
- <div class="dialog">
20
- <h1>503 - Error</h1>
21
- <p>The website is down right now ...</p>
22
- </div>
23
- </body>
24
- </html>
@@ -1,275 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html>
4
- <head>
5
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
6
- <title>Ruby on Rails: Welcome aboard</title>
7
- <style type="text/css" media="screen">
8
- body {
9
- margin: 0;
10
- margin-bottom: 25px;
11
- padding: 0;
12
- background-color: #f0f0f0;
13
- font-family: "Lucida Grande", "Bitstream Vera Sans", "Verdana";
14
- font-size: 13px;
15
- color: #333;
16
- }
17
-
18
- h1 {
19
- font-size: 28px;
20
- color: #000;
21
- }
22
-
23
- a {color: #03c}
24
- a:hover {
25
- background-color: #03c;
26
- color: white;
27
- text-decoration: none;
28
- }
29
-
30
-
31
- #page {
32
- background-color: #f0f0f0;
33
- width: 750px;
34
- margin: 0;
35
- margin-left: auto;
36
- margin-right: auto;
37
- }
38
-
39
- #content {
40
- float: left;
41
- background-color: white;
42
- border: 3px solid #aaa;
43
- border-top: none;
44
- padding: 25px;
45
- width: 500px;
46
- }
47
-
48
- #sidebar {
49
- float: right;
50
- width: 175px;
51
- }
52
-
53
- #footer {
54
- clear: both;
55
- }
56
-
57
-
58
- #header, #about, #getting-started {
59
- padding-left: 75px;
60
- padding-right: 30px;
61
- }
62
-
63
-
64
- #header {
65
- background-image: url("images/rails.png");
66
- background-repeat: no-repeat;
67
- background-position: top left;
68
- height: 64px;
69
- }
70
- #header h1, #header h2 {margin: 0}
71
- #header h2 {
72
- color: #888;
73
- font-weight: normal;
74
- font-size: 16px;
75
- }
76
-
77
-
78
- #about h3 {
79
- margin: 0;
80
- margin-bottom: 10px;
81
- font-size: 14px;
82
- }
83
-
84
- #about-content {
85
- background-color: #ffd;
86
- border: 1px solid #fc0;
87
- margin-left: -11px;
88
- }
89
- #about-content table {
90
- margin-top: 10px;
91
- margin-bottom: 10px;
92
- font-size: 11px;
93
- border-collapse: collapse;
94
- }
95
- #about-content td {
96
- padding: 10px;
97
- padding-top: 3px;
98
- padding-bottom: 3px;
99
- }
100
- #about-content td.name {color: #555}
101
- #about-content td.value {color: #000}
102
-
103
- #about-content.failure {
104
- background-color: #fcc;
105
- border: 1px solid #f00;
106
- }
107
- #about-content.failure p {
108
- margin: 0;
109
- padding: 10px;
110
- }
111
-
112
-
113
- #getting-started {
114
- border-top: 1px solid #ccc;
115
- margin-top: 25px;
116
- padding-top: 15px;
117
- }
118
- #getting-started h1 {
119
- margin: 0;
120
- font-size: 20px;
121
- }
122
- #getting-started h2 {
123
- margin: 0;
124
- font-size: 14px;
125
- font-weight: normal;
126
- color: #333;
127
- margin-bottom: 25px;
128
- }
129
- #getting-started ol {
130
- margin-left: 0;
131
- padding-left: 0;
132
- }
133
- #getting-started li {
134
- font-size: 18px;
135
- color: #888;
136
- margin-bottom: 25px;
137
- }
138
- #getting-started li h2 {
139
- margin: 0;
140
- font-weight: normal;
141
- font-size: 18px;
142
- color: #333;
143
- }
144
- #getting-started li p {
145
- color: #555;
146
- font-size: 13px;
147
- }
148
-
149
-
150
- #search {
151
- margin: 0;
152
- padding-top: 10px;
153
- padding-bottom: 10px;
154
- font-size: 11px;
155
- }
156
- #search input {
157
- font-size: 11px;
158
- margin: 2px;
159
- }
160
- #search-text {width: 170px}
161
-
162
-
163
- #sidebar ul {
164
- margin-left: 0;
165
- padding-left: 0;
166
- }
167
- #sidebar ul h3 {
168
- margin-top: 25px;
169
- font-size: 16px;
170
- padding-bottom: 10px;
171
- border-bottom: 1px solid #ccc;
172
- }
173
- #sidebar li {
174
- list-style-type: none;
175
- }
176
- #sidebar ul.links li {
177
- margin-bottom: 5px;
178
- }
179
-
180
- </style>
181
- <script type="text/javascript" src="javascripts/prototype.js"></script>
182
- <script type="text/javascript" src="javascripts/effects.js"></script>
183
-
184
- function about() {
185
- if (Element.empty('about-content')) {
186
- new Ajax.Updater('about-content', 'rails/info/properties', {
187
- method: 'get',
188
- onFailure: function() {Element.classNames('about-content').add('failure')},
189
- onComplete: function() {new Effect.BlindDown('about-content', {duration: 0.25})}
190
- });
191
- } else {
192
- new Effect[Element.visible('about-content') ?
193
- 'BlindUp' : 'BlindDown']('about-content', {duration: 0.25});
194
- }
195
- }
196
-
197
- window.onload = function() {
198
- $('search-text').value = '';
199
- $('search').onsubmit = function() {
200
- $('search-text').value = 'site:rubyonrails.org ' + $F('search-text');
201
- }
202
- }
203
- </script>
204
- </head>
205
- <body>
206
- <div id="page">
207
- <div id="sidebar">
208
- <ul id="sidebar-items">
209
- <li>
210
- <form id="search" action="http://www.google.com/search" method="get">
211
- <input type="hidden" name="hl" value="en" />
212
- <input type="text" id="search-text" name="q" value="site:rubyonrails.org " />
213
- <input type="submit" value="Search" /> the Rails site
214
- </form>
215
- </li>
216
-
217
- <li>
218
- <h3>Join the community</h3>
219
- <ul class="links">
220
- <li><a href="http://www.rubyonrails.org/">Ruby on Rails</a></li>
221
- <li><a href="http://weblog.rubyonrails.org/">Official weblog</a></li>
222
- <li><a href="http://wiki.rubyonrails.org/">Wiki</a></li>
223
- </ul>
224
- </li>
225
-
226
- <li>
227
- <h3>Browse the documentation</h3>
228
- <ul class="links">
229
- <li><a href="http://api.rubyonrails.org/">Rails API</a></li>
230
- <li><a href="http://stdlib.rubyonrails.org/">Ruby standard library</a></li>
231
- <li><a href="http://corelib.rubyonrails.org/">Ruby core</a></li>
232
- <li><a href="http://guides.rubyonrails.org/">Rails Guides</a></li>
233
- </ul>
234
- </li>
235
- </ul>
236
- </div>
237
-
238
- <div id="content">
239
- <div id="header">
240
- <h1>Welcome aboard</h1>
241
- <h2>You&rsquo;re riding Ruby on Rails!</h2>
242
- </div>
243
-
244
- <div id="about">
245
- <h3><a href="rails/info/properties" onclick="about(); return false">About your application&rsquo;s environment</a></h3>
246
- <div id="about-content" style="display: none"></div>
247
- </div>
248
-
249
- <div id="getting-started">
250
- <h1>Getting started</h1>
251
- <h2>Here&rsquo;s how to get rolling:</h2>
252
-
253
- <ol>
254
- <li>
255
- <h2>Use <tt>script/generate</tt> to create your models and controllers</h2>
256
- <p>To see all available options, run it without parameters.</p>
257
- </li>
258
-
259
- <li>
260
- <h2>Set up a default route and remove or rename this file</h2>
261
- <p>Routes are set up in config/routes.rb.</p>
262
- </li>
263
-
264
- <li>
265
- <h2>Create your database</h2>
266
- <p>Run <tt>rake db:migrate</tt> to create your database. If you're not using SQLite (the default), edit <tt>config/database.yml</tt> with your username and password.</p>
267
- </li>
268
- </ol>
269
- </div>
270
- </div>
271
-
272
- <div id="footer">&nbsp;</div>
273
- </div>
274
- </body>
275
- </html>