noe 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. data/CHANGELOG.md +27 -0
  2. data/Gemfile +2 -0
  3. data/LICENCE.md +22 -0
  4. data/README.md +111 -45
  5. data/Rakefile +18 -20
  6. data/bin/noe +1 -1
  7. data/lib/noe.rb +7 -21
  8. data/lib/noe/commons.rb +23 -0
  9. data/lib/noe/config.yaml +2 -2
  10. data/lib/noe/ext/array.rb +18 -0
  11. data/lib/noe/ext/hash.rb +48 -0
  12. data/lib/noe/go.rb +158 -40
  13. data/lib/noe/install.rb +13 -7
  14. data/lib/noe/list.rb +34 -10
  15. data/lib/noe/loader.rb +67 -0
  16. data/lib/noe/main.rb +15 -15
  17. data/lib/noe/prepare.rb +121 -0
  18. data/lib/noe/show_spec.rb +45 -0
  19. data/lib/noe/template.rb +84 -4
  20. data/noe.gemspec +186 -30
  21. data/spec/ext/hash/methodize_spec.rb +30 -0
  22. data/spec/noe_spec.rb +4 -0
  23. data/spec/spec_helper.rb +0 -2
  24. data/spec/template/entry/infer_wlang_dialect_spec.rb +31 -0
  25. data/tasks/gem.rake +44 -0
  26. data/tasks/spec_test.rake +61 -0
  27. data/tasks/unit_test.rake +56 -0
  28. data/tasks/yard.rake +36 -0
  29. data/templates/ruby/CHANGELOG.md +9 -1
  30. data/templates/ruby/README.md +47 -10
  31. data/templates/ruby/noespec.yaml +195 -26
  32. data/templates/ruby/short.yaml +33 -0
  33. data/templates/ruby/src/Gemfile +2 -0
  34. data/templates/ruby/src/LICENCE.md +22 -0
  35. data/templates/ruby/src/Manifest.txt +11 -0
  36. data/templates/ruby/src/README.md +6 -1
  37. data/templates/ruby/src/Rakefile +16 -36
  38. data/templates/ruby/src/__lower__.gemspec +178 -23
  39. data/templates/ruby/src/lib/__lower__.rb +5 -2
  40. data/templates/ruby/src/lib/__lower__/loader.rb +65 -0
  41. data/templates/ruby/src/spec/spec_helper.rb +0 -2
  42. data/templates/ruby/src/tasks/gem.rake +44 -0
  43. data/templates/ruby/src/tasks/spec_test.rake +61 -0
  44. data/templates/ruby/src/tasks/unit_test.rake +56 -0
  45. data/templates/ruby/src/tasks/yard.rake +36 -0
  46. metadata +349 -79
  47. data/LICENCE.txt +0 -20
  48. data/lib/noe/create.rb +0 -77
  49. data/templates/ruby/src/LICENCE.txt +0 -20
@@ -0,0 +1,33 @@
1
+ # Noe template for ruby gem libraries (https://github.com/blambeau/noe) - short version
2
+ # Run 'noe show-spec' and 'noe help show-spec' for additional details.
3
+
4
+ # Don't remove this entry!
5
+ template-info:
6
+ name: "!{template_name}"
7
+ version: 1.1.0
8
+ links:
9
+ source: https://github.com/blambeau/noe/tree/master/templates/ruby
10
+ documentation: https://github.com/blambeau/noe/blob/master/templates/ruby/README.md
11
+
12
+ # Update to match your own configuration.
13
+ variables:
14
+ # A ruby lower case project name.
15
+ lower:
16
+ hello_world
17
+
18
+ # A ruby upper case project name.
19
+ upper:
20
+ HelloWorld
21
+
22
+ # Project summary (~= 5 lines).
23
+ summary: |
24
+ A simple "Hello World" example for Noe's skeleton for Ruby projects
25
+
26
+ # Authors of the project (- {name: Bob, email: bob@gmail.com}, ...)
27
+ authors: []
28
+
29
+ # Web links for the project (- http://..., - http://...).
30
+ links: []
31
+
32
+ # Gem dependencies. (- {name: ..., version: ..., groups: [...]}, ...)
33
+ dependencies: []
@@ -0,0 +1,2 @@
1
+ source 'http://rubygems.org'
2
+ gemspec :name => +{lower}
@@ -0,0 +1,22 @@
1
+ # The MIT Licence
2
+
3
+ Copyright (c) !{Time.now.strftime('%Y')} - *{authors as a}{!{a.name}}{, }
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,11 @@
1
+ !{lower}.gemspec
2
+ CHANGELOG.md
3
+ Gemfile
4
+ bin/**/*
5
+ lib/**/*
6
+ LICENCE.md
7
+ Rakefile
8
+ README.md
9
+ spec/**/*
10
+ tasks/**/*
11
+ test/**/*
@@ -1,3 +1,8 @@
1
1
  # !{upper}
