noe 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,15 +1,36 @@
1
+ # Installs a rake task for for running examples written using rspec.
1
2
  #
2
- # Install a rake task for running examples written using rspec.
3
+ # This file installs the 'rake spec_test' (aliased as 'rake spec') as well as
4
+ # extends 'rake test' to run spec tests, if any. It is automatically generated
5
+ # by Noe from your .noespec file, and should therefore be configured there,
6
+ # under the variables/rake_tasks/spec_test entry, as illustrated below:
3
7
  #
4
- # More information about rspec: http://relishapp.com/rspec
5
- # This file has been written to conform to RSpec v2.4.0
8
+ # variables:
9
+ # rake_tasks:
10
+ # spec_test:
11
+ # pattern: spec/**/*_spec.rb
12
+ # verbose: true
13
+ # rspec_opts: [--color, --backtrace]
14
+ # ...
15
+ #
16
+ # If you have specific needs requiring manual intervention on this file,
17
+ # don't forget to set safe-override to false in your noe specification:
18
+ #
19
+ # template-info:
20
+ # manifest:
21
+ # tasks/spec_test.rake:
22
+ # safe-override: false
23
+ #
24
+ # This file has been written to conform to RSpec v2.4.0. More information about
25
+ # rspec and options of the rake task defined below can be found on
26
+ # http://relishapp.com/rspec
6
27
  #
7
28
  begin
8
29
  require "rspec/core/rake_task"
9
30
  desc "Run RSpec code examples"
10
31
  RSpec::Core::RakeTask.new(:spec_test) do |t|
11
32
  # Glob pattern to match files.
12
- t.pattern = 'spec/**/*_spec.rb'
33
+ t.pattern = "spec/**/*_spec.rb"
13
34
 
14
35
  # By default, if there is a Gemfile, the generated command will include
15
36
  # 'bundle exec'. Set this to true to ignore the presence of a Gemfile,
@@ -17,7 +38,7 @@ begin
17
38
  t.skip_bundler = false
18
39
 
19
40
  # Name of Gemfile to use
20
- t.gemfile = 'Gemfile'
41
+ t.gemfile = "Gemfile"
21
42
 
22
43
  # Whether or not to fail Rake when an error occurs (typically when
23
44
  # examples fail).
@@ -34,22 +55,19 @@ begin
34
55
  t.rcov = false
35
56
 
36
57
  # Path to rcov.
37
- t.rcov_path = 'rcov'
58
+ t.rcov_path = "rcov"
38
59
 
39
- # Command line options to pass to rcov.
40
- # See 'rcov --help' about this
41
- t.rcov_opts = %w{}
60
+ # Command line options to pass to rcov. See 'rcov --help' about this
61
+ t.rcov_opts = []
42
62
 
43
- # Command line options to pass to ruby.
44
- # See 'ruby --help' about this
45
- t.ruby_opts = %w{}
63
+ # Command line options to pass to ruby. See 'ruby --help' about this
64
+ t.ruby_opts = []
46
65
 
47
66
  # Path to rspec
48
- t.rspec_path = 'rspec'
67
+ t.rspec_path = "rspec"
49
68
 
50
- # Command line options to pass to rspec.
51
- # See 'rspec --help' about this
52
- t.rspec_opts = %w{--color --backtrace}
69
+ # Command line options to pass to rspec. See 'rspec --help' about this
70
+ t.rspec_opts = ["--color", "--backtrace"]
53
71
  end
54
72
  rescue LoadError => ex
55
73
  task :spec_test do
@@ -1,8 +1,28 @@
1
+ # Installs a rake task for for running unit tests.
1
2
  #
2
- # Install a rake task for running examples written using rspec.
3
+ # This file installs the 'rake unit_test' and extends 'rake test' to run unit
4
+ # tests, if any. It is automatically generated by Noe from your .noespec file,
5
+ # and should therefore be configured there, under the variables/rake_tasks/unit_test
6
+ # entry, as illustrated below:
3
7
  #
