study_line 0.2.0 → 0.2.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: 6f4bc67ba854cfe15f6e6e4fb24f18f7e3bea31915b37e5d0621d2b23b0fd1b7
4
- data.tar.gz: ad2d3f95738733bbc86431682e8cd8b85005b2db1640d9fb6a6b63e67081f203
3
+ metadata.gz: 65b3789eac88ddd9d55d3926be66ebf4ca3bd196ca0f808652fb6ca288ffa2d9
4
+ data.tar.gz: 430575c26dcba45eb59ecc2820328a3d4ebb1a31b0d5bbf3d3d02db3dbaeebb1
5
5
  SHA512:
6
- metadata.gz: cf936e8182719de5dc14383446f1c3d444755d782a946edb19255edb61592b2aba34724b0c313dc2fb470f8d111d6159aff75341fd14b9b5d0566a4c1dcab738
7
- data.tar.gz: 4e272c2b5a0294dd2bfb18fd7a251aa6492c9efa33d674349d081d90f0ea9ea7ac997a44a6d0ec9be666d6a572cc1d7984bcabceeab42c3132e557dadc0841e9
6
+ metadata.gz: 540dd1527c74a44029b2c072834daa1b90d7d7e0a0ed1bc8603ce87c29b0011d648557a34e0dd1857a14fa63c05c0737394dfa247d25e14fc47fbf102ba50791
7
+ data.tar.gz: 7ee67f154af89ccf6cb87d7a7d3c1d1c3d2c603ee5308cd2e8621dd510957837b220af69f4052a7078af1634035da5751cd374278497dfaae4ee246d70108886
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StudyLine
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.2"
5
5
  end
data/lib/study_line.rb CHANGED
@@ -2,23 +2,23 @@
2
2
 
3
3
  require 'thor'
4
4
  require 'httparty'
5
- require 'dotenv'
6
- Dotenv.load
5
+ require 'json'
6
+
7
+ CONFIG_FILE = File.join(Dir.home, '.stl_config')
7
8
 
8
9
  module StudyLine
9
10
  class CLI < Thor
10
11
  desc "configure TOKEN", "トークンを設定します。"
11
12
  def configure(token)
12
- File.open('.env', 'w') do |file|
13
- file.puts "CUSTOM_TOKEN=#{token}"
14
- end
13
+ config = { 'CUSTOM_TOKEN' => token }
14
+ File.write(CONFIG_FILE, config.to_json)
15
15
  puts "トークンが設定されました。"
16
16
  end
17
17
 
18
18
  class Sender
19
19
  include HTTParty
20
- # BASE_URI = 'https://studyline-cc21ae1829fc.herokuapp.com/api/study_sessions'
21
- BASE_URI = 'http://localhost:3000/api/study_sessions'
20
+ BASE_URI = 'https://studyline-cc21ae1829fc.herokuapp.com/api/study_sessions'
21
+ # BASE_URI = 'http://localhost:3000/api/study_sessions'
22
22
  end
23
23
  desc "start", "学習セッションの開始時間を記録します。"
24
24
  method_option :tag, aliases: "-t", desc: "タグを作成オプション"
@@ -59,14 +59,25 @@ module StudyLine
59
59
 
60
60
  desc "show_token", "保存されているトークンを表示します。"
61
61
  def show
62
- puts "現在のCUSTOM_TOKEN: #{ENV['CUSTOM_TOKEN'] || '未設定'}"
62
+ if File.exist?(CONFIG_FILE)
63
+ config = JSON.parse(File.read(CONFIG_FILE))
64
+ puts "現在のCUSTOM_TOKEN: #{config['CUSTOM_TOKEN'] || '未設定'}"
65
+ else
66
+ puts "トークンは未設定です。"
67
+ end
63
68
  end
64
69
 
65
70
  private
66
71
 
67
72
  def user_token
68
- ENV['CUSTOM_TOKEN'] || (raise "Error: Token not found.")
69
- end
73
+ if File.exist?(CONFIG_FILE)
74
+ config = JSON.parse(File.read(CONFIG_FILE))
75
+ config['CUSTOM_TOKEN'] || (raise "Error: Token not found.")
76
+ else
77
+ raise "Error: Token not found."
78
+ end
79
+ end
80
+
70
81
 
71
82
  def headers
72
83
  {
Binary file
data/study_line.gemspec CHANGED
@@ -30,8 +30,8 @@ Gem::Specification.new do |spec|
30
30
  f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile])
31
31
  end
32
32
  end
33
- spec.bindir = "exe"
34
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
33
+ spec.bindir = "bin"
34
+ spec.executables = spec.files.grep(%r{\Abin/}) { |f| File.basename(f) }
35
35
  spec.require_paths = ["lib"]
36
36
 
37
37
  # Uncomment to register a new dependency of your gem
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: study_line
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - kentaro0215
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-15 00:00:00.000000000 Z
11
+ date: 2024-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -54,6 +54,7 @@ files:
54
54
  - lib/study_line.rb
55
55
  - lib/study_line/version.rb
56
56
  - sig/study_line.rbs
57
+ - study_line-0.2.1.gem
57
58
  - study_line.gemspec
58
59
  - vendor/bundle/ruby/3.2.0/bin/dotenv
59
60
  - vendor/bundle/ruby/3.2.0/bin/htmldiff