Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcf97c1b

Browse files
authored
Merge pull request#123 from molawson/rake-print-width-arg
Add print_width config option for rake tasks
2 parents515aaff +b5758af commitcf97c1b

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

‎README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,16 @@ SyntaxTree::Rake::WriteTask.new do |t|
505505
end
506506
```
507507

508+
####`print_width`
509+
510+
If you want to use a different print width from the default (80), you can pass that to the`print_width` field, as in:
511+
512+
```ruby
513+
SyntaxTree::Rake::WriteTask.newdo |t|
514+
t.print_width=100
515+
end
516+
```
517+
508518
####`plugins`
509519

510520
If you're running Syntax Tree with plugins (either your own or the pre-built ones), you can pass that to the`plugins` field, as in:

‎lib/syntax_tree/rake/check_task.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,20 @@ class CheckTask < ::Rake::TaskLib
3535
# Defaults to [].
3636
attr_accessor:plugins
3737

38+
# Max line length.
39+
# Defaults to 80.
40+
attr_accessor:print_width
41+
3842
definitialize(
3943
name=:"stree:check",
4044
source_files= ::Rake::FileList["lib/**/*.rb"],
41-
plugins=[]
45+
plugins=[],
46+
print_width=DEFAULT_PRINT_WIDTH
4247
)
4348
@name=name
4449
@source_files=source_files
4550
@plugins=plugins
51+
@print_width=print_width
4652

4753
yieldselfifblock_given?
4854
define_task
@@ -58,6 +64,7 @@ def define_task
5864
defrun_task
5965
arguments=["check"]
6066
arguments <<"--plugins=#{plugins.join(",")}"ifplugins.any?
67+
arguments <<"--print-width=#{print_width}"ifprint_width !=DEFAULT_PRINT_WIDTH
6168

6269
SyntaxTree::CLI.run(arguments +Array(source_files))
6370
end

‎lib/syntax_tree/rake/write_task.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,20 @@ class WriteTask < ::Rake::TaskLib
3535
# Defaults to [].
3636
attr_accessor:plugins
3737

38+
# Max line length.
39+
# Defaults to 80.
40+
attr_accessor:print_width
41+
3842
definitialize(
3943
name=:"stree:write",
4044
source_files= ::Rake::FileList["lib/**/*.rb"],
41-
plugins=[]
45+
plugins=[],
46+
print_width=DEFAULT_PRINT_WIDTH
4247
)
4348
@name=name
4449
@source_files=source_files
4550
@plugins=plugins
51+
@print_width=print_width
4652

4753
yieldselfifblock_given?
4854
define_task
@@ -58,6 +64,7 @@ def define_task
5864
defrun_task
5965
arguments=["write"]
6066
arguments <<"--plugins=#{plugins.join(",")}"ifplugins.any?
67+
arguments <<"--print-width=#{print_width}"ifprint_width !=DEFAULT_PRINT_WIDTH
6168

6269
SyntaxTree::CLI.run(arguments +Array(source_files))
6370
end

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp