Awesome
How to setup local development environment
You need to complete several steps below to get yourself ready to develop PrePAN;
- Cloning this repository
- Bootstrapping
- OAuth setup
Clone this repository
$ git clone git://github.com/CPAN-API/prepan.git
$ cd prepan
Bootstrapping with script/setup.sh
Run script/setup.sh
at the PrePAN root directory to bootstrap your environment.
$ script/setup.sh
This command does following things:
- Installs Carton to manage moudle dependency, if it's not installed
- Installs preerequisite modules using
carton
command - Sets up databases for development and test
- Generates a configuration file from
local/development.eg.pl
tolocal/development.pl
OAuth setup
PrePAN uses Twitter and GitHub to authenticate users. You have to, at first, create a new Twitter application.
Create a new Twitter Application
You can create a new Twitter application on https://dev.twitter.com/apps.
- Press "Create a new application" button
- Input some information for your application, for example:
- Name: hogehoge prepan local
- Description: prepan local development for hogehoge
- Website: http://local.prepan.org/
- Callback URL: http://local.prepan.org/auth/twitter/callback (a callback URL must be set to authenticate users via browser)
- Press "Create your Twitter application" button
Next, you need to change settings for the app:
- Press "Settings" tab
- Change "Application Type" to:
- Access: Read and Write
- Check the box about "Allow this application to be used to Sign in with Twitter"
- Save settings
Then, you can use this application to develop PrePAN.
Add OAuth config into config/development.pl
After create a twitter application, you need to add an OAuth config into config/development.pl
.
Open config/development.pl
and add a consumer key and a consumer secret for your application.
Example:
Auth => {
Twitter => {
consumer_key => 'abcdefghijk', # your twitter consumer key
consumer_secret => 'consumersecrettttt', # your twitter consumer secret
callback_fail_path => '/auth/twitter/failed',
},
},
How to start local server
Execute the command below at PrePAN root directory:
$ carton exec -- plackup
You can access http://localhost:5000/. Enjoy Hacking!!
Local test setting
Run below command if you want to run tests.
$ carton exec -- prove -v t/**/*.t
Update dependency
Edit cpanfile
and run following commands if you want to update dependency:
$ carton install
$ git add cpanfile cpanfile.snapshot
$ git commit
Contact
You can ask @prepanorg or @shiba_yu36 if you have a question.