4
- # More information about rspec: http://relishapp.com/rspec
5
- # This file has been written to conform to RSpec v2.4.0
8
+ # variables:
9
+ # rake_tasks:
10
+ # unit_test:
11
+ # pattern: test/test*.rb
12
+ # verbose: false
13
+ # warning: false
14
+ # ...
15
+ #
16
+ # If you have specific needs requiring manual intervention on this file,
17
+ # don't forget to set safe-override to false in your noe specification:
18
+ #
19
+ # template-info:
20
+ # manifest:
21
+ # tasks/unit_test.rake:
22
+ # safe-override: false
23
+ #
24
+ # More info about the TestTask and its options can be found on
25
+ # http://rake.rubyforge.org/classes/Rake/TestTask.html
6
26
  #
7
27
  begin
8
28
  desc "Lauches unit tests"
@@ -11,21 +31,21 @@ begin
11
31
 
12
32
  # List of directories to added to $LOAD_PATH before running the
13
33
  # tests. (default is 'lib')
14
- t.libs = %w{ lib }
34
+ t.libs = ["lib"]
15
35
 
16
36
  # True if verbose test output desired. (default is false)
17
37
  t.verbose = false
18
38
 
19
39
  # Test options passed to the test suite. An explicit TESTOPTS=opts
20
40
  # on the command line will override this. (default is NONE)
21
- t.options = []
41
+ t.options = nil
22
42
 
23
43
  # Request that the tests be run with the warning flag set.
24
44
  # E.g. warning=true implies "ruby -w" used to run the tests.
25
45
  t.warning = false
26
46
 
27
47
  # Glob pattern to match test files. (default is 'test/test*.rb')
28
- t.pattern = 'test/test*.rb'
48
+ t.pattern = "test/test*.rb"
29
49
 
30
50
  # Style of test loader to use. Options are:
31
51
  #
@@ -1,22 +1,37 @@
1
+ # Installs a rake task to generate API documentation using yard.
2
+ #
3
+ # This file installs the 'rake yard' task. It is automatically generated by Noe from
4
+ # your .noespec file, and should therefore be configured there, under the
5
+ # variables/rake_tasks/yard entry, as illustrated below:
6
+ #
7
+ # variables:
8
+ # rake_tasks:
9
+ # yard:
10
+ # files: lib/**/*.rb
11
+ # options: []
12
+ # ...
13
+ #
14
+ # If you have specific needs requiring manual intervention on this file,
15
+ # don't forget to set safe-override to false in your noe specification:
1
16
  #
2
- # Install a rake task to generate API documentation using
3
- # yard.
17
+ # template-info:
18
+ # manifest:
19
+ # tasks/yard.rake:
20
+ # safe-override: false
4
21
  #
5
- # More information about yard: http://yardoc.org/
6
- # This file has been written to conform to yard v0.6.4
22
+ # This file has been written to conform to yard v0.6.4. More information about
23
+ # yard and the rake task installed below can be found on http://yardoc.org/
7
24
  #
8
- # About project documentation
9
25
  begin
10
26
  require "yard"
11
27
  desc "Generate yard documentation"
12
28
  YARD::Rake::YardocTask.new(:yard) do |t|
13
- # Array of options passed to the commandline utility
14
- # See 'yardoc --help' about this
15
- t.options = %w{--output-dir doc/api - README.md CHANGELOG.md LICENCE.md}
29
+ # Array of options passed to yardoc commandline. See 'yardoc --help' about this
30
+ t.options = ["--output-dir", "doc/api", "-", "README.md", "CHANGELOG.md", "LICENCE.md"]
16
31
 
17
32
  # Array of ruby source files (and any extra documentation files
18
33
  # separated by '-')
19
- t.files = ['lib/**/*.rb']
34
+ t.files = ["lib/**/*.rb"]
20
35
 
