Coder Social home page Coder Social logo

isabella232 / iot-website-source Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mit-cml/iot-website-source

0.0 0.0 0.0 94.53 MB

Source for the MIT App Inventor IoT Website (react.js based)

License: MIT License

JavaScript 99.78% Ruby 0.20% Shell 0.02%

iot-website-source's Introduction

Getting Started with Vagrant (recommended)

This currently does NOT work on Windows. See "Setting up on Windows" below.

In order to modify the IoT website you will need some software. We use “vagrant” to create a virtual machine to run this software to ensure that the correct versions are being used, regardless of platform and platform version.

You will need to install “VirtualBox” and “vagrant” 1

VirtualBox can be found at: https://www.virtualbox.org/wiki/Downloads

Vagrant can be found at: https://www.vagrantup.com/downloads.html

Download the appropriate installers and run them.

Assuming you have a GitHub account, you should clone the website source repository (assuming you are starting from your home directory)

Issue the following commands (The “#” and stuff after it is a comment, don't type it in!):

git clone [email protected]:mit-cml/iot-website-source
cd iot-website-source
vagrant up  # <– This step will take a *long* time, particularly
            #    the first time you run it.

At this point vagrant is downloading a ubuntu (linux) VM, starting it up in VirtualBox and provisioning it, which means it is downloading the software needed to build the website. This takes quite awhile, but only the first time you do the “vagrant up” command. When complete, move on to Building the site using Vagrant.

Building the site using Vagrant (recommended)

When you start working on the site for the day, you will begin by running vagrant up in the "iot-website-source" folder. Then you can log in to the VM:

vagrant ssh # <– This will connect you to the virtual machine
            #    your next command will be in the context of the
            #    virtual machine

cd /vagrant/docs
python makepages.py
npm start

This will compile the source of the website. It will be obvious if there are errors. If all goes well, you can go to “localhost:3000” on your host machine with a browser and see the site.

Once you are running, you are ready to edit. See Where the pages are… below.

Getting Started without Vagrant

You don't need vagrant if you have or can get node.js yourself. This means you're responsible for keeping your tools updated, as Vagrant isn't there to do it for you. This is probably much faster at initial setup than the Vagrant path.

Things you need:

Assuming you have a GitHub account, you should clone the website source repository (assuming you are starting from your home directory)

Issue the following commands:

git clone [email protected]:mit-cml/iot-website-source

cd iot-website-source
npm install
cd docs
npm install

Now you're ready!

Building the site without Vagrant

When you start working on the site for the day, you will change into the docs directory and start npm.

cd iot-website-source/docs
npm start

This will compile the source of the website. It will be obvious if there are errors. If all goes well, you can go to “localhost:3000” on your host machine with a browser and see the site.

Once you are running, you are ready to edit. See Where the pages are… below.

Setting up on Windows (without Vagrant - sort of recommended)

Install Github Desktop, Python 2.7, and node.js.

Add Python to your path variable:

  • Go to My Computer ➡️ Properties ➡️ Advanced ➡️ Environment Variables
  • Under User Variables, add ;C:\Python27 to the end of the user path Variables
  • If there is no User Path variable, create it and add C:\Python27

Clone the repository using Github Desktop. The default location is Documents\GitHub\iot-website-source. Know where it went.

Open Powershell, change (cd) into the repository directory, from above. In the directory, run:

> npm install
> cd docs
> npm install

and that's it! You're ready for "Using on Windows Without Vagrant," below.

Using on Windows Without Vagrant

There will be two powershell windows. One will run the server, the other will have a script that you re-run to apply any new changes.

In Powershell, change into the iot-website-source\docs directory, and run python makepages.py (if you use tab to autocomplete, it will be rewrite it to python .\makepages.py and that's fine.)

Open a second pwershell instance, change into the same directory and run npm run browser:development.

Open your browser and go to localhost:3000.

When you make changes to the files and want to see them in the browser, go to the first Powershell window and re-run python makepages.py. (You can use the up arrow on the keyboard so you don't have to re-type it.)

Where the pages are…

Page source (in Markdown) live in docs/src/app/pages. You can edit any of the pages in that directory and rebuild the site and you will see your changes.

If you are using vagrant, this will be inside the /vagrant folder.

If you are not using vagrant, this will be inside the iot-website-source folder.

If the processor is running (because you have run npm start), then the website in your brownser ("localhost:3000") will automatically update when you save changes to any of these files.

Adding a new page

This is a little more complicated, but only a little.

Create your page in /vagrant/docs/src/app/pages. You then need to edit the makepages.py script to assign your page a path. Look at the lines that are there to see how to do it. You then need to edit /vagrant/docs/src/app/AppNavDrawer.js to add your page to the hierarchy of pages defined there. Again, look at the existing pages as a guide.

DO NOT EDIT /vagrant/docs/src/app/AppRoutes.js This file is automatically generated by the makepages.py script (which is why you edit the script to add a page).

So far we have two top-level drawers defined, “Teachers” and “Extensions”. You can add a new top-level draw. However to do so you also need to edit /vagrant/docs/src/app/Master.js. Look around line 160 where the existing top level drawers are mentioned. Add your draw there (using the code there as a guide).

When you are done, use the “npm start” to test out your additions.

Building the site for public distribution

To build the site for upload to the distribution location you do:

cd /vagrant/docs
python makepages.py
npm run browser:build

If all goes well you can type “exit” (or control-D) to leave the virtual machine. You then do:

vagrant halt

This will shutdown the virtual machine. You can then to a “vagrant up” in the future to test/build the site again. It should be much faster then the initial time.

Updating the production site and deploying it

At this point you are going to clone (or “pull” if you already have a copy) the production built website to your local machine. You will then update the site from the files you built above and then you will push it out to deploy it.

IMPORTANT: You will not be able to do this until you are authorized. Send your “ssh” public key (not private key) to [email protected] and I can add you.

The details here are for the site as run from our own server at http://iot.appinventor.mit.edu. These details will change when we move to GitHub.

Assuming you do not have a copy of the site do (from your home directory):

git clone [email protected]:iot-pages
cd iot-website-source/docs/build/
rsync -v -a * ../../../iot-pages/
cd ../src/www
rsync -v -a blocks ../../../../iot-pages/
cd ../../../../iot-pages
git add . --all
git commit # <– This will invoke an editor for you to put in the commit comment

This upates your local copy of the production site.

Now push it to production, which will update the deployed site:

git push origin master

Footnotes:

1
If you are running under Linux, you can avoid using VirtualBox and can use “lxc” instead, which is much faster. See Jeff for details.

iot-website-source's People

Contributors

afmckinney avatar alitaheri avatar castrolol avatar cgestes avatar chrismcv avatar ewpatton avatar hai-cea avatar halatmit avatar igorbt avatar jkruder avatar jtollerene avatar louy avatar marksherman avatar marnusw avatar mbrookes avatar mikepb avatar mmrtnz avatar nathanmarks avatar newoga avatar oliviertassinari avatar pomerantsev avatar pradel avatar shahrukhzindani avatar shaurya947 avatar solkaz avatar theosherry avatar tintin1343 avatar vmakhaev avatar yulric avatar zadielerick avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.