Skip to content

Commit

Permalink
Merge pull request #40 from jedcn/updates-for-rubocop
Browse files Browse the repository at this point in the history
[rubocop] Update code to pass latest rubocop preferences
  • Loading branch information
jedcn committed May 10, 2015
2 parents 086ccf7 + 2687b0f commit 0235731
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 13 deletions.
5 changes: 3 additions & 2 deletions lib/reveal-ck/commands/listen_to_rebuild_slides.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ module Commands
class ListenToRebuildSlides
attr_reader :ui, :rebuild_method
def initialize(ui, &block)
@ui, @rebuild_method = ui, block
@ui = ui
@rebuild_method = block
end

def run
Expand All @@ -25,7 +26,7 @@ def message_about_files(files, message)
end

def ignored_files_regex
/^slides\/.+$/
%r{^slides/.+$}
end

def message_and_rebuild(mod, add, del)
Expand Down
4 changes: 3 additions & 1 deletion lib/reveal-ck/commands/print_banner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ module Commands
class PrintBanner
attr_reader :doc_root, :port, :slides_file, :ui
def initialize(doc_root, port, slides_file, ui)
@doc_root, @port, @slides_file = doc_root, port, slides_file
@doc_root = doc_root
@port = port
@slides_file = slides_file
@ui = ui
end

Expand Down
3 changes: 2 additions & 1 deletion lib/reveal-ck/commands/start_web_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ module Commands
class StartWebServer
attr_reader :doc_root, :port
def initialize(doc_root, port)
@doc_root, @port = doc_root, port
@doc_root = doc_root
@port = port
end

def run
Expand Down
3 changes: 2 additions & 1 deletion lib/reveal-ck/commands/thread_waker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ module Commands
# Utility that wakes up a thread periodically
class ThreadWaker
def initialize(thread_to_wake, wait_period = 1)
@thread_to_wake, @wait_period = thread_to_wake, wait_period
@thread_to_wake = thread_to_wake
@wait_period = wait_period
end

def run
Expand Down
9 changes: 6 additions & 3 deletions lib/reveal-ck/presentation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,23 @@ def add(content)
end

def self.from_template(args)
file, config = retrieve(:file, args), retrieve(:config, args)
file = retrieve(:file, args)
config = retrieve(:config, args)
presentation = Presentation.new config: config
template = Templates::Processor.open(file: file, config: config)
presentation.html = template.output
presentation
end

def self.from_dsl(args)
file, config = retrieve(:file, args), retrieve(:config, args)
file = retrieve(:file, args)
config = retrieve(:config, args)
RevealCK::PresentationDSL.load file: file, config: config
end

def self.load(args)
file, config = retrieve(:file, args), retrieve(:config, args)
file = retrieve(:file, args)
config = retrieve(:config, args)
if file.end_with? '.rb'
Presentation.from_dsl file: file, config: config
else
Expand Down
4 changes: 3 additions & 1 deletion lib/reveal-ck/presentation_dsl.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

module RevealCK
#
# Public: A PresentationDSL defines the DSL behind a
Expand Down Expand Up @@ -64,7 +65,8 @@ def presentation(&block)
end

def self.load(args)
file, config = retrieve(:file, args), retrieve(:config, args)
file = retrieve(:file, args)
config = retrieve(:config, args)
builder = PresentationDSL.new config: config
contents = File.open(file).read
builder.instance_eval(contents)
Expand Down
6 changes: 4 additions & 2 deletions lib/reveal-ck/templates/processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class Processor
attr_reader :config

def initialize(args)
file, @config = retrieve(:file, args), retrieve(:config, args)
@config = retrieve(:config, args)
file = retrieve(:file, args)
@template = Tilt.new file
end

Expand All @@ -25,7 +26,8 @@ def output(locals = {})
end

def self.open(args)
file, config = retrieve(:file, args), retrieve(:config, args)
file = retrieve(:file, args)
config = retrieve(:config, args)
Processor.new(file: file, config: config)
end
end
Expand Down
3 changes: 3 additions & 0 deletions spec/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ inherit_from: ../.rubocop.yml
Documentation:
Enabled: false

Metrics/ModuleLength:
Enabled: false

FileName:
Exclude:
- lib/reveal-ck_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Commands
end

let :generated_slides do
/^slides\/.+$/
%r{^slides/.+$}
end

it 'sets up ::Listen to run when things change' do
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/reveal-ck/templates/processor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module Templates
end

let :pretty_printed_basic do
/<p>\s+This is basic (Slim|Haml)\s+<\/p>/
%r{<p>\s+This is basic (Slim|Haml)\s+</p>}
end

it 'can process a slim template' do
Expand Down

0 comments on commit 0235731

Please sign in to comment.