air_test 0.1.6.1 → 0.1.6.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 76572704e0d1a8c3abc7e274def6c51611efba858a6f434b6bbfd5f871aedf12
4
- data.tar.gz: 11235311464e8fe0db11323d3f0fee3fb156c676ab4b3b56f7c02abf410a71d0
3
+ metadata.gz: 3e04796d0b80ac35cf63aa0d65fab417c7f1b2c793f953108be1779129489cba
4
+ data.tar.gz: 9e31c0266c59d7963c70cdc3d2158b92e12814a32be15d065f062f1026485884
5
5
  SHA512:
6
- metadata.gz: 793c1fd212fcbd747c85abd0130f69dafa849035d4ce69595b72342f119c73f69c9be5f88fe8375e9c439a8be12e96c487f7e93f733f36957163df49d3647d8a
7
- data.tar.gz: dca493fc7c39853ae784be49e4b187e3d8b752b2d0e7306f2532b4b7d71584e185130f922527598b2e07e64633a256173a5c1fb8dca2053aedcc7a53eac9ff6d
6
+ metadata.gz: e6ce0f69bc475ed1ef913fac555f125c131dd49aef39f9165fffd05c8288b16d5013dfb38b41f9ed7d4119f81ba270f7b8af3ea08c4faf9c18543d8f719d5559
7
+ data.tar.gz: e4311d1981fb6289d81275619461490ac2d4ee2f1c47982fa51166dafb7e48047b4519a648d44e68c398462fe3887b63923bc326a1b72993f38c7748b542cf31
data/lib/air_test/cli.rb CHANGED
@@ -9,6 +9,7 @@ module AirTest
9
9
  class CLI
10
10
  def initialize
11
11
  @prompt = TTY::Prompt.new
12
+ load_env_files
12
13
  end
13
14
 
14
15
  def init(silent: false)
@@ -152,25 +153,25 @@ module AirTest
152
153
  end
153
154
 
154
155
  def initialize_airtest_config(config)
155
- # Initialize AirTest configuration with environment variables
156
+ # Initialize AirTest configuration with values from config file
156
157
  AirTest.configure do |airtest_config|
157
158
  case config['tool']
158
159
  when 'notion'
159
- airtest_config.notion[:token] = ENV['NOTION_TOKEN']
160
- airtest_config.notion[:database_id] = ENV['NOTION_DATABASE_ID']
160
+ airtest_config.notion[:token] = config['notion']['token']
161
+ airtest_config.notion[:database_id] = config['notion']['database_id']
161
162
  when 'jira'
162
- airtest_config.jira[:token] = ENV['JIRA_TOKEN']
163
- airtest_config.jira[:project_id] = ENV['JIRA_PROJECT_ID']
164
- airtest_config.jira[:domain] = ENV['JIRA_DOMAIN']
165
- airtest_config.jira[:email] = ENV['JIRA_EMAIL']
163
+ airtest_config.jira[:token] = config['jira']['token']
164
+ airtest_config.jira[:project_id] = config['jira']['project_id']
165
+ airtest_config.jira[:domain] = config['jira']['domain']
166
+ airtest_config.jira[:email] = config['jira']['email']
166
167
  when 'monday'
167
- airtest_config.monday[:token] = ENV['MONDAY_TOKEN']
168
- airtest_config.monday[:board_id] = ENV['MONDAY_BOARD_ID']
169
- airtest_config.monday[:domain] = ENV['MONDAY_DOMAIN']
168
+ airtest_config.monday[:token] = config['monday']['token']
169
+ airtest_config.monday[:board_id] = config['monday']['board_id']
170
+ airtest_config.monday[:domain] = config['monday']['domain']
170
171
  end
171
172
 
172
- airtest_config.github[:token] = ENV['GITHUB_BOT_TOKEN']
173
- airtest_config.repo = ENV['REPO'] || config['github']['repo']
173
+ airtest_config.github[:token] = config['github']['token']
174
+ airtest_config.repo = config['github']['repo']
174
175
  airtest_config.tool = config['tool']
