-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kurtis Rainbolt-Greene
committed
Nov 24, 2013
1 parent
9e1f05f
commit 45bc2d4
Showing
65 changed files
with
1,163 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
blankgem | ||
whiskey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
language: ruby | ||
rvm: | ||
- 1.8.7 | ||
- 1.9.3 | ||
- 2.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/usr/bin/env ruby | ||
source "https://rubygems.org/" | ||
|
||
# Specify your gem's dependencies in blankgem.gemspec | ||
# Specify your gem's dependencies in whiskey.gemspec | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require "whiskey/command" | ||
|
||
Whiskey::Command.start |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require "logger" | ||
require "astruct" | ||
require "active_support/core_ext" | ||
|
||
module Whiskey | ||
def self.logger | ||
@logger ||= Logger.new(STDOUT).tap do |log| | ||
log.level = ENV["WHISKEY_ENVIRONMENT"] == "development" ? Logger::DEBUG : Logger::INFO | ||
log.formatter = nil | ||
end | ||
end | ||
end | ||
|
||
require_relative "whiskey/version" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require "thor" | ||
require "whiskey" | ||
|
||
module Whiskey | ||
class Command < Thor | ||
include Thor::Actions | ||
|
||
attr_accessor :values | ||
|
||
def self.source_root | ||
File.join(File.dirname(__FILE__), "command", "templates") | ||
end | ||
|
||
desc "build NAME", "Builds a new whiskey project from the scaffold" | ||
def build(name) | ||
@values = AltStruct.new | ||
Build.new(self, name).call | ||
end | ||
|
||
desc "server [start|stop]", "Starts the whiskey server up" | ||
def server(switch) | ||
case switch | ||
when "start" then StartServer.new.call | ||
end | ||
end | ||
end | ||
end | ||
|
||
require_relative "command/build" | ||
require_relative "command/start_server" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
module Whiskey | ||
class Command < Thor | ||
class Build | ||
extend Forwardable | ||
|
||
RUBIES = ["rbx", "jruby", "ruby-2.0.0"] | ||
RUBIES_ASK = "Which Ruby do you want to use?\n\n\t- ruby-2.0.0\n\t- rubinius\n\t- jruby\n" | ||
|
||
attr_reader :command, :name | ||
|
||
def_delegator :@command, :empty_directory | ||
def_delegator :@command, :directory | ||
def_delegator :@command, :template | ||
def_delegator :@command, :inside | ||
def_delegator :@command, :run | ||
def_delegator :@command, :ask | ||
def_delegator :@command, :say | ||
|
||
def initialize(command, name) | ||
@command = command | ||
@name = @command.values.name = name | ||
end | ||
|
||
def call | ||
empty_directory(name) | ||
command.destination_root = name | ||
template("Gemfile") | ||
template("gitignore", ".gitignore") | ||
template("LICENSE.txt") | ||
template("Thorfile") | ||
template("Procfile") | ||
template("server.rb") | ||
inside("lib") do | ||
template("example.rb", "#{name}.rb") | ||
directory("example", "#{name}") | ||
end | ||
directory("db") | ||
|
||
@command.values.ruby = ask(RUBIES_ASK, limit_to: RUBIES) | ||
template("ruby-version", ".ruby-version") | ||
template("ruby-gemset", ".ruby-gemset") | ||
empty_directories("script", "log", "tmp", "doc") | ||
run("git init") | ||
say("You should now run: bundle install") | ||
end | ||
|
||
private | ||
|
||
def empty_directories(*directories) | ||
directories.each { |directory| empty_directory directory } | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module Whiskey | ||
class Command < Thor | ||
class StartServer | ||
def initialize(host = nil, port = nil, environment = "development") | ||
ENV["WHISKEY_HOST"] = host | ||
ENV["WHISKEY_PORT"] = port | ||
ENV["WHISKEY_ENVIRONMENT"] = environment | ||
end | ||
|
||
def call | ||
load File.join(Dir.pwd, "server.rb") | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env ruby | ||
source "https://rubygems.org" | ||
|
||
gem "whiskey", "<%= Whiskey::VERSION %>" | ||
|
||
gem "sqlite3", "~> 1.3" | ||
# gem "pg", "~> 0.14" | ||
# gem "mysql2", "~> 0.3" | ||
# gem "redis", "~> 3.0" | ||
# gem "dalli", "~> 2.6" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Copyright (c) 2013 YOUR NAME HERE | ||
|
||
MIT License | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mute: bundle exec whiskey server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env ruby | ||
$:.unshift File.expand_path("../server", __FILE__) | ||
|
||
require "bundler" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This is where you'll place any logic that boots up your instance from scratch | ||
|
||
introduction = Document.create do |doc| | ||
doc.title = "Introduction" | ||
doc.body = """ | ||
Welcome to <%= values.name.camelize %> a new MUTE! | ||
To make an account here simply type: | ||
account create a_suitable_username a_suitable_password | ||
To login to your account type: | ||
account access a_suitable_username a_suitable_password | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# See http://help.github.com/ignore-files/ for more about ignoring files. | ||
# | ||
# If you find yourself ignoring temporary files generated by your text editor | ||
# or operating system, you probably want to add a global ignore instead: | ||
# git config --global core.excludesfile ~/.gitignore | ||
|
||
# Ignore all bundler caching | ||
/vendor/cache | ||
/vendor/ruby | ||
|
||
# Ignore all tempfiles | ||
/tmp | ||
|
||
# Ignores that should be in the global gitignore | ||
/coverage/ | ||
/doc/ | ||
/log/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module <%= values.name.camelize %> | ||
require_relative "<%= values.name %>/model" | ||
require_relative "<%= values.name %>/action" | ||
require_relative "<%= values.name %>/control" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module <%= values.name.camelize %> | ||
class Action < Whiskey::Server::Action | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module <%= values.name.camelize %> | ||
module Control | ||
include Whiskey::Server::Control | ||
require_relative "control/routes" | ||
end | ||
end |
63 changes: 63 additions & 0 deletions
63
lib/whiskey/command/templates/lib/example/control/accounts.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
module <%= values.name.camelize %> | ||
module Control | ||
module Accounts | ||
include Whiskey::Server::Control | ||
|
||
class Create < Action | ||
include Accounts | ||
|
||
def initialize(parameters) | ||
|
||
end | ||
|
||
def to_hash | ||
{ | ||
|
||
} | ||
end | ||
end | ||
|
||
class Update < Action | ||
include Accounts | ||
|
||
def initialize(parameters) | ||
|
||
end | ||
|
||
def to_hash | ||
{ | ||
|
||
} | ||
end | ||
end | ||
|
||
class Show < Action | ||
include Accounts | ||
|
||
def initialize(parameters) | ||
|
||
end | ||
|
||
def to_hash | ||
{ | ||
|
||
} | ||
end | ||
end | ||
|
||
class List < Action | ||
include Accounts | ||
|
||
def initialize(parameters) | ||
|
||
end | ||
|
||
def to_hash | ||
{ | ||
|
||
} | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.