diff --git a/.c9/runners/Hyperloop.run b/.c9/runners/Hyperloop.run index f3c546c..16698d9 100644 --- a/.c9/runners/Hyperloop.run +++ b/.c9/runners/Hyperloop.run @@ -3,7 +3,7 @@ "bash", "--login", "-c", - "rvm 2.3.1 do bundle exec invoker start Procfile" + "rvm 2.3.4 do bundle exec invoker start Procfile" ], "working_dir": "$project_path", "info": "Hyperloop Application running at \\033[01;34m$url\\033[00m.\n\\033[01;31m", diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 0000000..808474e --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +rails-clone-and-go diff --git a/.ruby-version b/.ruby-version index a625450..fd06a92 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.3.1 \ No newline at end of file +2.3.4 \ No newline at end of file diff --git a/Procfile b/Procfile index 8dc8033..4e60c20 100644 --- a/Procfile +++ b/Procfile @@ -1,3 +1,3 @@ -web: bundle exec rails s -p 8080 -b 0.0.0.0 -hot-loader: bundle exec opal-hot-reloader -d app/hyperloop -p 8081 +web: bundle exec rails s -p 3000 -b 0.0.0.0 +hot-loader: bundle exec opal-hot-reloader -d app/hyperloop diff --git a/README.md b/README.md index d8fef76..6732f85 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ before proceeding. Some steps in the setup can take 2-3 minutes... be patient... -**Once setup completes you will need to run `rvm use 2.3.1` to switch the Ruby 2.3.1.** +**Once setup completes you will need to run `rvm use 2.3.4` to switch the Ruby 2.3.4.** Once you are installed you can fire up the server and the opal-hot-reloader by running `./bin/hyperloop` in a console window (in Cloud9 you can also use the run command at the top navbar.) @@ -76,7 +76,7 @@ Hyperloop Operations keep Stores and Components separated, provides a central pl Setup does the following. If you are not using rvm or mysql you will have to manually walk through these steps: -1. Make sure a recent version (we use 2.3.1, but 2.4.0 also works fine) of ruby is installed +1. Make sure a recent version (we use 2.3.4, but 2.4.0 also works fine) of ruby is installed 2. Make sure bundler is installed 3. Update the `config/database.yml` file 4. Change the applcation name in `config/application.rb` diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index ccc85f2..9b77b37 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -11,7 +11,8 @@ // about supported directives. // //= require rails-ujs -//= require 'jquery' +//= require jquery //= require_tree . //= require hyperloop-loader -Opal.OpalHotReloader.$listen() // optional (port, false, poll_seconds) i.e. (8081, false, 1) + +Opal.OpalHotReloader.$listen() // optional (port) i.e. (8081), default is 25222 diff --git a/app/hyperloop/components/app.rb b/app/hyperloop/components/app.rb index 154b59a..980dcc4 100644 --- a/app/hyperloop/components/app.rb +++ b/app/hyperloop/components/app.rb @@ -1,17 +1,17 @@ # app/hyperloop/components/app.rb -class App < Hyperloop::Router +class App < Hyperloop::Router # usually the top level component is Router which is a kind of Hyperloop component - + history :browser - + after_mount do every(1) { force_update! } end - + route do DIV(class: :hyperloophelloworld) do - IMG(src: "assets/hyperloop-logo-medium-white.png") + IMG(src: 'assets/hyperloop-logo-medium-white.png') DIV { "Hyperloop at your service! - The time is #{Time.now}" } diff --git a/bin/hyperloop b/bin/hyperloop index 6aa1de2..03f171f 100755 --- a/bin/hyperloop +++ b/bin/hyperloop @@ -7,5 +7,5 @@ include FileUtils APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) chdir APP_ROOT do - system 'rvm 2.3.1 do bundle exec invoker start Procfile' + system 'rvm 2.3.4 do bundle exec invoker start Procfile' end diff --git a/bin/setup b/bin/setup index 96ce145..8dade83 100755 --- a/bin/setup +++ b/bin/setup @@ -5,8 +5,8 @@ include FileUtils # path to your application root. APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) -APP_NAME = ENV['C9_PROJECT'] || File.basename(APP_ROOT) -APP_CLASS = APP_NAME.gsub('-', '_').split('_').collect!{ |w| w.capitalize }.join +APP_NAME = ENV['C9_PROJECT'] || File.basename(APP_ROOT) # rails-clone-and-go +APP_CLASS = APP_NAME.gsub('-', '_').split('_').collect!{ |w| w.capitalize }.join # RailsCloneAndGo def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") @@ -15,15 +15,15 @@ end chdir APP_ROOT do # This script is a starting point to setup your application. # Add necessary setup steps to this file. - - puts '== Installing Ruby 2.3.1 ==' - system `rvm install ruby-2.3.1` - system `rvm 2.3.1` - puts '== Installing dependencies ==' - system! 'rvm 2.3.1 do gem install bundler --conservative' - system('rvm 2.3.1 do bundle check') || system!('rvm 2.3.1 do bundle install') - + # puts '== Installing Ruby 2.3.4 ==' + # system `rvm install ruby-2.3.4` + # system `rvm 2.3.4` + + # puts '== Installing dependencies ==' + # system! 'rvm 2.3.4 do gem install bundler --conservative' + # system('rvm 2.3.4 do bundle check') || system!('rvm 2.3.4 do bundle install') + puts '== Updating database yml file ==' db_yml_path = File.join(APP_ROOT, 'config', 'database.yml') IO.write(db_yml_path, File.open(db_yml_path) {|f| f.read.gsub(/hyperloop_/, "#{APP_NAME}_")}) @@ -32,7 +32,7 @@ chdir APP_ROOT do puts "== Updating app name to #{APP_CLASS} ==" application_path = File.join(APP_ROOT, 'config', 'application.rb') IO.write(application_path, File.open(application_path) {|f| f.read.gsub(/HyperloopCloneAndGo/, "#{APP_CLASS}")}) - + if ENV['C9_PROJECT'] puts "== Updating Hot Reloader Settings ==" application_path = File.join(APP_ROOT, 'app', 'assets', 'javascripts', 'application.js') @@ -42,23 +42,23 @@ chdir APP_ROOT do application_path = File.join(APP_ROOT, 'Procfile') IO.write(application_path, File.open(application_path) {|f| f.read.gsub(/ -p 808\d/, '')}) end - + puts '== Initializing the DB ==' if ENV['C9_PROJECT'] && `mysql-ctl status 2>&1` =~ /stopped/ puts "********* starting mysql **********" `mysql-ctl start` end - system('rvm 2.3.1 do bundle exec rails db:create') - if system('rvm 2.3.1 do bundle exec rake environment') + system('rvm 2.3.4 do bundle exec rails db:create') + if system('rvm 2.3.4 do bundle exec rake environment') puts "\n\n\e[33m" puts "*********************************************************************************\n\n" - puts "To finish installation switch to ruby 2.3.1 by doing an 'rvm use 2.3.1'\n" + puts "To finish installation switch to ruby 2.3.4 by doing an 'rvm use 2.3.4'\n" puts "*********************************************************************************\n\n" else puts "\n\n\e[33m" puts "*********************************************************************************\n\n" puts "Failed to create your DB. Make sure MySql is installed and running.\n" - puts "To finish installation switch to ruby 2.3.1 by doing an 'rvm use 2.3.1'\n" + puts "To finish installation switch to ruby 2.3.4 by doing an 'rvm use 2.3.4'\n" puts "Then do a 'bundle exec rails db:create'" puts "*********************************************************************************\n\n" end diff --git a/config/database.yml.bak b/config/database.yml.bak new file mode 100644 index 0000000..2e71708 --- /dev/null +++ b/config/database.yml.bak @@ -0,0 +1,54 @@ +# MySQL. Versions 5.1.10 and up are supported. +# +# Install the MySQL driver +# gem install mysql2 +# +# Ensure the MySQL gem is defined in your Gemfile +# gem 'mysql2' +# +# And be sure to use new-style password hashing: +# http://dev.mysql.com/doc/refman/5.7/en/old-client.html +# +default: &default + adapter: mysql2 + encoding: utf8 + pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> + username: root + password: + socket: /var/run/mysql/mysql.sock + +development: + <<: *default + database: hyperloop_development + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + <<: *default + database: hyperloop_test + +# As with config/secrets.yml, you never want to store sensitive information, +# like your database password, in your source code. If your source code is +# ever seen by anyone, they now have access to your database. +# +# Instead, provide the password as a unix environment variable when you boot +# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database +# for a full rundown on how to provide these environment variables in a +# production deployment. +# +# On Heroku and other platform providers, you may have a full connection URL +# available as an environment variable. For example: +# +# DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase" +# +# You can use this database configuration with: +# +# production: +# url: <%= ENV['DATABASE_URL'] %> +# +production: + <<: *default + database: hyperloop_production + username: hyperloop-developer + password: <%= ENV['HYPERLOOP_PRODUCTION_DB_PASSWORD'] %>