175
176
  end
176
177
  end
@@ -386,23 +387,23 @@ module AirTest
386
387
  'dev_assignee' => config[:dev_assignee],
387
388
  'interactive_mode' => config[:interactive_mode],
388
389
  'notion' => {
389
- 'token' => 'ENV["NOTION_TOKEN"]',
390
- 'database_id' => 'ENV["NOTION_DATABASE_ID"]'
390
+ 'token' => ENV['NOTION_TOKEN'] || 'your_notion_token',
391
+ 'database_id' => ENV['NOTION_DATABASE_ID'] || 'your_notion_database_id'
391
392
  },
392
393
  'jira' => {
393
- 'token' => 'ENV["JIRA_TOKEN"]',
394
- 'project_id' => 'ENV["JIRA_PROJECT_ID"]',
395
- 'domain' => 'ENV["JIRA_DOMAIN"]',
396
- 'email' => 'ENV["JIRA_EMAIL"]'
394
+ 'token' => ENV['JIRA_TOKEN'] || 'your_jira_token',
395
+ 'project_id' => ENV['JIRA_PROJECT_ID'] || 'your_jira_project_id',
396
+ 'domain' => ENV['JIRA_DOMAIN'] || 'your_jira_domain',
397
+ 'email' => ENV['JIRA_EMAIL'] || 'your_jira_email'
397
398
  },
398
399
  'monday' => {
399
- 'token' => 'ENV["MONDAY_TOKEN"]',
400
- 'board_id' => 'ENV["MONDAY_BOARD_ID"]',
401
- 'domain' => 'ENV["MONDAY_DOMAIN"]'
400
+ 'token' => ENV['MONDAY_TOKEN'] || 'your_monday_token',
401
+ 'board_id' => ENV['MONDAY_BOARD_ID'] || 'your_monday_board_id',
402
+ 'domain' => ENV['MONDAY_DOMAIN'] || 'your_monday_domain'
402
403
  },
403
404
  'github' => {
404
- 'token' => 'ENV["GITHUB_BOT_TOKEN"]',
405
- 'repo' => 'your-org/your-repo'
405
+ 'token' => ENV['GITHUB_BOT_TOKEN'] || 'your_github_token',
406
+ 'repo' => ENV['REPO'] || 'your-org/your-repo'
406
407
  }
407
408
  }
408
409
 
@@ -512,6 +513,35 @@ module AirTest
512
513
  end
513
514
  end
514
515
 
516
+ private
517
+
518
+ def load_env_files
519
+ # Try to load .env files in order of preference
520
+ env_files = ['.env.airtest', '.env']
521
+
522
+ env_files.each do |env_file|
523
+ if File.exist?(env_file)
524
+ load_env_file(env_file)
525
+ puts "#{GREEN}✅ Loaded environment variables from #{env_file}#{RESET}" if ENV['AIRTEST_DEBUG']
526
+ break
527
+ end
528
+ end
529
+ end
530
+
531
+ def load_env_file(file_path)
532
+ File.readlines(file_path).each do |line|
533
+ line.strip!
534
+ next if line.empty? || line.start_with?('#')
535
+
536
+ if line.include?('=')
537
+ key, value = line.split('=', 2)
538
+ ENV[key.strip] = value.strip.gsub(/^["']|["']$/, '') # Remove quotes
539
+ end
540
+ end
541
+ rescue => e
542
+ puts "#{YELLOW}⚠️ Warning: Could not load #{file_path}: #{e.message}#{RESET}" if ENV['AIRTEST_DEBUG']
543
+ end
544
+
515
545
  # Color constants
516
546
  GREEN = "\e[32m"
517
547
  YELLOW = "\e[33m"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AirTest
4
- VERSION = "0.1.6.1"
4
+ VERSION = "0.1.6.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: air_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6.1
4
+ version: 0.1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - julien bouland