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,4 +1,39 @@
1
- # 1.1.0 / FIX ME
1
+ # 1.2.0 / 2011-01-17
2
+
3
+ * Broken things
4
+
5
+ * Arrays are not union-merged anymore during YAML merging between .noespec and template's noespec.yaml.
6
+ This may introduce small problems on existing projects that use the default ruby skeleton while
7
+ specifying additional dependencies. Users have to copy default dependencies in their own .noespec
8
+ file.
9
+ * Noe does not contain its loader anymore. As a side effect, it does not require rubygems anymore
10
+ and 'noe' binary relies on the gem installer to meet its dependencies.
11
+
12
+ * Minor enhancements
13
+
14
+ * Fixed 'noe --backtrace go', which didn't print the ruby backtrace.
15
+
16
+ * Bug fixes
17
+
18
+ * A nil value on right of YAML merging (.noespec) correctly overrides the value specified on left
19
+ (typically template's noespec.yaml)
20
+
21
+ * Default ruby skeleton
22
+
23
+ * A 'description' variable is introduced in .noespec and made mandatory to avoid weird results
24
+ on rubygems.org when using the whole README.md file for project description.
25
+ * Enhanced 'rake package/gem' to be configurable from .noespec under variables/rake_tasks/gem
26
+ * Enhanced 'rake unit_test' to be configurable from .noespec under variables/rake_tasks/unit_test
27
+ * Enhanced 'rake spec_test' to be configurable from .noespec under variables/rake_tasks/unit_test
28
+ * Enhanced 'rake yard' to be configurable from .noespec under variables/rake_tasks/yard
29
+ * Added 'rake debug_mail' which is configurable from .noespec under variables/rake_tasks/debug_mail
30
+ * lib/__lower__/loader.rb only use plain requires instead of a more complex algorithm. This follows
31
+ the discussion with Luis Lavena on ruby-talk (http://bit.ly/gqukPw)
32
+ * Added a proposal dependency (wlang ~> 0.10.1) required by the debug_mail task
33
+ * Fixed tasks/unit_test.rake under 1.9.2 (raised 'no such file to load -- []' with options=[] instead
34
+ of nil)
35
+
36
+ # 1.1.0 / 2011-01-14
2
37
 
3
38
  * Template specification/instantiation enhancements
4
39
 
@@ -0,0 +1,40 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ noe (1.2.0)
5
+ highline (~> 1.6.0)
6
+ quickl (~> 0.2.0)
7
+ wlang (~> 0.10.1)
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ bluecloth (2.0.9)
13
+ diff-lcs (1.1.2)
14
+ highline (1.6.1)
15
+ quickl (0.2.0)
16
+ rake (0.8.7)
17
+ rspec (2.4.0)
18
+ rspec-core (~> 2.4.0)
19
+ rspec-expectations (~> 2.4.0)
20
+ rspec-mocks (~> 2.4.0)
21
+ rspec-core (2.4.0)
22
+ rspec-expectations (2.4.0)
23
+ diff-lcs (~> 1.1.2)
24
+ rspec-mocks (2.4.0)
25
+ wlang (0.10.1)
26
+ yard (0.6.4)
27
+
28
+ PLATFORMS
29
+ ruby
30
+
31
+ DEPENDENCIES
32
+ bluecloth (~> 2.0.9)
33
+ bundler (~> 1.0)
34
+ highline (~> 1.6.0)
35
+ noe!
36
+ quickl (~> 0.2.0)
37
+ rake (~> 0.8.7)
38
+ rspec (~> 2.4.0)
39
+ wlang (~> 0.10.1)
40
+ yard (~> 0.6.4)
@@ -0,0 +1,15 @@
1
+ bin/**/*
2
+ CHANGELOG.md
3
+ Gemfile
4
+ Gemfile.lock
5
+ lib/**/*
6
+ LICENCE.md
7
+ Manifest.txt
8
+ noe.gemspec
9
+ noe.noespec
10
+ Rakefile
11
+ README.md
12
+ spec/**/*
13
+ tasks/**/*
14
+ test/**/*
15
+ templates/**/*
data/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  # Noe - A simple and extensible project generator
2
2
 
3
- Noe is a tool that generates projects from predefined skeletons (aka project/application
4
- templates). Skeletons are designed for building specific products (a ruby library, a static
5
- or dynamic web site, ...). Noe instantiates them and helps you maintaining your product
6
- via meta-information provided by a .noespec yaml file.
3
+ Noe is a tool that generates project skeletons from predefined templates. A template is designed
4
+ for a specific product (a ruby library, a static or dynamic web site, ...). Noe instantiates
5
+ templates and helps you maintaining your product via meta-information provided by a .noespec yaml
6
+ file. In contrast to other tools, Noe is not specific to certain kinds of products. Writing your
7
+ own template is possible and even simple!
7
8
 
8
- Noe comes bundled with a skeleton for creating and maintaining a ruby gem. This skeleton
9
- is written and maintained to follow ruby best practices and may also be tuned for your own
10
- needs. Read more about it and related projects as well as the underlying philosophy in the
11
- sections below.
9
+ Noe comes bundled with a skeleton for creating and maintaining a ruby gem. This skeleton is written
10
+ and maintained to follow ruby best practices and may also be tuned for your own needs. Read more
11
+ about it and related projects as well as the underlying philosophy in the sections below.
12
12
 
13
13
  ## Getting started
14
14
 
@@ -31,7 +31,8 @@ instantiate a ruby project simply execute the following commands in turn:
31
31
  noe go
32
32
 
33
33
  That's it! But also have a look at 'noe help prepare' and 'not help go' for additional
34
- options.
34
+ options. Also have a look at [http://revision-zero.org/noe](http://revision-zero.org/noe)
35
+ for a blog post about basic usage.
35
36
 
36
37
  ## Philosophy
37
38
 
data/Rakefile CHANGED
@@ -1,8 +1,9 @@
1
1
  begin
2
2
  gem "bundler", "~> 1.0"
3
3
  require "bundler/setup"
4
- rescue LoadError
5
- abort "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
data/lib/noe.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Noe
2
2
 
3
3
  # Noe's version
4
- VERSION = "1.1.0".freeze
4
+ VERSION = "1.2.0".freeze
5
5
 
6
6
  class Error < StandardError; end
7
7
 
@@ -11,8 +11,4 @@ class Array
11
11
  end
12
12
  end
13
13
 
14
- def noe_merge(right)
15
- (self + right).uniq
16
- end
17
-
18
14
  end # class Array
@@ -18,7 +18,7 @@ class Hash
18
18
  # Makes a fully recursive merge
19
19
  def noe_merge(right)
20
20
  self.merge(right) do |key,oldval,newval|
21
- if oldval.nil?
21
+ if oldval.nil? or newval.nil?
22
22
  newval
23
23
  elsif oldval.class != newval.class
24
24
  raise Noe::Error, "Conflict on #{key} has to be resolved manually, sorry.\n"\
@@ -1,67 +1,3 @@
1
- module Noe
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
- # Noe::Loader.require('fileutils')
29
- #
30
- # # Require a gem without specifing any particular version
31
- # Noe::Loader.require('highline')
32
- #
33
- # # Require a gem, specifing a particular version
34
- # Noe::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
- # Noe::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 Noe
65
- Noe::Loader.require("wlang", "~> 0.10.0")
66
- Noe::Loader.require("quickl", "~> 0.2.0")
67
- Noe::Loader.require("highline", "~> 1.6.0")
1
+ require "wlang"
2
+ require "quickl"
3
+ require "highline"
@@ -64,6 +64,7 @@ module Noe
64
64
  puts "#{ex.class}: #{ex.message}"
65
65
  back = ex.wlang_backtrace || ex.backtrace
66
66
  puts back.join("\n")
67
+ puts ex.backtrace.join("\n") if @backtrace
67
68
  rescue Quickl::Error => ex
68
69
  raise
69
70
  rescue Noe::Error => ex
@@ -21,13 +21,13 @@ Gem::Specification.new do |s|
21
21
  # A short summary of this gem
22
22
  #
23
23
  # This is displayed in `gem list -d`.
24
- s.summary = "Noe is a tool that generates projects from predefined skeletons (aka project/application templates). Skeletons are designed for building specific products (a ruby library, a static or dynamic web site, ...). Noe instantiates them and helps you maintaining your product via meta-information provided by a .noespec yaml file."
24
+ s.summary = "Noe is a simple, general-purpose and extensible skeleton generator from project templates"
25
25
 
26
26
  # A long description of this gem (required)
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 = "Noe is a tool that generates project skeletons from predefined templates. A template is designed for a specific product (a ruby library, a static or dynamic web site, ...). Noe instantiates templates and helps you maintaining your product via meta-information provided by a .noespec yaml file. In contrast to other tools, Noe is not specific to certain kinds of products. Writing your own template is possible and even simple!"
31
31
 
32
32
  # The URL of this gem home page (optional)
33
33
  s.homepage = "http://github.com/blambeau/noe"
@@ -129,7 +129,8 @@ Gem::Specification.new do |s|
129
129
  s.add_development_dependency("rspec", "~> 2.4.0")
130
130
  s.add_development_dependency("yard", "~> 0.6.4")
131
131
  s.add_development_dependency("bluecloth", "~> 2.0.9")
132
- s.add_dependency("wlang", "~> 0.10.0")
132
+ s.add_development_dependency("wlang", "~> 0.10.1")
133
+ s.add_dependency("wlang", "~> 0.10.1")
133
134
  s.add_dependency("quickl", "~> 0.2.0")
134
135
  s.add_dependency("highline", "~> 1.6.0")
135
136
 
@@ -0,0 +1,44 @@
1
+ template-info:
2
+ name: ruby
3
+ version: 1.2.0
4
+ author: Bernard Lambeau <blambeau@gmail.com>
5
+ variables:
6
+ lower: noe
7
+ upper: Noe
8
+ version: 1.2.0
9
+ summary:
10
+ Noe is a simple, general-purpose and extensible skeleton generator from project templates
11
+ description:
12
+ Noe is a tool that generates project skeletons from predefined templates. A template is designed
13
+ for a specific product (a ruby library, a static or dynamic web site, ...). Noe instantiates
14
+ templates and helps you maintaining your product via meta-information provided by a .noespec yaml
15
+ file. In contrast to other tools, Noe is not specific to certain kinds of products. Writing your
16
+ own template is possible and even simple!
17
+ authors:
18
+ - {name: Bernard Lambeau, email: blambeau@gmail.com}
19
+ links:
20
+ - http://github.com/blambeau/noe
21
+ - http://rubygems.org/gems/noe
22
+ - http://revision-zero.org/noe
23
+ dependencies:
24
+ - {name: rake, version: "~> 0.8.7", groups: [development]}
25
+ - {name: bundler, version: "~> 1.0", groups: [development]}
26
+ - {name: rspec, version: "~> 2.4.0", groups: [development]}
27
+ - {name: yard, version: "~> 0.6.4", groups: [development]}
28
+ - {name: bluecloth, version: "~> 2.0.9", groups: [development]}
29
+ #
30
+ - {name: wlang, version: "~> 0.10.1", groups: [development, runtime]}
31
+ - {name: quickl, version: "~> 0.2.0", groups: [runtime]}
32
+ - {name: highline, version: "~> 1.6.0", groups: [runtime]}
33
+ gemspec:
34
+ post_install_message: |
35
+ Noe successfully installed!
36
+
37
+ What's next?
38
+ - 'noe help install' for configuration and default templates
39
+ - 'noe prepare --template=ruby hello_world'
40
+
41
+ Thank you for using Noe, enjoy!
42
+ rake_tasks:
43
+ debug_mail:
44
+ nb_changelog_sections: 2
@@ -0,0 +1,77 @@
1
+ # Installs a rake task for debuging the announcement mail.
2
+ #
3
+ # This file installs the 'rake debug_mail' that flushes an announcement mail
4
+ # for your library on the standard output. It is automatically generated
5
+ # by Noe from your .noespec file, and should therefore be configured there,
6
+ # under the variables/rake_tasks/debug_mail entry, as illustrated below:
7
+ #
8
+ # variables:
9
+ # rake_tasks:
10
+ # debug_mail:
11
+ # rx_changelog_sections: /^#/
12
+ # nb_changelog_sections: 1
13
+ # ...
14
+ #
15
+ # If you have specific needs requiring manual intervention on this file,
16
+ # don't forget to set safe-override to false in your noe specification:
17
+ #
18
+ # template-info:
19
+ # manifest:
20
+ # tasks/debug_mail.rake:
21
+ # safe-override: false
22
+ #
23
+ # The mail template used can be found in debug_mail.txt. That file may be
24
+ # changed to tune the mail you want to send. If you do so, don't forget to
25
+ # add a manifest entry in your .noespec file to avoid overriding you
26
+ # changes. The mail template uses wlang, with parentheses for block
27
+ # delimiters.
28
+ #
29
+ # template-info:
30
+ # manifest:
31
+ # tasks/debug_mail.txt:
32
+ # safe-override: false
33
+ #
34
+ begin
35
+ require 'wlang'
36
+ require 'yaml'
37
+
38
+ task :debug_mail do
39
+ # Check that a .noespec file exists
40
+ noespec_file = File.expand_path('../../noe.noespec', __FILE__)
41
+ unless File.exists?(noespec_file)
42
+ raise "Unable to find .noespec project file, sorry."
43
+ end
44
+
45
+ # Load it as well as variables and options
46
+ noespec = YAML::load(File.read(noespec_file))
47
+ vars = noespec['variables'] || {}
48
+
49
+ # Changes are taken from CHANGELOG
50
+ logs = Dir[File.expand_path("../../CHANGELOG.*", __FILE__)]
51
+ unless logs.size == 1
52
+ abort "Unable to find a changelog file"
53
+ end
54
+
55
+ # Load interesting changesets
56
+ changes, end_found = [], 0
57
+ File.readlines(logs.first).select{|line|
58
+ if line =~ /^#/
59
+ break if end_found >= 2
60
+ end_found += 1
61
+ end
62
+ changes << line
63
+ }
64
+ vars['changes'] = changes.join
65
+
66
+ # WLang template
67
+ template = File.expand_path('../debug_mail.txt', __FILE__)
68
+
69
+ # Let's go!
70
+ $stdout << WLang::file_instantiate(template, vars, "wlang/active-text")
71
+ end
72
+
73
+ rescue LoadError
74
+ task :debug_mail do
75
+ abort "wlang is not available. Try 'gem install wlang'"
76
+ end
77
+ end
@@ -0,0 +1,13 @@
1
+ Subject: [ANN] !{lower} !{version} Released
2
+
3
+ !{lower} version !{version} has been released!
4
+
5
+ !{summary}
6
+
7
+ *{links as l}{* <!{l}>}{!{"\n"}}
8
+
9
+ !{description}
10
+
11
+ Changes:
12
+
13
+ !{changes}
@@ -1,4 +1,28 @@
1
- # Install .gem project packaging
1
+ # Installs rake tasks for gemming and packaging
2
+ #
3
+ # This file installs the 'rake package', 'rake gem' tasks and associates
4
+ # (clobber_package, repackage, ...). It is automatically generated by Noe
5
+ # from your .noespec file, and should therefore be configured there, under
6
+ # the variables/rake_tasks/gem entry, as illustrated below:
7
+ #
8
+ # variables:
9
+ # rake_tasks:
10
+ # gem:
11
+ # package_dir: pkg
12
+ # need_tar: false
13
+ # need_tar_gz: false
14
+ # need_tar_bz2: false
15
+ # need_zip: false
16
+ # ...
17
+ #
18
+ # If you have specific needs requiring manual intervention on this file,
19
+ # don't forget to set safe-override to false in your noe specification:
20
+ #
21
+ # template-info:
22
+ # manifest:
23
+ # tasks/gem.rake:
24
+ # safe-override: false
25
+ #
2
26
  begin
3
27
  require 'rubygems/package_task'
4
28
  Gem::PackageTask.new($gemspec) do |t|
@@ -10,28 +34,28 @@ begin
10
34
  t.version = $gemspec.version
11
35
 
12
36
  # Directory used to store the package files
13
- t.package_dir = 'pkg'
37
+ t.package_dir = "pkg"
14
38
 
15
39
  # True if a gzipped tar file (tgz) should be produced
16
40
  t.need_tar = false
17
41
 
18
42
  # True if a gzipped tar file (tar.gz) should be produced
19
- t.need_tar_gz = true
43
+ t.need_tar_gz = false
20
44
 
21
45
  # True if a bzip2'd tar file (tar.bz2) should be produced
22
46
  t.need_tar_bz2 = false
23
47
 
24
48
  # True if a zip file should be produced (default is false)
25
- t.need_zip = true
49
+ t.need_zip = false
26
50
 
27
51
  # List of files to be included in the package.
28
52
  t.package_files = $gemspec.files
29
53
 
30
54
  # Tar command for gzipped or bzip2ed archives.
31
- t.tar_command = 'tar'
55
+ t.tar_command = "tar"
32
56
 
33
57
  # Zip command for zipped archives.
34
- t.zip_command = 'zip'
58
+ t.zip_command = "zip"
35
59
 
36
60
  end
37
61
  rescue LoadError