2
2
 
3
- !{description}
3
+ !{summary}
4
+
5
+ ## Links
6
+
7
+ !{links.join("\n")}
8
+
@@ -1,42 +1,22 @@
1
- # We run tests by default
2
- task :default => :spec
3
-
4
- ### About project tests
5
1
  begin
6
- require "rspec/core/rake_task"
7
-
8
- desc "Run all examples"
9
- RSpec::Core::RakeTask.new(:spec) do |t|
10
- t.rspec_opts = %w[--color]
11
- t.verbose = false
12
- end
2
+ gem "bundler", "~> 1.0"
3
+ require "bundler/setup"
13
4
  rescue LoadError
5
+ abord "This project requires bundler, try 'gem install bundler'"
14
6
  end
15
7
 
16
- # About project documentation
17
- begin
18
- require "yard"
19
-
20
- desc "Generate yard documentation"
21
- YARD::Rake::YardocTask.new do |t|
22
- t.files = ['lib/**/*.rb']
23
- t.options = ['--output-dir', 'doc/api', '-', "README.md", "CHANGELOG.md"]
24
- end
25
- rescue LoadError
26
- end
8
+ # Dynamically load the gem spec
9
+ $gemspec_file = File.expand_path('../!{lower}.gemspec', __FILE__)
10
+ $gemspec = Kernel.eval(File.read($gemspec_file))
27
11
 
28
- # About project packaging
29
- begin
30
- require "rake/gempackagetask"
31
-
32
- # Dynamically load the gem spec
33
- spec_file = File.expand_path('../!{lower}.gemspec', __FILE__)
34
- spec = Kernel.eval(File.read(spec_file))
12
+ # We run tests by default
13
+ task :default => :test
35
14
 
36
- # Everything looks fine, add the gem task
37
- desc "Create the .gem package"
38
- Rake::GemPackageTask.new(spec) do |pkg|
39
- pkg.need_tar = true
40
- end
41
- rescue LoadError
42
- end
15
+ #
16
+ # Install all tasks found in tasks folder
17
+ #
18
+ # See .rake files there for complete documentation.
19
+ #
20
+ Dir["tasks/*.rake"].each do |taskfile|
21
+ instance_eval File.read(taskfile), taskfile
22
+ end
@@ -1,31 +1,186 @@
1
- require File.expand_path('../lib/!{lower}', __FILE__)
2
- spec = Gem::Specification.new do |s|
3
- s.name = %q{!{lower}}
4
- s.version = !{upper}::VERSION.dup
5
- s.date = Time.now.strftime('%Y-%m-%d')
1
+ # We require your library, mainly to have access to the VERSION number.
2
+ # Feel free to set $version manually.
3
+ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
4
+ require +{lower}
5
+ $version = !{upper}::VERSION.dup
6
6
 
7
- s.author = %q{!{author}}
8
- s.email = %q{!{email}}
7
+ #
8
+ # This is your Gem specification. Default values are provided so that your library
9
+ # should be correctly packaged given what you have described in the .noespec file.
10
+ #
11
+ Gem::Specification.new do |s|
12
+
13
+ ################################################################### ABOUT YOUR GEM
14
+
15
+ # Gem name (required)
16
+ s.name = +{lower}
17
+
18
+ # Gem version (required)
19
+ s.version = $version
20
+
21
+ # A short summary of this gem
22
+ #
23
+ # This is displayed in `gem list -d`.
24
+ s.summary = +{summary}
9
25
 
10
- s.description = %q{!{description}}
26
+ # A long description of this gem (required)
27
+ #
28
+ # The description should be more detailed than the summary. For example,
29
+ # you might wish to copy the entire README into the description.
30
+ s.description = File.read(File.expand_path('../README.md', __FILE__))
31
+
32
+ # The URL of this gem home page (optional)
33
+ s.homepage = +{links.first}
11
34
 
