Code Monkey home page Code Monkey logo

peony's Introduction

Peony

Local Script Management System Using Rake (是不是为记不住经常用的脚本和配置而烦恼! 让Peony把你的脚本和配置记录下来。)

Installation

Add this line to your application's Gemfile:

gem 'peony'

And then execute:

$ bundle

Or install it yourself as:

$ gem install peony

Usage

Simple Example

Peony inherits from Rake, and added many useful methods for you to write rake scripts.

	set :from, "Jack"
	set :to, "Tom"
	
	namespace :hello do
	  task :run do
	    run "echo '#{from} say hello to #{to}.'"
	  end
	end
peony hello:run
#Jack say hello to Tom
peony hello:run from=James
#James say hello to Tom 

Useful recipes

If you want to run nginx server on your local server, you can add the following to your Rakefile

	set :base_dir, "/u"
    set :www_http_port, 80
    set :www_paths, {
      "/homebrew" => "/Library/Caches/Homebrew"
    }
    set :nginx, "/usr/local/bin/nginx"
    

Execute the following commands

peony nginx:init
peony nginx:www:init
peony nginx:www:start

Then you can check the http://localhost/homebrew

Maybe you just want to use rake, all you just want to use some recipes of peony, you can just add the following code to your Rakefile

require 'peony'
require 'peony/rake'

spec = Gem::Specification.find_by_name("peony")
modules = ["#{spec.gem_dir}/recipes/nginx.rake", "#{spec.gem_dir}/recipes/nginx/www.rake"]
modules.each do|f|
  load f
end

Directory Convension

template and recipes

  |--peony_root
     |--Rakefile
     |--recipes
        |--nginx.rake
        |--pgsql.rake
        |--...
     |--templates
        |--nginx.conf.erb
        |--pgsql.conf.erb
        |--...

if you want to run peony command in any directory, you can add peony_root to your environment.

export peony_root=/u/bin

generated directory convension

  |--u
    |--bin
    |--etc
       |--my.cnf
       |--nginx
       |--mongo
       |--httpd
       |--elasticsearch
       |--...
    |--share
       |--apache-tomcat-6.0.32
       |--php-5.3.10
       |--...
    |--var
       |--data
          |--mysql
          |--pgsql
          |--mongo
          |--elasticsearch
          |--redis
       |--log
       |--run
       |--tmp
       |--www

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

peony's People

Contributors

jameszhan avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar  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.