nse_data 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rubocop.yml +7 -0
- data/CHANGELOG.md +22 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +24 -0
- data/LICENSE.txt +21 -0
- data/README.md +179 -0
- data/Rakefile +72 -0
- data/doc/NseData/API/Base.html +350 -0
- data/doc/NseData/API/SpecialPreopen.html +220 -0
- data/doc/NseData/API.html +117 -0
- data/doc/NseData/APIManager.html +644 -0
- data/doc/NseData/Cache/CachePolicy.html +907 -0
- data/doc/NseData/Cache/CacheStore.html +674 -0
- data/doc/NseData/Cache.html +117 -0
- data/doc/NseData/Client.html +385 -0
- data/doc/NseData/Config/Base.html +552 -0
- data/doc/NseData/Config/Logger.html +430 -0
- data/doc/NseData/Config.html +117 -0
- data/doc/NseData/Error.html +124 -0
- data/doc/NseData/HttpClient/BaseClient.html +349 -0
- data/doc/NseData/HttpClient/FaradayClient.html +301 -0
- data/doc/NseData/HttpClient.html +117 -0
- data/doc/NseData.html +524 -0
- data/doc/_index.html +243 -0
- data/doc/class_list.html +54 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +503 -0
- data/doc/file.README.html +304 -0
- data/doc/file_list.html +59 -0
- data/doc/frames.html +22 -0
- data/doc/index.html +304 -0
- data/doc/js/app.js +344 -0
- data/doc/js/full_list.js +242 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +294 -0
- data/doc/top-level-namespace.html +110 -0
- data/lib/nse_data/api_manager.rb +83 -0
- data/lib/nse_data/cache/README.md +77 -0
- data/lib/nse_data/cache/cache_policy.rb +118 -0
- data/lib/nse_data/cache/cache_store.rb +84 -0
- data/lib/nse_data/cache/redis_cache_store.rb +3 -0
- data/lib/nse_data/config/api_endpoints.yml +56 -0
- data/lib/nse_data/config/base.rb +38 -0
- data/lib/nse_data/config/logger.rb +39 -0
- data/lib/nse_data/http_client/base_client.rb +26 -0
- data/lib/nse_data/http_client/faraday_client.rb +68 -0
- data/lib/nse_data/version.rb +5 -0
- data/lib/nse_data.rb +65 -0
- data/nse_data.gemspec +34 -0
- metadata +131 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3bde71fd80e3987e026f0e1192363af2592eda5507b7bcc90de9ae0360514ad4
|
4
|
+
data.tar.gz: 3440701773c045b2c4cdf183b7bbbc1066f4405118a3ce017bfba3f76b2cd5b0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c101e627bde2635a0d0bfda069c8470ca6327a0bb1e26ee1718070b93cc9c0997ae819ec0c9cb6f48ab8b80066c190d537832556a1ba0c1c67f79bbea778d412
|
7
|
+
data.tar.gz: f33ee4792bf817af6626020db3c4f4212251828ee472e8e498c79ac370a98a9284f3f7337d44b410b09e665a216f2768caae80beb979f10b332b7b6937461614
|
data/.rubocop.yml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
[0.1.0] - 2024-09-10
|
4
|
+
|
5
|
+
## Added
|
6
|
+
- **Caching Mechanism**: Implemented a scalable & flexible caching mechanism to reduce unnecessary API requests. Currently, it supports in-memory caching, with configurable features like custom TTL, disable caching for certain APIs or force refresh API calls.
|
7
|
+
|
8
|
+
- **Logger Configuration**: Implemented a custom logging system that can be configured by users. By default, logs are written to system temporary files.
|
9
|
+
|
10
|
+
- **HttpClient**: Implemented a flexible HTTP client using Faraday, with support for future extensions to other libraries, if needed.
|
11
|
+
|
12
|
+
- **ApiManager**: Implemented an API Manager that sets up the base URL, loads API endpoints from a YAML file, creates dynamic methods for each endpoint, and integrates the caching mechanism with configurable TTL for API calls and no-caching for some endpoints.
|
13
|
+
|
14
|
+
- **RSpec Tests**: Added RSpec tests for core classes with code coverage over 90%.
|
15
|
+
|
16
|
+
- **Security Audit**: Verified gem dependencies using bundler-audit to ensure no known vulnerabilities.
|
17
|
+
|
18
|
+
## Usage Notes
|
19
|
+
For usage instructions, please refer to the documentation available in the README file.
|
20
|
+
|
21
|
+
## Future Work
|
22
|
+
**Core Logic Extraction**: Plan to extract the core API interaction logic into a separate gem.
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
+
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at ahasunos@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/Gemfile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in nse_data.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
# Specify your gem's dependencies in nse_data.gemspec
|
9
|
+
gemspec
|
10
|
+
|
11
|
+
group :development do
|
12
|
+
gem 'bundler-audit', require: false
|
13
|
+
gem 'byebug'
|
14
|
+
gem 'rake', '~> 13.0'
|
15
|
+
gem 'rspec', '~> 3.0'
|
16
|
+
gem 'rubocop', '~> 1.21'
|
17
|
+
gem 'yard', '~> 0.9.37'
|
18
|
+
end
|
19
|
+
|
20
|
+
group :test do
|
21
|
+
gem 'simplecov'
|
22
|
+
gem 'timecop'
|
23
|
+
gem 'webmock', '~> 3.0'
|
24
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2024 Sonu Saha
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,179 @@
|
|
1
|
+
# NseData
|
2
|
+
## Table of Contents
|
3
|
+
- [NseData](#nsedata)
|
4
|
+
- [Table of Contents](#table-of-contents)
|
5
|
+
- [Features](#features)
|
6
|
+
- [Installation](#installation)
|
7
|
+
- [Usage](#usage)
|
8
|
+
- [High-Level Interface](#high-level-interface)
|
9
|
+
- [Low-Level API](#low-level-api)
|
10
|
+
- [Configuration](#configuration)
|
11
|
+
- [Example](#example)
|
12
|
+
- [APIs Available](#apis-available)
|
13
|
+
- [Development](#development)
|
14
|
+
- [Running Tests](#running-tests)
|
15
|
+
- [Code Style and Linting](#code-style-and-linting)
|
16
|
+
- [Contributing](#contributing)
|
17
|
+
- [License](#license)
|
18
|
+
- [Code of Conduct](#code-of-conduct)
|
19
|
+
|
20
|
+
**NseData** is a Ruby gem designed to interact with the National Stock Exchange (NSE) of India's API, providing an easy-to-use interface for developers to retrieve stock market data. The gem offers a high-level API for most users and a lower-level API for advanced users who need more control over the interactions.
|
21
|
+
|
22
|
+
## Features
|
23
|
+
- Fetch stock market data from multiple NSE APIs
|
24
|
+
- High-level and low-level API interfaces
|
25
|
+
- Simple and clear error handling for HTTP requests
|
26
|
+
- Ruby 3.1 and 3.2 support with a test matrix across different OS
|
27
|
+
- Easy integration with CI/CD and coverage tools
|
28
|
+
|
29
|
+
## Installation
|
30
|
+
|
31
|
+
Add this line to your application's Gemfile:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
gem 'nse_data'
|
35
|
+
```
|
36
|
+
|
37
|
+
And then execute:
|
38
|
+
|
39
|
+
```bash
|
40
|
+
bundle install
|
41
|
+
```
|
42
|
+
|
43
|
+
Or install it yourself as:
|
44
|
+
|
45
|
+
```bash
|
46
|
+
gem install nse_data
|
47
|
+
```
|
48
|
+
|
49
|
+
## Available Methods
|
50
|
+
|
51
|
+
- fetch_all_indices
|
52
|
+
- fetch_circulars
|
53
|
+
- fetch_equity_master
|
54
|
+
- fetch_glossary
|
55
|
+
- fetch_holiday_clearing
|
56
|
+
- fetch_holiday_trading
|
57
|
+
- fetch_index_names
|
58
|
+
- fetch_latest_circulars
|
59
|
+
- fetch_market_data_pre_open
|
60
|
+
- fetch_market_status
|
61
|
+
- fetch_market_turnover
|
62
|
+
- fetch_merged_daily_reports_capital
|
63
|
+
- fetch_merged_daily_reports_debt
|
64
|
+
- fetch_merged_daily_reports_derivatives
|
65
|
+
|
66
|
+
## Usage
|
67
|
+
|
68
|
+
### High-Level Interface
|
69
|
+
The high-level interface is designed to be simple and user-friendly. You can instantiate an object and call the available methods:
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
require 'nse_data'
|
73
|
+
|
74
|
+
puts NseData.list_all_endpoints # Returns all the available APIs in the library
|
75
|
+
puts NseData.fetch_all_indices # Returns the response.body of allIndices endpoint of NSE
|
76
|
+
```
|
77
|
+
|
78
|
+
### Low-Level API
|
79
|
+
For advanced users, the lower-level APIManager class offers more control over requests:
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
require 'nse_data'
|
83
|
+
|
84
|
+
api_manager = NseData::APIManager.new
|
85
|
+
response = api_manager.fetch_data('index_names')
|
86
|
+
puts response.body # Returns index names in JSON format
|
87
|
+
```
|
88
|
+
|
89
|
+
where `index_names` is the name of the API routing to the path of https://www.nseindia.com/api/index-names
|
90
|
+
|
91
|
+
## Configuration
|
92
|
+
The gem uses an `api_endpoints.yml` file located in the config directory. This file maps API names to their respective endpoint URLs.
|
93
|
+
|
94
|
+
### Example
|
95
|
+
```yaml
|
96
|
+
all_indices:
|
97
|
+
path: "allIndices"
|
98
|
+
description: "Fetches data of all available indices."
|
99
|
+
```
|
100
|
+
|
101
|
+
### APIs Available
|
102
|
+
- **all_indices**: Fetches data of all available indices.
|
103
|
+
- **circulars**: Provides a list of circulars.
|
104
|
+
- **equity_master**: Fetches equity master data.
|
105
|
+
- **glossary**: Fetches glossary content.
|
106
|
+
- **holiday_clearing**: Fetches clearing holiday data.
|
107
|
+
- **holiday_trading**: Fetches trading holiday data.
|
108
|
+
- **index_names**: Fetches names of all indices.
|
109
|
+
- **latest_circulars**: Provides the latest circulars.
|
110
|
+
- **market_data_pre_open**: Fetches market pre-open data for all securities.
|
111
|
+
- **market_status**: Fetches the current status of the market.
|
112
|
+
- **market_turnover**: Fetches turnover data for the market.
|
113
|
+
- **merged_daily_reports_capital**: Fetches merged daily reports for capital.
|
114
|
+
- **merged_daily_reports_debt**: Fetches merged daily reports for debt.
|
115
|
+
- **merged_daily_reports_derivatives**: Fetches merged daily reports for derivatives.
|
116
|
+
|
117
|
+
Please refer to the [api_endpoints.yml](lib/nse_data/config/api_endpoints.yml) file for the actual endpoint routing information.
|
118
|
+
|
119
|
+
## Development
|
120
|
+
|
121
|
+
To get started with contributing to **NseData**, follow these steps:
|
122
|
+
|
123
|
+
1. **Clone the repository**:
|
124
|
+
|
125
|
+
First, clone the repository to your local machine and navigate to the project directory:
|
126
|
+
|
127
|
+
```bash
|
128
|
+
git clone https://github.com/ahasunos/nse_data.git
|
129
|
+
cd nse_data
|
130
|
+
|
131
|
+
2. **Install dependencies**:
|
132
|
+
|
133
|
+
After navigating to the project directory, install the required gems using Bundler:
|
134
|
+
|
135
|
+
```bash
|
136
|
+
bundle install
|
137
|
+
```
|
138
|
+
|
139
|
+
### Running Tests
|
140
|
+
The project uses RSpec for testing. Before submitting any changes, make sure to run the test suite to ensure that everything works as expected:
|
141
|
+
|
142
|
+
```bash
|
143
|
+
bundle exec rspec
|
144
|
+
```
|
145
|
+
|
146
|
+
### Code Style and Linting
|
147
|
+
To maintain consistent code quality and style, the project uses RuboCop for linting. Before submitting a pull request, ensure that your code adheres to the project's style guidelines by running RuboCop:
|
148
|
+
|
149
|
+
```bash
|
150
|
+
bundle exec rubocop
|
151
|
+
```
|
152
|
+
|
153
|
+
If RuboCop identifies any issues, it will provide suggestions for how to fix them.
|
154
|
+
|
155
|
+
## Debugging
|
156
|
+
### NseData::Config::Logger
|
157
|
+
The `NseData::Config::Logger` class is part of the NseData gem, providing configurable logging capabilities for your application. By default, it logs to a temporary file in the system's temporary directory, but it can be customized to suit your needs.
|
158
|
+
|
159
|
+
#### Usage
|
160
|
+
|
161
|
+
By default, the Logger class logs to a temporary file. You can configure it as follows:
|
162
|
+
```ruby
|
163
|
+
NseData.configure do |config|
|
164
|
+
custom_logger = Logger.new($stdout)
|
165
|
+
config.logger = custom_logger
|
166
|
+
end
|
167
|
+
```
|
168
|
+
|
169
|
+
## Contributing
|
170
|
+
|
171
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ahasunos/nse_data. For major changes, please open an issue first to discuss what you would like to change.
|
172
|
+
|
173
|
+
## License
|
174
|
+
|
175
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
176
|
+
|
177
|
+
## Code of Conduct
|
178
|
+
|
179
|
+
Everyone interacting in the NseData project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/nse_data/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Load Bundler's gem tasks (e.g., `rake build`, `rake install`, etc.)
|
4
|
+
require 'bundler/gem_tasks'
|
5
|
+
|
6
|
+
# Load RSpec's rake task to run the test suite using `rake spec`
|
7
|
+
require 'rspec/core/rake_task'
|
8
|
+
|
9
|
+
# Define the `spec` task to run RSpec tests
|
10
|
+
RSpec::Core::RakeTask.new(:spec)
|
11
|
+
|
12
|
+
# Load RuboCop's rake task to check for style guide violations using `rake rubocop`
|
13
|
+
require 'rubocop/rake_task'
|
14
|
+
|
15
|
+
# Define the `rubocop` task to run RuboCop linter
|
16
|
+
RuboCop::RakeTask.new
|
17
|
+
|
18
|
+
# Load Yard's rake task for generating documentation using `rake yard`
|
19
|
+
require 'yard'
|
20
|
+
|
21
|
+
# Define the `yard` task to generate documentation
|
22
|
+
YARD::Rake::YardocTask.new
|
23
|
+
|
24
|
+
# By default, run both the `spec` (tests) and `rubocop` (linter) tasks
|
25
|
+
task default: %i[spec rubocop]
|
26
|
+
|
27
|
+
require_relative 'lib/nse_data'
|
28
|
+
|
29
|
+
namespace :docs do
|
30
|
+
desc 'Update README with dynamically defined methods'
|
31
|
+
task :update_readme do
|
32
|
+
# Ensure the API methods are defined
|
33
|
+
NseData.define_api_methods
|
34
|
+
|
35
|
+
# List all methods defined on NseData
|
36
|
+
methods = NseData.methods(false).grep(/^fetch_/)
|
37
|
+
|
38
|
+
# Read the existing README
|
39
|
+
readme_path = 'README.md'
|
40
|
+
readme_content = File.read(readme_path)
|
41
|
+
|
42
|
+
# Define markers for where to insert the methods section
|
43
|
+
start_marker = '## Available Methods'
|
44
|
+
end_marker = '## Usage'
|
45
|
+
start_index = readme_content.index(start_marker) + start_marker.length
|
46
|
+
end_index = readme_content.index(end_marker)
|
47
|
+
|
48
|
+
if start_index && end_index
|
49
|
+
methods_section = readme_content[start_index...end_index]
|
50
|
+
new_methods_section = "#{start_marker}\n\n"
|
51
|
+
methods.each do |method|
|
52
|
+
new_methods_section += "- #{method}\n"
|
53
|
+
end
|
54
|
+
|
55
|
+
# Write back the updated README
|
56
|
+
updated_content = readme_content.sub(methods_section, new_methods_section)
|
57
|
+
File.write(readme_path, updated_content)
|
58
|
+
|
59
|
+
puts 'README updated with the following methods:'
|
60
|
+
methods.each { |method| puts "- #{method}" }
|
61
|
+
else
|
62
|
+
puts 'Could not find markers to update in README.md'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Usage:
|
68
|
+
# 1. `rake spec` - Runs the RSpec tests
|
69
|
+
# 2. `rake rubocop` - Runs RuboCop linter for code quality checks
|
70
|
+
# 3. `rake yard` - Generates Yard documentation (output in the `doc/` folder)
|
71
|
+
# 4. `rake` - Runs both the tests and RuboCop checks (default task)
|
72
|
+
# 5. `rake docs:update_readme` - Update readme with available methods generated dynamically in nse_data.rb
|