12
- s.require_paths = ["lib"]
13
- s.bindir = 'bin'
14
- s.executables = []
35
+ # Gem publication date (required but auto)
36
+ #
37
+ # Today is automatically used by default, uncomment only if
38
+ # you know what you do!
39
+ #
40
+ # s.date = Time.now.strftime('%Y-%m-%d')
41
+
42
+ # The license(s) for the library. Each license must be a short name, no
43
+ # more than 64 characters.
44
+ #
45
+ # s.licences = %w{}
15
46
 
16
- s.has_rdoc = true
17
- s.extra_rdoc_files = ["README.md", "CHANGELOG.md"]
47
+ # The rubyforge project this gem lives under (optional)
48
+ #
49
+ # s.rubyforge_project = nil
18
50
 
19
- s.files =
20
- Dir['lib/**/*'] +
21
- Dir['spec/**/*'] +
22
- %w{ !{lower}.gemspec Rakefile README.md CHANGELOG.md LICENCE.txt}
51
+ ################################################################### ABOUT THE AUTHORS
52
+
53
+ # The list of author names who wrote this gem.
54
+ #
55
+ # If you are providing multiple authors and multiple emails they should be
56
+ # in the same order.
57
+ #
58
+ s.authors = +{authors.collect{|a| a.name}}
59
+
60
+ # Contact emails for this gem
61
+ #
62
+ # If you are providing multiple authors and multiple emails they should be
63
+ # in the same order.
64
+ #
65
+ # NOTE: Somewhat strangly this attribute is always singular!
66
+ # Don't replace by s.emails = ...
67
+ s.email = +{authors.collect{|a| a.email}}
23
68
 
24
- s.add_development_dependency('rake')
25
- s.add_development_dependency('rspec', ">= 2.4.0")
26
- s.add_development_dependency('yard', ">= 0.6.4")
27
- s.add_development_dependency('bluecloth', ">= 0.6.4")
69
+ ################################################################### PATHS, FILES, BINARIES
70
+
71
+ # Paths in the gem to add to $LOAD_PATH when this gem is
72
+ # activated (required).
73
+ #
74
+ # The default 'lib' is typically sufficient.
75
+ s.require_paths = +{gemspec.require_paths}
76
+
77
+ # Files included in this gem.
78
+ #
79
+ # By default, we take all files included in the Manifest.txt file on root
80
+ # of the project. Entries of the manifest are interpreted as Dir[...]
81
+ # patterns so that lazy people may use wilcards like lib/**/*
82
+ #
83
+ here = File.dirname(__FILE__)
84
+ s.files = File.readlines(File.join(here, 'Manifest.txt')).
85
+ inject([]){|files, pattern|
86
+ files + Dir[File.join(here, pattern.strip)]
87
+ }
28
88
 
29
- s.homepage = %q{!{homepage}}
30
- end
89
+ # Test files included in this gem.
90
+ #
91
+ s.test_files = *{gemspec.test_files as t}{Dir[+{t}]}{ + }
92
+
93
+ # The path in the gem for executable scripts (optional)
94
+ #
95
+ s.bindir = +{gemspec.bindir}
96
+
97
+ # Executables included in the gem.
98
+ #
99
+ s.executables = (*{gemspec.executables as t}{Dir[+{t}]}{ + }).collect{|f| File.basename(f)}
100
+
101
+ ################################################################### REQUIREMENTS & INSTALL
102
+ # Remember the gem version requirements operators and schemes:
103
+ # = Equals version
104
+ # != Not equal to version
105
+ # > Greater than version
106
+ # < Less than version
107
+ # >= Greater than or equal to
108
+ # <= Less than or equal to
109
+ # ~> Approximately greater than
110
+ #
111
+ # Don't forget to have a look at http://lmgtfy.com/?q=Ruby+Versioning+Policies
112
+ # for setting your gem version.
113
+ #
114
+ # For your requirements to other gems, remember that
115
+ # ">= 2.2.0" (optimistic: specify minimal version)
116
+ # ">= 2.2.0", "< 3.0" (pessimistic: not greater than the next major)
117
+ # "~> 2.2" (shortcut for ">= 2.2.0", "< 3.0")
118
+ # "~> 2.2.0" (shortcut for ">= 2.2.0", "< 2.3.0")
119
+ #
120
+
121
+ #
122
+ # One call to add_dependency('gem_name', 'gem version requirement') for each
123
+ # runtime dependency. These gems will be installed with your gem.
124
+ # One call to add_development_dependency('gem_name', 'gem version requirement')
125
+ # for each development dependency. These gems are required for developers
126
+ #
127
+ *{dependencies.select{|dep| dep.groups.include?('development')} as dep}{s.add_development_dependency(+{dep.name}, +{dep.version})}{!{"\n "}}
128
+ *{dependencies.select{|dep| dep.groups.include?('runtime')} as dep}{s.add_dependency(+{dep.name}, +{dep.version})}{!{"\n "}}
129
+
130
+ # The version of ruby required by this gem
131
+ #
132
+ # Uncomment and set this if your gem requires specific ruby versions.
133
+ #
134
+ # s.required_ruby_version = ">= 0"
135
+
136
+ # The RubyGems version required by this gem
137
+ #
138
+ # s.required_rubygems_version = ">= 0"
139
+
140
+ # The platform this gem runs on. See Gem::Platform for details.
141
+ #
142
+ # s.platform = nil
31
143
 
