geny 2.1.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 558b6cc3a2985012f76f27a23c8a1a338aef4bdf
4
- data.tar.gz: a859475b06d94fdba962beb25b0ffece71eb1119
3
+ metadata.gz: 053de574e07eefcb259a4ef3949722575c18e36b
4
+ data.tar.gz: d9bcca07beaa5a8621e9fa5dce42f4468f3fa282
5
5
  SHA512:
6
- metadata.gz: cd59935ac74a3cdb86e94e93c61e2154a5a62db930c0f699aef8ff5d9d825d2dc78da99e2a5e94cd103c410b12ac5aac9aac1ff480d2ff5ab4f2ba79b546d9dc
7
- data.tar.gz: 0c4465488a3d5920d51659e399cbed3d972179ea7d528c79e9ab92e4f3fffca154565858e78b2f99c674fbf5cd72696ecf2970b6b9ae1dc4c8a8fc803f965f19
6
+ metadata.gz: 2336a52da788edeb5716327fb3fdc180bd3f4cda6f071a278f49ca2e815d1e6d3fa9b10cf3922511265ddaceecb3c01c535c05c97ec5af60dfc32ff3d1275c6b
7
+ data.tar.gz: 6ced3852fde17514e948abdfd51d1eece62a5ad26b988ace601df0426f4bbe9b76a86ec34b987bde8302fd9d98cd2d0deb288de8b4fa2643278e2346f9aa2057
data/bin/rspec-each ADDED
@@ -0,0 +1,20 @@
1
+ #!/bin/bash
2
+ # Runs each spec file independently
3
+
4
+ for spec in $(find spec -name "*_spec.rb*"); do
5
+ echo "Running $spec..."
6
+
7
+ until bundle exec rspec "$spec"; do
8
+ echo -n -e "\n$spec failed. Retry? "
9
+ read answer
10
+
11
+ if [ "$answer" != "${answer#[Yy]}" ]; then
12
+ echo "Retrying..."
13
+ else
14
+ echo "Aborting!"
15
+ exit
16
+ fi
17
+ done
18
+
19
+ echo "Success!"
20
+ done
data/lib/geny/command.rb CHANGED
@@ -6,6 +6,9 @@ module Geny
6
6
  # The filename for a generator, relative to the root
7
7
  FILENAME = "generator.rb"
8
8
 
9
+ # Nested commands are joined with colon
10
+ SEPARATOR = ":"
11
+
9
12
  # The directory where templates are stored, relative to the root
10
13
  TEMPLATES = "templates"
11
14
 
data/lib/geny/dsl.rb CHANGED
@@ -26,7 +26,8 @@ module Geny
26
26
 
27
27
  # Define helper methods. These methods are available within
28
28
  # the {#invoke} block and all templates.
29
- def helpers(&block)
29
+ def helpers(*modules, &block)
30
+ @helpers += modules unless modules.empty?
30
31
  @helpers << Module.new(&block) if block_given?
31
32
  @helpers
32
33
  end
@@ -10,6 +10,7 @@ end
10
10
 
11
11
  helpers do
12
12
  def generator_path
13
- File.join(".geny", *name.split(":"), Geny::Command::FILENAME)
13
+ path = name.split(Geny::Command::SEPARATOR)
14
+ File.join(".geny", *path, Geny::Command::FILENAME)
14
15
  end
15
16
  end
data/lib/geny/registry.rb CHANGED
@@ -4,13 +4,17 @@ require "geny/command"
4
4
 
5
5
  module Geny
6
6
  class Registry
7
- # The default load path. By default, Geny
8
- # will search
9
- LOAD_PATH = [
10
- File.join(Dir.pwd, ".geny"),
11
- *ENV.fetch("CODE_HEN_PATH", "").split(":"),
12
- File.expand_path("../generators", __dir__)
13
- ]
7
+ # The load path for project-local generators
8
+ LOCAL_PATH = [File.join(Dir.pwd, ".geny")]
9
+
10
+ # The load path that is read from ENV vars
11
+ ENV_PATH = ENV.fetch("GENY_PATH", "").split(":")
12
+
13
+ # The load path for Geny's own generators
14
+ GENY_PATH = [File.join(__dir__, "generators")]
15
+
16
+ # The default load path. By default, Geny will search
17
+ LOAD_PATH = LOCAL_PATH + ENV_PATH + GENY_PATH
14
18
 
15
19
  # The directories to search for commands in
16
20
  # @return [Array<String>]
@@ -33,7 +37,7 @@ module Geny
33
37
  path.glob(glob).map do |file|
34
38
  root = file.dirname
35
39
  name = root.relative_path_from(path)
36
- name = name.to_s.tr(File::SEPARATOR, ":")
40
+ name = name.to_s.tr(File::SEPARATOR, Command::SEPARATOR)
37
41
  build(name, root.to_s)
38
42
  end
39
43
  end
@@ -46,7 +50,8 @@ module Geny
46
50
  # @return [Command,nil]
47
51
  def find(name)
48
52
  load_path.each do |path|
49
- file = File.join(path, *name.split(":"), Command::FILENAME)
53
+ parts = name.split(Command::SEPARATOR)
54
+ file = File.join(path, *parts, Command::FILENAME)
50
55
  root = File.dirname(file)
51
56
  return build(name, root) if File.exist?(file)
52
57
  end
data/lib/geny/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Geny
2
- VERSION = "2.1.1"
2
+ VERSION = "2.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geny
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ray Zane
@@ -140,11 +140,10 @@ files:
140
140
  - README.md
141
141
  - Rakefile
142
142
  - bin/console
143
+ - bin/rspec-each
143
144
  - bin/setup
144
145
  - exe/geny
145
146
  - geny.gemspec
146
- - lib/generators/new/generator.rb
147
- - lib/generators/new/templates/generator.rb.erb
148
147
  - lib/geny.rb
149
148
  - lib/geny/actions/files.rb
150
149
  - lib/geny/actions/find.rb
@@ -160,6 +159,8 @@ files:
160
159
  - lib/geny/context/view.rb
161
160
  - lib/geny/dsl.rb
162
161
  - lib/geny/error.rb
162
+ - lib/geny/generators/new/generator.rb
163
+ - lib/geny/generators/new/templates/generator.rb.erb
163
164
  - lib/geny/registry.rb
164
165
  - lib/geny/version.rb
165
166
  homepage: https://github.com/rzane/geny