Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 28 additions & 14 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
inherit_from: .rubocop_todo.yml

require: rubocop-rspec

AllCops:
DisplayCopNames: true

Layout/SpaceBeforeFirstArg:
Enabled: false

## Style

Style/Documentation:
Enabled: false
Style/SingleSpaceBeforeFirstArg:
Enabled: false
Style/AccessorMethodName:
Enabled: false
Style/SymbolArray:
Enabled: false
Style/SignalException:
Expand All @@ -30,32 +31,37 @@ Style/CollectionMethods:
Style/TrivialAccessors:
ExactNameMatch: true

Style/PredicateName:
NamePrefix:
- is_
- have_
NamePrefixBlacklist:
- is_
- have_

Style/StringLiterals:
EnforcedStyle: double_quotes

## Metrics

Metrics/LineLength:
Max: 100
Max: 120
Exclude:
- 'spec/**/*'

Metrics/MethodLength:
Max: 15
Exclude:
- 'spec/**/*'

Metrics/CyclomaticComplexity:
Max: 10

Metrics/BlockLength:
Exclude:
- 'spec/**/*'

Naming/AccessorMethodName:
Enabled: false
Naming/PredicateName:
NamePrefix:
- is_
- have_
NamePrefixBlacklist:
- is_
- have_

## RSpec

RSpec/DescribeClass:
Expand All @@ -68,3 +74,11 @@ RSpec/FilePath:
Enabled: false
RSpec/InstanceVariable:
Enabled: false
RSpec/ExampleLength:
Enabled: false
RSpec/ContextWording:
Enabled: false
RSpec/MultipleExpectations:
Enabled: false
RSpec/ExpectActual:
Enabled: false
21 changes: 21 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2019-03-26 23:45:23 -0700 using RuboCop version 0.66.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 2
Metrics/AbcSize:
Max: 31

# Offense count: 1
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 110

# Offense count: 2
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/MethodLength:
Max: 24
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: ruby

rvm:
- 2.0.0-p648
- 2.3.7

before_install:
- gem update bundler
2 changes: 1 addition & 1 deletion exe/mac_setup
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ when "install"
# config_path = (ARGV - options)[0] || File.expand_path(DEFAULT_CONFIG_PATH)

# if File.exist?(config_path)
MacSetup.install # (config_path, options)
MacSetup.install # (config_path, options)
# else
# puts "You must specify a path to config file or create one at #{DEFAULT_CONFIG_PATH}"
# end
Expand Down
6 changes: 3 additions & 3 deletions lib/mac_setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ module MacSetup
HomebrewRunner,
ScriptInstaller,
DefaultsInstaller
]
].freeze

DEFAULT_PLUGINS = [
Plugins::MacAppStore,
Plugins::Keybase,
Plugins::Dotfiles,
Plugins::Asdf
]
].freeze

class << self
def bootstrap(dotfiles_repo)
Expand All @@ -48,7 +48,7 @@ def bootstrap(dotfiles_repo)
plugins(config).each { |plugin| plugin.bootstrap(config) }
end

def install # (config_path, _options)
def install
config = Configuration.new(DEFAULT_CONFIG_PATH)

Shell.raw("brew update")
Expand Down
2 changes: 1 addition & 1 deletion lib/mac_setup/brewfile_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

module MacSetup
class BrewfileInstaller
BUNDLE_TAP = "homebrew/bundle"
BUNDLE_TAP = "homebrew/bundle".freeze

attr_reader :config, :status

Expand Down
2 changes: 1 addition & 1 deletion lib/mac_setup/command_line_tools_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module MacSetup
class CommandLineToolsInstaller
BIN_PATH = "/Library/Developer/CommandLineTools/usr/bin/clang"
BIN_PATH = "/Library/Developer/CommandLineTools/usr/bin/clang".freeze

def self.run
if File.exist?(BIN_PATH)
Expand Down
10 changes: 4 additions & 6 deletions lib/mac_setup/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Configuration
InvalidConfigError = Class.new(StandardError)
DEFAULT_KEYS = [
:repo, :plugins, :git_repos, :symlinks, :taps, :brews, :fonts, :casks, :quicklook, :mas, :extra_dotfiles
]
].freeze

def initialize(config_path)
@config_path = config_path
Expand Down Expand Up @@ -99,11 +99,9 @@ def mas

def add_brews(item, existing_brews = brews)
existing_brews.merge!(brew_value(item)) do |key, oldval, newval|
if oldval == newval
oldval
else
raise InvalidConfigError, "#{key} is defined twice!: #{oldval}, #{newval}"
end
raise InvalidConfigError, "#{key} is defined twice!: #{oldval}, #{newval}" unless oldval == newval

