ruby-edit 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f21cef72632c9b6a7a8454cba04c421a71b1ebdc
4
+ data.tar.gz: 5193cc1c0c17ca953dcae7ed2994c6d5323f684b
5
+ SHA512:
6
+ metadata.gz: c850f1b84cc7fe68dfd30fbbde7a9585563d075707269da797a62b854daef738b1e46f75cd23224968fe6cd2449ce77d466eb337ae3cf36d4de1060c8bf8a232
7
+ data.tar.gz: ae1ab6d62c38349726990f65f376500693c6a9d1546291d6c51c2fb1acfa7a24ab951e981806033aae24b707b00f90b008e5cb62ab882ab9d2464ea4e5e21d1e
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
@@ -0,0 +1,15 @@
1
+ Layout/TrailingBlankLines:
2
+ EnforcedStyle: final_blank_line
3
+
4
+ Metrics/BlockLength:
5
+ Max: 100
6
+
7
+ Metrics/LineLength:
8
+ Max: 100
9
+
10
+ Style/Documentation:
11
+ Enabled: false
12
+
13
+ Style/Encoding:
14
+ Enabled: false
15
+
@@ -0,0 +1,6 @@
1
+ SimpleCov.start do
2
+ add_filter '/spec/'
3
+ add_filter 'lib/ruby_edit/command.rb'
4
+ add_group 'Commands', 'lib/ruby_edit/commands'
5
+ end
6
+
@@ -0,0 +1,6 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.3
5
+ before_install: gem install bundler -v 1.16.2
6
+
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at finn_francis@yahoo.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in ruby-edit.gemspec
8
+ gemspec
9
+
@@ -0,0 +1,141 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ruby-edit (0.1.0)
5
+ pastel (~> 0.7.2)
6
+ thor (~> 0.20.0)
7
+ tty-color (~> 0.4.2)
8
+ tty-command (~> 0.8.0)
9
+ tty-config (~> 0.2.0)
10
+ tty-cursor (~> 0.5.0)
11
+ tty-editor (~> 0.4.0)
12
+ tty-file (~> 0.6.0)
13
+ tty-font (~> 0.2.0)
14
+ tty-markdown (~> 0.4.0)
15
+ tty-pager (~> 0.11.0)
16
+ tty-platform (~> 0.1.0)
17
+ tty-progressbar (~> 0.15.0)
18
+ tty-prompt (~> 0.16.1)
19
+ tty-screen (~> 0.6.4)
20
+ tty-spinner (~> 0.8.0)
21
+ tty-table (~> 0.10.0)
22
+ tty-tree (~> 0.1.0)
23
+ tty-which (~> 0.3.0)
24
+
25
+ GEM
26
+ remote: https://rubygems.org/
27
+ specs:
28
+ byebug (9.0.6)
29
+ coderay (1.1.2)
30
+ diff-lcs (1.3)
31
+ docile (1.3.1)
32
+ equatable (0.5.0)
33
+ hitimes (1.3.0)
34
+ json (2.1.0)
35
+ kramdown (1.16.2)
36
+ method_source (0.8.2)
37
+ necromancer (0.4.0)
38
+ pastel (0.7.2)
39
+ equatable (~> 0.5.0)
40
+ tty-color (~> 0.4.0)
41
+ pry (0.10.4)
42
+ coderay (~> 1.1.0)
43
+ method_source (~> 0.8.1)
44
+ slop (~> 3.4)
45
+ pry-byebug (3.4.2)
46
+ byebug (~> 9.0)
47
+ pry (~> 0.10)
48
+ rake (10.5.0)
49
+ rouge (3.1.1)
50
+ rspec (3.6.0)
51
+ rspec-core (~> 3.6.0)
52
+ rspec-expectations (~> 3.6.0)
53
+ rspec-mocks (~> 3.6.0)
54
+ rspec-core (3.6.0)
55
+ rspec-support (~> 3.6.0)
56
+ rspec-expectations (3.6.0)
57
+ diff-lcs (>= 1.2.0, < 2.0)
58
+ rspec-support (~> 3.6.0)
59
+ rspec-mocks (3.6.0)
60
+ diff-lcs (>= 1.2.0, < 2.0)
61
+ rspec-support (~> 3.6.0)
62
+ rspec-support (3.6.0)
63
+ simplecov (0.16.1)
64
+ docile (~> 1.1)
65
+ json (>= 1.8, < 3)
66
+ simplecov-html (~> 0.10.0)
67
+ simplecov-html (0.10.2)
68
+ slop (3.6.0)
69
+ strings (0.1.1)
70
+ unicode-display_width (~> 1.3.0)
71
+ unicode_utils (~> 1.4.0)
72
+ thor (0.20.0)
73
+ timers (4.1.2)
74
+ hitimes
75
+ tty-color (0.4.2)
76
+ tty-command (0.8.1)
77
+ pastel (~> 0.7.0)
78
+ tty-config (0.2.0)
79
+ tty-cursor (0.5.0)
80
+ tty-editor (0.4.0)
81
+ tty-prompt (~> 0.16.0)
82
+ tty-which (~> 0.3.0)
83
+ tty-file (0.6.0)
84
+ diff-lcs (~> 1.3.0)
85
+ pastel (~> 0.7.2)
86
+ tty-prompt (~> 0.16.1)
87
+ tty-font (0.2.0)
88
+ tty-markdown (0.4.0)
89
+ kramdown (~> 1.16.2)
90
+ pastel (~> 0.7.2)
91
+ rouge (~> 3.1.0)
92
+ strings (~> 0.1.0)
93
+ tty-color (~> 0.4.2)
94
+ tty-screen (~> 0.6.4)
95
+ tty-pager (0.11.0)
96
+ strings (~> 0.1.0)
97
+ tty-screen (~> 0.6.4)
98
+ tty-which (~> 0.3.0)
99
+ tty-platform (0.1.0)
100
+ tty-progressbar (0.15.0)
101
+ tty-cursor (~> 0.5.0)
102
+ tty-screen (~> 0.6.4)
103
+ unicode-display_width (~> 1.3)
104
+ tty-prompt (0.16.1)
105
+ necromancer (~> 0.4.0)
106
+ pastel (~> 0.7.0)
107
+ timers (~> 4.0)
108
+ tty-cursor (~> 0.5.0)
109
+ tty-reader (~> 0.3.0)
110
+ tty-reader (0.3.0)
111
+ tty-cursor (~> 0.5.0)
112
+ tty-screen (~> 0.6.4)
113
+ wisper (~> 2.0.0)
114
+ tty-screen (0.6.4)
115
+ tty-spinner (0.8.0)
116
+ tty-cursor (>= 0.5.0)
117
+ tty-table (0.10.0)
118
+ equatable (~> 0.5.0)
119
+ necromancer (~> 0.4.0)
120
+ pastel (~> 0.7.2)
121
+ strings (~> 0.1.0)
122
+ tty-screen (~> 0.6.4)
123
+ tty-tree (0.1.0)
124
+ tty-which (0.3.0)
125
+ unicode-display_width (1.3.3)
126
+ unicode_utils (1.4.0)
127
+ wisper (2.0.0)
128
+
129
+ PLATFORMS
130
+ ruby
131
+
132
+ DEPENDENCIES
133
+ bundler (~> 1.16)
134
+ pry-byebug
135
+ rake (~> 10.0)
136
+ rspec (~> 3.0)
137
+ ruby-edit!
138
+ simplecov
139
+
140
+ BUNDLED WITH
141
+ 1.16.2
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 finn-francis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,72 @@
1
+ # RubyEdit
2
+
3
+ ALPHA RELEASE
4
+
5
+ RubyEdit is a simple commandline app that allows you to edit grep results in one file.
6
+
7
+ ## Installation
8
+
9
+ Run this line in your terminal:
10
+
11
+ ```ruby
12
+ gem install ruby-edit
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ### ruby-edit
18
+
19
+ Run:
20
+ ```bash
21
+ ruby-edit -e my_expression -p ./path/to/file/
22
+ ```
23
+
24
+ This will populate a tempfile with the grep results.
25
+
26
+ e.g.
27
+ ```ruby
28
+ ./path/to/file/file.rb:4: my_expression('string')
29
+ ./path/to/file/file.rb:10: def my_expression(string)
30
+ ./path/to/file/file_spec.rb:7: expect { my_expression('string') }.to do
31
+ ```
32
+
33
+ Perform your edits and then save your file.
34
+
35
+ Warning:
36
+ Leave the path and line number alone, as this is used to find the respective file.
37
+ The space between the line number and your text is your indentation. Removing it will affect the indentation of your text.
38
+
39
+ You'll then be prompted in the console:
40
+
41
+ ```bash
42
+ Do you want to apply these changes? (Y/n)
43
+ ```
44
+
45
+ Selecting 'Y' will insert your changes into their respective files.
46
+
47
+ ### configure
48
+
49
+ Run:
50
+ ```bash
51
+ ruby-edit configure -e my_editor
52
+ ```
53
+
54
+ This will set your default editor.
55
+ Pass the command you use to start your editor, NOT the name of the editor.
56
+ For example: if you use Sublime Text send `subl` not `Sublime Text`
57
+
58
+ ## Development
59
+
60
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
61
+
62
+ ## Contributing
63
+
64
+ Bug reports and pull requests are welcome on GitHub at https://github.com/finn-francis/ruby-edit. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
65
+
66
+ ## Code of Conduct
67
+
68
+ Everyone interacting in the RubyEdit project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/ruby-edit/blob/master/CODE_OF_CONDUCT.md).
69
+
70
+ ## Copyright
71
+
72
+ Copyright (c) 2018 finn-francis. See [MIT License](LICENSE.txt) for further details.
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
9
+
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'ruby_edit'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ require 'pry'
11
+ Pry.start
12
+
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,2 @@
1
+ ---
2
+ editor: vim
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ lib_path = File.expand_path('../lib', __dir__)
5
+ $LOAD_PATH.unshift(lib_path) unless $LOAD_PATH.include?(lib_path)
6
+ require 'ruby_edit/cli'
7
+
8
+ Signal.trap('INT') do
9
+ warn("\n#{caller.join("\n")}: interrupted")
10
+ exit(1)
11
+ end
12
+
13
+ begin
14
+ RubyEdit::CLI.start
15
+ rescue RubyEdit::CLI::Error => err
16
+ puts "ERROR: #{err.message}"
17
+ exit 1
18
+ end
19
+
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ruby_edit/version'
4
+ require 'ruby_edit/configuration'
5
+
6
+ module RubyEdit
7
+ SOURCE_FILE_LOCATION = File.expand_path('../temp/sourcefile', __dir__)
8
+
9
+ class << self
10
+ def config
11
+ @config ||= RubyEdit::Configuration.new
12
+ end
13
+ end
14
+ end
15
+