スポンサーリンク

AptanaStudio3でHeroku(Rails)

Railsチュートリアル

http://railstutorial.jp/

を、

Windows 8.1

Aptana Studio 3 (日本語化)

の条件のもとで、またやり始めている。

だんだんRailsが面白くなってきた。

(1)Railsチュートリアル

http://railstutorial.jp/

(2)『改訂3版 基礎Ruby on Rails』

http://www.oiax.jp/rails4book

(3)「Herokuではじめる 初心者のためのRuby on Rails3入門」

http://libro.tuyano.com/index2?id=782001

この3つを繰り返し繰り返し読んでいる。一気に全部やるのは大変なので、途中までやって、つまづいたり、飽きたりしたら、別の本 or サイトを読みながら、繰り返しやっていくと、だんだん、最初、つまづいたところも、次に進めるようになってくる。

特に、最初は、gitとか全くうまくいかなかった(当然、意味など今でも分かっていない)し、herokuなんて何回やってもできなかったが、繰り返しやっていくにつれて、少しずつ、できるようになってきた気がする。まだまだだが。

Railsをやっている最初のあたり、ミスったところ。

スペースが、全角だと、エラー

スペースが、足りないと、エラー

文字が一文字でも間違っていると、エラー(当たり前だが、、、)

 

http://qiita.com/ikuwow/items/8b8aa9ac8990f98691a9

git add *
git commit -m "chapter 4 done"
git push origin master

 

git push heroku master

 

(1)Rails チュートリアル 第1章

Gemfileは、以下のようにしたところ、HerokuにDeploy(アップロード?)できた。

(チュートリアル通りのGemfileにすると、ローカルでさえサーバーWEBRickがうまくいかない。)

(Cloud9では、チュートリアル通りにやればうまくいった気がする。)

http://qiita.com/ikuwow/items/8b8aa9ac8990f98691a9

によると、とにかく、

Herokuにアップロードするとき、よくわからないが、

Gemfileに、

———-

group :production do
  gem ‘pg’,             ‘0.17.1’
  gem ‘rails_12factor’, ‘0.0.2’
end

———-

と記載してから、bundle install することと、

————-

Procfileを作ります。
$ vim Procfile
# 中身は以下のようにする。
web: bundle exec rails server -p $PORT

————-

をしなければならないらしい。理由は分からない。

image

 

1回目Herokuにアップロードできてから、すぐに、2回目、全く同じようにやろうとしたら、なぜかうまくいかず、

http://qiita.com/ikuwow/items/8b8aa9ac8990f98691a9

を繰り返し見て、やってみたら、なんとかできた。うまくいかなかったときと、うまくいったときの違いが全く分からない。。。

—————–

source ‘https://rubygems.org’

# Bundle edge Rails instead: gem ‘rails’, github: ‘rails/rails’
gem ‘rails’, ‘4.2.2’
# Use SCSS for stylesheets
gem ‘sass-rails’, ‘~> 5.0’
# Use Uglifier as compressor for JavaScript assets
gem ‘uglifier’, ‘>= 1.3.0’
# Use CoffeeScript for .coffee assets and views
gem ‘coffee-rails’, ‘~> 4.1.0’
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem ‘therubyracer’, platforms: :ruby

# Use jquery as the JavaScript library
gem ‘jquery-rails’
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem ‘turbolinks’
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem ‘jbuilder’, ‘~> 2.0’
# bundle exec rake doc:rails generates the API under doc/api.
gem ‘sdoc’, ‘~> 0.4.0’, group: :doc

# Use ActiveModel has_secure_password
# gem ‘bcrypt’, ‘~> 3.1.7’

# Use Unicorn as the app server
# gem ‘unicorn’

# Use Capistrano for deployment
# gem ‘capistrano-rails’, group: :development

group :development, :test do
  # Use sqlite3 as the database for Active Record
  gem ‘sqlite3’
  # Call ‘byebug’ anywhere in the code to stop execution and get a debugger console
  gem ‘byebug’
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem ‘web-console’, ‘~> 2.0’
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem ‘tzinfo-data’, platforms: [:mingw, :mswin, :x64_mingw, :jruby]

group :production do
  gem ‘pg’,             ‘0.17.1’
  gem ‘rai

—————–

スポンサーリンク