rubyapp 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ .DS_Store
data/README.markdown ADDED
@@ -0,0 +1,80 @@
1
+ # Ruby application generator ##
2
+
3
+ A Thor based generator to rapidly create a Ruby project with all the infrastructure setup for testing, mocking etc.
4
+
5
+ * Jeweler to create basic gem setup
6
+ * Binaries in \bin if --binaries
7
+ * Project library files in /lib
8
+ * Cucumber features, step definitions and basic configurations
9
+ * Rspec2 specs with configurations
10
+ * Unit tests
11
+ * Shoulda tests
12
+ * Mock libraries: mocha, flex, rr, rspec
13
+ * Autotest with grock and fsevent
14
+ * Bundler configuration for gem management
15
+ * Require DSL using require-me gem
16
+ * RCov for test coverage
17
+ * Heckle for test mutations
18
+
19
+ ## Install ##
20
+
21
+ It can be installed as a thor task:
22
+
23
+ <code>$ thor install lib/application.thor</code>
24
+
25
+ Alternatively install it as a gem and use the binary.
26
+ <code>$ gem install rubyapp</code>
27
+
28
+ ## Usage ##
29
+
30
+ To run it as a thor task:
31
+ <code>$ thor ruby:app my-ruby-app [options]</code>
32
+
33
+ Alternatively run it using the binary
34
+ <code>$ rubyapp my-ruby-project [options]</code>
35
+
36
+ ## Options ##
37
+
38
+ You can define system wide default options for ruby apps you create (your preferred framework stack) in a <code>~/.rubyapp</code> file.
39
+ The *~* implies ENV['HOME], the environment variable "HOME" on any system. Any options you call the program with explicitly will override the defaults in this file.
40
+
41
+ The options --rspec2, --cucumber, --license, --autotest, and --bundler are all set to true unless explicitly disabled either in the .rubyapp file or using the negation option when rubyapp is run (see negating boolean options below).
42
+
43
+ Boolean options:
44
+ To negate a boolean option prefix it with <code>no-</code>, fx <code>--no-rspec2</code> to disable rspec2 from the project infrastructure creation.
45
+
46
+ Rubyproject currently supports the following boolean options:
47
+
48
+ <pre><code>--install_gems
49
+ --jeweler
50
+ --bundler
51
+ --rspec2
52
+ --cucumber
53
+ --signatures
54
+ --license
55
+ --binaries
56
+ --test_unit
57
+ --shoulda
58
+ --mock_lib
59
+ --autotest
60
+ --heckle
61
+ --rake
62
+ --rcov
63
+ --require_me
64
+ </code></pre>
65
+
66
+ String options:
67
+ <code>--mock-lib</code>
68
+
69
+ Valid *mock-lib* values: rspec, mocha, flexmock, rr
70
+
71
+ Example:
72
+ <code>$ rubyapp my-ruby-mock-project --mock-lib flexmock</code>
73
+
74
+ ## Community ##
75
+ Please feel free to fork this project or provide suggestions for improvements, bug fixes etc.
76
+
77
+ *Share and enjoy!*
78
+
79
+ Copyright (c) 2010, Kristian Mandrup
80
+
data/Rakefile ADDED
@@ -0,0 +1,42 @@
1
+ begin
2
+ require 'jeweler'
3
+ Jeweler::Tasks.new do |gem|
4
+ gem.name = "rubyapp"
5
+ gem.summary = %Q{Create a fully configured ruby project}
6
+ gem.description = %Q{Create a fully configured ruby project with a set of common frameworks to choose from}
7
+ gem.email = "kmandrup@gmail.com"
8
+ gem.homepage = "http://github.com/kristianmandrup/rubyapp"
9
+ gem.authors = ["Kristian Mandrup"]
10
+ # gem.add_development_dependency "rspec", ">= 2.0.0.beta9"
11
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
12
+ end
13
+ Jeweler::GemcutterTasks.new
14
+ rescue LoadError
15
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
16
+ end
17
+
18
+ # require 'spec/rake/spectask'
19
+ # Spec::Rake::SpecTask.new(:spec) do |spec|
20
+ # spec.libs << 'lib' << 'spec'
21
+ # spec.spec_files = FileList['spec/**/*_spec.rb']
22
+ # end
23
+ #
24
+ # Spec::Rake::SpecTask.new(:rcov) do |spec|
25
+ # spec.libs << 'lib' << 'spec'
26
+ # spec.pattern = 'spec/**/*_spec.rb'
27
+ # spec.rcov = true
28
+ # end
29
+ #
30
+ # task :spec => :check_dependencies
31
+ #
32
+ # task :default => :spec
33
+ #
34
+ # require 'rake/rdoctask'
35
+ # Rake::RDocTask.new do |rdoc|
36
+ # version = File.exist?('VERSION') ? File.read('VERSION') : ""
37
+ #
38
+ # rdoc.rdoc_dir = 'rdoc'
39
+ # rdoc.title = "rubyapp #{version}"
40
+ # rdoc.rdoc_files.include('README*')
41
+ # rdoc.rdoc_files.include('lib/**/*.rb')
42
+ # end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
data/bin/rubyapp ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- mode: ruby -*-
3
+
4
+ require 'ruby_app'
5
+ Ruby::App.start
@@ -0,0 +1,224 @@
1
+ require 'active_support/inflector'
2
+
3
+ module Ruby
4
+ class App < Thor::Group
5
+ include Thor::Actions
6
+
7
+ desc "Generates a ruby application"
8
+
9
+ # Define arguments and options
10
+ argument :app_name
11
+
12
+ class_option :rspec2, :type => :boolean, :desc => "Use RSpec 2"
13
+ class_option :cucumber, :type => :boolean, :desc => "Use Cucumber"
14
+ class_option :signatures, :type => :boolean, :desc => "Create signature files"
15
+ class_option :license, :type => :boolean, :desc => "Create license file"
16
+ class_option :binaries, :type => :boolean, :desc => "Create binaries"
17
+
18
+ class_option :test_unit, :type => :boolean, :desc => "Use Test-unit"
19
+ class_option :shoulda, :type => :boolean, :desc => "Use Shoulda"
20
+
21
+ class_option :mock_lib, :type => :string, :desc => "Which Mocking framework to use"
22
+ class_option :autotest, :type => :boolean, :desc => "Use autotest"
23
+ class_option :heckle, :type => :boolean, :desc => "Use Heckle"
24
+
25
+ class_option :rake, :type => :boolean, :desc => "Configure Rakefile for Rake"
26
+ class_option :jeweler, :type => :boolean, :desc => "Use Jeweler"
27
+ class_option :rcov, :type => :boolean, :desc => "Use RCov"
28
+
29
+ class_option :require_me, :type => :boolean, :desc => "Use require-me gem"
30
+
31
+ class_option :bundler, :type => :boolean, :desc => "Create a Gemfile and configure project to use Bundler"
32
+
33
+ class_option :install_gems, :type => :boolean, :desc => "Install all gems as required by project configuration"
34
+
35
+
36
+ attr_accessor :project_options
37
+
38
+ def self.source_root
39
+ # template_path(__FILE__)
40
+ File.join(File.dirname(__FILE__), '..', 'templates')
41
+ end
42
+
43
+ def load_local_settings
44
+ local_settings_file = File.join(ENV['HOME'], '.rubyapp')
45
+ if File.exist? local_settings_file
46
+ str = File.open(local_settings_file).read
47
+ arr = str.split(/\n|,|:/).map{|s| s.strip}.map do |n|
48
+ case n
49
+ when "true"
50
+ true
51
+ when "false"
52
+ false
53
+ else
54
+ n
55
+ end
56
+ end
57
+ local_settings = Hash[*arr]
58
+ @project_options = local_settings.merge(options)
59
+ end
60
+ end
61
+
62
+ def default_settings
63
+ @project_options ||= options.dup
64
+ [:rspec2, :cucumber, :license, :autotest, :bundler].each{|key| project_options[key] ||= true}
65
+ end
66
+
67
+ def create_root
68
+ self.destination_root = File.expand_path(app_name, destination_root)
69
+ empty_directory '.'
70
+ FileUtils.cd(destination_root)
71
+ end
72
+
73
+ def install_gems
74
+ return nil if !project_options[:install_gems]
75
+ gems << "heckle" if project_options[:heckle]
76
+ gems << "rcov" if project_options[:rcov]
77
+ gems << "cucumber" if project_options[:cucumber]
78
+ gems << "ZenTest autotest-growl autotest-fsevent" if project_options[:autotest]
79
+ gems << "#{project_options[:mock_lib]}"
80
+ gems << "require-me" if project_options[:require_me]
81
+ gems << "bundler" if project_options[:bundler]
82
+ gems << "shoulda" if project_options[:shoulda]
83
+ gems << "test-unit" if project_options[:test_unit]
84
+ gems << "rake" if project_options[:rake]
85
+ gems << "jeweler" if project_options[:jeweler]
86
+
87
+ run "gem install rspec --pre" if project_options[:rspec]
88
+ run "gem install #{gems.join(' ')}"
89
+ end
90
+
91
+ def main_runner
92
+ if project_options[:jeweler]
93
+ run "jeweler #{appname}"
94
+ else
95
+ create_app
96
+ end
97
+ create_gemfile if !skip?(:bundler, 'Use Bundler?')
98
+ create_binaries if !skip?(:binaries, 'Create binaries?')
99
+ configure_cucumber if !skip?(:cucumber, 'Use Cucumber?')
100
+ configure_rspec2 if project_options[:rspec2]
101
+ configure_autotest if !skip?(:autotest, 'Use autotest?')
102
+ configure_shoulda if project_options[:shoulda]
103
+ configure_test_unit if project_options[:test_unit]
104
+ create_gitignore
105
+ create_readme
106
+ create_signatures if project_options[:signatures]
107
+ if skip?(:license, 'Use MIT license?')
108
+ say "Shame on you…", :red
109
+ return
110
+ else
111
+ copy_licence
112
+ end
113
+ autotest_feature_notice if project_options[:cucumber]
114
+ end
115
+
116
+ protected
117
+
118
+ def create_app
119
+ create_lib
120
+ end
121
+
122
+ def create_lib
123
+ empty_directory 'lib'
124
+ inside 'lib' do
125
+ empty_directory "#{app_name}"
126
+ template 'app_name.rb.erb', "#{app_name}/#{app_name}.rb"
127
+ template 'app_entrypoint.erb', "#{app_name}.rb"
128
+ end
129
+ end
130
+
131
+ def create_gemfile
132
+ return nil if !
133
+ template 'Gemfile'
134
+ end
135
+
136
+ def create_binaries
137
+ empty_directory 'bin'
138
+ inside "bin" do
139
+ template('binary', "#{app_name}")
140
+ template('binary.bat', "#{app_name}.bat")
141
+ end
142
+ end
143
+
144
+ def configure_cucumber
145
+ empty_directory 'features'
146
+ inside 'features' do
147
+ template('app_name.feature.erb', "#{app_name}.feature")
148
+ empty_directory 'step_definitions'
149
+ inside 'step_definitions' do
150
+ template('app_name_steps.erb', "#{app_name}_steps.rb")
151
+ end
152
+ empty_directory 'support'
153
+ inside 'support' do
154
+ template('env.rb.erb', 'env.rb')
155
+ end
156
+ end
157
+ end
158
+
159
+ def configure_rspec2
160
+ empty_directory 'spec'
161
+ create_file 'spec/rspec.options', '.rspec'
162
+ directory 'autotest'
163
+ inside 'spec' do
164
+ empty_directory "#{app_name}"
165
+ template 'spec_helper.rb.erb', "spec_helper.rb"
166
+ template 'app_name/sample_spec.rb.erb', "#{app_name}/#{app_name}_spec.rb"
167
+ end
168
+ end
169
+
170
+ def configure_autotest
171
+ create_file 'autotest.options', '.autotest'
172
+ end
173
+
174
+ def configure_shoulda
175
+ empty_directory 'shoulda'
176
+ inside 'shoulda' do
177
+ template('test_app_name.rb.erb', "test_#{app_name}.rb")
178
+ end
179
+ end
180
+
181
+ def configure_test_unit
182
+ empty_directory 'test'
183
+ inside 'test' do
184
+ template('test_app_name.rb.erb', "test_#{app_name}.rb")
185
+ end
186
+ end
187
+
188
+ def create_gitignore
189
+ template('gitignore', '.gitignore')
190
+ end
191
+
192
+ def create_readme
193
+ template('README.markdown', 'README.markdown')
194
+ end
195
+
196
+
197
+ def create_signatures
198
+ empty_directory '_signatures'
199
+ inside '_signatures' do
200
+ template 'APP.RUBY.signature'
201
+ end
202
+ end
203
+
204
+ def copy_licence
205
+ if !ENV['USERNAME']
206
+ say "WARNING: Env. variable USERNAME not set, using USERNAME = '#{ENV['USER']}' in license", :yellow
207
+ end
208
+ # Make a copy of the MITLICENSE file at the source root
209
+ template "MITLICENSE", "MITLICENSE"
210
+ end
211
+
212
+ def autotest_feature_notice
213
+ say "---"
214
+ say "autotest notice:"
215
+ say "To avoid cucumber features being run, start autotest like this"
216
+ say "$ AUTOFEATURE=false autotest"
217
+ end
218
+
219
+ protected
220
+ def skip?(key, question)
221
+ !project_options[key] || !yes?(question)
222
+ end
223
+ end
224
+ end
data/lib/ruby_app.rb ADDED
@@ -0,0 +1,224 @@
1
+ require 'active_support/inflector'
2
+
3
+ module Ruby
4
+ class App < Thor::Group
5
+ include Thor::Actions
6
+
7
+ desc "Generates a ruby application"
8
+
9
+ # Define arguments and options
10
+ argument :app_name
11
+
12
+ class_option :rspec2, :type => :boolean, :desc => "Use RSpec 2"
13
+ class_option :cucumber, :type => :boolean, :desc => "Use Cucumber"
14
+ class_option :signatures, :type => :boolean, :desc => "Create signature files"
15
+ class_option :license, :type => :boolean, :desc => "Create license file"
16
+ class_option :binaries, :type => :boolean, :desc => "Create binaries"
17
+
18
+ class_option :test_unit, :type => :boolean, :desc => "Use Test-unit"
19
+ class_option :shoulda, :type => :boolean, :desc => "Use Shoulda"
20
+
21
+ class_option :mock_lib, :type => :string, :desc => "Which Mocking framework to use"
22
+ class_option :autotest, :type => :boolean, :desc => "Use autotest"
23
+ class_option :heckle, :type => :boolean, :desc => "Use Heckle"
24
+
25
+ class_option :rake, :type => :boolean, :desc => "Configure Rakefile for Rake"
26
+ class_option :jeweler, :type => :boolean, :desc => "Use Jeweler"
27
+ class_option :rcov, :type => :boolean, :desc => "Use RCov"
28
+
29
+ class_option :require_me, :type => :boolean, :desc => "Use require-me gem"
30
+
31
+ class_option :bundler, :type => :boolean, :desc => "Create a Gemfile and configure project to use Bundler"
32
+
33
+ class_option :install_gems, :type => :boolean, :desc => "Install all gems as required by project configuration"
34
+
35
+
36
+ attr_accessor :project_options
37
+
38
+ def self.source_root
39
+ # template_path(__FILE__)
40
+ File.join(File.dirname(__FILE__), '..', 'templates')
41
+ end
42
+
43
+ def load_local_settings
44
+ local_settings_file = File.join(ENV['HOME'], '.rubyapp')
45
+ if File.exist? local_settings_file
46
+ str = File.open(local_settings_file).read
47
+ arr = str.split(/\n|,|:/).map{|s| s.strip}.map do |n|
48
+ case n
49
+ when "true"
50
+ true
51
+ when "false"
52
+ false
53
+ else
54
+ n
55
+ end
56
+ end
57
+ local_settings = Hash[*arr]
58
+ @project_options = local_settings.merge(options)
59
+ end
60
+ end
61
+
62
+ def default_settings
63
+ @project_options ||= options.dup
64
+ [:rspec2, :cucumber, :license, :autotest, :bundler].each{|key| project_options[key] ||= true}
65
+ end
66
+
67
+ def create_root
68
+ self.destination_root = File.expand_path(app_name, destination_root)
69
+ empty_directory '.'
70
+ FileUtils.cd(destination_root)
71
+ end
72
+
73
+ def install_gems
74
+ return nil if !project_options[:install_gems]
75
+ gems << "heckle" if project_options[:heckle]
76
+ gems << "rcov" if project_options[:rcov]
77
+ gems << "cucumber" if project_options[:cucumber]
78
+ gems << "ZenTest autotest-growl autotest-fsevent" if project_options[:autotest]
79
+ gems << "#{project_options[:mock_lib]}"
80
+ gems << "require-me" if project_options[:require_me]
81
+ gems << "bundler" if project_options[:bundler]
82
+ gems << "shoulda" if project_options[:shoulda]
83
+ gems << "test-unit" if project_options[:test_unit]
84
+ gems << "rake" if project_options[:rake]
85
+ gems << "jeweler" if project_options[:jeweler]
86
+
87
+ run "gem install rspec --pre" if project_options[:rspec]
88
+ run "gem install #{gems.join(' ')}"
89
+ end
90
+
91
+ def main_runner
92
+ if project_options[:jeweler]
93
+ run "jeweler #{appname}"
94
+ else
95
+ create_app
96
+ end
97
+ create_gemfile if !skip?(:bundler, 'Use Bundler?')
98
+ create_binaries if !skip?(:binaries, 'Create binaries?')
99
+ configure_cucumber if !skip?(:cucumber, 'Use Cucumber?'
100
+ configure_rspec2 if project_options[:rspec2]
101
+ configure_autotest if !skip?(:autotest, 'Use autotest?')
102
+ configure_shoulda if project_options[:shoulda]
103
+ configure_test_unit if project_options[:test_unit]
104
+ create_gitignore
105
+ create_readme
106
+ create_signatures if project_options[:signatures]
107
+ if skip?(:license, 'Use MIT license?')
108
+ say "Shame on you…", :red
109
+ return
110
+ else
111
+ copy_licence
112
+ end
113
+ autotest_feature_notice if project_options[:cucumber]
114
+ end
115
+
116
+ protected
117
+
118
+ def create_app
119
+ create_lib
120
+ end
121
+
122
+ def create_lib
123
+ empty_directory 'lib'
124
+ inside 'lib' do
125
+ empty_directory "#{app_name}"
126
+ template 'app_name.rb.erb', "#{app_name}/#{app_name}.rb"
127
+ template 'app_entrypoint.erb', "#{app_name}.rb"
128
+ end
129
+ end
130
+
131
+ def create_gemfile
132
+ return nil if !
133
+ template 'Gemfile'
134
+ end
135
+
136
+ def create_binaries
137
+ empty_directory 'bin'
138
+ inside "bin" do
139
+ template('binary', "#{app_name}")
140
+ template('binary.bat', "#{app_name}.bat")
141
+ end
142
+ end
143
+
144
+ def configure_cucumber
145
+ empty_directory 'features'
146
+ inside 'features' do
147
+ template('app_name.feature.erb', "#{app_name}.feature")
148
+ empty_directory 'step_definitions'
149
+ inside 'step_definitions' do
150
+ template('app_name_steps.erb', "#{app_name}_steps.rb")
151
+ end
152
+ empty_directory 'support'
153
+ inside 'support' do
154
+ template('env.rb.erb', 'env.rb')
155
+ end
156
+ end
157
+ end
158
+
159
+ def configure_rspec2
160
+ empty_directory 'spec'
161
+ create_file 'spec/rspec.options', '.rspec'
162
+ directory 'autotest'
163
+ inside 'spec' do
164
+ empty_directory "#{app_name}"
165
+ template 'spec_helper.rb.erb', "spec_helper.rb"
166
+ template 'app_name/sample_spec.rb.erb', "#{app_name}/#{app_name}_spec.rb"
167
+ end
168
+ end
169
+
170
+ def configure_autotest
171
+ create_file 'autotest.options', '.autotest'
172
+ end
173
+
174
+ def configure_shoulda
175
+ empty_directory 'shoulda'
176
+ inside 'shoulda' do
177
+ template('test_app_name.rb.erb', "test_#{app_name}.rb")
178
+ end
179
+ end
180
+
181
+ def configure_test_unit
182
+ empty_directory 'test'
183
+ inside 'test' do
184
+ template('test_app_name.rb.erb', "test_#{app_name}.rb")
185
+ end
186
+ end
187
+
188
+ def create_gitignore
189
+ template('gitignore', '.gitignore')
190
+ end
191
+
192
+ def create_readme
193
+ template('README.markdown', 'README.markdown')
194
+ end
195
+
196
+
197
+ def create_signatures
198
+ empty_directory '_signatures'
199
+ inside '_signatures' do
200
+ template 'APP.RUBY.signature'
201
+ end
202
+ end
203
+
204
+ def copy_licence
205
+ if !ENV['USERNAME']
206
+ say "WARNING: Env. variable USERNAME not set, using USERNAME = '#{ENV['USER']}' in license", :yellow
207
+ end
208
+ # Make a copy of the MITLICENSE file at the source root
209
+ template "MITLICENSE", "MITLICENSE"
210
+ end
211
+
212
+ def autotest_feature_notice
213
+ say "---"
214
+ say "autotest notice:"
215
+ say "To avoid cucumber features being run, start autotest like this"
216
+ say "$ AUTOFEATURE=false autotest"
217
+ end
218
+
219
+ protected
220
+ def skip?(key, question)
221
+ !project_options[key] || !yes?(question)
222
+ end
223
+ end
224
+ end
data/templates/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source :gemcutter
2
+
3
+ <%= "gem 'require-me', '>=0.7.6'" if project_options[:require_me] %>
4
+
5
+ group :test do
6
+ <%= "gem 'rspec', '>=2.0.0.beta.9'" if project_options[:rspec] %>
7
+ <%= "gem 'cucumber', '>=0.7.3'" if project_options[:cucumber] %>
8
+ <%= "gem '#{project_options[:mock_lib]}'" %>
9
+ end
@@ -0,0 +1,22 @@
1
+ Copyright (c) <#{Time.new.year}> <#{ENV['USERNAME'] || ENV['USER']}>
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,11 @@
1
+ # <%= app_name.humanize %> #
2
+
3
+ The <%= app_name.humanize %> project ...
4
+
5
+ ## Installation ##
6
+
7
+ ## Usage ##
8
+
9
+ ## Copyright ##
10
+
11
+ Copyright (c) <<%= Time.new.year %>> <<%= ENV['USERNAME'] || ENV['USER'] %>>
@@ -0,0 +1,10 @@
1
+ ----
2
+ Application:
3
+ Name: <%= app_name %>
4
+ Origin: mine
5
+ Version: 0.1.0
6
+ Test:
7
+ - Cucumber
8
+ - RSpec
9
+
10
+
@@ -0,0 +1,9 @@
1
+ Autotest.add_hook(:initialize) {|at|
2
+ at.add_exception %r{^\.git} # ignore Version Control System
3
+ at.add_exception %r{^./tmp} # ignore temp files, lest autotest will run again, and again...
4
+ # at.clear_mappings # take out the default (test/test*rb)
5
+ at.add_mapping(%r{^lib/.*\.rb$}) {|f, _|
6
+ Dir['spec/**/*.rb']
7
+ }
8
+ nil
9
+ }
@@ -0,0 +1 @@
1
+ Autotest.add_discovery { "rspec2" }
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
3
+ require '#{app_name}#'
File without changes
@@ -0,0 +1,2 @@
1
+ default: --format profile features --color
2
+ html_report: --format progress --format html --out=features_report.html features
@@ -0,0 +1,3 @@
1
+ default: .
2
+ autotest: --color
3
+ autotest-all: --color
@@ -0,0 +1,15 @@
1
+ Feature: <%= app_name %> ...
2
+ As a user
3
+ I want to ...
4
+ In order to ...
5
+
6
+ Scenario Outline: do it
7
+ Given the secret code is "<code>"
8
+ When I guess "<guess>"
9
+ Then the mark should be "<mark>"
10
+
11
+ Scenarios: no matches
12
+ | code | guess | mark |
13
+ | 1234 | 5678 | |
14
+ | 1234 | 5678 | |
15
+
@@ -0,0 +1,11 @@
1
+ Given /^the secret code is "([^\"]*)"$/ do |arg1|
2
+ pending # express the regexp above with the code you wish you had
3
+ end
4
+
5
+ When /^I guess "([^\"]*)"$/ do |arg1|
6
+ pending # express the regexp above with the code you wish you had
7
+ end
8
+
9
+ Then /^the mark should be "([^\"]*)"$/ do |arg1|
10
+ pending # express the regexp above with the code you wish you had
11
+ end
@@ -0,0 +1,4 @@
1
+ $LOAD_PATH << File.expand_path('../../../lib', __FILE__)
2
+ require '<%= app_name %>'
3
+ require 'rspec'
4
+ World(RSpec::Matchers)
@@ -0,0 +1,11 @@
1
+ .DS_STORE
2
+
3
+ # yard generated
4
+ doc
5
+ .yardoc
6
+
7
+ # jeweler generated
8
+ pkg
9
+
10
+
11
+
@@ -0,0 +1,2 @@
1
+ <%= "require 'require-me'" if project_options[:require_me] %>
2
+ <%= "require '#{app_name}/#{app_name}'" %>
@@ -0,0 +1,10 @@
1
+ module <%= app_name.camelize %>
2
+ class Basic
3
+ attr_accessor :name
4
+
5
+ def initialize(name = nil)
6
+ @name = name
7
+ end
8
+
9
+ end
10
+ end
@@ -0,0 +1,24 @@
1
+ require 'shoulda'
2
+
3
+ class <%= app_name.camelize %>Test < Test::Unit::TestCase
4
+ context "A <%= app_name.camelize %> instance" do
5
+
6
+ def setup
7
+ @basic = <%= app_name.camelize %>::Basic.new
8
+ end
9
+
10
+ should "do the magic dance" do
11
+ assert @basic, "No basic"
12
+ end
13
+
14
+ context "in mystery mode" do
15
+ setup do
16
+ # ...
17
+ end
18
+
19
+ should "do stuff" do
20
+ # assert ...
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,23 @@
1
+ require 'require-me'
2
+ Folder.require_spec 'spec_helper', __FILE__
3
+
4
+ module Hello
5
+ describe Basic do
6
+ context "empty basic" do
7
+ let(:basic) { <%= app_name.camelize %>::Basic.new }
8
+
9
+ describe "#basic" do
10
+ it "should not have a name" do
11
+ basic.name.should be_nil
12
+ end
13
+ end
14
+ end
15
+
16
+ context "named basic" do
17
+ let(:named) { <%= app_name.camelize %>::Basic.new 'blip' }
18
+ it "should have a name 'blip' " do
19
+ named.name.should be == "blip"
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,2 @@
1
+ --format nested
2
+ --color
@@ -0,0 +1,11 @@
1
+ <%= "require 'bundler'" if project_options[:bundler] %>
2
+ <%= "Bundler.setup(:default, :test)" if project_options[:bundler] %>
3
+ <%= "require 'require-me'" if project_options[:require_me] %>
4
+ require 'rspec'
5
+ require 'rspec/autorun'
6
+ require '<%= app_name %>'
7
+
8
+ RSpec.configure do |config|
9
+ config.mock_with :<%= project_options[:mock_lib] %>
10
+ end
11
+
@@ -0,0 +1,11 @@
1
+ require 'test/unit'
2
+
3
+ class <%= app_name.camelize %>Test < Test::Unit::TestCase
4
+ def setup
5
+ @basic = <%= app_name.camelize %>::Basic.new
6
+ end
7
+
8
+ def test_magic
9
+ assert @basic, "No basic"
10
+ end
11
+ end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubyapp
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Kristian Mandrup
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-06-06 00:00:00 -04:00
18
+ default_executable: rubyapp
19
+ dependencies: []
20
+
21
+ description: Create a fully configured ruby project with a set of common frameworks to choose from
22
+ email: kmandrup@gmail.com
23
+ executables:
24
+ - rubyapp
25
+ extensions: []
26
+
27
+ extra_rdoc_files:
28
+ - README.markdown
29
+ files:
30
+ - .gitignore
31
+ - README.markdown
32
+ - Rakefile
33
+ - VERSION
34
+ - bin/rubyapp
35
+ - lib/application.thor
36
+ - lib/ruby_app.rb
37
+ - templates/Gemfile
38
+ - templates/MITLICENSE
39
+ - templates/README.markdown
40
+ - templates/_signatures/APP.RUBY.signature
41
+ - templates/autotest.options
42
+ - templates/autotest/discover.rb
43
+ - templates/bin/binary
44
+ - templates/bin/binary.bat
45
+ - templates/config/cucumber.yml
46
+ - templates/cucumber.yml
47
+ - templates/features/app_name.feature.erb
48
+ - templates/features/step_definitions/app_name_steps.erb
49
+ - templates/features/support/env.rb.erb
50
+ - templates/gitignore
51
+ - templates/lib/app_entrypoint.erb
52
+ - templates/lib/app_name.rb.erb
53
+ - templates/shoulda/test_app_name.rb.erb
54
+ - templates/spec/app_name/sample_spec.rb.erb
55
+ - templates/spec/rspec.options
56
+ - templates/spec/spec_helper.rb.erb
57
+ - templates/test/test_app_name.rb.erb
58
+ has_rdoc: true
59
+ homepage: http://github.com/kristianmandrup/rubyapp
60
+ licenses: []
61
+
62
+ post_install_message:
63
+ rdoc_options:
64
+ - --charset=UTF-8
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
+ segments:
73
+ - 0
74
+ version: "0"
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ segments:
81
+ - 0
82
+ version: "0"
83
+ requirements: []
84
+
85
+ rubyforge_project:
86
+ rubygems_version: 1.3.7
87
+ signing_key:
88
+ specification_version: 3
89
+ summary: Create a fully configured ruby project
90
+ test_files: []
91
+