sinatra-gen 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ == 0.1.1 2008-12-16
2
+
3
+ * 1 major enhancement
4
+ * added --cap option for generating capistrano recipe
5
+ * 1 minor enhancement
6
+ * added empty config.yml on generation
7
+
1
8
  == 0.1.0 2008-12-13
2
9
 
3
10
  * 1 major enhancement:
data/Manifest.txt CHANGED
@@ -5,9 +5,12 @@ README.rdoc
5
5
  Rakefile
6
6
  app_generators/sinatra_app/USAGE
7
7
  app_generators/sinatra_app/sinatra_app_generator.rb
8
+ app_generators/sinatra_app/templates/Capfile
8
9
  app_generators/sinatra_app/templates/Rakefile.erb
9
10
  app_generators/sinatra_app/templates/app.rb.erb
10
11
  app_generators/sinatra_app/templates/config.ru.erb
12
+ app_generators/sinatra_app/templates/config.yml
13
+ app_generators/sinatra_app/templates/config/deploy.rb.erb
11
14
  app_generators/sinatra_app/templates/lib/module.rb.erb
12
15
  app_generators/sinatra_app/templates/test/test_app_rspec.rb.erb
13
16
  app_generators/sinatra_app/templates/test/test_app_shoulda.rb.erb
@@ -20,4 +23,5 @@ app_generators/sinatra_app/templates/views/erb_layout.erb
20
23
  app_generators/sinatra_app/templates/views/haml_index.erb
21
24
  app_generators/sinatra_app/templates/views/haml_layout.erb
22
25
  bin/sinatra-gen
23
- lib/sinatra-gen.rb
26
+ lib/sinatra-gen.rb
27
+ sinatra-gen.gemspec
data/README.rdoc CHANGED
@@ -18,18 +18,20 @@ Run:
18
18
 
19
19
  e.g.
20
20
 
21
- sinatra-gen mysinatrapp --vendor -i --test=shoulda --views=haml
21
+ sinatra-gen mysinatrapp --vendor --init --test=shoulda --views=haml
22
22
 
23
23
  Options (can also be obtained by running sinatra-gen with no arguments):
24
24
 
25
- -v, --version Show the sinatra-gen version number and quit.
26
- -d, --vendor Extract the latest sinatra to vendor/sinatra
27
- -t, --tiny Only create the minimal files.
28
- -s, --scripts Install the rubigen scripts (script/generate, script/destroy)
29
- -i, --init Initialize a git repository
30
- --git /path/to/git Specify a different path for 'git'
31
- --test=test_framework Specify your testing framework (unit (default)/rspec/spec/shoulda)
32
- --views=view_framework Specify your view framework (erb (default)/haml/builder)
25
+ -v, --version Show the sinatra-gen version number and quit.
26
+ -d, --vendor Extract the latest sinatra to vendor/sinatra
27
+ --tiny Only create the minimal files.
28
+ --init Initialize a git repository
29
+ --cap Adds config directory with basic capistrano deploy.rb
30
+ --scripts Install the rubigen scripts (script/generate, script/destroy)
31
+ --git /path/to/git Specify a different path for 'git'
32
+ --test=test_framework Specify your testing framework (unit (default)/rspec/spec/shoulda)
33
+ --views=view_framework Specify your view framework (erb (default)/haml/builder)
34
+
33
35
 
34
36
  The --tiny option will create no directories. Just an app.rb, a Rakefile, and a config.ru (Rackup file)
35
37
 
data/Rakefile CHANGED
@@ -6,8 +6,8 @@ require File.dirname(__FILE__) + '/lib/sinatra-gen'
6
6
  $hoe = Hoe.new('sinatra-gen', SinatraGen::VERSION) do |p|
7
7
  p.developer('Aaron Quint', 'aaron@quirkey.com')
8
8
  p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