144
+ # Extensions to build when installing the gem.
145
+ #
146
+ # Valid types of extensions are extconf.rb files, configure scripts
147
+ # and rakefiles or mkrf_conf files.
148
+ #
149
+ s.extensions = +{gemspec.extensions}
150
+
151
+ # External (to RubyGems) requirements that must be met for this gem to work.
152
+ # It’s simply information for the user.
153
+ #
154
+ s.requirements = +{gemspec.requirements}
155
+
156
+ # A message that gets displayed after the gem is installed
157
+ #
158
+ # Uncomment and set this if you want to say something to the user
159
+ # after gem installation
160
+ #
161
+ s.post_install_message = +{gemspec.post_install_message}
162
+
163
+ ################################################################### SECURITY
164
+
165
+ # The key used to sign this gem. See Gem::Security for details.
166
+ #
167
+ # s.signing_key = nil
168
+
169
+ # The certificate chain used to sign this gem. See Gem::Security for
170
+ # details.
171
+ #
172
+ # s.cert_chain = []
173
+
174
+ ################################################################### RDOC
175
+
176
+ # An ARGV style array of options to RDoc
177
+ #
178
+ # See 'rdoc --help' about this
179
+ #
180
+ s.rdoc_options = +{gemspec.rdoc_options}
181
+
182
+ # Extra files to add to RDoc such as README
183
+ #
184
+ s.extra_rdoc_files = *{gemspec.extra_rdoc_files as t}{Dir[+{t}]}{ + }
185
+
186
+ end
@@ -1,6 +1,9 @@
1
+ #
2
+ # !{summary}
3
+ #
1
4
  module !{upper}
2
5
 
3
6
  VERSION = "1.0.0".freeze
4
7
 
5
- end
6
-
8
+ end # module !{upper}
9
+ require "!{lower}/loader"
@@ -0,0 +1,65 @@
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,4 +1,2 @@
1
1
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
- require 'rubygems'
3
- require 'rspec'
4
2
  require '!{lower}'
@@ -0,0 +1,44 @@
1
+ # Install .gem project packaging
2
+ begin
3
+ require 'rubygems/package_task'
4
+ Gem::PackageTask.new($gemspec) do |t|
5
+
6
+ # Name of the package
7
+ t.name = $gemspec.name
8
+
9
+ # Version of the package
10
+ t.version = $gemspec.version
11
+
12
+ # Directory used to store the package files
13
+ t.package_dir = 'pkg'
14
+
15
+ # True if a gzipped tar file (tgz) should be produced
16
+ t.need_tar = false
17
+
18
+ # True if a gzipped tar file (tar.gz) should be produced
19
+ t.need_tar_gz = true
20
+
21
+ # True if a bzip2'd tar file (tar.bz2) should be produced
22
+ t.need_tar_bz2 = false
23
+
24
+ # True if a zip file should be produced (default is false)
25
+ t.need_zip = true
26
+
27
+ # List of files to be included in the package.
28
+ t.package_files = $gemspec.files
29
+
30
+ # Tar command for gzipped or bzip2ed archives.
31
+ t.tar_command = 'tar'
32
+
33
+ # Zip command for zipped archives.
34
+ t.zip_command = 'zip'
35
+
36
+ end
37
+ rescue LoadError
38
+ task :gem do
39
+ abort 'rubygems/package_task is not available. You should verify your rubygems installation'
40
+ end
41
+ task :package do
42
+ abort 'rubygems/package_task is not available. You should verify your rubygems installation'
43
+ end
44
+ end