Merge branch 'master' into master

This commit is contained in:
Adam Strickland
2017-05-19 12:27:06 -05:00
committed by GitHub
12 changed files with 84 additions and 109 deletions

View File

@@ -10,9 +10,10 @@ AllCops:
Exclude:
- "vendor/**/*"
- "db/schema.rb"
RunRailsCops: false
DisplayCopNames: false
DisplayCopNames: true
StyleGuideCopsOnly: false
Rails:
Enabled: false
Style/AccessModifierIndentation:
Description: Check indentation of private/protected visibility modifiers.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#indent-public-private-protected
@@ -425,14 +426,10 @@ Style/TrailingBlankLines:
SupportedStyles:
- final_newline
- final_blank_line
Style/TrailingComma:
Description: Checks for trailing comma in parameter lists and literals.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas
Style/TrailingCommaInLiteral:
Enabled: false
EnforcedStyleForMultiline: no_comma
SupportedStyles:
- comma
- no_comma
Style/TrailingCommaInArguments:
Enabled: true
Style/TrivialAccessors:
Description: Prefer attr_* methods to trivial readers/writers.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#attr_family
@@ -526,6 +523,18 @@ Metrics/PerceivedComplexity:
reader.
Enabled: false
Max: 7
Metrics/BlockLength:
Exclude:
- lib/tmuxinator/cli.rb
- spec/factories/**/*.rb
- spec/matchers/**/*.rb
- spec/**/*_spec.rb
Lint/PercentStringArray:
Exclude:
- lib/tmuxinator/cli.rb
Style/MutableConstant:
Exclude:
- lib/tmuxinator/project.rb
Lint/AssignmentInCondition:
Description: Don't use assignment in conditions.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
@@ -545,48 +554,6 @@ Lint/DefEndAlignment:
SupportedStyles:
- start_of_line
- def
Rails/ActionFilter:
Description: Enforces consistent use of action filter methods.
Enabled: false
EnforcedStyle: action
SupportedStyles:
- action
- filter
Include:
- app/controllers/**/*.rb
Rails/DefaultScope:
Description: Checks if the argument passed to default_scope is a block.
Enabled: true
Include:
- app/models/**/*.rb
Rails/HasAndBelongsToMany:
Description: Prefer has_many :through to has_and_belongs_to_many.
Enabled: true
Include:
- app/models/**/*.rb
Rails/Output:
Description: Checks for calls to puts, print, etc.
Enabled: true
Include:
- app/**/*.rb
- config/**/*.rb
- db/**/*.rb
- lib/**/*.rb
Rails/ReadWriteAttribute:
Description: Checks for read_attribute(:attr) and write_attribute(:attr, val).
Enabled: true
Include:
- app/models/**/*.rb
Rails/ScopeArgs:
Description: Checks the arguments of ActiveRecord scopes.
Enabled: true
Include:
- app/models/**/*.rb
Rails/Validation:
Description: Use validates :attribute, hash of validations.
Enabled: true
Include:
- app/models/**/*.rb
Style/InlineComment:
Description: Avoid inline comments.
Enabled: false
@@ -679,10 +646,6 @@ Style/DefWithParentheses:
Description: Use def with parentheses when there are arguments.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#method-parens
Enabled: true
Style/DeprecatedHashMethods:
Description: Checks for use of deprecated Hash methods.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#hash-key
Enabled: false
Style/Documentation:
Description: Document classes and non-namespace modules.
Enabled: false
@@ -834,7 +797,7 @@ Style/SelfAssignment:
used.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#self-assignment
Enabled: false
Style/SingleSpaceBeforeFirstArg:
Style/SpaceBeforeFirstArg:
Description: Checks that exactly one space is used between a method name and the
first argument for method calls without parentheses.
Enabled: true
@@ -846,8 +809,7 @@ Style/SpaceAfterComma:
Description: Use spaces after commas.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-operators
Enabled: true
Style/SpaceAfterControlKeyword:
Description: Use spaces after if/elsif/unless/while/until/case/when.
Style/SpaceAroundKeyword:
Enabled: true
Style/SpaceAfterMethodName:
Description: Do not put a space between a method name and the opening parenthesis
@@ -875,9 +837,6 @@ Style/SpaceAroundOperators:
Description: Use spaces around operators.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-operators
Enabled: true
Style/SpaceBeforeModifierKeyword:
Description: Put a space before the modifier keyword.
Enabled: true
Style/SpaceInsideBrackets:
Description: No spaces after [ or before ].
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-spaces-braces
@@ -1013,10 +972,6 @@ Lint/ShadowingOuterLocalVariable:
Description: Do not use the same name as outer local variable for block arguments
or block local variables.
Enabled: true
Lint/SpaceBeforeFirstArg:
Description: Put a space between a method name and the first argument in a method
call without parentheses.
Enabled: true
Lint/StringConversionInInterpolation:
Description: Checks for Object#to_s usage in string interpolation.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-to-s
@@ -1054,6 +1009,3 @@ Lint/UselessSetterCall:
Lint/Void:
Description: Possible use of operator/literal/variable in void context.
Enabled: false
Rails/Delegate:
Description: Prefer delegate method for delegations.
Enabled: false

View File

@@ -1,4 +1,7 @@
## Unreleased
- Add ability for pre_window commands to parse yaml arrays
### Misc
- Removed support for Ruby 1.9.3
- Move gem dependencies from Gemfile to tmuxinator.gemspec

View File

