schlepper 0.8.1 → 0.9.0

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: c3c5f9a5358658edd6cdb6641d2cea5aa978d96a
4
- data.tar.gz: 3c86775ae64e0645c43f68fd551440fef94fa22c
3
+ metadata.gz: 590aee564323d53ed712ae142ef36c3e9b11fe29
4
+ data.tar.gz: 0a29017031beffc990469bd71b486f42a2749f27
5
5
  SHA512:
6
- metadata.gz: 4434f22f2925840349749411cb27c7cba41d7e3e2f9d0619d692a48df887f5cedb7444f78f354b3cb68dcab54fa1cf465ea5ba622cba7555c087920e5bf7d2f1
7
- data.tar.gz: ae1ff3befa3bec7d6e3f64d68e96f4b62783442c70d90037b2137a77ff68e67a73572042abd3265da9f56db5643805980ae3a780df9ef9db45bdd9aad98e5e15
6
+ metadata.gz: db6a6a3baf2d102578a78c9112b775ebabfd42534df44e8246dc2ef61f39c3c5f88f19f3e0c8249402395226187b5ce867fc4b125876a5e75224a2aaea712f0e
7
+ data.tar.gz: 1aa5208607ef35eb9be55a32015d197e5cfa2dd6e766bf03a821c59bf36e77f0fa7f4e0f7fdd0414ff13fbeddef99fe9b0a5994176e72f0f78e94e960d78cfae
data/.travis.yml CHANGED
@@ -4,7 +4,3 @@ cache: bundler
4
4
  rvm:
5
5
  - 2.3.1
6
6
  before_install: gem install bundler -v 1.12.5
7
-
8
- addons:
9
- code_climate:
10
- repo_token: 2978fbd741bd082b4ef00cae71d664d6ebdabdc82b3076179d7608dc2c9bc393
@@ -0,0 +1,22 @@
1
+ module Rspec
2
+ module Schlepper
3
+ class TaskGenerator < Rails::Generators::NamedBase
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ def onetime_script_spec
7
+ template 'onetime_script_spec.rb.erb', "#{::Schlepper::Paths::SPEC_DIR}/#{file_name}_spec.rb"
8
+ end
9
+
10
+ def task_name
11
+ file_name.sub(/\A\d+_/, '')
12
+ end
13
+
14
+ def require_task_path
15
+ task_dir = Pathname.new(::Schlepper::Paths::TASK_DIR)
16
+ spec_dir = Pathname.new(::Schlepper::Paths::SPEC_DIR)
17
+
18
+ "#{task_dir.relative_path_from spec_dir}/#{file_name}"
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,9 @@
1
+ require_relative '<%= require_task_path %>'
2
+
3
+ describe <%= task_name.classify %> do
4
+ let(:task) { described_class.new }
5
+
6
+ it 'returns true for success' do
7
+ expect(task.run).to be true
8
+ end
9
+ end
@@ -4,11 +4,19 @@ module Schlepper
4
4
 
5
5
  def onetime_script
6
6
  @now = Time.now
7
- template 'onetime_script.rb.erb', "script/schleppers/#{stringified_timestamp}_#{file_name}.rb"
7
+ template 'onetime_script.rb.erb', "#{Paths::TASK_DIR}/#{timestamped_task_name}.rb"
8
8
  end
9
9
 
10
10
  def stringified_timestamp
11
11
  @now.strftime '%Y%m%d%H%M%S'
12
12
  end
13
+
14
+ def timestamped_task_name
15
+ "#{stringified_timestamp}_#{file_name}"
16
+ end
17
+
18
+ hook_for :test_framework, as: 'schlepper:task' do |instance, test_generator|
19
+ instance.invoke test_generator, [instance.timestamped_task_name]
20
+ end
13
21
  end
14
22
  end
data/lib/schlepper.rb CHANGED
@@ -7,4 +7,5 @@ module Schlepper
7
7
  autoload :Process, 'schlepper/process'
8
8
  autoload :Task, 'schlepper/task'
9
9
  autoload :AbstractMethodHelper, 'schlepper/abstract_method_helper'
10
+ autoload :Paths, 'schlepper/paths'
10
11
  end
@@ -0,0 +1,7 @@
1
+ module Schlepper
2
+ module Paths
3
+ # These are relative to the Rails root directory.
4
+ TASK_DIR = 'script/schleppers'.freeze
5
+ SPEC_DIR = 'spec/schleppers'.freeze
6
+ end
7
+ end
@@ -62,7 +62,7 @@ module Schlepper
62
62
  end
63
63
 
64
64
  private def load_tasks_that_need_run
65
- Dir.glob("#{Rails.root}/script/schleppers/*.rb").
65
+ Dir.glob("#{Rails.root}/#{Paths::TASK_DIR}/*.rb").
66
66
  map { |f| File.basename(f) }.
67
67
  reject { |f| f.scan(/\A(\d{10,})/).empty? }.
68
68
  reject { |f| @versions.has_key?(f.scan(/\A(\d{10,})/).first.first) }.
@@ -1,3 +1,3 @@
1
1
  module Schlepper
2
- VERSION = '0.8.1'
2
+ VERSION = '0.9.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schlepper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rory O'Connell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-02 00:00:00.000000000 Z
11
+ date: 2017-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -137,11 +137,14 @@ files:
137
137
  - Rakefile
138
138
  - bin/console
139
139
  - bin/setup
140
+ - lib/generators/rspec/schlepper/task_generator.rb
141
+ - lib/generators/rspec/schlepper/templates/onetime_script_spec.rb.erb
140
142
  - lib/generators/schlepper/USAGE
141
143
  - lib/generators/schlepper/task_generator.rb
142
144
  - lib/generators/schlepper/templates/onetime_script.rb.erb
143
145
  - lib/schlepper.rb
144
146
  - lib/schlepper/abstract_method_helper.rb
147
+ - lib/schlepper/paths.rb
145
148
  - lib/schlepper/process.rb
146
149
  - lib/schlepper/railtie.rb
147
150
  - lib/schlepper/task.rb