spring-commands-any 1.0.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.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/.rspec +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +40 -0
- data/Rakefile +2 -0
- data/lib/spring-commands-any.rb +3 -0
- data/lib/spring/commands/any.rb +34 -0
- data/lib/spring/commands/any/version.rb +7 -0
- data/spec/spec_helper.rb +105 -0
- data/spec/spring/commands/any_spec.rb +72 -0
- data/spring-commands-any.gemspec +27 -0
- metadata +128 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 044e5776b04f53c6e5895d6aabfacc59b82428f0
|
4
|
+
data.tar.gz: 70565d399d298ddcaf5845631d6876dc2400cdf9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d523de69565dbd8c55c088f44401e3abe4ea49ad00573a5ce51a9c752e47565d76dc4137384a2194d31edc1d6af9f24bc3012a82eaecf9000bb48a2e37ebb9d9
|
7
|
+
data.tar.gz: 706375b5352e8805e31f9bf1864fa78e271f6e502dcd65c3a02f72f04d2afe48792f171555abb9b9a082635c5db9f17525ccfc37307d022601d83834a6d0d4f3
|
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
vendor
|
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Takehiko Shinkura
|
2
|
+
|
3
|
+
MIT License
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# spring-commands-any
|
2
|
+
|
3
|
+
This gem implements any of your own commands for [Spring](https://github.com/rails/spring).
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
``` ruby
|
10
|
+
gem 'spring-commands-any', group: :development
|
11
|
+
```
|
12
|
+
|
13
|
+
Insert a code to your command:
|
14
|
+
|
15
|
+
bundle exec spring binstub your-command
|
16
|
+
|
17
|
+
And then modify it not to use Spring when you run your command with `bundle exec`:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
begin
|
21
|
+
# load File.expand_path("../spring", __FILE__)
|
22
|
+
load File.expand_path("../spring", __FILE__) unless defined? Bundler
|
23
|
+
rescue LoadError
|
24
|
+
end
|
25
|
+
```
|
26
|
+
Run `spring stop` and run your command:
|
27
|
+
|
28
|
+
./bin/your-command args
|
29
|
+
|
30
|
+
Also you can pass `-e` or `--environment=` to specify environment:
|
31
|
+
|
32
|
+
./bin/your-command args -e test
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
1. Fork it ( https://github.com/[my-github-username]/spring-commands-any/fork )
|
37
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
38
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
39
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
40
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require "spring/commands/any/version"
|
2
|
+
require "spring/commands"
|
3
|
+
|
4
|
+
module Spring
|
5
|
+
module Commands
|
6
|
+
class Any
|
7
|
+
|
8
|
+
def self.commands
|
9
|
+
# Installed spring-commands-Gems, except this gem
|
10
|
+
spring_commands = Gem::Specification
|
11
|
+
.map(&:name)
|
12
|
+
.grep(/^spring-commands-/)
|
13
|
+
.map {|name| name.sub "spring-commands-", "" }
|
14
|
+
.reject {|name| name == "any" }
|
15
|
+
|
16
|
+
# built in commands
|
17
|
+
binstubs = ["rails", "rake", "spring", "bundle"] + spring_commands
|
18
|
+
|
19
|
+
Pathname.glob(Spring.application_root_path.join("{bin,script}/*"))
|
20
|
+
.map {|path| path.basename.to_s}
|
21
|
+
.reject {|binstub| binstub.end_with? *binstubs }
|
22
|
+
end
|
23
|
+
|
24
|
+
def env(args)
|
25
|
+
RailsRunner.new.env(args)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
Any.commands.each do |command|
|
31
|
+
Spring.register_command command, Any.new
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
4
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
5
|
+
#
|
6
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
7
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
8
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
9
|
+
# individual file that may not need all of that loaded. Instead, make a
|
10
|
+
# separate helper file that requires this one and then use it only in the specs
|
11
|
+
# that actually need it.
|
12
|
+
#
|
13
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
14
|
+
# users commonly want.
|
15
|
+
#
|
16
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
17
|
+
require "tmpdir"
|
18
|
+
require "fileutils"
|
19
|
+
require "spring/configuration"
|
20
|
+
|
21
|
+
path = Pathname.new(Dir.tmpdir + "/spring-commands-any")
|
22
|
+
FileUtils.rm_rf path
|
23
|
+
FileUtils.mkdir_p path
|
24
|
+
|
25
|
+
Spring.application_root = path
|
26
|
+
FileUtils.mkdir "#{path}/config"
|
27
|
+
FileUtils.touch "#{path}/config/application.rb"
|
28
|
+
|
29
|
+
require "spring/commands/any"
|
30
|
+
|
31
|
+
RSpec.configure do |config|
|
32
|
+
|
33
|
+
config.before do
|
34
|
+
FileUtils.mkdir ["#{path}/bin", "#{path}/script"]
|
35
|
+
end
|
36
|
+
|
37
|
+
config.after(:suite) do
|
38
|
+
FileUtils.rm_rf path
|
39
|
+
end
|
40
|
+
|
41
|
+
config.after do
|
42
|
+
FileUtils.rm_rf ["#{path}/bin", "#{path}/script"]
|
43
|
+
end
|
44
|
+
|
45
|
+
# The settings below are suggested to provide a good initial experience
|
46
|
+
# with RSpec, but feel free to customize to your heart's content.
|
47
|
+
=begin
|
48
|
+
# These two settings work together to allow you to limit a spec run
|
49
|
+
# to individual examples or groups you care about by tagging them with
|
50
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
51
|
+
# get run.
|
52
|
+
config.filter_run :focus
|
53
|
+
config.run_all_when_everything_filtered = true
|
54
|
+
|
55
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
56
|
+
# file, and it's useful to allow more verbose output when running an
|
57
|
+
# individual spec file.
|
58
|
+
if config.files_to_run.one?
|
59
|
+
# Use the documentation formatter for detailed output,
|
60
|
+
# unless a formatter has already been configured
|
61
|
+
# (e.g. via a command-line flag).
|
62
|
+
config.default_formatter = 'doc'
|
63
|
+
end
|
64
|
+
|
65
|
+
# Print the 10 slowest examples and example groups at the
|
66
|
+
# end of the spec run, to help surface which specs are running
|
67
|
+
# particularly slow.
|
68
|
+
config.profile_examples = 10
|
69
|
+
|
70
|
+
# Run specs in random order to surface order dependencies. If you find an
|
71
|
+
# order dependency and want to debug it, you can fix the order by providing
|
72
|
+
# the seed, which is printed after each run.
|
73
|
+
# --seed 1234
|
74
|
+
config.order = :random
|
75
|
+
|
76
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
77
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
78
|
+
# test failures related to randomization by passing the same `--seed` value
|
79
|
+
# as the one that triggered the failure.
|
80
|
+
Kernel.srand config.seed
|
81
|
+
|
82
|
+
# rspec-expectations config goes here. You can use an alternate
|
83
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
84
|
+
# assertions if you prefer.
|
85
|
+
config.expect_with :rspec do |expectations|
|
86
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
87
|
+
# For more details, see:
|
88
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
89
|
+
expectations.syntax = :expect
|
90
|
+
end
|
91
|
+
|
92
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
93
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
94
|
+
config.mock_with :rspec do |mocks|
|
95
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
96
|
+
# For more details, see:
|
97
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
98
|
+
mocks.syntax = :expect
|
99
|
+
|
100
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
101
|
+
# a real object. This is generally recommended.
|
102
|
+
mocks.verify_partial_doubles = true
|
103
|
+
end
|
104
|
+
=end
|
105
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Spring
|
4
|
+
module Commands
|
5
|
+
describe Any do
|
6
|
+
|
7
|
+
def make_file(name, bin_dir = "bin")
|
8
|
+
FileUtils.touch "#{Spring.application_root_path}/#{bin_dir}/#{name}"
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:command) { "test-command" }
|
12
|
+
|
13
|
+
describe '.commands' do
|
14
|
+
let(:commands) { Any.commands }
|
15
|
+
|
16
|
+
context 'command exists in bin/' do
|
17
|
+
it "returns the command" do
|
18
|
+
make_file command
|
19
|
+
|
20
|
+
expect(commands).to include command
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'command exists in script/' do
|
25
|
+
it "returns the command" do
|
26
|
+
make_file command, "script"
|
27
|
+
|
28
|
+
expect(commands).to include command
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
it "doesn't return spring-commands-any itself" do
|
33
|
+
expect(commands).not_to include "any"
|
34
|
+
end
|
35
|
+
|
36
|
+
it "doesn't return built in commands" do
|
37
|
+
binstubs = ["rails", "rake", "spring", "bundle"]
|
38
|
+
binstubs.each {|binstub| make_file binstub }
|
39
|
+
|
40
|
+
expect(commands).not_to include *binstubs
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'spring-commands-rspec in Gemfile' do
|
44
|
+
it { expect(commands).not_to include "rspec" }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '#env' do
|
49
|
+
context 'args == -e production' do
|
50
|
+
let(:args) { ["-e", "production"] }
|
51
|
+
|
52
|
+
it { expect(Any.new.env(args)).to eq "production" }
|
53
|
+
end
|
54
|
+
|
55
|
+
context 'args == --environment=production' do
|
56
|
+
let(:args) { ["--environment=production"] }
|
57
|
+
|
58
|
+
it { expect(Any.new.env(args)).to eq "production" }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context 'Gem is loaded' do
|
63
|
+
it 'register commands' do
|
64
|
+
make_file command
|
65
|
+
load "spring/commands/any.rb"
|
66
|
+
|
67
|
+
expect(Spring.command?(command)).to eq true
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'spring/commands/any/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "spring-commands-any"
|
8
|
+
spec.version = Spring::Commands::Any::VERSION
|
9
|
+
spec.authors = ["Takehiko Shinkura"]
|
10
|
+
spec.email = ["tynmarket@gmail.com"]
|
11
|
+
spec.summary = %q{Any of your commands for spring}
|
12
|
+
spec.description = %q{Any of your commands for spring}
|
13
|
+
spec.homepage = "https://github.com/tyn-iMarket/spring-commands-any"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "spring", ">= 0.9.1"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.0.0"
|
26
|
+
spec.add_development_dependency "spring-commands-rspec"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spring-commands-any
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Takehiko Shinkura
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: spring
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.9.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.9.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.0.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.0.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: spring-commands-rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Any of your commands for spring
|
84
|
+
email:
|
85
|
+
- tynmarket@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE.txt
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- lib/spring-commands-any.rb
|
97
|
+
- lib/spring/commands/any.rb
|
98
|
+
- lib/spring/commands/any/version.rb
|
99
|
+
- spec/spec_helper.rb
|
100
|
+
- spec/spring/commands/any_spec.rb
|
101
|
+
- spring-commands-any.gemspec
|
102
|
+
homepage: https://github.com/tyn-iMarket/spring-commands-any
|
103
|
+
licenses:
|
104
|
+
- MIT
|
105
|
+
metadata: {}
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
require_paths:
|
109
|
+
- lib
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
requirements: []
|
121
|
+
rubyforge_project:
|
122
|
+
rubygems_version: 2.2.2
|
123
|
+
signing_key:
|
124
|
+
specification_version: 4
|
125
|
+
summary: Any of your commands for spring
|
126
|
+
test_files:
|
127
|
+
- spec/spec_helper.rb
|
128
|
+
- spec/spring/commands/any_spec.rb
|