creperie 0.0.1.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/crepe +5 -0
- data/lib/creperie.rb +4 -0
- data/lib/creperie/cli.rb +18 -0
- data/lib/creperie/commands.rb +3 -0
- data/lib/creperie/commands/base.rb +18 -0
- data/lib/creperie/commands/console.rb +58 -0
- data/lib/creperie/commands/new.rb +28 -0
- data/lib/creperie/commands/server.rb +35 -0
- data/lib/creperie/generators/app.rb +54 -0
- data/lib/creperie/generators/templates/app/.gitignore +17 -0
- data/lib/creperie/generators/templates/app/Gemfile +27 -0
- data/lib/creperie/generators/templates/app/README.md +0 -0
- data/lib/creperie/generators/templates/app/Rakefile.tt +8 -0
- data/lib/creperie/generators/templates/app/app/apis/base_api.rb +12 -0
- data/lib/creperie/generators/templates/app/app/helpers/application_helper.rb +3 -0
- data/lib/creperie/generators/templates/app/app/models/.keep +0 -0
- data/lib/creperie/generators/templates/app/app/presenters/.keep +0 -0
- data/lib/creperie/generators/templates/app/config.ru.tt +23 -0
- data/lib/creperie/generators/templates/app/config/application.rb.tt +26 -0
- data/lib/creperie/generators/templates/app/config/boot.rb +4 -0
- data/lib/creperie/generators/templates/app/config/database.yml.tt +24 -0
- data/lib/creperie/generators/templates/app/config/environment/development.rb.tt +4 -0
- data/lib/creperie/generators/templates/app/config/environment/production.rb.tt +4 -0
- data/lib/creperie/generators/templates/app/config/environment/test.rb.tt +4 -0
- data/lib/creperie/generators/templates/app/config/initializers/active_record.rb.tt +10 -0
- data/lib/creperie/generators/templates/app/config/initializers/active_support.rb.tt +8 -0
- data/lib/creperie/generators/templates/app/config/initializers/crepe.rb.tt +1 -0
- data/lib/creperie/generators/templates/app/db/migrate/.keep +0 -0
- data/lib/creperie/generators/templates/app/db/seeds.rb +8 -0
- data/lib/creperie/generators/templates/app/lib/tasks/db/seed.rake.tt +10 -0
- data/lib/creperie/generators/templates/app/lib/tasks/environment.rake +27 -0
- data/lib/creperie/generators/templates/app/log/.keep +0 -0
- data/lib/creperie/loader.rb +53 -0
- data/lib/creperie/version.rb +14 -0
- data/spec/spec_helper.rb +13 -0
- metadata +125 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5c878370e14fa0bea28c72df03bd60674d577305
|
4
|
+
data.tar.gz: 5b198e52aad9463ee954f485942393dc3971fb7d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 957e0e2701ef297d1b225240f4d3a41887fe9fcb4835e1286fdf81901c05a107fd0000736a9f8672dbfefeb92c50715e78cce581b1888c5e632a93562bed8a6d
|
7
|
+
data.tar.gz: 9503bd006a61e5c9837f25e2f5e0a6c4de5aafdc9a039a09d2c5fcb39d7d23df362226d1c42c81bf2ef313d9f77671d63408aeffb527169023b0517beaa7cdca
|
data/bin/crepe
ADDED
data/lib/creperie.rb
ADDED
data/lib/creperie/cli.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'clamp'
|
2
|
+
require 'creperie/commands'
|
3
|
+
require 'creperie/loader'
|
4
|
+
|
5
|
+
module Creperie
|
6
|
+
class CLI < Commands::Base
|
7
|
+
def execute
|
8
|
+
request_help
|
9
|
+
end
|
10
|
+
|
11
|
+
subcommand 'new', 'Generate a new Crêpe application.', Commands::New
|
12
|
+
|
13
|
+
if Loader.crepe_app?
|
14
|
+
subcommand ['console', 'c'], 'Start the Crêpe console.', Commands::Console
|
15
|
+
subcommand ['server', 's'], 'Start the Crêpe server.', Commands::Server
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'clamp'
|
2
|
+
|
3
|
+
module Creperie
|
4
|
+
module Commands
|
5
|
+
class Base < Clamp::Command
|
6
|
+
option ['-v', '--version'], :flag, 'Print the Crêperie version and exit.' do
|
7
|
+
require 'creperie/version'
|
8
|
+
puts Creperie::VERSION
|
9
|
+
exit 0
|
10
|
+
end
|
11
|
+
|
12
|
+
option ['-h', '--help'], :flag, 'Print this help message and exit.' do
|
13
|
+
request_help
|
14
|
+
exit 0
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'creperie/commands/base'
|
2
|
+
require 'creperie/loader'
|
3
|
+
|
4
|
+
module Creperie
|
5
|
+
module Commands
|
6
|
+
class Console < Base
|
7
|
+
option ['-E', '--env'], 'ENV', 'Specify the Crêpe environment', default: 'development' do |env|
|
8
|
+
ENV['CREPE_ENV'] = env
|
9
|
+
end
|
10
|
+
|
11
|
+
def execute
|
12
|
+
with_rack_aliased! do
|
13
|
+
load Loader.config_ru
|
14
|
+
end
|
15
|
+
|
16
|
+
begin
|
17
|
+
require 'pry'
|
18
|
+
Pry.start
|
19
|
+
rescue LoadError
|
20
|
+
IRB.start
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def pry?
|
27
|
+
gemfile = Loader.gemfile
|
28
|
+
File.read(gemfile) =~ /gem (['"])pry/
|
29
|
+
end
|
30
|
+
|
31
|
+
# The best way to load a Crêpe application's environment into an IRB shell
|
32
|
+
# is to load the config.ru file, as that must load/require all code
|
33
|
+
# necessary to run the application. However, this means we must provide
|
34
|
+
# two DSL methods expected to be mixed into Object by Rack::Builder, `use`
|
35
|
+
# and `run`. To prevent the permanence from this, we load config.ru with
|
36
|
+
# those methods defined as no-ops and then undefine them afterwards.
|
37
|
+
def with_rack_aliased!(&block)
|
38
|
+
alias_rack!
|
39
|
+
yield
|
40
|
+
unalias_rack!
|
41
|
+
end
|
42
|
+
|
43
|
+
def alias_rack!
|
44
|
+
Object.class_eval do
|
45
|
+
def use(*args) end
|
46
|
+
def run(*args) end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def unalias_rack!
|
51
|
+
Object.class_eval do
|
52
|
+
undef :use
|
53
|
+
undef :run
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'creperie/commands/base'
|
2
|
+
require 'creperie/generators/app'
|
3
|
+
|
4
|
+
module Creperie
|
5
|
+
module Commands
|
6
|
+
class New < Base
|
7
|
+
parameter 'APP_PATH', 'The name and path of your Crêpe application'
|
8
|
+
|
9
|
+
# Generator options
|
10
|
+
option ['-B', '--skip_bundle'], :flag, "Don't run bundle install."
|
11
|
+
option ['-G', '--skip-git'], :flag, "Don't create a git repository."
|
12
|
+
|
13
|
+
# Runtime options
|
14
|
+
option ['-f', '--force'], :flag, 'Overwrite files that already exist.'
|
15
|
+
option ['-p', '--pretend'], :flag, 'Run but do not make any changes'
|
16
|
+
option ['-q', '--quiet'], :flag, 'Suppress status output'
|
17
|
+
option ['-s', '--skip'], :flag, 'Skip files that already exist'
|
18
|
+
|
19
|
+
def execute
|
20
|
+
options = parse_options.reduce({}) do |h, option|
|
21
|
+
h.tap { |h| h[option.attribute_name] = send(option.read_method) }
|
22
|
+
end
|
23
|
+
|
24
|
+
Generators::App.new([app_path], options).invoke_all
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'creperie/commands/base'
|
2
|
+
require 'creperie/loader'
|
3
|
+
|
4
|
+
module Creperie
|
5
|
+
module Commands
|
6
|
+
class Server < Base
|
7
|
+
option ['-s', '--server'], 'SERVER', 'Serve using the specified dispatcher'
|
8
|
+
|
9
|
+
option ['-o', '--host'], 'HOST', 'Binds Crêpe to the specified host', default: '0.0.0.0'
|
10
|
+
option ['-p', '--port'], 'PORT', 'Runs Crêpe on the specified port', default: 9292 do |o|
|
11
|
+
Integer(o)
|
12
|
+
end
|
13
|
+
option ['-E', '--env'], 'ENV', 'Specify the Crêpe environment', default: 'development'
|
14
|
+
option ['-P', '--pid'], 'PIDFILE', "Store Crêpe's PID in the specified file"
|
15
|
+
option ['-c', '--config'], 'RACKUP_FILE', 'Specify a Rackup file other than config.ru'
|
16
|
+
option ['-D', '--daemonize'], :flag, 'Run Crêpe daemonized in the background'
|
17
|
+
|
18
|
+
def execute
|
19
|
+
rackup = "bundle exec rackup"
|
20
|
+
rackup += " -s #{server}" if server
|
21
|
+
rackup += " -p #{port}" if port
|
22
|
+
rackup += " -o #{host}" if host
|
23
|
+
rackup += " -E #{env}" if env
|
24
|
+
rackup += " -P #{pid}" if pid
|
25
|
+
rackup += " -D" if daemonize?
|
26
|
+
|
27
|
+
# By default, find the project's config.ru file and use it.
|
28
|
+
config = config || Loader.config_ru
|
29
|
+
rackup += " #{config}"
|
30
|
+
|
31
|
+
Kernel.exec(rackup)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'thor/group'
|
3
|
+
require 'thor/actions'
|
4
|
+
|
5
|
+
module Creperie
|
6
|
+
module Generators
|
7
|
+
class App < Thor::Group
|
8
|
+
include Thor::Actions
|
9
|
+
add_runtime_options!
|
10
|
+
source_root File.expand_path('../templates/app', __FILE__)
|
11
|
+
|
12
|
+
class_option :skip_bundle, type: :boolean, desc: "Don't run bundle install",
|
13
|
+
aliases: '-B', default: false
|
14
|
+
|
15
|
+
class_option :skip_git, type: :boolean, desc: "Don't create a git repository",
|
16
|
+
aliases: '-G', default: false
|
17
|
+
|
18
|
+
argument :app_name
|
19
|
+
|
20
|
+
def copy_files
|
21
|
+
say 'Pouring a new crêpe...'
|
22
|
+
|
23
|
+
directory '.', app_name
|
24
|
+
end
|
25
|
+
|
26
|
+
def bundle_install
|
27
|
+
return if options[:skip_bundle]
|
28
|
+
|
29
|
+
inside(app_name) { run 'bundle install' }
|
30
|
+
end
|
31
|
+
|
32
|
+
def git_init
|
33
|
+
return if options[:skip_git]
|
34
|
+
|
35
|
+
inside(app_name) do
|
36
|
+
run 'git init', capture: true
|
37
|
+
run 'git add .', capture: true
|
38
|
+
run 'git commit -am "Initial commit"', capture: true
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def finish
|
43
|
+
say 'Your crêpe is ready.', :green
|
44
|
+
end
|
45
|
+
|
46
|
+
protected
|
47
|
+
|
48
|
+
# This will turn `app_name` into `AppName` to write constants.
|
49
|
+
def app_name_const
|
50
|
+
app_name.gsub(/[a-z\d]*/) { $&.capitalize }.gsub('_', '')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
6
|
+
|
7
|
+
# Ignore bundler-related configuration.
|
8
|
+
/.bundle
|
9
|
+
/bin/
|
10
|
+
/vendor/bundle/
|
11
|
+
|
12
|
+
# Ignore all logfiles and tempfiles.
|
13
|
+
/log/*.log
|
14
|
+
/tmp
|
15
|
+
|
16
|
+
# Ignore sensitive files.
|
17
|
+
/config/database.yml
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# A sample Gemfile
|
2
|
+
source 'https://rubygems.org'
|
3
|
+
|
4
|
+
# Bundle from GitHub, as only a prerelease is currently available.
|
5
|
+
gem 'crepe', github: 'stephencelis/crepe'
|
6
|
+
gem 'rake'
|
7
|
+
gem 'app'
|
8
|
+
|
9
|
+
# Crêperie provides CLI convenience for your crepe app as well.
|
10
|
+
gem 'creperie', github: 'davidcelis/creperie'
|
11
|
+
|
12
|
+
# Use ActiveRecord to define models and PostgreSQL to store them.
|
13
|
+
gem 'activerecord', '~> 4.0.0', require: 'active_record'
|
14
|
+
gem 'pg'
|
15
|
+
|
16
|
+
# Use Jsonite to convert objects to JSON for presentation. Place
|
17
|
+
# presenters in the app/presenters/ directory.
|
18
|
+
#
|
19
|
+
# More info: https://github.com/barrelage/jsonite
|
20
|
+
# gem 'jsonite', github: 'barrelage/jsonite'
|
21
|
+
|
22
|
+
# Use puma as the web server.
|
23
|
+
# gem 'puma'
|
24
|
+
|
25
|
+
group :development, :test do
|
26
|
+
gem 'pry'
|
27
|
+
end
|
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# This is the class that all other Crêpe APIs should inherit from. It defines
|
2
|
+
# a shared configuration and helper methods that should be used across your
|
3
|
+
# entire Crepe application.
|
4
|
+
|
5
|
+
class BaseAPI < Crepe::API
|
6
|
+
# Catch ActiveRecord::RecordNotFound exceptions with a 404 response.
|
7
|
+
rescue_from(ActiveRecord::RecordNotFound) { error! :not_found }
|
8
|
+
|
9
|
+
# Add shared helper methods to ApplicationHelper, or create your own
|
10
|
+
# additional helper classes and include them here.
|
11
|
+
helper ApplicationHelper
|
12
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path('../config/application', __FILE__)
|
3
|
+
|
4
|
+
module <%= app_name_const %>
|
5
|
+
class API < BaseAPI
|
6
|
+
respond_to :json
|
7
|
+
|
8
|
+
# curl 0.0.0.0:9292/
|
9
|
+
# => {"hello":"world"}
|
10
|
+
get do
|
11
|
+
{ hello: 'world' }
|
12
|
+
end
|
13
|
+
|
14
|
+
# Mount your other APIs here
|
15
|
+
# mount UsersAPI => :users
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# Add Rack middleware to your stack.
|
20
|
+
use ActiveRecord::ConnectionAdapters::ConnectionManagement
|
21
|
+
|
22
|
+
# Your crêpe is ready.
|
23
|
+
run <%= app_name_const %>::API
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
require 'crepe'
|
3
|
+
|
4
|
+
# Require the gems listed in Gemfile, including any gems
|
5
|
+
# you've limited to :test, :development, or :production.
|
6
|
+
Bundler.require(:default, Crepe.env)
|
7
|
+
$LOAD_PATH.unshift Crepe.root unless $LOAD_PATH.include?(Crepe.root)
|
8
|
+
|
9
|
+
module <%= app_name_const %>
|
10
|
+
class Application < Configurable
|
11
|
+
# Set your application's default Time Zone. For more information, see
|
12
|
+
# http://api.rubyonrails.org/classes/ActiveSupport/TimeWithZone.html
|
13
|
+
config.time_zone = 'UTC'
|
14
|
+
|
15
|
+
# You can also set custom config values here to use throughout your app.
|
16
|
+
#
|
17
|
+
# config.key = 'value'
|
18
|
+
# <%= app_name_const %>.key # => 'value'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Load environment-specific configuration.
|
23
|
+
require Crepe.root.join('config', 'environment', Crepe.env)
|
24
|
+
|
25
|
+
# Load initializers.
|
26
|
+
Dir['config/initializers/*'].each { |f| require f }
|
@@ -0,0 +1,24 @@
|
|
1
|
+
defaults: &defaults
|
2
|
+
adapter: postgresql
|
3
|
+
encoding: unicode
|
4
|
+
|
5
|
+
development:
|
6
|
+
<<: *defaults
|
7
|
+
database: <%= app_name %>_development
|
8
|
+
pool: 16
|
9
|
+
username: postgres
|
10
|
+
password:
|
11
|
+
|
12
|
+
test:
|
13
|
+
<<: *defaults
|
14
|
+
database: <%= app_name %>_test
|
15
|
+
pool: 16
|
16
|
+
username: postgres
|
17
|
+
password:
|
18
|
+
|
19
|
+
production:
|
20
|
+
<<: *defaults
|
21
|
+
database: <%= app_name %>_production
|
22
|
+
pool: 25
|
23
|
+
username: postgres
|
24
|
+
password:
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Establish a connection to the database.
|
2
|
+
database_yml = File.read(Crepe.root.join('config', 'database.yml'))
|
3
|
+
database = YAML.load(ERB.new(database_yml).result)[Crepe.env]
|
4
|
+
ActiveRecord::Base.establish_connection(database)
|
5
|
+
|
6
|
+
# Store timestamps in UTC. If you really wish, you can use your application's
|
7
|
+
# default time_zone as well:
|
8
|
+
#
|
9
|
+
# ActiveRecord::Base.default_timezone = <%= app_name_const %>::Application.time_zone
|
10
|
+
ActiveRecord::Base.default_timezone = :utc
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require 'active_support/dependencies'
|
2
|
+
|
3
|
+
# Set up autoloading.
|
4
|
+
relative_load_paths = %w[app/apis app/helpers app/models app/presenters lib]
|
5
|
+
ActiveSupport::Dependencies.autoload_paths += relative_load_paths
|
6
|
+
|
7
|
+
# Set the default Time Zone.
|
8
|
+
Time.zone_default = <%= app_name_const %>::Application.time_zone
|
@@ -0,0 +1 @@
|
|
1
|
+
Crepe.logger.level = <%= app_name_const%>::Application.log_level
|
File without changes
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database
|
2
|
+
# with its default values. The data can then be loaded with `rake db:seed`
|
3
|
+
# or created alongside the database with `rake db:setup`.
|
4
|
+
#
|
5
|
+
# Examples:
|
6
|
+
#
|
7
|
+
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
8
|
+
# Mayor.create(name: 'Emanuel', city: cities.first)
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module <%= app_name_const %>
|
2
|
+
class SeedLoader
|
3
|
+
def self.load_seed
|
4
|
+
seed_file = Crepe.root.join('db', 'seeds')
|
5
|
+
load seed_file if File.exists?(seed_file)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
ActiveRecord::Tasks::DatabaseTasks.seed_loader = <%= app_name_const %>::SeedLoader
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Configure ActiveRecord::DatabaseTasks so they work outside of Rails.
|
2
|
+
databases = YAML.load(ERB.new(File.read('config/database.yml')).result)
|
3
|
+
|
4
|
+
ActiveRecord::Tasks::DatabaseTasks.database_configuration = databases
|
5
|
+
ActiveRecord::Tasks::DatabaseTasks.db_dir = Crepe.root.join('db')
|
6
|
+
ActiveRecord::Tasks::DatabaseTasks.root = Crepe.root
|
7
|
+
ActiveRecord::Tasks::DatabaseTasks.env = Crepe.env
|
8
|
+
|
9
|
+
# Loads the environment for rake tasks that need it.
|
10
|
+
task :environment do
|
11
|
+
# Set up environment
|
12
|
+
ActiveRecord::Tasks::DatabaseTasks.db_dir = Crepe.root.join('db')
|
13
|
+
|
14
|
+
# Establish a connection to the correct database
|
15
|
+
ActiveRecord::Base.establish_connection(databases[Crepe.env])
|
16
|
+
|
17
|
+
# Set up logging
|
18
|
+
log = Crepe.root.join('log', "#{Crepe.env}.log")
|
19
|
+
ActiveRecord::Base.logger = Logger.new(File.open(log, 'w+'))
|
20
|
+
end
|
21
|
+
|
22
|
+
# Some database tasks in ActiveRecord unfortunately require a Rails.env
|
23
|
+
module Rails
|
24
|
+
def self.env
|
25
|
+
Crepe.env
|
26
|
+
end
|
27
|
+
end
|
File without changes
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
module Creperie
|
4
|
+
module Loader
|
5
|
+
class << self
|
6
|
+
# If we find a Gemfile using the method below and it contains Crepe
|
7
|
+
# as a dependency, we can safely assume we're in a Crepe application.
|
8
|
+
def crepe_app?
|
9
|
+
File.read(find_file(gemfile)) =~ /gem (['"])crepe\1/
|
10
|
+
end
|
11
|
+
|
12
|
+
def application
|
13
|
+
return unless crepe_app?
|
14
|
+
fild_file('./config/application.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
def config_ru
|
18
|
+
return unless crepe_app?
|
19
|
+
find_file('config.ru')
|
20
|
+
end
|
21
|
+
|
22
|
+
# Beginning with the current working directory, recursively search
|
23
|
+
# up through the filesystem for a Gemfile.
|
24
|
+
def gemfile
|
25
|
+
find_file('Gemfile')
|
26
|
+
end
|
27
|
+
|
28
|
+
# Beginning with the current working directory, recursively search
|
29
|
+
# up through the filesystem for a Gemfile.lock.
|
30
|
+
def gemfile_lock
|
31
|
+
find_file('Gemfile.lock')
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def find_file(filename)
|
37
|
+
original_dir = Dir.pwd
|
38
|
+
|
39
|
+
loop do
|
40
|
+
# Return the full path of the file if we find it.
|
41
|
+
return File.expand_path(filename) if File.file?(filename)
|
42
|
+
|
43
|
+
# If we've reached the root of the filesystem without finding the
|
44
|
+
# specified file, give up.
|
45
|
+
Dir.chdir(original_dir) and return if Pathname.new(Dir.pwd).root?
|
46
|
+
|
47
|
+
# Otherwise, move up a directory and search again.
|
48
|
+
Dir.chdir('..')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
RSpec.configure do |config|
|
8
|
+
# Run specs in random order to surface order dependencies. If you find an
|
9
|
+
# order dependency and want to debug it, you can fix the order by providing
|
10
|
+
# the seed, which is printed after each run.
|
11
|
+
# --seed 1234
|
12
|
+
config.order = 'random'
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: creperie
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.pre
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Celis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: clamp
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.6'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thor
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.18'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.18'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.14'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.14'
|
55
|
+
description: Create and maintain your Crêpe applications.
|
56
|
+
email:
|
57
|
+
- me@davidcel.is
|
58
|
+
executables:
|
59
|
+
- crepe
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- bin/crepe
|
64
|
+
- lib/creperie.rb
|
65
|
+
- lib/creperie/cli.rb
|
66
|
+
- lib/creperie/commands.rb
|
67
|
+
- lib/creperie/commands/base.rb
|
68
|
+
- lib/creperie/commands/console.rb
|
69
|
+
- lib/creperie/commands/new.rb
|
70
|
+
- lib/creperie/commands/server.rb
|
71
|
+
- lib/creperie/generators/app.rb
|
72
|
+
- lib/creperie/generators/templates/app/.gitignore
|
73
|
+
- lib/creperie/generators/templates/app/Gemfile
|
74
|
+
- lib/creperie/generators/templates/app/README.md
|
75
|
+
- lib/creperie/generators/templates/app/Rakefile.tt
|
76
|
+
- lib/creperie/generators/templates/app/app/apis/base_api.rb
|
77
|
+
- lib/creperie/generators/templates/app/app/helpers/application_helper.rb
|
78
|
+
- lib/creperie/generators/templates/app/app/models/.keep
|
79
|
+
- lib/creperie/generators/templates/app/app/presenters/.keep
|
80
|
+
- lib/creperie/generators/templates/app/config.ru.tt
|
81
|
+
- lib/creperie/generators/templates/app/config/application.rb.tt
|
82
|
+
- lib/creperie/generators/templates/app/config/boot.rb
|
83
|
+
- lib/creperie/generators/templates/app/config/database.yml.tt
|
84
|
+
- lib/creperie/generators/templates/app/config/environment/development.rb.tt
|
85
|
+
- lib/creperie/generators/templates/app/config/environment/production.rb.tt
|
86
|
+
- lib/creperie/generators/templates/app/config/environment/test.rb.tt
|
87
|
+
- lib/creperie/generators/templates/app/config/initializers/active_record.rb.tt
|
88
|
+
- lib/creperie/generators/templates/app/config/initializers/active_support.rb.tt
|
89
|
+
- lib/creperie/generators/templates/app/config/initializers/crepe.rb.tt
|
90
|
+
- lib/creperie/generators/templates/app/db/migrate/.keep
|
91
|
+
- lib/creperie/generators/templates/app/db/seeds.rb
|
92
|
+
- lib/creperie/generators/templates/app/lib/tasks/db/seed.rake.tt
|
93
|
+
- lib/creperie/generators/templates/app/lib/tasks/environment.rake
|
94
|
+
- lib/creperie/generators/templates/app/log/.keep
|
95
|
+
- lib/creperie/generators/templates/app/tmp/.keep
|
96
|
+
- lib/creperie/loader.rb
|
97
|
+
- lib/creperie/version.rb
|
98
|
+
- spec/spec_helper.rb
|
99
|
+
homepage: https://github.com/davidcelis/creperie
|
100
|
+
licenses:
|
101
|
+
- MIT
|
102
|
+
metadata: {}
|
103
|
+
post_install_message:
|
104
|
+
rdoc_options: []
|
105
|
+
require_paths:
|
106
|
+
- lib
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 1.3.1
|
117
|
+
requirements: []
|
118
|
+
rubyforge_project:
|
119
|
+
rubygems_version: 2.2.2
|
120
|
+
signing_key:
|
121
|
+
specification_version: 4
|
122
|
+
summary: Pour a new Crêpe app.
|
123
|
+
test_files:
|
124
|
+
- spec/spec_helper.rb
|
125
|
+
has_rdoc:
|