rformat 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -1,4 +1,5 @@
1
1
  require 'optparse'
2
+ require 'pry'
2
3
  require 'rformat'
3
4
  require 'rformat/environment'
4
5
 
@@ -30,7 +31,7 @@ module RFormat
30
31
  parse_options
31
32
 
32
33
  if @command && @command !~ /^-/
33
- self.send(@command, @args)
34
+ @args.empty? ? self.send(@command) : self.send(@command, @args)
34
35
  else
35
36
  help
36
37
  end
@@ -41,7 +42,7 @@ module RFormat
41
42
  @output.puts File.read File.join(RFormat::root_dir, 'HELP.txt')
42
43
  end
43
44
 
44
- def list(args)
45
+ def list
45
46
  @output.puts "Formatters:"
46
47
  @output.puts @environment.formatters.keys.map { |f| " #{f}\n" }
47
48
  end
@@ -70,9 +71,13 @@ module RFormat
70
71
  end
71
72
 
72
73
  def parse_command
73
- command = @args.first == 'list' ? @args.shift : @args.first
74
- command = command.to_sym if command.respond_to? :to_sym
75
- @command = command == :list ? :list : :write
74
+ command = :help if @args.empty?
75
+ if @args.first && @args.first == 'list'
76
+ command = :list
77
+ @args.shift
78
+ end
79
+ command = :write if command.nil?
80
+ @command = command
76
81
  end
77
82
 
78
83
  def parse_options
data/rformat.gemspec ADDED
@@ -0,0 +1,99 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "rformat"
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Dayton Nolan"]
12
+ s.date = "2012-11-19"
13
+ s.description = "rformat will swap out the formatter contents of your ~/.rspec file so you can switch rspec formatters on the fly."
14
+ s.email = "dnolan@gmail.com"
15
+ s.executables = ["rformat"]
16
+ s.extra_rdoc_files = [
17
+ "LICENSE.txt",
18
+ "README.md"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ ".rspec",
23
+ "Gemfile",
24
+ "Gemfile.lock",
25
+ "Guardfile",
26
+ "HELP.txt",
27
+ "LICENSE.txt",
28
+ "README.md",
29
+ "Rakefile",
30
+ "VERSION",
31
+ "bin/rformat",
32
+ "lib/rformat.rb",
33
+ "lib/rformat/application.rb",
34
+ "lib/rformat/environment.rb",
35
+ "lib/rformat/formatters.yml",
36
+ "rformat.gemspec",
37
+ "spec/application_spec.rb",
38
+ "spec/environment_spec.rb",
39
+ "spec/rformat_spec.rb",
40
+ "spec/spec_helper.rb"
41
+ ]
42
+ s.homepage = "http://github.com/daytonn/rformat"
43
+ s.licenses = ["MIT"]
44
+ s.require_paths = ["lib"]
45
+ s.rubygems_version = "1.8.23"
46
+ s.summary = "rformat is a command line utility to manage rspec formatters"
47
+
48
+ if s.respond_to? :specification_version then
49
+ s.specification_version = 3
50
+
51
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
52
+ s.add_runtime_dependency(%q<fuubar>, [">= 0"])
53
+ s.add_runtime_dependency(%q<nyan-cat-formatter>, [">= 0"])
54
+ s.add_runtime_dependency(%q<rspec-formatter-webkit>, [">= 0"])
55
+ s.add_runtime_dependency(%q<rspec-nc>, [">= 0"])
56
+ s.add_runtime_dependency(%q<unicorn-formatter>, [">= 0"])
57
+ s.add_development_dependency(%q<bundler>, [">= 0"])
58
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
59
+ s.add_development_dependency(%q<rspec>, [">= 0"])
60
+ s.add_development_dependency(%q<terminal-notifier>, [">= 0"])
61
+ s.add_development_dependency(%q<guard-rspec>, [">= 0"])
62
+ s.add_development_dependency(%q<pry>, [">= 0"])
63
+ s.add_development_dependency(%q<pry-nav>, [">= 0"])
64
+ s.add_development_dependency(%q<rb-fsevent>, [">= 0"])
65
+ s.add_development_dependency(%q<terminal-notifier-guard>, [">= 0"])
66
+ else
67
+ s.add_dependency(%q<fuubar>, [">= 0"])
68
+ s.add_dependency(%q<nyan-cat-formatter>, [">= 0"])
69
+ s.add_dependency(%q<rspec-formatter-webkit>, [">= 0"])
70
+ s.add_dependency(%q<rspec-nc>, [">= 0"])
71
+ s.add_dependency(%q<unicorn-formatter>, [">= 0"])
72
+ s.add_dependency(%q<bundler>, [">= 0"])
73
+ s.add_dependency(%q<jeweler>, [">= 0"])
74
+ s.add_dependency(%q<rspec>, [">= 0"])
75
+ s.add_dependency(%q<terminal-notifier>, [">= 0"])
76
+ s.add_dependency(%q<guard-rspec>, [">= 0"])
77
+ s.add_dependency(%q<pry>, [">= 0"])
78
+ s.add_dependency(%q<pry-nav>, [">= 0"])
79
+ s.add_dependency(%q<rb-fsevent>, [">= 0"])
80
+ s.add_dependency(%q<terminal-notifier-guard>, [">= 0"])
81
+ end
82
+ else
83
+ s.add_dependency(%q<fuubar>, [">= 0"])
84
+ s.add_dependency(%q<nyan-cat-formatter>, [">= 0"])
85
+ s.add_dependency(%q<rspec-formatter-webkit>, [">= 0"])
86
+ s.add_dependency(%q<rspec-nc>, [">= 0"])
87
+ s.add_dependency(%q<unicorn-formatter>, [">= 0"])
88
+ s.add_dependency(%q<bundler>, [">= 0"])
89
+ s.add_dependency(%q<jeweler>, [">= 0"])
90
+ s.add_dependency(%q<rspec>, [">= 0"])
91
+ s.add_dependency(%q<terminal-notifier>, [">= 0"])
92
+ s.add_dependency(%q<guard-rspec>, [">= 0"])
93
+ s.add_dependency(%q<pry>, [">= 0"])
94
+ s.add_dependency(%q<pry-nav>, [">= 0"])
95
+ s.add_dependency(%q<rb-fsevent>, [">= 0"])
96
+ s.add_dependency(%q<terminal-notifier-guard>, [">= 0"])
97
+ end
98
+ end
99
+
@@ -19,7 +19,7 @@ describe RFormat::Application do
19
19
  it "outputs a list of the available formatters" do
