herokuコマンドが見つからない

ubuntuで久しぶりにherokuを使おうと

$ heroku login
とかしたら

command not found

とかでました

Heroku Toolbelt
のとおりコマンドを実行

$ wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh

としたら既に最新版が入ってるとか言われました

$ which heroku
としても無反応..

入れなおしました
wgetしているシェルスクリプト見ると普通にapt-get installしてたので

$ apt-get –purge remove heroku heroku-toolbelt

で消して再度コマンド実行
$ wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh

で見事はいりました

rakeでタスクの一覧を見る

Spreeのときはデフォルトの管理ユーザーを作るのに

$ rake spree_auth:admin:create

を使ったりします
参考: Ruby on RailsにSpreeを入れてみた | bgbgbg

こういったタスクなにがあるんだっけ..?のときに

$ rake -T

とすると一覧で見れて便利です

ちなみに spree を入れた時の結果はこんな感じ

rake assets:clobber                                 # Remove compiled assets
rake assets:environment                             # Load asset compile environment
rake assets:precompile                              # Compile all the assets named in config.assets.precompile
rake cache_digests:dependencies                     # Lookup first-level dependencies for TEMPLATE (like messages/show or comments/_comment.html)
rake cache_digests:nested_dependencies              # Lookup nested dependencies for TEMPLATE (like messages/show or comments/_comment.html)
rake db:bootstrap                                   # Bootstrap is: migrating, loading defaults, sample data and seeding (for all extensions) and load_products tasks
rake db:create                                      # Creates the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:create:all to create all databases in the config)
rake db:drop                                        # Drops the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:drop:all to drop all databases in the config)
rake db:fixtures:load                               # Load fixtures into the current environment's database
rake db:load_dir[dir]                               # Loads fixtures from the the dir you specify using rake db:load_dir[loadfrom]
rake db:load_file[file,dir]                         # Loads a specified fixture file:
rake db:migrate                                     # Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)
rake db:migrate:status                              # Display status of migrations
rake db:remigrate                                   # Migrate schema to version 0 and back up again
rake db:rollback                                    # Rolls the schema back to the previous version (specify steps w/ STEP=n)
rake db:schema:cache:clear                          # Clear a db/schema_cache.dump file
rake db:schema:cache:dump                           # Create a db/schema_cache.dump file
rake db:schema:dump                                 # Create a db/schema.rb file that is portable against any DB supported by AR
rake db:schema:load                                 # Load a schema.rb file into the database
rake db:seed                                        # Load the seed data from db/seeds.rb
rake db:setup                                       # Create the database, load the schema, and initialize with the seed data (use db:reset to also drop the database first)
rake db:structure:dump                              # Dump the database structure to db/structure.sql
rake db:structure:load                              # Recreate the databases from the structure.sql file
rake db:version                                     # Retrieves the current schema version number
rake deface:clean                                   # Removes all precompiled override templates
rake deface:failures_by_virtual_path[virtual_path]  # Report on failing overrides for a partial/template
rake deface:get_result[virtual_path]                # Get the resulting markup for a partial/template
rake deface:precompile                              # Precompiles overrides into template files
rake deface:test_all                                # Load and apply all overrides, and output results
rake deface:test_selector[virtual_path,selector]    # Applies selectors to given partial/template, and returns match(s) source
rake doc:app                                        # Generate docs for the app -- also available doc:rails, doc:guides (options: TEMPLATE=/rdoc-template.rb, TITLE="Custom Title")
rake email:test                                     # Sends test email to specified address - Example: EMAIL=spree@example.com bundle exec rake test:email
rake exchanges:charge_unreturned_items              # Takes unreturned exchanged items and creates a new order to charge
rake log:clear                                      # Truncates all *.log files in log/ to zero bytes (specify which logs with LOGS=test,development)
rake middleware                                     # Prints out your Rack middleware stack
rake notes                                          # Enumerate all annotations (use notes:optimize, :fixme, :todo for focus)
rake notes:custom                                   # Enumerate a custom annotation, specify with ANNOTATION=CUSTOM
rake paperclip:clean                                # Cleans out invalid attachments
rake paperclip:refresh                              # Refreshes both metadata and thumbnails
rake paperclip:refresh:metadata                     # Regenerates content_type/size metadata for a given CLASS (and optional ATTACHMENT)
rake paperclip:refresh:missing_styles               # Regenerates missing thumbnail styles for all classes using Paperclip
rake paperclip:refresh:thumbnails                   # Regenerates thumbnails for a given CLASS (and optional ATTACHMENT and STYLES splitted by comma)
rake rails:template                                 # Applies the template supplied by LOCATION=(/path/to/template) or URL
rake rails:update                                   # Update configs and some other initially generated files (or use just update:configs or update:bin)
rake routes                                         # Print out all defined routes in match order, with names
rake secret                                         # Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie sessions)
rake spec                                           # Run all specs in spec directory (excluding plugin specs)
rake spec:controllers                               # Run the code examples in spec/controllers
rake spec:helpers                                   # Run the code examples in spec/helpers
rake spree:install:migrations                       # Copy migrations from spree to application
rake spree:reset_taxon_permalinks                   # Resets all taxon permalinks
rake spree_api:install:migrations                   # Copy migrations from spree_api to application
rake spree_auth:admin:create                        # Create admin username and password
rake spree_auth:install:migrations                  # Copy migrations from spree_auth to application
rake spree_i18n:install:migrations                  # Copy migrations from spree_i18n to application
rake spree_paypal_express:install:migrations        # Copy migrations from spree_paypal_express to application
rake spree_sample:load                              # Loads sample data
rake stats                                          # Report code statistics (KLOCs, etc) from the application or engine
rake test                                           # Runs all tests in test folder
rake test:all                                       # Run tests quickly by merging all types and not resetting db
rake test:all:db                                    # Run tests quickly, but also reset db
rake test:db                                        # Run tests quickly, but also reset db
rake time:zones:all                                 # Displays all time zones, also available: time:zones:us, time:zones:local -- filter with OFFSET parameter, e.g., OFFSET=-6
rake tmp:clear                                      # Clear session, cache, and socket files from tmp/ (narrow w/ tmp:sessions:clear, tmp:cache:clear, tmp:sockets:clear)
rake tmp:create                                     # Creates tmp directories for sessions, cache, sockets, and pids

bundleでインストールしたgemの場所を見たり開いたりする

rubyでgemをbundleでインストールした際、gemのソースが見たくなったら

$ bundle show rails
/home/vagrant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rails-4.2.0

などと場所がわかります

一気にエディタで開きたかったら

$ bundle open rails

で指定したエディタで開きます

エディタを指定してなければエラーが発生

To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR

そういうときはUbuntuの場合

$ vim ~/.vimrc

EDITOR="vim"

とか書き込んで、設定読み込み

$ source ~/.vimrc

で再度 bundle openしてあげるといいです

spree 2.6 から 3.0へバージョンアップする

rails 4.1.8 + spree 2.6
でECサイトを作っていましたが、spree 3.0が出てました

https://guides.spreecommerce.com/release_notes/spree_3_0_0.html

  • Bootstrap Backend & Frontend
  • Rails 4.2 Support
  • Google Analytics Enhanced Ecommerce

が主な対応みたいで、上げてみました

https://guides.spreecommerce.com/release_notes/spree_3_0_0.html

を参考に上げてみました
rails 4.2 + spree 最新にします

$ vim Gemfiles

source 'https://rubygems.org'

gem 'rails', '~> 4.2.0'
gem 'mysql2'
gem 'uglifier', '>= 1.3.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0',          group: :doc
gem 'spring',        group: :development

group :assets do
  gem 'sprockets-rails'
  gem 'sass-rails',   '~> 4.0.0'
  gem 'coffee-rails', '~> 4.0.0'
end

gem 'spree', github: 'spree/spree'
gem 'spree_auth_devise', github: 'spree/spree_auth_devise'
gem 'spree_gateway', github: 'spree/spree_gateway'

で最終的にはこんな形になりました

インストール
$ bundle update
$ bundle install
$ rake railties:install:migrations
$ rake db:migrate

で、あがったようです
bootstrapで見た目も変わりました