ricque 0.1.0
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.
- data/bin/ricque +49 -0
- data/lib/ricque/version.rb +3 -0
- data/lib/ricque.rb +5 -0
- data/lib/template/.gitignore +28 -0
- data/lib/template/.rspec +4 -0
- data/lib/template/.rvmrc +1 -0
- data/lib/template/Gemfile +18 -0
- data/lib/template/Gemfile.lock +44 -0
- data/lib/template/README +0 -0
- data/lib/template/Rakefile +3 -0
- data/lib/template/config/application.rb +114 -0
- data/lib/template/config/boot.rb +48 -0
- data/lib/template/config/environment.rb +3 -0
- data/lib/template/config/environments/development.rb +3 -0
- data/lib/template/config/environments/production.rb +3 -0
- data/lib/template/config/environments/test.rb +3 -0
- data/lib/template/config/initializers/00_slogger.rb +3 -0
- data/lib/template/doc/README_FOR_APP +0 -0
- data/lib/template/lib/ricque/version.rb +3 -0
- data/lib/template/lib/ricque.rb +5 -0
- data/lib/template/lib/tasks/ricque.rake +4 -0
- data/lib/template/lib/tasks/rspec.rake +10 -0
- data/lib/template/log/.gitkeep +0 -0
- data/lib/template/script/console +34 -0
- data/lib/template/spec/spec_helper.rb +29 -0
- data/lib/template/tmp/pids/.gitkeep +0 -0
- metadata +86 -0
data/bin/ricque
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.push File.expand_path("../../lib", __FILE__)
|
3
|
+
|
4
|
+
require 'active_support/inflector'
|
5
|
+
require 'fileutils'
|
6
|
+
require File.expand_path("../../lib/ricque", __FILE__)
|
7
|
+
|
8
|
+
case ARGV[0]
|
9
|
+
when 'new'
|
10
|
+
if ARGV[1].nil?
|
11
|
+
puts 'Invalid application name'
|
12
|
+
exit
|
13
|
+
end
|
14
|
+
app_name = ARGV[1].underscore
|
15
|
+
|
16
|
+
camelized_app_name = app_name.camelize
|
17
|
+
dashesized_app_name = app_name.dasherize
|
18
|
+
|
19
|
+
root_path = File.expand_path("../..", __FILE__)
|
20
|
+
template_path = File.join root_path, 'lib', 'template', '.'
|
21
|
+
|
22
|
+
current_path = File.expand_path(".")
|
23
|
+
|
24
|
+
app_path = File.join(current_path, dashesized_app_name)
|
25
|
+
|
26
|
+
puts "Creating path #{app_path}"
|
27
|
+
if Dir.exists?(app_path)
|
28
|
+
puts "Path #{app_path} already exists"
|
29
|
+
exit 1
|
30
|
+
end
|
31
|
+
Dir.mkdir app_path
|
32
|
+
|
33
|
+
Dir.chdir(app_path) do
|
34
|
+
puts "Copying files"
|
35
|
+
FileUtils.cp_r template_path, ".", :preserve => true
|
36
|
+
puts "Renaming file content"
|
37
|
+
`grep -Irl "Ricque" . | xargs sed -i '' 's/Ricque/#{camelized_app_name}/g'`
|
38
|
+
`grep -Irl "ricque" . | xargs sed -i '' 's/ricque/#{dashesized_app_name}/g'`
|
39
|
+
`grep -Irl "{RICQUE_VERSION}" . | xargs sed -i '' 's/{RICQUE_VERSION}/#{Ricque::VERSION}/g'`
|
40
|
+
puts "Renaming files"
|
41
|
+
FileUtils.mv 'lib/ricque', "lib/#{dashesized_app_name}"
|
42
|
+
FileUtils.mv "lib/ricque.rb", "lib/#{dashesized_app_name}.rb"
|
43
|
+
FileUtils.mv "lib/tasks/ricque.rake", "lib/tasks/#{dashesized_app_name}.rake"
|
44
|
+
end
|
45
|
+
|
46
|
+
puts "Application created on path #{app_path}"
|
47
|
+
else
|
48
|
+
puts "Usage: ricque new [app_name]"
|
49
|
+
end
|
data/lib/ricque.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
log/*
|
2
|
+
tmp/*
|
3
|
+
doc/app/*
|
4
|
+
db/schema.rb
|
5
|
+
db/*.sqlite3
|
6
|
+
coverage
|
7
|
+
*~
|
8
|
+
*.swp
|
9
|
+
coverage.data
|
10
|
+
.idea
|
11
|
+
dump.rdb
|
12
|
+
xml
|
13
|
+
.bundle
|
14
|
+
bin
|
15
|
+
vendor/gems/*
|
16
|
+
.DS_Store
|
17
|
+
.gitconfig
|
18
|
+
.rvmrc
|
19
|
+
vendor/bundle
|
20
|
+
vendor/cache
|
21
|
+
.sass-cache*
|
22
|
+
*.log
|
23
|
+
*screen.css
|
24
|
+
*ie.css
|
25
|
+
*print.css
|
26
|
+
.irbrc
|
27
|
+
.yard*
|
28
|
+
tags
|
data/lib/template/.rspec
ADDED
data/lib/template/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm --create 1.9.2@ricque
|
@@ -0,0 +1,18 @@
|
|
1
|
+
source :rubygems
|
2
|
+
|
3
|
+
if RUBY_VERSION =~ /1.9/
|
4
|
+
Encoding.default_external = Encoding::UTF_8
|
5
|
+
Encoding.default_internal = Encoding::UTF_8
|
6
|
+
end
|
7
|
+
|
8
|
+
gem 'slogger'
|
9
|
+
|
10
|
+
group :test do
|
11
|
+
gem 'rspec'
|
12
|
+
gem "simplecov"
|
13
|
+
gem "simplecov-rcov"
|
14
|
+
end
|
15
|
+
|
16
|
+
group :development, :debug do
|
17
|
+
gem 'ruby-debug19', :require => 'ruby-debug'
|
18
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
archive-tar-minitar (0.5.2)
|
5
|
+
columnize (0.3.6)
|
6
|
+
diff-lcs (1.1.3)
|
7
|
+
linecache19 (0.5.12)
|
8
|
+
ruby_core_source (>= 0.1.4)
|
9
|
+
multi_json (1.5.0)
|
10
|
+
rspec (2.12.0)
|
11
|
+
rspec-core (~> 2.12.0)
|
12
|
+
rspec-expectations (~> 2.12.0)
|
13
|
+
rspec-mocks (~> 2.12.0)
|
14
|
+
rspec-core (2.12.2)
|
15
|
+
rspec-expectations (2.12.1)
|
16
|
+
diff-lcs (~> 1.1.3)
|
17
|
+
rspec-mocks (2.12.1)
|
18
|
+
ruby-debug-base19 (0.11.25)
|
19
|
+
columnize (>= 0.3.1)
|
20
|
+
linecache19 (>= 0.5.11)
|
21
|
+
ruby_core_source (>= 0.1.4)
|
22
|
+
ruby-debug19 (0.11.6)
|
23
|
+
columnize (>= 0.3.1)
|
24
|
+
linecache19 (>= 0.5.11)
|
25
|
+
ruby-debug-base19 (>= 0.11.19)
|
26
|
+
ruby_core_source (0.1.5)
|
27
|
+
archive-tar-minitar (>= 0.5.2)
|
28
|
+
simplecov (0.7.1)
|
29
|
+
multi_json (~> 1.0)
|
30
|
+
simplecov-html (~> 0.7.1)
|
31
|
+
simplecov-html (0.7.1)
|
32
|
+
simplecov-rcov (0.2.3)
|
33
|
+
simplecov (>= 0.4.1)
|
34
|
+
slogger (0.0.9)
|
35
|
+
|
36
|
+
PLATFORMS
|
37
|
+
ruby
|
38
|
+
|
39
|
+
DEPENDENCIES
|
40
|
+
rspec
|
41
|
+
ruby-debug19
|
42
|
+
simplecov
|
43
|
+
simplecov-rcov
|
44
|
+
slogger
|
data/lib/template/README
ADDED
File without changes
|
@@ -0,0 +1,114 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
module Ricque
|
4
|
+
|
5
|
+
RICQUE_VERSION = '{RICQUE_VERSION}'
|
6
|
+
|
7
|
+
@@initialized = false
|
8
|
+
|
9
|
+
def self.initialize!
|
10
|
+
return if @@initialized
|
11
|
+
|
12
|
+
puts "#{"="*5} Loading Ricque #{"="*40}"
|
13
|
+
started_at = Time.now
|
14
|
+
|
15
|
+
initializer_files_path = ::File.join(::File.expand_path('initializers', self.config_dir), '**', '*.rb')
|
16
|
+
environment_file_path = ::File.join(::File.expand_path('environments', self.config_dir), "#{self.env}.rb")
|
17
|
+
lib_files_path = ::File.join(::File.expand_path("lib/#{app_name}", self.root), '**', '*.rb')
|
18
|
+
environment = self.env
|
19
|
+
|
20
|
+
if !File.exists?(environment_file_path)
|
21
|
+
puts "\tEnvironment file was not found for [#{self.env}]"
|
22
|
+
environment = Ricque::DEFAULT_ENVIRONMENT
|
23
|
+
environment_file_path = ::File.join(::File.expand_path('environments', self.config_dir), "#{Ricque::DEFAULT_ENVIRONMENT}.rb")
|
24
|
+
end
|
25
|
+
|
26
|
+
puts "\tExecuting before_initialize_blocks (#{before_initialize_blocks.count})"
|
27
|
+
execute_before_initialize!
|
28
|
+
|
29
|
+
load_path environment_file_path, "\tLoading environment file for [#{environment}]"
|
30
|
+
|
31
|
+
load_path initializer_files_path, "\tLoading initializers"
|
32
|
+
|
33
|
+
load_path lib_files_path, "\tLoading application files"
|
34
|
+
|
35
|
+
puts "\tExecuting after_initialize_blocks (#{after_initialize_blocks.count})"
|
36
|
+
execute_after_initialize!
|
37
|
+
|
38
|
+
puts "\tRicque loaded on environment \"#{ENV["RUBY_ENV"]}\" in #{Time.now - started_at} seconds"
|
39
|
+
puts "#{"="*5} Ricque loaded #{"="*40}"
|
40
|
+
|
41
|
+
@@initialized = true
|
42
|
+
|
43
|
+
nil
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.initialized?
|
47
|
+
@@initialized
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.before_initialize &block
|
51
|
+
before_initialize_blocks << block
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.execute_before_initialize!
|
55
|
+
before_initialize_blocks.each(&:call)
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.after_initialize &block
|
59
|
+
after_initialize_blocks << block
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.execute_after_initialize!
|
63
|
+
after_initialize_blocks.each(&:call)
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.configure &block
|
67
|
+
block.call configuration
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.configuration
|
71
|
+
@@config ||= {}
|
72
|
+
@@config
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.logger= logger
|
76
|
+
configuration[:logger] = logger
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.logger
|
80
|
+
configuration[:logger]
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.logger?
|
84
|
+
!configuration[:logger].nil?
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.development?
|
88
|
+
ENV["RUBY_ENV"] == "development"
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.load_tasks
|
92
|
+
tasks_files = ::File.join(::File.expand_path('lib/tasks', self.root), '**', '*.rake')
|
93
|
+
|
94
|
+
::Dir[tasks_files].each { |it| import it }
|
95
|
+
end
|
96
|
+
|
97
|
+
private
|
98
|
+
|
99
|
+
def self.after_initialize_blocks
|
100
|
+
@@after_initialize_blocks ||= []
|
101
|
+
@@after_initialize_blocks
|
102
|
+
end
|
103
|
+
|
104
|
+
def self.before_initialize_blocks
|
105
|
+
@@before_initialize_blocks ||= []
|
106
|
+
@@before_initialize_blocks
|
107
|
+
end
|
108
|
+
|
109
|
+
def self.load_path path, message
|
110
|
+
files = ::Dir[path]
|
111
|
+
puts "#{message} (#{files.size})"
|
112
|
+
files.each { |file| load file }
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Ricque
|
2
|
+
APP_NAME = 'ricque'
|
3
|
+
DEFAULT_ENVIRONMENT = 'development'
|
4
|
+
|
5
|
+
def self.app_name
|
6
|
+
APP_NAME
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.lib_dir
|
10
|
+
ENV["LIB_DIR_#{app_name}"]
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.config_dir
|
14
|
+
ENV["CONFIG_ROOT_#{app_name}"]
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.config_dir= config_dir
|
18
|
+
ENV["CONFIG_ROOT_#{app_name}"] = config_dir
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.root
|
22
|
+
ENV["APP_ROOT_#{app_name}"]
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.env
|
26
|
+
ENV["RUBY_ENV"]
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.groups
|
30
|
+
ENV["BUNDLER_GROUPS"].split(',')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
ENV["APP_ROOT_#{Ricque.app_name}"] = ::File.expand_path('../..', __FILE__)
|
35
|
+
ENV["CONFIG_ROOT_#{Ricque.app_name}"] = ::File.expand_path('config', ENV["APP_ROOT_#{Ricque.app_name}"])
|
36
|
+
ENV["LIB_DIR_#{Ricque.app_name}"] = ::File.expand_path("lib/#{Ricque.app_name}", ENV["APP_ROOT_#{Ricque.app_name}"])
|
37
|
+
|
38
|
+
Ricque::DEFAULT_ENVIRONMENT = "development" unless defined?(Ricque::DEFAULT_ENVIRONMENT)
|
39
|
+
|
40
|
+
ENV["RUBY_ENV"] = ENV["RUBY_ENV"] || ENV["RACK_ENV"] || Ricque::DEFAULT_ENVIRONMENT
|
41
|
+
ENV["RACK_ENV"] = ENV["RUBY_ENV"]
|
42
|
+
|
43
|
+
ENV["BUNDLER_GROUPS"] = "default,#{ENV["RUBY_ENV"]}"
|
44
|
+
|
45
|
+
require 'rubygems'
|
46
|
+
require 'bundler/setup'
|
47
|
+
|
48
|
+
Bundler.require(*ENV["BUNDLER_GROUPS"].split(','))
|
File without changes
|
File without changes
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
options = {}
|
6
|
+
|
7
|
+
OptionParser.new do |opt|
|
8
|
+
opt.banner = "Usage: console [environment] [options]"
|
9
|
+
opt.on("-e", "--environment=name", String,
|
10
|
+
"Specifies the environment to run this console under (test/development/production).",
|
11
|
+
"Default: development") { |v| options[:environment] = v.strip }
|
12
|
+
opt.on("-d", "--debugger", 'Enable the debugger.') { |v| options[:debugger] = v }
|
13
|
+
opt.parse!(ARGV)
|
14
|
+
end
|
15
|
+
|
16
|
+
if ARGV.first && ARGV.first[0] != '-'
|
17
|
+
env = ARGV.first
|
18
|
+
options[:environment] = env
|
19
|
+
ARGV.shift
|
20
|
+
end
|
21
|
+
|
22
|
+
ENV["RUBY_ENV"] = options[:environment] if options[:environment]
|
23
|
+
|
24
|
+
if options[:debugger]
|
25
|
+
require 'ruby-debug'
|
26
|
+
puts "=> Debugger enabled"
|
27
|
+
end
|
28
|
+
|
29
|
+
require File.expand_path('../../config/environment', __FILE__)
|
30
|
+
|
31
|
+
require 'irb'
|
32
|
+
require 'irb/completion'
|
33
|
+
|
34
|
+
IRB.start
|
@@ -0,0 +1,29 @@
|
|
1
|
+
ENV["RUBY_ENV"] = ENV["RACK_ENV"] = 'test'
|
2
|
+
|
3
|
+
require 'simplecov'
|
4
|
+
require 'simplecov-rcov'
|
5
|
+
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
|
6
|
+
SimpleCov.start 'rails' do
|
7
|
+
add_filter "/spec/"
|
8
|
+
end
|
9
|
+
|
10
|
+
require File.expand_path("../../config/environment", __FILE__)
|
11
|
+
|
12
|
+
require 'rspec/autorun'
|
13
|
+
# require 'factory_girl'
|
14
|
+
# require 'database_cleaner'
|
15
|
+
|
16
|
+
Dir["#{Ricque.root}/spec/support/**/*.rb"].each {|f| require f}
|
17
|
+
|
18
|
+
RSpec.configure do |config|
|
19
|
+
|
20
|
+
# config.include FactoryGirl::Syntax::Methods
|
21
|
+
|
22
|
+
# config.before(:suite) do
|
23
|
+
# end
|
24
|
+
|
25
|
+
# config.after(:each) do
|
26
|
+
# end
|
27
|
+
|
28
|
+
config.order = "random"
|
29
|
+
end
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ricque
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ricardo Tealdi
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-03 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activesupport
|
16
|
+
requirement: &70104348352180 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.6.1
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70104348352180
|
25
|
+
description: Ricque is a generator of Ruby applications with bootstrap similar to
|
26
|
+
Rails' bootstrap
|
27
|
+
email:
|
28
|
+
- ricardo.tealdi@gmail.com
|
29
|
+
executables:
|
30
|
+
- ricque
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- lib/ricque/version.rb
|
35
|
+
- lib/ricque.rb
|
36
|
+
- lib/template/.gitignore
|
37
|
+
- lib/template/.rspec
|
38
|
+
- lib/template/.rvmrc
|
39
|
+
- lib/template/config/application.rb
|
40
|
+
- lib/template/config/boot.rb
|
41
|
+
- lib/template/config/environment.rb
|
42
|
+
- lib/template/config/environments/development.rb
|
43
|
+
- lib/template/config/environments/production.rb
|
44
|
+
- lib/template/config/environments/test.rb
|
45
|
+
- lib/template/config/initializers/00_slogger.rb
|
46
|
+
- lib/template/doc/README_FOR_APP
|
47
|
+
- lib/template/Gemfile
|
48
|
+
- lib/template/Gemfile.lock
|
49
|
+
- lib/template/lib/ricque/version.rb
|
50
|
+
- lib/template/lib/ricque.rb
|
51
|
+
- lib/template/lib/tasks/ricque.rake
|
52
|
+
- lib/template/lib/tasks/rspec.rake
|
53
|
+
- lib/template/log/.gitkeep
|
54
|
+
- lib/template/Rakefile
|
55
|
+
- lib/template/README
|
56
|
+
- lib/template/script/console
|
57
|
+
- lib/template/spec/spec_helper.rb
|
58
|
+
- lib/template/tmp/pids/.gitkeep
|
59
|
+
- bin/ricque
|
60
|
+
homepage:
|
61
|
+
licenses:
|
62
|
+
- MIT
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project: ricque
|
81
|
+
rubygems_version: 1.8.11
|
82
|
+
signing_key:
|
83
|
+
specification_version: 3
|
84
|
+
summary: Ricque is a generator of Ruby applications with bootstrap similar to Rails'
|
85
|
+
bootstrap
|
86
|
+
test_files: []
|