20
20
  output.should_receive(:puts).with("Formatters:")
21
21
  output.should_receive(:puts).with(env.formatters.keys.map { |f| " #{f}\n" })
22
- app.list []
22
+ app.list
23
23
  end
24
24
 
25
25
  it "outputs the version with copyright information" do
@@ -32,9 +32,11 @@ describe RFormat::Application do
32
32
 
33
33
  it "can parse the command from an args array" do
34
34
  ARGV = ['list']
35
- expect(app.parse_command).to eq(:list)
35
+ a = RFormat::Application.new
36
+ expect(a.parse_command).to eq(:list)
36
37
  ARGV = ['nyan', 'unicorn']
37
- expect(app.parse_command).to eq(:write)
38
+ b = RFormat::Application.new
39
+ expect(b.parse_command).to eq(:write)
38
40
  end
39
41
 
40
42
  it "doesn't count subcommands as arguments" do
@@ -77,14 +79,16 @@ describe RFormat::Application do
77
79
 
78
80
  it "should run the write command" do
79
81
  ARGV = ['nyan', 'unicorn']
80
- app.should_receive(:write).with(['nyan', 'unicorn'])
81
- app.run
82
+ a = RFormat::Application.new
83
+ a.should_receive(:write).with(['nyan', 'unicorn'])
84
+ a.run
82
85
  end
83
86
 
84
87
  it "should run the list command" do
85
88
  ARGV = ['list']
86
- app.should_receive(:list).with([])
87
- app.run
89
+ a = RFormat::Application.new
90
+ a.should_receive(:list)
91
+ a.run
88
92
  end
89
93
 
90
94
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rformat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -260,6 +260,7 @@ files:
260
260
  - lib/rformat/application.rb
261
261
  - lib/rformat/environment.rb
262
262
  - lib/rformat/formatters.yml
263
+ - rformat.gemspec
263
264
  - spec/application_spec.rb
264
265
  - spec/environment_spec.rb
265
266
  - spec/rformat_spec.rb
@@ -279,7 +280,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
279
280
  version: '0'
280
281
  segments:
281
282
  - 0
282
- hash: -135377835534220607
283
+ hash: 2990223959535639986
283
284
  required_rubygems_version: !ruby/object:Gem::Requirement
284
285
  none: false
285
286
  requirements: