Class: Frameit::CommandsGenerator

Inherits:
Object
  • Object
show all
Includes:
Commander::Methods
Defined in:
frameit/lib/frameit/commands_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.startObject



19
20
21
22
# File 'frameit/lib/frameit/commands_generator.rb', line 19

def self.start
  Frameit::DependencyChecker.check_dependencies
  self.new.run
end

Instance Method Details

#runObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'frameit/lib/frameit/commands_generator.rb', line 24

def run
  program :name, 'frameit'
  program :version, Fastlane::VERSION
  program :description, 'Quickly put your screenshots into the right device frames'
  program :help, 'Author', 'Felix Krause <[email protected]>'
  program :help, 'Website', 'https://fastlane.tools'
  program :help, 'Documentation', 'https://docs.fastlane.tools/actions/frameit/'
  program :help_formatter, FastlaneCore::HelpFormatter

  global_option('--verbose') { FastlaneCore::Globals.verbose = true }
  global_option('--env STRING[,STRING2]', String, 'Add environment(s) to use with `dotenv`')

  default_command(:run)

  command :run do |c|
    c.syntax = 'fastlane frameit black'
    c.description = "Adds a black frame around all screenshots"

    FastlaneCore::CommanderGenerator.new.generate(Frameit::Options.available_options, command: c)

    c.action do |args, options|
      load_config(options)
      Frameit::Runner.new.run('.', nil)
    end
  end

  command :silver do |c|
    c.syntax = 'fastlane frameit silver'
    c.description = "Adds a silver frame around all screenshots"

    FastlaneCore::CommanderGenerator.new.generate(Frameit::Options.available_options, command: c)

    c.action do |args, options|
      load_config(options)
      Frameit::Runner.new.run('.', Frameit::Color::SILVER)
    end
  end

  command :gold do |c|
    c.syntax = 'fastlane frameit gold'
    c.description = "Adds a gold frame around all screenshots"

    FastlaneCore::CommanderGenerator.new.generate(Frameit::Options.available_options, command: c)

    c.action do |args, options|
      load_config(options)
      Frameit::Runner.new.run('.', Frameit::Color::GOLD)
    end
  end

  command :rose_gold do |c|
    c.syntax = 'fastlane frameit rose_gold'
    c.description = "Adds a rose gold frame around all screenshots"

    FastlaneCore::CommanderGenerator.new.generate(Frameit::Options.available_options, command: c)

    c.action do |args, options|
      load_config(options)
      Frameit::Runner.new.run('.', Frameit::Color::ROSE_GOLD)
    end
  end

  command :android do |c|
    c.syntax = 'fastlane frameit android'
    c.description = "Adds Android frames around all screenshots"

    FastlaneCore::CommanderGenerator.new.generate(Frameit::Options.available_options, command: c)

    c.action do |args, options|
      load_config(options)
      Frameit::Runner.new.run('.', nil, Platform::ANDROID)
    end
  end

  command :ios do |c|
    c.syntax = 'fastlane frameit ios'
    c.description = "Adds iOS frames around all screenshots"

    FastlaneCore::CommanderGenerator.new.generate(Frameit::Options.available_options, command: c)

    c.action do |args, options|
      load_config(options)
      Frameit::Runner.new.run('.', nil, Platform::IOS)
    end
  end

  command :setup do |c|
    c.syntax = 'fastlane frameit setup'
    c.description = "Downloads and sets up the latest device frames"

    c.action do |args, options|
      Frameit::FrameDownloader.new.download_frames
    end
  end

  command :download_frames do |c|
    c.syntax = 'fastlane frameit download_frames'
    c.description = "Downloads and sets up the latest device frames"

    c.action do |args, options|
      Frameit::FrameDownloader.new.download_frames
    end
  end

  alias_command(:white, :silver)

  run!
end