suprails 0.1.4 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +6 -2
- data/TODO +6 -0
- data/bin/suprails +27 -4
- data/lib/runner.rb +10 -18
- data/lib/suprails.rb +2 -2
- data/lib/yaml_helper.rb +22 -0
- data/suprails.config.example +20 -1
- metadata +2 -2
data/README
CHANGED
@@ -48,12 +48,12 @@ delete "public/index.html"
|
|
48
48
|
gpl
|
49
49
|
git
|
50
50
|
haml
|
51
|
-
save
|
51
|
+
save # saves a copy of the configfile into rails app
|
52
52
|
|
53
53
|
Installation
|
54
54
|
============
|
55
55
|
|
56
|
-
$ sudo gem install
|
56
|
+
$ sudo gem install suprails
|
57
57
|
|
58
58
|
Execution
|
59
59
|
============
|
@@ -76,6 +76,10 @@ History/Bugs
|
|
76
76
|
|
77
77
|
gems.config currently only accepts one arg.
|
78
78
|
|
79
|
+
0.2.1 - Added ability to specify a particular config file when running suprails
|
80
|
+
Added output for all commands
|
81
|
+
Updated help text when suprails is run without args (after 1st time)
|
82
|
+
|
79
83
|
0.1.3 - Added the save command and extended the file command
|
80
84
|
|
81
85
|
0.1.2 - Changed runcommand to runinside
|
data/TODO
CHANGED
data/bin/suprails
CHANGED
@@ -21,7 +21,7 @@
|
|
21
21
|
|
22
22
|
require File.dirname(__FILE__) + '/../lib/suprails'
|
23
23
|
opts = ARGV
|
24
|
-
SUPRAILS_VERSION = 0.1
|
24
|
+
SUPRAILS_VERSION = "0.2.1"
|
25
25
|
|
26
26
|
def is_setup?
|
27
27
|
File.exists?(File.expand_path('~/.suprails'))
|
@@ -49,11 +49,32 @@ if !is_setup?
|
|
49
49
|
end
|
50
50
|
|
51
51
|
if opts.length == 0
|
52
|
-
puts
|
52
|
+
puts <<-EOF
|
53
|
+
Usage: /usr/bin/suprails /path/to/your/app [options]
|
54
|
+
|
55
|
+
Options:
|
56
|
+
-v, --version Show the Suprails version number and quit.
|
57
|
+
-c, --config filename Configuration file to use (^foo resolves to ~/.suprails/config.foo)
|
58
|
+
|
59
|
+
Description:
|
60
|
+
The 'suprails' command parses a configuration file to create a new Ruby on
|
61
|
+
Rails application customized however you'd like.
|
62
|
+
|
63
|
+
Examples:
|
64
|
+
suprails ~/dev/pro/WidgetStoreFront
|
65
|
+
|
66
|
+
This generates a Rails application in ~/dev/pro/WidgetStoreFront with all
|
67
|
+
the customizations you specified in ~/.suprails/config
|
68
|
+
|
69
|
+
suprails ~/dev/fun/BazBlog -c ^bort
|
70
|
+
|
71
|
+
This generates a Rails application in ~/dev/fun/BazBlog with all the
|
72
|
+
customizations you specified in ~/.suprails/config.bort
|
73
|
+
EOF
|
53
74
|
else
|
54
75
|
# If options include -v or --version, print the version and exit
|
55
76
|
if opts.any? {|opt| %w{-v --version}.include?(opt)}
|
56
|
-
puts SUPRAILS_VERSION
|
77
|
+
puts "Suprails Version: #{SUPRAILS_VERSION}"
|
57
78
|
exit
|
58
79
|
end
|
59
80
|
|
@@ -62,10 +83,12 @@ else
|
|
62
83
|
if config.is_a? Fixnum
|
63
84
|
opts.delete_at(config)
|
64
85
|
config = opts.delete_at(config)
|
86
|
+
# allow "^foo" to resolve to "~/.suprails/config.foo"
|
87
|
+
config = config.sub(/\A(\^)/, '~/.suprails/config.')
|
65
88
|
end
|
66
89
|
|
67
90
|
if opts.first =~ /^[a-zA-Z0-9]+/
|
68
|
-
Suprails.new(opts.shift).create_project
|
91
|
+
Suprails.new(opts.shift).create_project(config)
|
69
92
|
else
|
70
93
|
puts 'Invalid Application Name. Must start with alphanumeric character!'
|
71
94
|
end
|
data/lib/runner.rb
CHANGED
@@ -56,22 +56,21 @@ class Runner
|
|
56
56
|
db = DB.new Runner.app_name
|
57
57
|
@base = File.expand_path "./#{Runner.app_name}"
|
58
58
|
Dir.mkdir(@base)
|
59
|
-
# text = File.read(@runfile).split('\n')
|
60
|
-
# text.each {|l| instance_eval(l)}
|
61
59
|
text = File.read(@runfile)
|
62
60
|
instance_eval(text)
|
63
61
|
end
|
64
62
|
|
65
63
|
def sources sourcefolder
|
66
64
|
@sources = File.expand_path "#{sourcefolder}/"
|
65
|
+
puts "Using #{@sources} for file sources"
|
67
66
|
end
|
68
67
|
|
69
68
|
def rails
|
70
|
-
|
69
|
+
shell "rails #{Runner.app_name}"
|
71
70
|
end
|
72
71
|
|
73
72
|
def frozen_rails
|
74
|
-
|
73
|
+
shell "rails #{Runner.app_name} --freeze"
|
75
74
|
end
|
76
75
|
|
77
76
|
def debug p = ''
|
@@ -88,6 +87,7 @@ class Runner
|
|
88
87
|
|
89
88
|
def folder folder_name
|
90
89
|
path = "#{@base}/"
|
90
|
+
puts "New folder: #{@base}"
|
91
91
|
paths = folder_name.split('/')
|
92
92
|
paths.each do |p|
|
93
93
|
path += "#{p}/"
|
@@ -103,11 +103,12 @@ class Runner
|
|
103
103
|
source = File.expand_path "#{@sources}/#{source_file}"
|
104
104
|
end
|
105
105
|
dest = File.expand_path "./#{Runner.app_name}/#{destination}"
|
106
|
-
File.copy(source, dest,
|
106
|
+
File.copy(source, dest, true) if File.exists? source
|
107
107
|
end
|
108
108
|
|
109
109
|
def delete file_name
|
110
110
|
file_name = "#{@base}/#{file_name}"
|
111
|
+
puts "Deleting: #{@file_name}"
|
111
112
|
File.delete file_name if File.exists?(file_name)
|
112
113
|
end
|
113
114
|
|
@@ -135,21 +136,11 @@ class Runner
|
|
135
136
|
end
|
136
137
|
|
137
138
|
def git
|
138
|
-
|
139
|
-
begin
|
140
|
-
gem = require 'git'
|
141
|
-
rescue LoadError => e
|
142
|
-
nil
|
143
|
-
end
|
144
|
-
if gem
|
145
|
-
g = Git.init(@base)
|
146
|
-
else
|
147
|
-
runinside 'git init'
|
148
|
-
end
|
139
|
+
runinside('git init')
|
149
140
|
end
|
150
141
|
|
151
142
|
def svn
|
152
|
-
runinside
|
143
|
+
runinside('svnadmin create')
|
153
144
|
end
|
154
145
|
|
155
146
|
def runinside *opts
|
@@ -164,12 +155,13 @@ class Runner
|
|
164
155
|
File.open(File.expand_path("./#{Runner.app_name}/#{filename}"), 'w') do |f|
|
165
156
|
f.puts contents
|
166
157
|
end
|
158
|
+
puts "Generating file: #{filename}"
|
167
159
|
end
|
168
160
|
|
169
161
|
private
|
170
162
|
|
171
163
|
def shell cmd
|
172
|
-
`#{cmd}`
|
164
|
+
puts `#{cmd}`
|
173
165
|
end
|
174
166
|
|
175
167
|
end
|
data/lib/suprails.rb
CHANGED
data/lib/yaml_helper.rb
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
#
|
2
|
+
# Suprails: The customizable wrapper to the rails command
|
3
|
+
#
|
4
|
+
# Copyright 2008 Bradley Grzesiak
|
5
|
+
# This file is part of Suprails.
|
6
|
+
#
|
7
|
+
# Suprails is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# Suprails is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with Suprails. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#
|
20
|
+
|
21
|
+
require 'yaml'
|
22
|
+
|
1
23
|
class YAMLHelper
|
2
24
|
def self.create_yaml(file, values)
|
3
25
|
directory = File.dirname(file)
|
data/suprails.config.example
CHANGED
@@ -81,7 +81,7 @@ delete "public/index.html"
|
|
81
81
|
# Example:
|
82
82
|
# gpl
|
83
83
|
|
84
|
-
# You can setup your database, too. Unfortunately, this is
|
84
|
+
# You can setup your database, too. Unfortunately, this is NOT YET IMPLEMENTED.
|
85
85
|
# Use 'file' to copy your database.yml file instead.
|
86
86
|
# Examples:
|
87
87
|
# db.development.adapter :sqlite3
|
@@ -89,6 +89,12 @@ delete "public/index.html"
|
|
89
89
|
# db.development.timeout 5000
|
90
90
|
# db.create
|
91
91
|
# db.migrate
|
92
|
+
#
|
93
|
+
# For the time being, you can instead use db.save_yaml
|
94
|
+
# Example:
|
95
|
+
# db.save_yaml({ "development" =>
|
96
|
+
# {"adapter" => 'sqlite3', 'database' => 'db/dev.sqlite3' }
|
97
|
+
# })
|
92
98
|
|
93
99
|
# Rake works too
|
94
100
|
# Example:
|
@@ -117,6 +123,19 @@ git
|
|
117
123
|
# Example:
|
118
124
|
# haml
|
119
125
|
|
126
|
+
# If you want to create a new file from within this file (for archival
|
127
|
+
# purposes compared to the 'file' command), use the new_file command
|
128
|
+
# Example:
|
129
|
+
# new_file '.gitignore', <<-EOF
|
130
|
+
# log/*.log
|
131
|
+
# tmp/**/*
|
132
|
+
# .DS_Store
|
133
|
+
# doc/api
|
134
|
+
# doc/app
|
135
|
+
# coverage
|
136
|
+
# db/*.sqlite3
|
137
|
+
# EOF
|
138
|
+
|
120
139
|
# Finally, you can save a copy of this configuration file into your rails app's
|
121
140
|
# doc directory with the 'save' command
|
122
141
|
# Example:
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: suprails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bradley Grzesiak
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-11-
|
12
|
+
date: 2008-11-30 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|