Skip to content

Commit

Permalink
Merge pull request #46 from anshizzle/master
Browse files Browse the repository at this point in the history
Clean up gem based on rubocop
  • Loading branch information
klobuczek authored Dec 13, 2018
2 parents 2f76b19 + a6bc157 commit b79b7c0
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 36 deletions.
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ gemspec

group 'test' do
gem 'coveralls', require: false
gem 'simplecov-html', require: false
gem 'guard-rspec', require: false
gem 'neo4j-core'
gem 'rake'
gem 'rspec'
gem 'rspec-its'
gem 'guard-rspec', require: false
gem 'neo4j-core'
gem 'simplecov-html', require: false
end
4 changes: 2 additions & 2 deletions Guardfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ end

guard :rspec, cmd: 'bundle exec rspec' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { 'spec' }
watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { 'spec' }
end
1 change: 1 addition & 0 deletions lib/neo4j/rake_tasks/download.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def create_progress_bar(message, total)

def update_progress_bar(value)
return unless @progress_bar

value = @progress_bar.total >= value ? value : @progress_bar.total
@progress_bar.progress = value
end
Expand Down
10 changes: 3 additions & 7 deletions lib/neo4j/rake_tasks/neo4j_server.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
require 'os'
require 'zip'
require 'pathname'
require File.expand_path('../windows_server_manager', __FILE__)
require File.expand_path('../starnix_server_manager', __FILE__)

require File.expand_path('windows_server_manager', __dir__)
require File.expand_path('starnix_server_manager', __dir__)

namespace :neo4j do
def clear_task_if_defined(task_name)
Expand Down Expand Up @@ -38,9 +37,7 @@ namespace :neo4j do
server_manager = server_manager(args[:environment])
server_manager.install(args[:edition])

if server_manager.supports_auth?
server_manager.config_auth_enabeled!(false)
end
server_manager.config_auth_enabeled!(false) if server_manager.supports_auth?

puts 'To start it type one of the following:'
puts cyanize(' rake neo4j:start')
Expand Down Expand Up @@ -94,7 +91,6 @@ namespace :neo4j do
task :config, :environment, :port do |_, args|
args.with_defaults(environment: :development, port: 7474)


puts "Config Neo4j in #{args[:environment]}"

server_manager = server_manager(args[:environment])
Expand Down
2 changes: 1 addition & 1 deletion lib/neo4j/rake_tasks/starnix_server_manager.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../server_manager', __FILE__)
require File.expand_path('server_manager', __dir__)

module Neo4j
module RakeTasks
Expand Down
2 changes: 1 addition & 1 deletion lib/neo4j/rake_tasks/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Neo4j
module RakeTasks
VERSION = '0.7.19'
VERSION = '0.7.19'.freeze
end
end
6 changes: 3 additions & 3 deletions lib/neo4j/rake_tasks/windows_server_manager.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../server_manager', __FILE__)
require File.expand_path('server_manager', __dir__)

module Neo4j
module RakeTasks
Expand All @@ -24,7 +24,7 @@ def install
def validate_is_system_admin!
return if nt_admin?

fail 'You do not have administrative rights to stop the Neo4j Service'
raise 'You do not have administrative rights to stop the Neo4j Service'
end

protected
Expand Down Expand Up @@ -60,7 +60,7 @@ def each_file_in_zip(zip_path)
end

def nt_admin?
system_or_fail('reg query "HKU\\S-1-5-19"').size > 0
!system_or_fail('reg query "HKU\\S-1-5-19"').empty?
end
end
end
Expand Down
15 changes: 8 additions & 7 deletions neo4j-rake_tasks.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
lib = File.expand_path('../lib/', __FILE__)
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)

require 'neo4j/rake_tasks/version'
Expand All @@ -25,26 +25,27 @@ DESCRIPTION

s.require_path = 'lib'
s.files = Dir.glob('{bin,lib,config}/**/*') +
%w(README.md Gemfile neo4j-rake_tasks.gemspec)
%w[README.md Gemfile neo4j-rake_tasks.gemspec]
s.has_rdoc = true
s.extra_rdoc_files = %w( README.md )
s.extra_rdoc_files = %w[README.md]
s.rdoc_options = [
'--quiet',
'--title',
'--line-numbers',
'--main',
'README.rdoc',
'--inline-source']
'--inline-source'
]

s.add_dependency('rake')
s.add_dependency('os')
s.add_dependency('rake')
s.add_dependency('ruby-progressbar')
s.add_dependency('rubyzip', '>= 1.1.7')

# s.add_development_dependency('vcr')
s.add_development_dependency('pry')
s.add_development_dependency('simplecov')
s.add_development_dependency('guard')
s.add_development_dependency('guard-rubocop')
s.add_development_dependency('pry')
s.add_development_dependency('rubocop')
s.add_development_dependency('simplecov')
end
11 changes: 5 additions & 6 deletions release_if_new.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,22 @@

gemspec_files = Dir.glob('*.gemspec')

fail 'Too many gemspecs!' if gemspec_files.size > 1
raise 'Too many gemspecs!' if gemspec_files.size > 1

gemspec_file = gemspec_files.first
gem_name = File.basename(gemspec_file, '.*')

spec = Gem::Specification::load(gemspec_file)
spec = Gem::Specification.load(gemspec_file)

LOGGER.info "Checking to see if version #{spec.version} of gem `#{gem_name}` exists"

http_result = `curl --head https://rubygems.org/gems/#{gem_name}/versions/#{spec.version} | head -1`

status_code = http_result.match(/^HTTP\/[\d\.]+ (\d+)/)[1].to_i
status_code = http_result.match(%r{^HTTP/[\d\.]+ (\d+)})[1].to_i

if status_code == 200
LOGGER.info "Version already exists"
LOGGER.info 'Version already exists'
else
LOGGER.info "Version does not exist. Releasing..."
LOGGER.info 'Version does not exist. Releasing...'
system('rake release')
end

12 changes: 6 additions & 6 deletions spec/starnix_server_manager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

require 'neo4j/rake_tasks/starnix_server_manager'

BASE_PATHNAME = Pathname.new(File.expand_path('../', __FILE__))
BASE_PATHNAME = Pathname.new(File.expand_path(__dir__))

module Neo4j
module RakeTasks
Expand All @@ -19,7 +19,7 @@ module RakeTasks
subject { server_manager.modify_config_contents(contents, properties) }
after(:each) { path.rmtree }

let_context properties: {prop: 2} do
let_context properties: { prop: 2 } do
let_context(contents: 'prop=1') { it { should eq('prop=2') } }
let_context(contents: 'prop =1') { it { should eq('prop=2') } }
let_context(contents: 'prop= 1') { it { should eq('prop=2') } }
Expand All @@ -37,11 +37,11 @@ module RakeTasks
end

let_context contents: 'prop=false' do
let_context(properties: {prop: true}) { it { should eq('prop=true') } }
let_context(properties: { prop: true }) { it { should eq('prop=true') } }
end

let_context contents: 'prop=true' do
let_context(properties: {prop: false}) { it { should eq('prop=false') } }
let_context(properties: { prop: false }) { it { should eq('prop=false') } }
end
end

Expand All @@ -57,14 +57,14 @@ def server_up(port)

before(:each) do
if server_up(neo4j_port)
fail "There is a server already running on port #{neo4j_port}. Can't run spec"
raise "There is a server already running on port #{neo4j_port}. Can't run spec"
end

if path.exist?
message = 'DB temporary directory already exists! '
message += "Delete #{path} if safe to do so and then proceed"

fail message
raise message
end
end

Expand Down

0 comments on commit b79b7c0

Please sign in to comment.