9
- p.post_install_message = 'PostInstall.txt'
10
- p.rubyforge_name = "quirkey"
9
+ p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
10
+ p.rubyforge_name = 'quirkey'
11
11
  p.extra_deps = [
12
12
  ['rubigen','>= 1.3.3'],
13
13
  ]
@@ -5,7 +5,7 @@ class SinatraAppGenerator < RubiGen::Base
5
5
 
6
6
  default_options :author => nil
7
7
 
8
- attr_accessor :app_name, :vendor, :tiny, :git, :git_init, :test_framework, :view_framework, :install_scripts
8
+ attr_accessor :app_name, :vendor, :tiny, :git, :git_init, :test_framework, :view_framework, :install_scripts, :cap
9
9
 
10
10
  def initialize(runtime_args, runtime_options = {})
11
11
  super
@@ -18,7 +18,7 @@ class SinatraAppGenerator < RubiGen::Base
18
18
  def manifest
19
19
  record do |m|
20
20
  # Ensure appropriate folder(s) exists
21
- m.directory ''
21
+ m.directory ''
22
22
 
23
23
  if git_init
24
24
  `cd #{@destination_root} && #{git} init`
@@ -30,6 +30,7 @@ class SinatraAppGenerator < RubiGen::Base
30
30
 
31
31
  unless tiny
32
32
  BASEDIRS.each { |path| m.directory path }
33
+ m.file 'config.yml', 'config.yml'
33
34
  m.template 'lib/module.rb.erb', "lib/#{app_name}.rb"
34
35
  m.template 'test/test_helper.rb.erb', 'test/test_helper.rb'
35
36
  m.template "test/test_app_#{test_framework}.rb.erb", "test/test_#{app_name}.rb"
@@ -47,6 +48,12 @@ class SinatraAppGenerator < RubiGen::Base
47
48
  `#{command}`
48
49
  end
49
50
 
51
+ if cap
52
+ m.directory 'config'
53
+ m.file 'Capfile', 'Capfile'
54
+ m.template 'config/deploy.rb.erb', 'config/deploy.rb'
55
+ end
56
+
50
57
  if install_scripts
51
58
  m.dependency "install_rubigen_scripts", [destination_root, 'sinatra-gen'], :shebang => options[:shebang], :collision => :force
52
59
  end
@@ -68,9 +75,10 @@ EOS
68
75
 
69
76
  opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
70
77
  opts.on("-d", "--vendor", "Extract the latest sinatra to vendor/sinatra") {|o| options[:vendor] = o }
71
- opts.on("-t", "--tiny", "Only create the minimal files.") {|o| options[:tiny] = o }
72
- opts.on("-i", "--init", "Initialize a git repository") {|o| options[:init] = o }
73
- opts.on("-s", "--scripts", "Install the rubigen scripts (script/generate, script/destroy)") {|o| options[:scripts] = o }
78
+ opts.on("--tiny", "Only create the minimal files.") {|o| options[:tiny] = o }
79
+ opts.on("--init", "Initialize a git repository") {|o| options[:init] = o }
80
+ opts.on("--cap", "Adds config directory with basic capistrano deploy.rb") {|o| options[:cap] = o }
81
+ opts.on("--scripts", "Install the rubigen scripts (script/generate, script/destroy)") {|o| options[:scripts] = o }
74
82
  opts.on("--git /path/to/git", "Specify a different path for 'git'") {|o| options[:git] = o }
75
83
  opts.on("--test=test_framework", String, "Specify your testing framework (unit (default)/rspec/spec/shoulda)") {|o| options[:test_framework] = o }
76
84
  opts.on("--views=view_framework", "Specify your view framework (erb (default)/haml/builder)") {|o| options[:view_framework] = o }
@@ -82,6 +90,7 @@ EOS
82
90
  # raw instance variable value.
83
91
  self.vendor = options[:vendor]
84
92
  self.tiny = options[:tiny]
93
+ self.cap = options[:cap]
85
94
  self.git = options[:git] || `which git`.strip
86
95
  self.git_init = options[:init]