21
36
  # A proc to call before running the task
22
37
  # t.before = proc{ }
@@ -1,10 +1,26 @@
1
- # 1.1.0 / FIX ME
1
+ # 1.2.0 / 2011-01-17
2
+
3
+ * A 'description' variable is introduced in .noespec and made mandatory to avoid weird results
4
+ on rubygems.org when using the whole README.md file for project description.
5
+ * A 'version' variable is introduced in .noespec and made mandatory.
6
+ * Enhanced 'rake package/gem' to be configurable from .noespec under variables/rake_tasks/gem
7
+ * Enhanced 'rake unit_test' to be configurable from .noespec under variables/rake_tasks/unit_test
8
+ * Enhanced 'rake spec_test' to be configurable from .noespec under variables/rake_tasks/unit_test
9
+ * Enhanced 'rake yard' to be configurable from .noespec under variables/rake_tasks/yard
10
+ * Added 'rake debug_mail' which is configurable from .noespec under variables/rake_tasks/debug_mail
11
+ * lib/__lower__/loader.rb only use plain requires instead of a more complex algorithm. This follows
12
+ the discussion with Luis Lavena on ruby-talk (http://bit.ly/gqukPw)
13
+ * Added a proposal dependency (wlang ~> 0.10.1) required by the debug_mail task
14
+ * Fixed tasks/unit_test.rake under 1.9.2 (raised 'no such file to load -- []' with options=[] instead
15
+ of nil)
16
+
17
+ # 1.1.0 / 2011-01-11
2
18
 
3
19
  * Added the tasks folder with well documented rake tasks
4
20
  * Added a dependency loader in __lower__/loader.rb that helps requiring gems the good way
5
21
  * Added Bundler support to easy developer's job trough Gemfile and "require 'bundle/setup'" in Rakefile
6
22
  * LICENCE.txt -> LICENCE.md
7
- * Follows a lot of changes in from Noe 1.0.0 -> 1.1.0
23
+ * Follows a lot of changes from Noe 1.0.0 -> 1.1.0
8
24
 
9
25
  # 1.0.0 / 2011-01-11
10
26
 
@@ -30,7 +30,7 @@ template-info:
30
30
  description: |
31
31
  This is a [Noe](https://github.com/blambeau/noe) template for creating a ruby gem
32
32
  library. Generated project comes with rake tasks to support the lifecycle of the
33
- library (testing, releasing, and so on). Following Noe's philosophy this template
33
+ library (testing, releasing, and so on). Following Noe philosophy this template
34
34
  also helps you understanding the ruby ecosystem by providing a fully documented
35
35
  project, rake tasks, and so on.
36
36
  authors:
@@ -95,6 +95,14 @@ template-info:
95
95
  spec/spec_helper.rb:
96
96
  description: Helper for ruby spec tests
97
97
  safe-override: true
98
+ tasks/debug_mail.rake:
99
+ description: configuration file for 'rake debug_mail'
100
+ safe-override: true
101
+ wlang-dialect: wlang/ruby
102
+ tasks/debug_mail.txt:
103
+ description: mail template used by 'rake debug_mail'
104
+ safe-override: true
105
+ wlang-dialect: wlang/dummy
98
106
  tasks/gem.rake:
99
107
  description: configuration file for 'rake package', 'rake gem' and associated tasks
100
108
  safe-override: true
@@ -125,10 +133,20 @@ variables:
125
133
  # name.
126
134
  upper:
127
135
  HelloWorld
136
+
137
+ # Version of your library
138
+ version:
139
+ 1.0.0
128
140
 
129
- # Project summary. The summary should be a short project description (5 lines)
130
- # and will be used to annotate your .gemspec file on rubygems.org.
131
- summary: A simple "Hello World" example for Noe's skeleton for Ruby projects
141
+ # Project summary (~ 1 line)
142
+ summary:
143
+ A simple "Hello World" example
144
+
145
+ # Project description (~ 5 lines). Project description should be more complete
146
+ # than the summary and will be used to describe your gem on rubygems.org
147
+ description: |-
148
+ This hello_world example provides you all you need to build a ruby gem library
149
+ while applying skeleton-driven coding with Noe (see http://revision-zero.org/noe)
132
150
 
133
151
  # Authors of the project. Each author entry is a Hash and MUST at least have
134
152
  # 'name' and 'email' keys. This is used to add meta information to your .gemspec
@@ -173,6 +191,8 @@ variables:
173
191
  # YARD and BlueCloth are required to run 'rake yard'. See tasks/yard.rake
174
192
  - {name: yard, version: "~> 0.6.4", groups: [development]}
175
193
  - {name: bluecloth, version: "~> 2.0.9", groups: [development]}
194
+ # wlang is required to run 'rake debug_mail'. See tasks/debug_mail.rake
195
+ - {name: wlang, version: "~> 0.10.1", groups: [development]}
176
196
 
177
197
  # Below are defined a certain number of specific variables for the .gemspec file
178
198
  # of your library. We'll include it here to keep .gemspec under Noe's control for
@@ -199,3 +219,89 @@ variables:
199
219
  requirements:
200
220
  # A friendly message you would like to display when the user installs your gem
201
221
  post_install_message:
222
+
223
+ # Below are defined a certain number of specific variables for each rake task.
224
+ # Have a look at tasks/*.rake for additional details on each one.
225
+ rake_tasks:
226
+ gem:
227
+ # Folder in which the packages are generated
228
+ package_dir: pkg
229
+ # Do you need a .tar package?
230
+ need_tar: false
231
+ # Do you need a .tar.gz package?
232
+ need_tar_gz: false
233
+ # Do you need a .tar.bz2 package?
234
+ need_tar_bz2: false
235
+ # Do you need a .zip package?
236
+ need_zip: false
237
+ # The shell command executed to build a .tar
238
+ tar_command: tar
239
+ # The shell command executed to build a .zip
240
+ zip_command: zip
241
+ debug_mail:
242
+ # Regular expression to detect change sections in
243
+ # the CHANGELOG file
244
+ rx_changelog_sections: '/^#/'
245
+ # Number of change sections to show in the mail
246
+ nb_changelog_sections: 1
247
+ spec_test:
248
+ # Pattern to find spec tests
249
+ pattern: spec/**/*_spec.rb
250
+ # By default, if there is a Gemfile, the generated command will include
251
+ # 'bundle exec'. Set this to true to ignore the presence of a Gemfile,
252
+ # and not add 'bundle exec' to the command.
253
+ skip_bundler: false
254
+ # Name of Gemfile to use
255
+ gemfile: Gemfile
256
+ # Whether or not to fail Rake when an error occurs (typically when
257
+ # examples fail).
258
+ fail_on_error: true
259
+ # A message to print to stderr when there are failures.
260
+ failure_message:
261
+ # Use verbose output. If this is set to true, the task will print the
262
+ # executed spec command to stdout.
263
+ verbose: true
264
+ # Use rcov for code coverage?
265
+ rcov: false
266
+ # Path to rcov.
267
+ rcov_path: rcov
268
+ # Command line options to pass to rcov. See 'rcov --help' about this
269
+ rcov_opts: []
270
+ # Command line options to pass to ruby. See 'ruby --help' about this
271
+ ruby_opts: []
272
+ # Path to rspec
273
+ rspec_path: rspec
274
+ # Command line options to pass to rspec. See 'rspec --help' about this
275
+ rspec_opts: [--color, --backtrace]
276
+ unit_test:
277
+ # Glob pattern to match test files. (default is 'test/test*.rb')
278
+ pattern: test/test*.rb
279
+ # Array of directories to added to $LOAD_PATH before running the tests.
280
+ libs: [ lib ]
281
+ # True if verbose test output desired.
282
+ verbose: false
283
+ # Test options passed to the test suite. An explicit TESTOPTS=opts
284
+ # on the command line will override this.
285
+ options:
286
+ # Request that the tests be run with the warning flag set.
287
+ # E.g. warning=true implies "ruby -w" used to run the tests.
288
+ warning: false
289
+ # Style of test loader to use. Options are:
290
+ #
291
+ # * :rake -- Rake provided test loading script (default).
292
+ # * :testrb -- Ruby provided test loading script.
293
+ # * :direct -- Load tests using command line loader.
294
+ #
295
+ loader: :rake
296
+ # Array of commandline options to pass to ruby when running test loader.
297
+ ruby_opts: []
298
+ # Explicitly define the list of test files to be included in a
299
+ # test. +list+ is expected to be an array of file names (a
300
+ # FileList is acceptable). If both +pattern+ and +test_files+ are
301
+ # used, then the list of test files is the union of the two.
302
+ test_files:
303
+ yard:
304
+ # Array of ruby source files
305
+ files: ['lib/**/*.rb']
306
+ # Array of options passed to yard commandline. See 'yardoc --help' about this
307
+ options: ['--output-dir', 'doc/api', '-', 'README.md', 'CHANGELOG.md', 'LICENCE.md']
@@ -19,10 +19,20 @@ variables:
19
19
  upper:
20
20
  HelloWorld
21
21
 
22
- # Project summary (~= 5 lines).
23
- summary: |
24
- A simple "Hello World" example for Noe's skeleton for Ruby projects
22
+ # Version of your library
23
+ version:
24
+ 1.0.0
25
+
26
+ # Project summary (~ 1 line).
27
+ summary: |-
28
+ A simple "Hello World" example
25
29
 
30
+ # Project description (~ 5 lines). Project description should be more complete
31
+ # than the summary and will be used to describe your gem on rubygems.org
32
+ description: |-
33
+ This hello_world example provides you all you need to build a ruby gem library
34
+ while applying skeleton-driven coding with Noe (see http://revision-zero.org/noe)
35
+
26
36
  # Authors of the project (- {name: Bob, email: bob@gmail.com}, ...)
27
37
  authors: []
28
38
 
@@ -30,4 +40,15 @@ variables:
30
40
  links: []
31
41
 
32
42
  # Gem dependencies. (- {name: ..., version: ..., groups: [...]}, ...)
33
- dependencies: []
43
+ dependencies:
44
+ # Rake is required for developers, as usual
45
+ - {name: rake, version: "~> 0.8.7", groups: [development]}
46
+ # Bundler is required for developers and is used by the Rakefile
47
+ - {name: bundler, version: "~> 1.0", groups: [development]}
48
+ # RSpec is required to run 'rake spec'. See tasks/spec.rake
49
+ - {name: rspec, version: "~> 2.4.0", groups: [development]}
50
+ # YARD and BlueCloth are required to run 'rake yard'. See tasks/yard.rake
51
+ - {name: yard, version: "~> 0.6.4", groups: [development]}
52
+ - {name: bluecloth, version: "~> 2.0.9", groups: [development]}
53
+ # wlang is required to run 'rake debug_mail'. See tasks/debug_mail.rake
54
+ - {name: wlang, version: "~> 0.10.1", groups: [development]}
@@ -1,9 +1,12 @@
1
1
  !{lower}.gemspec
2
+ !{lower}.noespec
2
3
  CHANGELOG.md
3
4
  Gemfile
5
+ Gemfile.lock
4
6
  bin/**/*
5
7
  lib/**/*
6
8
  LICENCE.md
9
+ Manifest.txt
7
10
  Rakefile
8
11
  README.md
9
12
  spec/**/*
@@ -1,8 +1,9 @@
1
1
  begin
2
2
  gem "bundler", "~> 1.0"
3
3
  require "bundler/setup"
4
- rescue LoadError
5
- abord "This project requires bundler, try 'gem install bundler'"
4
+ rescue LoadError => ex
5
+ puts ex.message
6
+ abort "Bundler failed to load, (did you run 'gem install bundler' ?)"
6
7
  end
7
8
 
8
9
  # Dynamically load the gem spec
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
27
27
  #
28
28
  # The description should be more detailed than the summary. For example,
29
29
  # you might wish to copy the entire README into the description.
30
- s.description = File.read(File.expand_path('../README.md', __FILE__))
30
+ s.description = +{description}
31
31
 
32
32
  # The URL of this gem home page (optional)
33
33
  s.homepage = +{links.first}
@@ -3,7 +3,7 @@
3
3
  #
4
4
  module !{upper}
5
5
 
6
- VERSION = "1.0.0".freeze
6
+ VERSION = "!{version}".freeze
7
7
 
8
8
  end # module !{upper}
9
9
  require "!{lower}/loader"
@@ -1,65 +1 @@
1
- module !{upper}
2
- #
3
- # This module provides tools to load stdlib and gem dependencies.
4
- #
5
- module Loader
6
-
7
- #
8
- # This method allows requiring dependencies with some flexibility.
9
- #
10
- # Implemented algorithm makes greedy choices about the environment:
11
- # 1. It first attempts a simple <code>Kernel.require(name)</code> before
12
- # anything else (even bypassing version requirement)
13
- # 2. If step 1 fails with a LoadError then it falls back requiring the
14
- # gem with specified version (defaults to >= 0) and retries step 1.
15
- # 3. If step 2 fails with a NameError, 'rubygems' are required and step
16
- # 2 is retried.
17
- # 4. If step 3. fails, the initial LoadError is reraised.
18
- #
19
- # Doing so ensures flexibility for the users of the library by not making
20
- # wrong assumptions about their environment. Testing the library is also
21
- # made easier, as illustrated in the examples below. Please note that this
22
- # method is useful to load external dependencies of your code only, not
23
- # .rb files of your own library.
24
- #
25
- # Examples:
26
- #
27
- # # Require something from the standard library
28
- # !{upper}::Loader.require('fileutils')
29
- #
30
- # # Require a gem without specifing any particular version
31
- # !{upper}::Loader.require('highline')
32
- #
33
- # # Require a gem, specifing a particular version
34
- # !{upper}::Loader.require('foo', "~> 1.6")
35
- #
36
- # # Twist the load path to use version of foo you've recently
37
- # # forked (bypass the version requirement)
38
- # $LOAD_PATH.unshift ... # or ruby -I...
39
- # !{upper}::Loader.require('highline', "~> 1.6")
40
- #
41
- # Learn more about this pattern:
42
- # - http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices
43
- # - https://gist.github.com/54177
44
- #
45
- def require(name, version = nil)
46
- Kernel.require name.to_s
47
- rescue LoadError
48
- begin
49
- gem name.to_s, version || ">= 0"
50
- rescue NameError
51
- if $VERBOSE
52
- Kernel.warn "#{__FILE__}:#{__LINE__}: warning: requiring rubygems myself, "\
53
- " you should use 'ruby -rubygems' instead. "\
54
- "See https://gist.github.com/54177"
55
- end
56
- require "rubygems"
57
- gem name.to_s, version || ">= 0"
58
- end
59
- Kernel.require name.to_s
60
- end
61
- module_function :require
62
-
63
- end # module Loader
64
- end # module !{upper}
65
- *{dependencies.select{|dep| dep.groups.include?('runtime')} as dep}{!{upper}::Loader.require(+{dep.name}, +{dep.version})}{!{"\n"}}
1
+ *{dependencies.select{|dep| dep.groups.include?('runtime')} as dep}{require +{dep.name}}{!{"\n"}}