oldval
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/mac_setup/homebrew_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module MacSetup
class HomebrewInstaller
BREW_INSTALL_URL = "https://raw.githubusercontent.com/Homebrew/install/master/install"
BREW_INSTALL_URL = "https://raw.githubusercontent.com/Homebrew/install/master/install".freeze

def self.run
if Shell.command_present?("brew")
Expand Down
2 changes: 1 addition & 1 deletion lib/mac_setup/homebrew_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def self.run(config, _status)
MacSetup.log("Installing Homebrew brews and casks") do
Tempfile.create("Brewfile") do |brewfile|
write_brewfile(config, brewfile)
File.chmod(0644, brewfile)
File.chmod(0o644, brewfile)
brewfile.rewind

Shell.raw("brew bundle install --file=#{brewfile.path}")
Expand Down
15 changes: 5 additions & 10 deletions lib/mac_setup/plugin.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
module MacSetup
class Plugin
class << self
def add_requirements(_config)
end
def add_requirements(_config); end

def run(_config, _status)
end
def run(_config, _status); end

def load(_plugin_name)
end
def load(_plugin_name); end

def get_status(_status)
end
def get_status(_status); end

def bootstrap(config)
end
def bootstrap(config); end
end
end
end
2 changes: 1 addition & 1 deletion lib/mac_setup/script_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module MacSetup
class ScriptInstaller
SCRIPTS_PATH = "mac_setup/scripts"
SCRIPTS_PATH = "mac_setup/scripts".freeze

def self.run(_config, _status)
Pathname.new(MacSetup.dotfiles_path).join(SCRIPTS_PATH).each_child do |script|
Expand Down
14 changes: 7 additions & 7 deletions lib/mac_setup/secrets.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module MacSetup
class Secrets
CRYPTO_LIB = "openssl"
CIPHER = "aes-256-cbc"
PLAINTEXT_EXT = "priv"
CIPHERTEXT_EXT = "crypt"
CRYPTO_LIB = "openssl".freeze
CIPHER = "aes-256-cbc".freeze
PLAINTEXT_EXT = "priv".freeze
CIPHERTEXT_EXT = "crypt".freeze

attr_reader :files, :password

Expand Down Expand Up @@ -122,15 +122,15 @@ def do_encrypt(file, target_path)
end

def encrypt_command(file, target_path)
%W(openssl enc -aes-256-cbc -k testme -in #{file} -out #{target_path})
%W[openssl enc -aes-256-cbc -k testme -in #{file} -out #{target_path}]
end

def decrypt_command(file, target_path)
%W(openssl enc -aes-256-cbc -k testme -d -in #{file} -out #{target_path})
%W[openssl enc -aes-256-cbc -k testme -d -in #{file} -out #{target_path}]
end

def base_command(password)
%W(#{CRYPTO_LIB} enc -#{CIPHER} -k #{password})
%W[#{CRYPTO_LIB} enc -#{CIPHER} -k #{password}]
end

def raw_file_path(file)
Expand Down
2 changes: 1 addition & 1 deletion lib/mac_setup/services_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module MacSetup
class ServicesInstaller
LAUNCH_AGENTS_PATH = File.expand_path("~/Library/LaunchAgents")
SERVICES_TAP = "homebrew/services"
SERVICES_TAP = "homebrew/services".freeze

attr_reader :config, :status, :services, :running_services

Expand Down
2 changes: 1 addition & 1 deletion lib/mac_setup/symlink_path_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def each_child(dir, &block)
if child.directory?
each_child(child, &block)
else
block.call(child)
yield(child)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/mac_setup/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module MacSetup
VERSION = "0.9.0"
VERSION = "0.9.0".freeze
end
9 changes: 4 additions & 5 deletions mac_setup.gemspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# coding: utf-8
lib = File.expand_path("../lib", __FILE__)
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "mac_setup/version"

Expand All @@ -20,10 +19,10 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_development_dependency "bundler", "~> 1.10"
spec.add_development_dependency "bundler", "~> 2.0"
spec.add_development_dependency "pry"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec"
spec.add_development_dependency "rubocop", "~> 0.34.2"
spec.add_development_dependency "rubocop"
spec.add_development_dependency "rubocop-rspec"
spec.add_development_dependency "pry"
end
47 changes: 0 additions & 47 deletions spec/command_line_tools_installer_spec.rb

This file was deleted.

Loading