87
96
  self.test_framework = options[:test_framework] || 'unit'
@@ -0,0 +1,3 @@
1
+ load 'deploy' if respond_to?(:namespace) # cap2 differentiator
2
+ Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
3
+ load 'config/deploy'
@@ -0,0 +1,13 @@
1
+ set :application, "<%= app_name %>"
2
+ set :deploy_via, :remote_cache
3
+ set :user, 'SERVER_USER_NAME'
4
+ set :runner, user
5
+
6
+ set :scm, :git
7
+ set :repository, "git@github.com:GITHUB_USER_NAME/#{application}.git"
8
+ set :branch, 'master'
9
+ set :git_enable_submodules, 1
10
+ set :keep_releases, 3
11
+ set :deploy_to, "/var/www/apps/#{application}"
12
+
13
+ server "YOUR_DOMAIN", :web, :app, :db, :primary => true
data/bin/sinatra-gen CHANGED
@@ -4,7 +4,7 @@ require 'rubygems'
4
4
  require 'rubigen'
5
5
 
6
6
  if %w(-v --version).include? ARGV.first
7
- require 'sinatra-gen'
7
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'sinatra-gen')
8
8
  puts "#{File.basename($0)} #{SinatraGen::VERSION}"
9
9
  exit(0)
10
10
  end
data/lib/sinatra-gen.rb CHANGED
@@ -2,5 +2,5 @@ $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
4
  module SinatraGen
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.1'
6
6
  end
