cutep 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ccc2e5e56ae78c5586e40d2ac652c04952cde8ed9a9a0cd934093f7b69ce482d
4
+ data.tar.gz: ac03ac69fe8bc7dfe46e9bf91a4443f3d22a536371bc2ceecb754179151c0c4b
5
+ SHA512:
6
+ metadata.gz: c5c0a8d37696bebfdc63a8120164d2fb052461058f7fca2a05262f36ba637bca681002eb17a22fe90a488e2095b18c1e70d18c1ae4b7830f38d2411781ba2752
7
+ data.tar.gz: 16788d70dae3b1858f602805bdefa068b87d55e9c4a7b402f1458863e56cc84e467a15ab9d71397812235c8e66eacd16b650b5ab203a4f876e633385a23519c2
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ Gemfile.lock
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.7.1
6
+ before_install: gem install bundler -v 2.1.4
@@ -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 koichiro.eto@gmail.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 [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in cutep.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "rspec", "~> 3.0"
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Koichiro Eto
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all 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,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,67 @@
1
+ # Cutep
2
+
3
+ Because of gem name restrictions, I use the name "cutep", but it's actually "qp". Call it "qp".
4
+
5
+ "qp" is an extension of "p".
6
+ Normal "p" only outputs the specified variables, etc. However, during programming, you may need information about where the "p" is being called.
7
+ "qp" outputs the information about where it is called at the same time.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'cutep'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle install
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install cutep
24
+
25
+ ## Usage
26
+
27
+ First, let's run the following "sample.rb" script.
28
+
29
+ ```
30
+ require 'qp'
31
+ qp 'foo'
32
+
33
+ def a_method
34
+ qp 'in a_method'
35
+ qp 1, 2, 3
36
+ end
37
+ a_method
38
+ ```
39
+
40
+ You will get the following output.
41
+
42
+ ```
43
+ % ruby sample.rb
44
+ sample.rb:2:<main> ["foo"]
45
+ sample.rb:5:a_method ["in a_method"]
46
+ sample.rb:6:a_method [1, 2, 3]
47
+ ```
48
+
49
+ This makes debugging a lot easier. Please try it out.
50
+
51
+ ## Development
52
+
53
+ 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.
54
+
55
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
56
+
57
+ ## Contributing
58
+
59
+ Bug reports and pull requests are welcome on GitHub at https://github.com/eto/cutep. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/eto/cutep/blob/master/CODE_OF_CONDUCT.md).
60
+
61
+ ## License
62
+
63
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
64
+
65
+ ## Code of Conduct
66
+
67
+ Everyone interacting in the Cutep project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/eto/cutep/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile CHANGED
@@ -1,194 +1,6 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'rake/clean'
4
- require 'rake/testtask'
5
- require 'rake/packagetask'
6
- require 'rake/gempackagetask'
7
- require 'rake/rdoctask'
8
- require 'rake/contrib/rubyforgepublisher'
9
- require 'fileutils'
10
- require 'hoe'
11
- begin
12
- require 'spec/rake/spectask'
13
- rescue LoadError
14
- puts 'To use rspec for testing you must install rspec gem:'
15
- puts '$ sudo gem install rspec'
16
- exit
17
- end
18
-
19
- include FileUtils
20
- require File.join(File.dirname(__FILE__), 'lib', 'qp')
21
-
22
- AUTHOR = 'Kouichirou Eto'
23
- EMAIL = "eto _at_ rubyforge _dot_ org"
24
- DESCRIPTION = '"Cute p" provide more human readable "p" function.'
25
- GEM_NAME = 'cutep'
26
-
27
- @config_file = "~/.rubyforge/user-config.yml"
28
- @config = nil
29
- def rubyforge_username
30
- unless @config
31
- begin
32
- @config = YAML.load(File.read(File.expand_path(@config_file)))
33
- rescue
34
- puts <<-EOS
35
- ERROR: No rubyforge config file found: #{@config_file}"
36
- Run 'rubyforge setup' to prepare your env for access to Rubyforge
37
- - See http://newgem.rubyforge.org/rubyforge.html for more details
38
- EOS
39
- # "
40
- exit
41
- end
42
- end
43
- @rubyforge_username ||= @config["username"]
44
- end
45
-
46
- RUBYFORGE_PROJECT = 'cutep' # The unix name for your project
47
- HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
48
- DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
49
- RUBYFORGE_ACCOUNT = 'eto'
50
-
51
- NAME = "cutep"
52
- REV = nil
53
- # UNCOMMENT IF REQUIRED:
54
- # REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
55
- VERS = QP::VERSION::STRING + (REV ? ".#{REV}" : "")
56
- CLEAN.include ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store']
57
- CLEAN.include ['*~']
58
- RDOC_OPTS = ['--quiet', '--title', 'cutep documentation',
59
- "--opname", "index.html",
60
- "--line-numbers",
61
- "--main", "README",
62
- "--inline-source"]
63
-
64
- class Hoe
65
- def extra_deps
66
- @extra_deps.reject { |x| Array(x).first == 'hoe' }
67
- end
68
- end
69
-
70
- # Generate all the Rake tasks
71
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
72
- hoe = Hoe.new(GEM_NAME, VERS) do |p|
73
- p.author = AUTHOR
74
- p.description = DESCRIPTION
75
- p.email = EMAIL
76
- p.summary = DESCRIPTION
77
- p.url = HOMEPATH
78
- p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
79
- p.test_globs = ["test/**/test_*.rb"]
80
- p.clean_globs |= CLEAN #An array of file patterns to delete on clean.
81
-
82
- # == Optional
83
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
84
- #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
85
- #p.spec_extras = {} # A hash of extra values to set in the gemspec.
86
- end
87
-
88
- CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\n\n")
89
- PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
90
- hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
91
-
92
- desc 'Generate website files'
93
- task :website_generate do
94
- Dir['website/**/*.txt'].each do |txt|
95
- sh %{ ruby scripts/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
96
- end
97
- end
98
-
99
- # add chmod.
100
- task :website_generate do
101
- sh %{ chmod -R go+rx website }
102
- end
103
-
104
- desc 'Upload website files to rubyforge'
105
- task :website_upload do
106
- host = "#{rubyforge_username}@rubyforge.org"
107
- remote_dir = "/var/www/gforge-projects/#{PATH}/"
108
- local_dir = 'website'
109
- sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
110
- end
111
-
112
- desc 'Generate and upload website files'
113
- task :website => [:website_generate, :website_upload, :publish_docs]
114
-
115
- desc 'Release the website and new gem version'
116
- task :deploy => [:check_version, :website, :release] do
117
- puts "Remember to create SVN tag:"
118
- puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
119
- "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
120
- puts "Suggested comment:"
121
- puts "Tagging release #{CHANGES}"
122
- end
123
-
124
- desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
125
- task :local_deploy => [:website_generate, :install_gem]
126
-
127
- task :check_version do
128
- unless ENV['VERSION']
129
- puts 'Must pass a VERSION=x.y.z release version'
130
- exit
131
- end
132
- unless ENV['VERSION'] == VERS
133
- puts "Please update your version.rb to match the release version, currently #{VERS}"
134
- exit
135
- end
136
- end
137
-
138
- desc "Run the specs under spec/models"
139
- Spec::Rake::SpecTask.new do |t|
140
- t.spec_opts = ['--options', "spec/spec.opts"]
141
- t.spec_files = FileList['spec/*_spec.rb']
142
- t.libs << "lib"
143
- end
144
-
145
- # add chmod.
146
- task :docs do
147
- sh %{ chmod -R go+rx doc }
148
- end
149
-
150
- # clear current task
151
- module Rake
152
- class Task
153
- def clear_actions
154
- @actions.clear
155
- end
156
- end
157
- end
158
-
159
- # clear current task
160
- t = Rake.application.lookup(:install_gem)
161
- t.clear_actions if t
162
-
163
- # redefine task
164
- task :install_gem => [:clean, :package] do
165
- if /mswin32/ =~ RUBY_PLATFORM || /cygwin/ =~ RUBY_PLATFORM
166
- sh "gem.cmd install pkg/*.gem" # for Cygwin
167
- else
168
- sh "sudo gem install pkg/*.gem"
169
- end
170
- end
171
-
172
- task :clean => [:chmod]
173
-
174
- desc 'Change mode to erase executable bits.'
175
- task :chmod do
176
- sh "chmod 644 Rakefile ChangeLog"
177
- sh "chmod 644 *.txt */*.txt"
178
- sh "chmod 644 */*.html"
179
- sh "chmod 644 */*.rhtml"
180
- sh "chmod 644 */*/*.js"
181
- sh "chmod 644 */*/*.css"
182
- sh "chmod 644 *.rb */*.rb"
183
- sh "chmod 755 scripts/*"
184
- end
185
-
186
- desc 'Create Manifest.txt file.'
187
- task :manifest => [:chmod, :clean] do
188
- ruby "scripts/makemanifest.rb"
189
- end
190
-
191
- task :gem => [:manifest]
192
-
193
- desc "Default task is to run specs"
194
- task :default => :spec
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "cutep"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -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,29 @@
1
+ require_relative 'lib/qp/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "cutep"
5
+ spec.version = QP::VERSION
6
+ spec.authors = ["Koichiro Eto"]
7
+ spec.email = ["k-eto@aist.go.jp"]
8
+
9
+ spec.summary = %q{"qp" is an extension of "p".}
10
+ spec.description = %q{ Normal "p" only outputs the specified variables, etc. However, during programming, you may need information about where the "p" is being called. "qp" outputs the information about where it is called at the same time.}
11
+ spec.homepage = "https://github.com/eto/cutep"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ spec.metadata["allowed_push_host"] = "https://rubygems.org/"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://github.com/eto/cutep"
19
+ spec.metadata["changelog_uri"] = "https://github.com/eto/cutep"
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ end
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+ end