ammeter 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ci.yml +70 -0
- data/.ruby-version +1 -0
- data/Gemfile +11 -33
- data/README.md +19 -1
- data/Rakefile +5 -6
- data/features/support/env.rb +1 -1
- data/features/templates/generate_example_app.rb +0 -1
- data/features/templates/my_rails_gem/Gemfile +3 -13
- data/features/templates/my_rails_gem/Rakefile +0 -1
- data/features/templates/my_railties_gem/Gemfile +3 -13
- data/features/templates/my_railties_gem/Rakefile +0 -1
- data/lib/ammeter/rspec/generator/example.rb +2 -1
- data/lib/ammeter/rspec/generator/matchers/have_correct_syntax.rb +5 -1
- data/lib/ammeter/version.rb +1 -1
- metadata +9 -8
- data/.travis.yml +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 15c215e3ca3e6612c3a575d4867460591978e772edc6b25af049887adcab428f
|
4
|
+
data.tar.gz: 94c066d9357c99d88fb78ea07ddc4a0387248bd5eafc8992d49b81a5bc5fa007
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 490b1a299c1916d6e42fb88409ba9c65e8343c6b9696dcbf686b81a08054a5a042737ee993c163f9802c0ea513735238e8deb032af72a7be35b646d138399043
|
7
|
+
data.tar.gz: 3aefd4e01fb7e0fd75caefd5ed5b4b70d531176e83221d881fb088f42f7bfc787221527b6f0cab9e7c31ece610bf7fa75d023c7fb5f10f7f7aaeb3d8cd3b070a
|
@@ -0,0 +1,70 @@
|
|
1
|
+
name: Ammeter CI
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches:
|
5
|
+
- 'main'
|
6
|
+
pull_request:
|
7
|
+
branches:
|
8
|
+
- '*'
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
name: 'Ruby: ${{ matrix.ruby }}, Rspec: ${{matrix.env.RSPEC_VERSION}}, Rails: ${{ matrix.env.RAILS_VERSION }}'
|
12
|
+
runs-on: ubuntu-20.04
|
13
|
+
strategy:
|
14
|
+
fail-fast: false
|
15
|
+
matrix:
|
16
|
+
include:
|
17
|
+
- ruby: 3.0
|
18
|
+
env:
|
19
|
+
RSPEC_VERSION: 'master'
|
20
|
+
RAILS_VERSION: '~> 6.1.0'
|
21
|
+
- ruby: 3.0
|
22
|
+
env:
|
23
|
+
RSPEC_VERSION: '~> 4.0'
|
24
|
+
RAILS_VERSION: '~> 6.1.0'
|
25
|
+
- ruby: 3.0
|
26
|
+
env:
|
27
|
+
RSPEC_VERSION: '~> 4.0'
|
28
|
+
RAILS_VERSION: '~> 6.0.0'
|
29
|
+
- ruby: 3.0
|
30
|
+
env:
|
31
|
+
RSPEC_VERSION: '~> 3.9'
|
32
|
+
RAILS_VERSION: '~> 6.0.0'
|
33
|
+
- ruby: 2.5
|
34
|
+
env:
|
35
|
+
RSPEC_VERSION: 'master'
|
36
|
+
RAILS_VERSION: '~> 6.1.0'
|
37
|
+
- ruby: 2.5
|
38
|
+
env:
|
39
|
+
RSPEC_VERSION: '~> 4.0'
|
40
|
+
RAILS_VERSION: '~> 6.1.0'
|
41
|
+
- ruby: 2.5
|
42
|
+
env:
|
43
|
+
RSPEC_VERSION: '~> 4.0'
|
44
|
+
RAILS_VERSION: '~> 6.0.0'
|
45
|
+
- ruby: 2.5
|
46
|
+
env:
|
47
|
+
RSPEC_VERSION: '~> 4.0'
|
48
|
+
RAILS_VERSION: '~> 5.2.0'
|
49
|
+
- ruby: 2.5
|
50
|
+
env:
|
51
|
+
RSPEC_VERSION: '~> 3.9'
|
52
|
+
RAILS_VERSION: '~> 6.0.0'
|
53
|
+
- ruby: 2.5
|
54
|
+
env:
|
55
|
+
RSPEC_VERSION: '~> 3.9'
|
56
|
+
RAILS_VERSION: '~> 5.2.0'
|
57
|
+
- ruby: ruby-head
|
58
|
+
env:
|
59
|
+
RSPEC_VERSION: 'master'
|
60
|
+
RAILS_VERSION: '~> 6.1.0'
|
61
|
+
env: ${{ matrix.env }}
|
62
|
+
steps:
|
63
|
+
- uses: actions/checkout@v2
|
64
|
+
- uses: ruby/setup-ruby@v1
|
65
|
+
with:
|
66
|
+
ruby-version: ${{ matrix.ruby }}
|
67
|
+
bundler-cache: true
|
68
|
+
- run: bundle install
|
69
|
+
- run: bundle exec rake ci
|
70
|
+
continue-on-error: ${{ matrix.allow_failure || false }}
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5.8
|
data/Gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
rspec_version = ENV['RSPEC_VERSION']
|
4
|
-
|
3
|
+
rspec_version = ENV['RSPEC_VERSION'] || '~> 4.0'
|
4
|
+
rails_version = ENV['RAILS_VERSION'] || '>= 5.1.0'
|
5
5
|
|
6
6
|
if rspec_version == 'master'
|
7
7
|
gem "rspec-rails", :git => 'git://github.com/rspec/rspec-rails.git'
|
@@ -13,38 +13,16 @@ if rspec_version == 'master'
|
|
13
13
|
gem "rspec-support", :git => 'git://github.com/rspec/rspec-support.git'
|
14
14
|
else
|
15
15
|
gem 'rspec-rails', rspec_version
|
16
|
-
gem 'rspec', rspec_version
|
17
16
|
end
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
gem 'jquery-rails', '~> 2.0'
|
27
|
-
gem 'haml-rails', '~> 0.4'
|
28
|
-
gem 'execjs', '~> 2.0.0'
|
29
|
-
elsif rspec_major_version == '3'
|
30
|
-
if RUBY_VERSION < '2.2.2'
|
31
|
-
gem 'rails', '< 5.0' # rails 5 is ruby >= 2.2.2
|
32
|
-
else
|
33
|
-
gem 'rails', '>= 4.0'
|
34
|
-
end
|
35
|
-
gem 'uglifier', '>= 1.3'
|
36
|
-
gem 'rake', '>= 0.10'
|
37
|
-
gem 'coffee-rails', '>= 4.0'
|
38
|
-
gem 'sass-rails', '>= 4.0'
|
39
|
-
gem 'jquery-rails', '>= 3.0'
|
40
|
-
gem 'haml-rails', '>= 0.5'
|
41
|
-
else
|
42
|
-
raise "rspec version #{rspec_version} is not supported"
|
43
|
-
end
|
44
|
-
|
45
|
-
gem "i18n", '< 0.7.0' if RUBY_VERSION < '1.9.3'
|
46
|
-
gem "rack", '<= 1.6.4' if RUBY_VERSION < '2.2.2'
|
18
|
+
gem 'rails', rails_version
|
19
|
+
gem 'uglifier'
|
20
|
+
gem 'rake'
|
21
|
+
gem 'coffee-rails'
|
22
|
+
gem 'sass-rails'
|
23
|
+
gem 'jquery-rails'
|
24
|
+
gem 'haml-rails'
|
47
25
|
|
48
|
-
# Specify your gem's dependencies in
|
26
|
+
# Specify your gem's dependencies in ammeter.gemspec
|
49
27
|
gemspec
|
50
28
|
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Ammeter [![
|
1
|
+
# Ammeter [![Ammeter CI](https://github.com/alexrothenberg/ammeter/actions/workflows/ci.yml/badge.svg)](https://github.com/alexrothenberg/ammeter/actions/workflows/ci.yml) [![Code Climate](https://codeclimate.com/github/alexrothenberg/ammeter.png)](https://codeclimate.com/github/alexrothenberg/ammeter) [![Gem Version](https://badge.fury.io/rb/ammeter.png)](http://badge.fury.io/rb/ammeter)
|
2
2
|
|
3
3
|
|
4
4
|
A gem that makes it easy to write specs for your Rails 3 Generators.
|
@@ -13,6 +13,24 @@ and we think you may find it useful too.
|
|
13
13
|
An [ammeter](http://en.wikipedia.org/wiki/Ammeter) is used to measure electrical current and
|
14
14
|
electricity can be produced by a generator.
|
15
15
|
|
16
|
+
# Installation
|
17
|
+
Add this line to your Gemfile (or gemspec):
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
gem 'ammeter'
|
21
|
+
```
|
22
|
+
|
23
|
+
And then execute:
|
24
|
+
```bash
|
25
|
+
$ bundle
|
26
|
+
```
|
27
|
+
|
28
|
+
Add:
|
29
|
+
```ruby
|
30
|
+
require 'ammeter/init'
|
31
|
+
```
|
32
|
+
To your `spec/spec_helper.rb`.
|
33
|
+
|
16
34
|
# Example
|
17
35
|
|
18
36
|
```ruby
|
data/Rakefile
CHANGED
@@ -35,20 +35,19 @@ def create_gem(gem_name)
|
|
35
35
|
sh "mkdir -p tmp/#{gem_name}/spec"
|
36
36
|
sh "cp '#{template_folder}/spec/spec_helper.rb' tmp/#{gem_name}/spec"
|
37
37
|
Dir.chdir("./tmp/#{gem_name}") do
|
38
|
-
Bundler.
|
38
|
+
Bundler.unbundled_system 'bundle install'
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
namespace :generate do
|
43
43
|
desc "generate a fresh app with rspec installed"
|
44
44
|
task :app => :ensure_bundler_11 do |t|
|
45
|
-
sh "bundle exec rails new ./tmp/example_app -m 'features/templates/generate_example_app.rb' --skip-test-unit"
|
45
|
+
sh "bundle exec rails new ./tmp/example_app -m 'features/templates/generate_example_app.rb' --skip-test-unit --skip-bootsnap --skip-spring --skip-webpack-install"
|
46
46
|
sh "cp 'features/templates/rspec.rake' ./tmp/example_app/lib/tasks"
|
47
47
|
Dir.chdir("./tmp/example_app/") do
|
48
|
-
Bundler.
|
49
|
-
Bundler.
|
50
|
-
Bundler.
|
51
|
-
Bundler.clean_system 'spring stop'
|
48
|
+
Bundler.unbundled_system 'bundle install'
|
49
|
+
Bundler.unbundled_system 'rake db:migrate'
|
50
|
+
Bundler.unbundled_system 'rails g rspec:install'
|
52
51
|
end
|
53
52
|
end
|
54
53
|
|
data/features/support/env.rb
CHANGED
@@ -42,7 +42,7 @@ def copy_to_aruba_from(gem_or_app_name)
|
|
42
42
|
if rspec_major_version == '2'
|
43
43
|
# rspec 2.x does not create rails_helper.rb so we create a symlink to avoid cluttering tests
|
44
44
|
write_symlink("tmp/#{gem_or_app_name}/spec/spec_helper.rb", gem_or_app_name, 'rails_helper.rb')
|
45
|
-
elsif rspec_major_version
|
45
|
+
elsif rspec_major_version >= '3'
|
46
46
|
write_symlink("tmp/#{gem_or_app_name}/spec/rails_helper.rb", gem_or_app_name)
|
47
47
|
end
|
48
48
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
rspec_version = ENV['RSPEC_VERSION']
|
4
|
-
|
3
|
+
rspec_version = ENV['RSPEC_VERSION'] || '~> 4.0'
|
4
|
+
rails_version = ENV['RAILS_VERSION'] || '>= 5.1.0'
|
5
5
|
|
6
6
|
if rspec_version == 'master'
|
7
7
|
gem "rspec-rails", :git => 'git://github.com/rspec/rspec-rails.git'
|
@@ -13,19 +13,9 @@ if rspec_version == 'master'
|
|
13
13
|
gem "rspec-support", :git => 'git://github.com/rspec/rspec-support.git'
|
14
14
|
else
|
15
15
|
gem 'rspec-rails', rspec_version
|
16
|
-
gem 'rspec', rspec_version
|
17
|
-
end
|
18
|
-
|
19
|
-
if rspec_major_version == '2' || RUBY_VERSION.to_f < 1.9
|
20
|
-
gem 'rails', '~> 3.2.0'
|
21
|
-
# Execjs is causing problems on 1.8.7
|
22
|
-
gem 'execjs', '~> 2.0.0'
|
23
|
-
elsif rspec_major_version == '3'
|
24
|
-
gem 'rails', '>= 4.1'
|
25
|
-
else
|
26
|
-
raise "rspec version #{rspec_version} is not supported"
|
27
16
|
end
|
28
17
|
|
18
|
+
gem 'rails', rails_version
|
29
19
|
|
30
20
|
# Specify your gem's dependencies in my_gem.gemspec
|
31
21
|
gemspec
|
@@ -1,7 +1,7 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
rspec_version = ENV['RSPEC_VERSION']
|
4
|
-
|
3
|
+
rspec_version = ENV['RSPEC_VERSION'] || '~> 4.0'
|
4
|
+
rails_version = ENV['RAILS_VERSION'] || '>= 5.1.0'
|
5
5
|
|
6
6
|
if rspec_version == 'master'
|
7
7
|
gem "rspec-rails", :git => 'git://github.com/rspec/rspec-rails.git'
|
@@ -13,19 +13,9 @@ if rspec_version == 'master'
|
|
13
13
|
gem "rspec-support", :git => 'git://github.com/rspec/rspec-support.git'
|
14
14
|
else
|
15
15
|
gem 'rspec-rails', rspec_version
|
16
|
-
gem 'rspec', rspec_version
|
17
|
-
end
|
18
|
-
|
19
|
-
if rspec_major_version == '2' || RUBY_VERSION.to_f < 1.9
|
20
|
-
gem 'railties', '~> 3.2.0'
|
21
|
-
# Execjs is causing problems on 1.8.7
|
22
|
-
#gem 'execjs', '~> 2.0.0'
|
23
|
-
elsif rspec_major_version == '3'
|
24
|
-
gem 'railties', '>= 4.1'
|
25
|
-
else
|
26
|
-
raise "rspec version #{rspec_version} is not supported"
|
27
16
|
end
|
28
17
|
|
18
|
+
gem 'railties', rails_version
|
29
19
|
|
30
20
|
# Specify your gem's dependencies in my_gem.gemspec
|
31
21
|
gemspec
|
@@ -12,7 +12,8 @@ RSpec::configure do |c|
|
|
12
12
|
c.include Ammeter::RSpec::Rails::GeneratorExampleHelpers,
|
13
13
|
:type => :generator
|
14
14
|
c.include Ammeter::RSpec::Rails::GeneratorExampleGroup,
|
15
|
-
:type => :generator
|
15
|
+
:type => :generator
|
16
|
+
c.include Ammeter::RSpec::Rails::GeneratorExampleGroup,
|
16
17
|
:file_path => lambda { |file_path, metadata|
|
17
18
|
metadata[:type].nil? && generator_path_regex =~ file_path
|
18
19
|
}
|
@@ -30,7 +30,11 @@ RSpec::Matchers.define :have_correct_syntax do
|
|
30
30
|
require 'ostruct'
|
31
31
|
|
32
32
|
begin
|
33
|
-
|
33
|
+
if Rails::VERSION::STRING < "6.0"
|
34
|
+
view = ActionView::Template::Handlers::ERB.call(OpenStruct.new(:source => code))
|
35
|
+
else
|
36
|
+
view = ActionView::Template::Handlers::ERB.call(OpenStruct.new, code)
|
37
|
+
end
|
34
38
|
eval('__crash_me__; ' + view)
|
35
39
|
rescue SyntaxError
|
36
40
|
false
|
data/lib/ammeter/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ammeter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Rothenberg
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -213,8 +213,9 @@ executables: []
|
|
213
213
|
extensions: []
|
214
214
|
extra_rdoc_files: []
|
215
215
|
files:
|
216
|
+
- ".github/workflows/ci.yml"
|
216
217
|
- ".gitignore"
|
217
|
-
- ".
|
218
|
+
- ".ruby-version"
|
218
219
|
- Gemfile
|
219
220
|
- History.md
|
220
221
|
- LICENSE.txt
|
@@ -267,7 +268,7 @@ files:
|
|
267
268
|
homepage: ''
|
268
269
|
licenses: []
|
269
270
|
metadata: {}
|
270
|
-
post_install_message:
|
271
|
+
post_install_message:
|
271
272
|
rdoc_options: []
|
272
273
|
require_paths:
|
273
274
|
- lib
|
@@ -282,9 +283,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
282
283
|
- !ruby/object:Gem::Version
|
283
284
|
version: '0'
|
284
285
|
requirements: []
|
285
|
-
rubyforge_project:
|
286
|
-
rubygems_version: 2.
|
287
|
-
signing_key:
|
286
|
+
rubyforge_project:
|
287
|
+
rubygems_version: 2.7.6.2
|
288
|
+
signing_key:
|
288
289
|
specification_version: 4
|
289
290
|
summary: Write specs for your Rails 3+ generators
|
290
291
|
test_files:
|
data/.travis.yml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
sudo: false
|
3
|
-
|
4
|
-
rvm:
|
5
|
-
- 2.3.0
|
6
|
-
- 2.2
|
7
|
-
- 2.1.2
|
8
|
-
- 2.0.0
|
9
|
-
- ruby-head
|
10
|
-
- jruby-9.1.2.0
|
11
|
-
|
12
|
-
env:
|
13
|
-
- RSPEC_VERSION=master
|
14
|
-
- RSPEC_VERSION='~> 3.0'
|
15
|
-
|
16
|
-
bundler_args: "--retry=3 --jobs=3"
|
17
|
-
|
18
|
-
script: "bundle exec rake ci --trace"
|
19
|
-
|
20
|
-
matrix:
|
21
|
-
allow_failures:
|
22
|
-
- rvm: ruby-head
|
23
|
-
- rvm: jruby-9.1.2.0
|