@@ -0,0 +1,44 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{sinatra-gen}
5
+ s.version = "0.1.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Aaron Quint"]
9
+ s.date = %q{2008-12-16}
10
+ s.default_executable = %q{sinatra-gen}
11
+ s.description = %q{sinatra-gen generates a common file structure and basic app files for a web app utilizing the sinatra framework. For more information on sinatra, check out http://sinatra.rubyforge.org}
12
+ s.email = ["aaron@quirkey.com"]
13
+ s.executables = ["sinatra-gen"]
14
+ s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc"]
15
+ s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "app_generators/sinatra_app/USAGE", "app_generators/sinatra_app/sinatra_app_generator.rb", "app_generators/sinatra_app/templates/Capfile", "app_generators/sinatra_app/templates/Rakefile.erb", "app_generators/sinatra_app/templates/app.rb.erb", "app_generators/sinatra_app/templates/config.ru.erb", "app_generators/sinatra_app/templates/config.yml", "app_generators/sinatra_app/templates/config/deploy.rb.erb", "app_generators/sinatra_app/templates/lib/module.rb.erb", "app_generators/sinatra_app/templates/test/test_app_rspec.rb.erb", "app_generators/sinatra_app/templates/test/test_app_shoulda.rb.erb", "app_generators/sinatra_app/templates/test/test_app_spec.rb.erb", "app_generators/sinatra_app/templates/test/test_app_unit.rb.erb", "app_generators/sinatra_app/templates/test/test_helper.rb.erb", "app_generators/sinatra_app/templates/views/builder_index.erb", "app_generators/sinatra_app/templates/views/erb_index.erb", "app_generators/sinatra_app/templates/views/erb_layout.erb", "app_generators/sinatra_app/templates/views/haml_index.erb", "app_generators/sinatra_app/templates/views/haml_layout.erb", "bin/sinatra-gen", "lib/sinatra-gen.rb", "sinatra-gen.gemspec", "test/test_generator_helper.rb", "test/test_helper.rb", "test/test_sinatra_app_generator.rb"]
16
+ s.has_rdoc = true
17
+ s.homepage = %q{http://github.com/quirkey/sinatra-gen}
18
+ s.post_install_message = %q{PostInstall.txt}
19
+ s.rdoc_options = ["--main", "README.rdoc"]
20
+ s.require_paths = ["lib"]
21
+ s.rubyforge_project = %q{sinatra-gen}
22
+ s.rubygems_version = %q{1.3.1}
23
+ s.summary = %q{sinatra-gen generates a common file structure and basic app files for a web app utilizing the sinatra framework}
24
+ s.test_files = ["test/test_generator_helper.rb", "test/test_helper.rb", "test/test_sinatra_app_generator.rb"]
25
+
26
+ if s.respond_to? :specification_version then
27
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
28
+ s.specification_version = 2
29
+
30
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
31
+ s.add_runtime_dependency(%q<rubigen>, [">= 1.3.3"])
32
+ s.add_development_dependency(%q<newgem>, [">= 1.2.1"])
33
+ s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
34
+ else
35
+ s.add_dependency(%q<rubigen>, [">= 1.3.3"])
36
+ s.add_dependency(%q<newgem>, [">= 1.2.1"])
37
+ s.add_dependency(%q<hoe>, [">= 1.8.0"])
38
+ end
39
+ else
40
+ s.add_dependency(%q<rubigen>, [">= 1.3.3"])
41
+ s.add_dependency(%q<newgem>, [">= 1.2.1"])
42
+ s.add_dependency(%q<hoe>, [">= 1.8.0"])
43
+ end
44
+ end
@@ -54,6 +54,16 @@ class TestSinatraAppGenerator < Test::Unit::TestCase
54
54
  assert_directory_exists '.git'
55
55
  end
56
56
 
57
+ def test_generate_app_with_cap_option
58
+ run_generator('sinatra_app', [APP_ROOT, '--cap'], sources)
59
+ assert_basic_paths_and_files
60
+ assert_directory_exists 'config'
61
+ assert_generated_file 'Capfile'
62
+ assert_generated_file 'config/deploy.rb' do |deploy_contents|
63
+ assert_match(/set \:application, "#{app_name}"/, deploy_contents)
64
+ end
65
+ end
66
+
57
67
  def test_generate_app_with_rspect_test_option
58
68
  run_generator('sinatra_app', [APP_ROOT, '--test=rspec'], sources)
59
69
  assert_basic_paths_and_files
@@ -145,6 +155,7 @@ class TestSinatraAppGenerator < Test::Unit::TestCase
145
155
  assert_generated_file 'config.ru'
146
156
  assert_generated_file 'app.rb'
147
157
  assert_generated_file 'Rakefile'
158
+ assert_generated_file 'config.yml'
148
159
  assert_generated_module "lib/#{app_name}"
149
160
  end
150
161
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-gen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Quint
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-13 00:00:00 -05:00
12
+ date: 2008-12-18 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.1.0
33
+ version: 1.2.1
34
34
  version:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: hoe
@@ -62,9 +62,12 @@ files:
62
62
  - Rakefile
63
63
  - app_generators/sinatra_app/USAGE
64
64
  - app_generators/sinatra_app/sinatra_app_generator.rb
65
+ - app_generators/sinatra_app/templates/Capfile
65
66
  - app_generators/sinatra_app/templates/Rakefile.erb
66
67
  - app_generators/sinatra_app/templates/app.rb.erb
67
68
  - app_generators/sinatra_app/templates/config.ru.erb
69
+ - app_generators/sinatra_app/templates/config.yml
70
+ - app_generators/sinatra_app/templates/config/deploy.rb.erb
68
71
  - app_generators/sinatra_app/templates/lib/module.rb.erb
69
72
  - app_generators/sinatra_app/templates/test/test_app_rspec.rb.erb
70
73
  - app_generators/sinatra_app/templates/test/test_app_shoulda.rb.erb
@@ -78,6 +81,7 @@ files:
78
81
  - app_generators/sinatra_app/templates/views/haml_layout.erb
79
82
  - bin/sinatra-gen
80
83
  - lib/sinatra-gen.rb
84
+ - sinatra-gen.gemspec
81
85
  has_rdoc: true
82
86
  homepage: http://github.com/quirkey/sinatra-gen
83
87
  post_install_message: PostInstall.txt