@@ -257,7 +257,7 @@ root: ~/<%= @settings["workspace"] %>
## Starting a session
This will fire up tmux with all the tabs and panes you configured.
This will fire up tmux with all the tabs and panes you configured, `start` is aliased to `s`.
```
tmuxinator start [project] -n [name]

View File

@@ -6,7 +6,7 @@ require "tmuxinator"
name = ARGV[0] || nil
if ARGV.length == 0 && Tmuxinator::Config.local?
if ARGV.empty? && Tmuxinator::Config.local?
Tmuxinator::Cli.new.local
elsif name && !Tmuxinator::Cli::COMMANDS.keys.include?(name.to_sym) &&
Tmuxinator::Config.exists?(name)

View File

@@ -30,7 +30,7 @@ module Tmuxinator
version: "Display installed tmuxinator version",
doctor: "Look for problems in your configuration",
list: "Lists all tmuxinator projects"
}
}.freeze
package_name "tmuxinator" \
unless Gem::Version.create(Thor::VERSION) < Gem::Version.create("0.18")

View File

@@ -1,7 +1,8 @@
module Tmuxinator
class Config
LOCAL_DEFAULT = "./.tmuxinator.yml".freeze
NO_LOCAL_FILE_MSG = "Project file at ./.tmuxinator.yml doesn't exist."
NO_LOCAL_FILE_MSG =
"Project file at ./.tmuxinator.yml doesn't exist.".freeze
class << self
# The directory (created if needed) in which to store new projects

View File

@@ -62,9 +62,9 @@ module Tmuxinator
def validate!
raise "Your project file should include some windows." \
unless self.windows?
unless windows?
raise "Your project file didn't specify a 'project_name'" \
unless self.name?
unless name?
self
end
@@ -110,42 +110,35 @@ module Tmuxinator
def pre
pre_config = yaml["pre"]
if pre_config.is_a?(Array)
pre_config.join("; ")
else
pre_config
end
parsed_parameters(pre_config)
end
def attach?
if yaml["attach"].nil?
yaml_attach = true
else
yaml_attach = yaml["attach"]
end
yaml_attach = if yaml["attach"].nil?
true
else
yaml["attach"]
end
attach = force_attach || !force_detach && yaml_attach
attach
end
def pre_window
if rbenv?
"rbenv shell #{yaml['rbenv']}"
elsif rvm?
"rvm use #{yaml['rvm']}"
elsif pre_tab?
yaml["pre_tab"]
else
yaml["pre_window"]
end
params = if rbenv?
"rbenv shell #{yaml['rbenv']}"
elsif rvm?
"rvm use #{yaml['rvm']}"
elsif pre_tab?
yaml["pre_tab"]
else
yaml["pre_window"]
end
parsed_parameters(params)
end
def post
post_config = yaml["post"]
if post_config.is_a?(Array)
post_config.join("; ")
else
post_config
end
parsed_parameters(post_config)
end
def tmux
@@ -306,5 +299,9 @@ module Tmuxinator
def window_options
yaml["windows"].map(&:values).flatten
end
def parsed_parameters(parameters)
parameters.is_a?(Array) ? parameters.join("; ") : parameters
end
end
end

View File

@@ -1,3 +1,3 @@
module Tmuxinator
VERSION = "0.9.0"
VERSION = "0.9.0".freeze
end

View File

@@ -74,7 +74,7 @@ describe Tmuxinator::Cli do
end
it "accepts a flag for alternate name" do
ARGV.replace(["start", "foo" "--name=bar"])
ARGV.replace(["start", "foo", "--name=bar"])
expect(Kernel).to receive(:exec)
capture_io { cli.start }

View File

@@ -166,14 +166,34 @@ describe Tmuxinator::Project do
rendered = project_with_literals_as_window_name
expect(rendered.windows.map(&:name)).to match_array(
%w(222 222333 111222333444555666777 222.3 4e5 4E5
true false nil // /sample/))
true false nil // /sample/)
)
end
end
end
describe "#pre_window" do
it "gets the pre_window command" do
expect(project.pre_window).to eq "rbenv shell 2.0.0-p247"
subject(:pre_window) { project.pre_window }
context "pre_window in yaml is string" do
before { project.yaml["pre_window"] = "mysql.server start" }
it "returns the string" do
expect(pre_window).to eq("mysql.server start")
end
end
context "pre_window in yaml is Array" do
before do
project.yaml["pre_window"] = [
"mysql.server start",
"memcached -d"
]
end
it "joins array using ;" do
expect(pre_window).to eq("mysql.server start; memcached -d")
end
end
context "with deprecations" do

View File

@@ -99,11 +99,13 @@ describe Tmuxinator::Window do
project: project, tab: window
)
expect(window.panes).to match([
a_pane.with(index: 0).and_commands("vim"),
a_pane.with(index: 1).and_commands("ls"),
a_pane.with(index: 2).and_commands("top")
])
expect(window.panes).to match(
[
a_pane.with(index: 0).and_commands("vim"),
a_pane.with(index: 1).and_commands("ls"),
a_pane.with(index: 2).and_commands("top")
]
)
end
end

View File

@@ -50,6 +50,6 @@ Gem::Specification.new do |s|
s.add_development_dependency "pry", "~> 0.10"
s.add_development_dependency "rake", "~> 10.4"
s.add_development_dependency "rspec", "~> 3.3"
s.add_development_dependency "rubocop", "~> 0.35.1"
s.add_development_dependency "rubocop", "~> 0.46.0"
s.add_development_dependency "simplecov", "~> 0.11.0"
end