gitmagical 1.1.0 → 1.5.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/gitmagic +62 -11
  3. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70c70528c492c0f61a5b4c1b8c7e6b69f48563e95545080697a7ea92bd6d4e95
4
- data.tar.gz: 1c0b896beae4857bfc9769dd8ca2cb1dac26df07abec8c9643d7d889861ece56
3
+ metadata.gz: 2c6fbb86fdc2d10bc79a9032da063fb50648558859d791dedcacd5e1289f55a2
4
+ data.tar.gz: 8d080a444a54b91a322c485b57121d8d9d23a131e7c07378d022be0810abef2e
5
5
  SHA512:
6
- metadata.gz: f526251bbe030a94c0e2a1e8bf2f24ddfcf2ad639acb57ba566a89056779ef346d03358d0ecfe57b3b19f33c1ddde8b0a4cf3ffec37dec1166ea16cf3edc5176
7
- data.tar.gz: 4a40fe81f418776789ed444729becb808e31e5797daebf61d57e98dc50b1d476620e4074b31d7887894edded22869730a352a74c4eb625c421ca7e1c71919078
6
+ metadata.gz: 1dfe63da86486b6f37b020b146caa0ab46e3155018add914b637c3aff67a0649ae27f63e289d5a88eefd01b11b7624d371a5b45ef1bb04ecaacc596f68bf72d7
7
+ data.tar.gz: 53359f4d2dcf20e8060ae0ae13b2aa7ff5bdc6402051e76ccd3400c9e26bcd176fd7da9b31253332b82df79fd7d763d46e83f3647a3d53b9e5011cc0162f0aa8
data/bin/gitmagic CHANGED
@@ -1,14 +1,60 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
3
 
4
- # Change these settings to fit your setup:
5
- $user = "isene"
6
- $repodir = "/home/geir/G/GIT-isene"
7
- $pres_templ = "/home/geir/G/GIT/gh-presentation"
8
- $issues = "true"
9
- $downloads = "true"
10
- $wiki = "false"
11
- $priv = "false"
4
+ require 'yaml'
5
+
6
+ # Configuration management with backward compatibility
7
+ class GitMagicConfig
8
+ def self.load
9
+ # Default values (your current settings)
10
+ defaults = {
11
+ 'user' => "isene",
12
+ 'repodir' => "/home/geir/G/GIT-isene",
13
+ 'pres_templ' => "/home/geir/G/GIT/gh-presentation",
14
+ 'issues' => "true",
15
+ 'downloads' => "true",
16
+ 'wiki' => "false",
17
+ 'priv' => "false",
18
+ 'github_token' => ENV['GITHUB_TOKEN'] || nil
19
+ }
20
+
21
+ config = defaults.dup
22
+
23
+ # Try to load from config files
24
+ config_paths = [
25
+ File.join(Dir.home, '.gitmagic.yml'),
26
+ File.join(Dir.home, '.config', 'gitmagic', 'config.yml'),
27
+ '.gitmagic.yml'
28
+ ]
29
+
30
+ config_paths.each do |path|
31
+ if File.exist?(path)
32
+ begin
33
+ loaded = YAML.load_file(path)
34
+ config.merge!(loaded) if loaded.is_a?(Hash)
35
+ break
36
+ rescue => e
37
+ # Continue with defaults if config file is invalid
38
+ end
39
+ end
40
+ end
41
+
42
+ config
43
+ end
44
+ end
45
+
46
+ # Load configuration
47
+ config = GitMagicConfig.load
48
+
49
+ # Set global variables for backward compatibility
50
+ $user = config['user']
51
+ $repodir = config['repodir']
52
+ $pres_templ = config['pres_templ']
53
+ $issues = config['issues']
54
+ $downloads = config['downloads']
55
+ $wiki = config['wiki']
56
+ $priv = config['priv']
57
+ $github_token = config['github_token']
12
58
 
13
59
  # Initializing variable
14
60
  $dir = Dir.pwd
@@ -20,7 +66,7 @@ require 'getoptlong'
20
66
  require 'fileutils'
21
67
  require 'date'
22
68
 
23
- prgmversion = 0.1
69
+ prgmversion = 1.5
24
70
 
25
71
  def help
26
72
  puts <<HELPTEXT
@@ -103,7 +149,12 @@ def gitinit
103
149
  File.write("#{$dir}/.git/config", gitconftxt, mode: 'a')
104
150
  # Upload the repo to Github
105
151
  jsontxt = "{\"name\": \"#{$repo}\", \"description\": \"#{$desc}\", \"private\": #{$priv}, \"has_issues\": #{$issues}, \"has_downloads\": #{$downloads}, \"has_wiki\": #{$wiki}}"
106
- cmd = %Q[curl -u #{$user} https://api.github.com/user/repos -d '#{jsontxt}']
152
+ if $github_token
153
+ cmd = %Q[curl -H "Authorization: token #{$github_token}" https://api.github.com/user/repos -d '#{jsontxt}']
154
+ else
155
+ # Fallback to old auth method for backward compatibility
156
+ cmd = %Q[curl -u #{$user} https://api.github.com/user/repos -d '#{jsontxt}']
157
+ end
107
158
  out = %x[ #{cmd} ]
108
159
  end
109
160
 
@@ -132,7 +183,7 @@ begin
132
183
  exit
133
184
  when "--clone"
134
185
  $repo = arg
135
- %x[ clone #{$repo} ]
186
+ %x[ git clone #{$repo} ]
136
187
  exit
137
188
  when "--desc"
138
189
  $desc = arg
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitmagical
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-27 00:00:00.000000000 Z
11
+ date: 2025-07-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'Initiate projects from your local folders. Update projects easily. Create
14
14
  new online presentations using Jekyll w/Gitpages. And more. See the Github page
@@ -25,7 +25,7 @@ licenses:
25
25
  - Unlicense
26
26
  metadata:
27
27
  source_code_uri: https://github.com/isene/gitmagic
28
- post_install_message:
28
+ post_install_message:
29
29
  rdoc_options: []
30
30
  require_paths:
31
31
  - lib
@@ -40,8 +40,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  requirements: []
43
- rubygems_version: 3.1.2
44
- signing_key:
43
+ rubygems_version: 3.4.20
44
+ signing_key:
45
45
  specification_version: 4
46
46
  summary: A swiss army knife of git tools
47
47
  test_files: []